aboutsummaryrefslogtreecommitdiffstats
path: root/lib/egg
diff options
context:
space:
mode:
Diffstat (limited to 'lib/egg')
-rw-r--r--lib/egg/egg-action.c32
-rw-r--r--lib/egg/egg-action.h2
2 files changed, 34 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",
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