diff options
author | Marco Pesenti Gritti <marco@it.gnome.org> | 2003-02-06 22:58:30 +0800 |
---|---|---|
committer | Marco Pesenti Gritti <mpeseng@src.gnome.org> | 2003-02-06 22:58:30 +0800 |
commit | 27bdb80c00c3648be780bb53f47e7885749613e7 (patch) | |
tree | 3b955c3f154e6935bebced2b53755d5cdde38836 /src/ephy-spinner-action.c | |
parent | eb7eaf060f2a2b08d80b50a103919ea3c1012a00 (diff) | |
download | gsoc2013-epiphany-27bdb80c00c3648be780bb53f47e7885749613e7.tar.gz gsoc2013-epiphany-27bdb80c00c3648be780bb53f47e7885749613e7.tar.zst gsoc2013-epiphany-27bdb80c00c3648be780bb53f47e7885749613e7.zip |
Do not use a button for spinner. Correctly update spinner size for toolbar
2003-02-06 Marco Pesenti Gritti <marco@it.gnome.org>
* lib/widgets/ephy-spinner.c: (ephy_spinner_expose),
(ephy_spinner_class_init):
* src/ephy-spinner-action.c: (create_tool_item),
(toolbar_style_sync), (item_parent_set_cb), (connect_proxy):
Do not use a button for spinner.
Correctly update spinner size for toolbar style.
Diffstat (limited to 'src/ephy-spinner-action.c')
-rw-r--r-- | src/ephy-spinner-action.c | 47 |
1 files changed, 39 insertions, 8 deletions
diff --git a/src/ephy-spinner-action.c b/src/ephy-spinner-action.c index 295e88545..1ad90ec64 100644 --- a/src/ephy-spinner-action.c +++ b/src/ephy-spinner-action.c @@ -19,6 +19,7 @@ #include "ephy-spinner-action.h" #include "ephy-spinner.h" #include "eggtoolitem.h" +#include "eggtoolbar.h" static void ephy_spinner_action_init (EphySpinnerAction *action); static void ephy_spinner_action_class_init (EphySpinnerActionClass *class); @@ -86,34 +87,64 @@ create_tool_item (EggAction *action) { GtkWidget *item; GtkWidget *spinner; - GtkWidget *button; item = GTK_WIDGET (egg_tool_item_new ()); - button = gtk_button_new (); - gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE); - gtk_widget_show (button); - gtk_container_add (GTK_CONTAINER (item), button); spinner = ephy_spinner_new (); - ephy_spinner_set_small_mode (EPHY_SPINNER (spinner), TRUE); - gtk_container_add (GTK_CONTAINER (button), spinner); + gtk_widget_show (spinner); + gtk_container_add (GTK_CONTAINER (item), spinner); egg_tool_item_set_pack_end (EGG_TOOL_ITEM (item), TRUE); egg_tool_item_set_homogeneous (EGG_TOOL_ITEM (item), FALSE); - gtk_widget_show (spinner); g_object_set_data (G_OBJECT (item), "spinner", spinner); return item; } static void +toolbar_style_sync (EggToolbar *toolbar, + GtkToolbarStyle style, + GtkWidget *proxy) +{ + gboolean small; + EphySpinner *spinner; + + spinner = EPHY_SPINNER (g_object_get_data (G_OBJECT (proxy), "spinner")); + + small = (style == GTK_TOOLBAR_ICONS || style == GTK_TOOLBAR_TEXT); + ephy_spinner_set_small_mode (EPHY_SPINNER (spinner), small); +} + +static void +item_parent_set_cb (GtkWidget *item, GtkWidget *previous_parent) +{ + EggToolbar *toolbar; + GtkToolbarStyle style; + + if (item->parent == NULL) return; + + toolbar = EGG_TOOLBAR (item->parent); + + g_signal_connect (toolbar, "style_changed", + G_CALLBACK (toolbar_style_sync), + item); + + style = egg_toolbar_get_style (toolbar); + toolbar_style_sync (toolbar, style, item); +} + +static void connect_proxy (EggAction *action, GtkWidget *proxy) { g_signal_connect_object (action, "notify::throbbing", G_CALLBACK (ephy_spinner_action_sync_throbbing), proxy, 0); + g_signal_connect (proxy, "parent_set", + G_CALLBACK (item_parent_set_cb), + NULL); (* EGG_ACTION_CLASS (parent_class)->connect_proxy) (action, proxy); } + static void ephy_spinner_action_set_property (GObject *object, guint prop_id, |