From ad82a73ab88fad40a6477dee250b48a508145875 Mon Sep 17 00:00:00 2001 From: Christian Dywan Date: Fri, 17 Apr 2009 03:16:37 +0200 Subject: [PATCH] Show only image buttons in Statusbar Features in statusbar --- extensions/statusbar-features.c | 19 +++++++++++++------ katze/katze-utils.c | 8 +++++++- midori/sokoke.c | 1 + 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/extensions/statusbar-features.c b/extensions/statusbar-features.c index 8eb65c69..6c37c1af 100644 --- a/extensions/statusbar-features.c +++ b/extensions/statusbar-features.c @@ -38,6 +38,7 @@ statusbar_features_app_add_browser_cb (MidoriApp* app, GtkWidget* bbox; MidoriWebSettings* settings; GtkWidget* button; + GtkWidget* image; /* FIXME: Monitor each view and modify its settings individually instead of merely replicating the global preferences. */ @@ -45,22 +46,28 @@ statusbar_features_app_add_browser_cb (MidoriApp* app, statusbar = katze_object_get_object (browser, "statusbar"); bbox = gtk_hbox_new (FALSE, 0); settings = katze_object_get_object (browser, "settings"); - button = katze_property_proxy (settings, "auto-load-images", NULL); - gtk_button_set_label (GTK_BUTTON (button), _("Images")); + button = katze_property_proxy (settings, "auto-load-images", "toggle"); + image = gtk_image_new_from_stock (STOCK_IMAGE, GTK_ICON_SIZE_MENU); + gtk_widget_show (image); + gtk_container_add (GTK_CONTAINER (button), image); #if GTK_CHECK_VERSION(2, 12, 0) gtk_widget_set_tooltip_text (button, _("Load images automatically")); #endif gtk_box_pack_start (GTK_BOX (bbox), button, FALSE, FALSE, 2); gtk_widget_show (button); - button = katze_property_proxy (settings, "enable-scripts", NULL); - gtk_button_set_label (GTK_BUTTON (button), _("Scripts")); + button = katze_property_proxy (settings, "enable-scripts", "toggle"); + image = gtk_image_new_from_stock (STOCK_SCRIPTS, GTK_ICON_SIZE_MENU); + gtk_widget_show (image); + gtk_container_add (GTK_CONTAINER (button), image); #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")); + button = katze_property_proxy (settings, "enable-plugins", "toggle"); + image = gtk_image_new_from_stock (STOCK_PLUGINS, GTK_ICON_SIZE_MENU); + gtk_widget_show (image); + gtk_container_add (GTK_CONTAINER (button), image); #if GTK_CHECK_VERSION(2, 12, 0) gtk_widget_set_tooltip_text (button, _("Enable plugins")); #endif diff --git a/katze/katze-utils.c b/katze/katze-utils.c index cebbf074..4bbee3b3 100644 --- a/katze/katze-utils.c +++ b/katze/katze-utils.c @@ -150,6 +150,9 @@ proxy_object_notify_string_cb (GObject* object, * choosing an existing filename, encoded as an URI. * "font": the widget created will be particularly suitable for * choosing a font from installed fonts. + * Since 0.1.6 the following hints are also supported: + * "toggle": the widget created will be an empty toggle button. This + * is only supported with boolean properties. * * Any other values for @hint are silently ignored. * @@ -193,7 +196,10 @@ katze_property_proxy (gpointer object, gchar* notify_property; gboolean toggled = katze_object_get_boolean (object, property); - widget = gtk_check_button_new_with_label (gettext (nick)); + if (_hint == g_intern_string ("toggle")) + widget = gtk_toggle_button_new (); + else + widget = gtk_check_button_new_with_label (gettext (nick)); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), toggled); g_signal_connect (widget, "toggled", G_CALLBACK (proxy_toggle_button_toggled_cb), object); diff --git a/midori/sokoke.c b/midori/sokoke.c index 3ef3bc37..d6ad1afc 100644 --- a/midori/sokoke.c +++ b/midori/sokoke.c @@ -769,6 +769,7 @@ sokoke_register_stock_items (void) static FatStockItem items[] = { { STOCK_EXTENSION, NULL, 0, 0, GTK_STOCK_CONVERT }, + { STOCK_IMAGE, NULL, 0, 0, GTK_STOCK_ORIENTATION_PORTRAIT }, { STOCK_NEWS_FEED, NULL, 0, 0, GTK_STOCK_INDEX }, { STOCK_SCRIPT, NULL, 0, 0, GTK_STOCK_EXECUTE }, { STOCK_STYLE, NULL, 0, 0, GTK_STOCK_SELECT_COLOR }, -- 2.39.5