From 71c44e8dc078e48bfb6bc6c2517041f75e9ab45e Mon Sep 17 00:00:00 2001 From: Marco Pesenti Gritti Date: Sun, 29 Jun 2003 11:10:07 +0000 Subject: Temporary implementation of toolbar tooltips, until it's implement in 2003-06-29 Marco Pesenti Gritti * 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. --- ChangeLog | 9 +++++++++ lib/egg/egg-action.c | 32 ++++++++++++++++++++++++++++++++ lib/egg/egg-action.h | 2 ++ 3 files changed, 43 insertions(+) diff --git a/ChangeLog b/ChangeLog index 6bc5f6a70..be5b31337 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2003-06-29 Marco Pesenti Gritti + + * 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. + 2003-06-29 Marco Pesenti Gritti * lib/egg/Makefile.am: 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); @@ -367,6 +383,18 @@ egg_action_sync_property (EggAction *action, GParamSpec *pspec, g_value_unset (&value); } +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) { @@ -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", diff --git a/lib/egg/egg-action.h b/lib/egg/egg-action.h index 7acf59210..0b678d208 100644 --- a/lib/egg/egg-action.h +++ b/lib/egg/egg-action.h @@ -33,6 +33,8 @@ struct _EggAction /* list of proxy widgets */ GSList *proxies; + + GtkTooltips *tooltips; }; struct _EggActionClass -- cgit v1.2.3