2008-11-18 01:08:50 +00:00
|
|
|
/*
|
|
|
|
Copyright (C) 2008 Christian Dywan <christian@twotoasts.de>
|
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU Lesser General Public
|
|
|
|
License as published by the Free Software Foundation; either
|
|
|
|
version 2.1 of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
See the file COPYING for the full license text.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <midori/midori.h>
|
|
|
|
|
2009-03-25 01:12:12 +00:00
|
|
|
static void
|
|
|
|
statusbar_features_app_add_browser_cb (MidoriApp* app,
|
|
|
|
MidoriBrowser* browser,
|
|
|
|
MidoriExtension* extension);
|
|
|
|
|
2009-01-06 01:26:19 +00:00
|
|
|
static void
|
|
|
|
statusbar_features_deactivate_cb (MidoriExtension* extension,
|
|
|
|
GtkWidget* bbox)
|
|
|
|
{
|
2009-03-25 01:12:12 +00:00
|
|
|
MidoriApp* app = midori_extension_get_app (extension);
|
|
|
|
|
2009-01-06 01:26:19 +00:00
|
|
|
gtk_widget_destroy (bbox);
|
2009-02-28 00:43:20 +00:00
|
|
|
g_signal_handlers_disconnect_by_func (
|
|
|
|
extension, statusbar_features_deactivate_cb, bbox);
|
2009-03-25 01:12:12 +00:00
|
|
|
g_signal_handlers_disconnect_by_func (
|
|
|
|
app, statusbar_features_app_add_browser_cb, extension);
|
2009-01-06 01:26:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
statusbar_features_app_add_browser_cb (MidoriApp* app,
|
|
|
|
MidoriBrowser* browser,
|
|
|
|
MidoriExtension* extension)
|
2008-11-18 01:08:50 +00:00
|
|
|
{
|
|
|
|
GtkWidget* statusbar;
|
|
|
|
GtkWidget* bbox;
|
|
|
|
MidoriWebSettings* settings;
|
|
|
|
GtkWidget* button;
|
|
|
|
|
|
|
|
/* FIXME: Monitor each view and modify its settings individually
|
|
|
|
instead of merely replicating the global preferences. */
|
|
|
|
|
|
|
|
statusbar = katze_object_get_object (browser, "statusbar");
|
2008-11-23 00:51:30 +00:00
|
|
|
bbox = gtk_hbox_new (FALSE, 0);
|
2008-11-18 01:08:50 +00:00
|
|
|
settings = katze_object_get_object (browser, "settings");
|
|
|
|
button = katze_property_proxy (settings, "auto-load-images", NULL);
|
2008-11-30 01:08:28 +00:00
|
|
|
gtk_button_set_label (GTK_BUTTON (button), _("Images"));
|
|
|
|
#if GTK_CHECK_VERSION(2, 12, 0)
|
|
|
|
gtk_widget_set_tooltip_text (button, _("Load images automatically"));
|
|
|
|
#endif
|
2008-11-23 00:51:30 +00:00
|
|
|
gtk_box_pack_start (GTK_BOX (bbox), button, FALSE, FALSE, 2);
|
2008-11-18 01:08:50 +00:00
|
|
|
gtk_widget_show (button);
|
|
|
|
button = katze_property_proxy (settings, "enable-scripts", NULL);
|
2008-11-30 01:08:28 +00:00
|
|
|
gtk_button_set_label (GTK_BUTTON (button), _("Scripts"));
|
|
|
|
#if GTK_CHECK_VERSION(2, 12, 0)
|
|
|
|
gtk_widget_set_tooltip_text (button, _("Enable scripts"));
|
|
|
|
#endif
|
|
|
|
gtk_box_pack_start (GTK_BOX (bbox), button, FALSE, FALSE, 2);
|
|
|
|
gtk_widget_show (button);
|
|
|
|
button = katze_property_proxy (settings, "enable-plugins", NULL);
|
|
|
|
gtk_button_set_label (GTK_BUTTON (button), _("Plugins"));
|
|
|
|
#if GTK_CHECK_VERSION(2, 12, 0)
|
|
|
|
gtk_widget_set_tooltip_text (button, _("Enable plugins"));
|
|
|
|
#endif
|
2008-11-23 00:51:30 +00:00
|
|
|
gtk_box_pack_start (GTK_BOX (bbox), button, FALSE, FALSE, 2);
|
2008-11-18 01:08:50 +00:00
|
|
|
gtk_widget_show (button);
|
|
|
|
gtk_widget_show (bbox);
|
|
|
|
gtk_box_pack_start (GTK_BOX (statusbar), bbox, FALSE, FALSE, 3);
|
2009-04-05 21:46:15 +00:00
|
|
|
g_object_unref (settings);
|
2009-01-06 01:26:19 +00:00
|
|
|
|
|
|
|
g_signal_connect (extension, "deactivate",
|
|
|
|
G_CALLBACK (statusbar_features_deactivate_cb), bbox);
|
2008-11-18 01:08:50 +00:00
|
|
|
}
|
|
|
|
|
2008-11-20 00:22:25 +00:00
|
|
|
static void
|
|
|
|
statusbar_features_activate_cb (MidoriExtension* extension,
|
|
|
|
MidoriApp* app)
|
|
|
|
{
|
2009-02-28 00:43:20 +00:00
|
|
|
KatzeArray* browsers;
|
|
|
|
MidoriBrowser* browser;
|
|
|
|
guint i;
|
|
|
|
|
|
|
|
browsers = katze_object_get_object (app, "browsers");
|
|
|
|
i = 0;
|
|
|
|
while ((browser = katze_array_get_nth_item (browsers, i++)))
|
|
|
|
statusbar_features_app_add_browser_cb (app, browser, extension);
|
2008-11-20 00:22:25 +00:00
|
|
|
g_signal_connect (app, "add-browser",
|
2009-01-06 01:26:19 +00:00
|
|
|
G_CALLBACK (statusbar_features_app_add_browser_cb), extension);
|
2008-11-20 00:22:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
MidoriExtension*
|
|
|
|
extension_init (void)
|
2008-11-18 01:08:50 +00:00
|
|
|
{
|
|
|
|
MidoriExtension* extension = g_object_new (MIDORI_TYPE_EXTENSION,
|
|
|
|
"name", "Statusbar Features",
|
|
|
|
"description", "",
|
|
|
|
"version", "0.1",
|
|
|
|
"authors", "Christian Dywan <christian@twotoasts.de>",
|
|
|
|
NULL);
|
|
|
|
|
2008-11-20 00:22:25 +00:00
|
|
|
g_signal_connect (extension, "activate",
|
|
|
|
G_CALLBACK (statusbar_features_activate_cb), NULL);
|
2008-11-18 01:08:50 +00:00
|
|
|
|
|
|
|
return extension;
|
|
|
|
}
|