diff options
author | Marco Pesenti Gritti <marco@it.gnome.org> | 2003-06-29 19:10:07 +0800 |
---|---|---|
committer | Marco Pesenti Gritti <mpeseng@src.gnome.org> | 2003-06-29 19:10:07 +0800 |
commit | 71c44e8dc078e48bfb6bc6c2517041f75e9ab45e (patch) | |
tree | eb6e58e48177425eaddbc47dbc87b013c1031ef8 /lib/egg/egg-action.c | |
parent | b41b89d2288fa87201f17909ce6ca252dacd292e (diff) | |
download | gsoc2013-epiphany-71c44e8dc078e48bfb6bc6c2517041f75e9ab45e.tar gsoc2013-epiphany-71c44e8dc078e48bfb6bc6c2517041f75e9ab45e.tar.gz gsoc2013-epiphany-71c44e8dc078e48bfb6bc6c2517041f75e9ab45e.tar.bz2 gsoc2013-epiphany-71c44e8dc078e48bfb6bc6c2517041f75e9ab45e.tar.lz gsoc2013-epiphany-71c44e8dc078e48bfb6bc6c2517041f75e9ab45e.tar.xz gsoc2013-epiphany-71c44e8dc078e48bfb6bc6c2517041f75e9ab45e.tar.zst gsoc2013-epiphany-71c44e8dc078e48bfb6bc6c2517041f75e9ab45e.zip |
Temporary implementation of toolbar tooltips, until it's implement in
2003-06-29 Marco Pesenti Gritti <marco@it.gnome.org>
* lib/egg/egg-action.c: (egg_action_init), (egg_action_finalize),
(egg_action_sync_tooltip), (connect_proxy):
* lib/egg/egg-action.h:
Temporary implementation of toolbar tooltips, until it's
implement in menu.
Diffstat (limited to 'lib/egg/egg-action.c')
-rw-r--r-- | lib/egg/egg-action.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/lib/egg/egg-action.c b/lib/egg/egg-action.c index d7f24ebee..aba6d59db 100644 --- a/lib/egg/egg-action.c +++ b/lib/egg/egg-action.c @@ -1,5 +1,6 @@ #include "egg-action.h" #include "eggtoolbutton.h" +#include "eggtoolbar.h" #include "eggintl.h" @@ -171,6 +172,8 @@ egg_action_class_init (EggActionClass *class) static void egg_action_init (EggAction *action) { + static GtkTooltips *egg_action_tooltips = NULL; + action->name = NULL; action->label = NULL; action->short_label = NULL; @@ -186,6 +189,17 @@ egg_action_init (EggAction *action) action->accel_quark = 0; action->proxies = NULL; + + if (egg_action_tooltips == NULL) + { + egg_action_tooltips = gtk_tooltips_new (); + action->tooltips = g_object_ref (egg_action_tooltips); + gtk_object_sink (GTK_OBJECT (egg_action_tooltips)); + } + else + { + action->tooltips = g_object_ref (egg_action_tooltips); + } } static void @@ -195,6 +209,8 @@ egg_action_finalize (GObject *object) action = EGG_ACTION (object); + g_object_unref (action->tooltips); + g_free (action->name); g_free (action->label); g_free (action->short_label); @@ -368,6 +384,18 @@ egg_action_sync_property (EggAction *action, GParamSpec *pspec, } static void +egg_action_sync_tooltip (EggAction *action, GParamSpec *pspec, GtkWidget *proxy) +{ + if (action->tooltip != NULL) + { + egg_tool_item_set_tooltip (EGG_TOOL_ITEM (proxy), + action->tooltips, + action->tooltip, + NULL); + } +} + +static void egg_action_sync_label (EggAction *action, GParamSpec *pspec, GtkWidget *proxy) { GtkWidget *label = NULL; @@ -521,6 +549,10 @@ connect_proxy (EggAction *action, GtkWidget *proxy) g_signal_connect_object (action, "notify::short_label", G_CALLBACK (egg_action_sync_short_label), proxy, 0); + egg_action_sync_tooltip (action, NULL, proxy); + g_signal_connect_object (action, "notify::tooltip", + G_CALLBACK (egg_action_sync_tooltip), + proxy, 0); g_object_set (G_OBJECT (proxy), "stock_id", action->stock_id, NULL); g_signal_connect_object (action, "notify::stock_id", |