gimp r25684 - in trunk: . app/actions app/widgets
- From: mitch svn gnome org
- To: svn-commits-list gnome org
- Subject: gimp r25684 - in trunk: . app/actions app/widgets
- Date: Sat, 17 May 2008 13:53:07 +0100 (BST)
Author: mitch
Date: Sat May 17 12:53:07 2008
New Revision: 25684
URL: http://svn.gnome.org/viewvc/gimp?rev=25684&view=rev
Log:
2008-05-17 Michael Natterer <mitch gimp org>
* app/actions/windows-actions.c: add tooltips to the menu items of
open and recently closed docks.
* app/widgets/gimpaction.c: connect to "notify::tooltip" and make
sure gimp_help_set_help_data() gets called when the action's
tooltip changes.
Modified:
trunk/ChangeLog
trunk/app/actions/windows-actions.c
trunk/app/widgets/gimpaction.c
Modified: trunk/app/actions/windows-actions.c
==============================================================================
--- trunk/app/actions/windows-actions.c (original)
+++ trunk/app/actions/windows-actions.c Sat May 17 12:53:07 2008
@@ -327,7 +327,8 @@
if (action)
g_object_set (action,
- "label", gtk_window_get_title (GTK_WINDOW (dock)),
+ "label", gtk_window_get_title (GTK_WINDOW (dock)),
+ "tooltip", gtk_window_get_title (GTK_WINDOW (dock)),
NULL);
}
@@ -359,7 +360,7 @@
entry.stock_id = NULL;
entry.label = gimp_object_get_name (GIMP_OBJECT (info));
entry.accelerator = NULL;
- entry.tooltip = NULL;
+ entry.tooltip = gimp_object_get_name (GIMP_OBJECT (info));
entry.callback = G_CALLBACK (windows_open_recent_cmd_callback);
entry.help_id = NULL;
Modified: trunk/app/widgets/gimpaction.c
==============================================================================
--- trunk/app/widgets/gimpaction.c (original)
+++ trunk/app/widgets/gimpaction.c Sat May 17 12:53:07 2008
@@ -52,19 +52,25 @@
};
-static void gimp_action_finalize (GObject *object);
-static void gimp_action_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec);
-static void gimp_action_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec);
-static void gimp_action_connect_proxy (GtkAction *action,
- GtkWidget *proxy);
-static void gimp_action_set_proxy (GimpAction *action,
- GtkWidget *proxy);
+static void gimp_action_finalize (GObject *object);
+static void gimp_action_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec);
+static void gimp_action_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec);
+
+static void gimp_action_connect_proxy (GtkAction *action,
+ GtkWidget *proxy);
+static void gimp_action_set_proxy (GimpAction *action,
+ GtkWidget *proxy);
+static void gimp_action_set_proxy_tooltip (GimpAction *action,
+ GtkWidget *proxy);
+static void gimp_action_tooltip_notify (GimpAction *action,
+ const GParamSpec *pspec,
+ gpointer data);
G_DEFINE_TYPE (GimpAction, gimp_action, GTK_TYPE_ACTION)
@@ -125,6 +131,10 @@
action->color = NULL;
action->viewable = NULL;
action->ellipsize = PANGO_ELLIPSIZE_NONE;
+
+ g_signal_connect (action, "notify::tooltip",
+ G_CALLBACK (gimp_action_tooltip_notify),
+ NULL);
}
static void
@@ -247,6 +257,7 @@
GTK_ACTION_CLASS (parent_class)->connect_proxy (action, proxy);
gimp_action_set_proxy (GIMP_ACTION (action), proxy);
+ gimp_action_set_proxy_tooltip (GIMP_ACTION (action), proxy);
}
@@ -278,42 +289,12 @@
/* private functions */
static void
-gimp_action_set_proxy_tooltip (GimpAction *action,
- GtkWidget *proxy)
-{
- gchar *tooltip;
-
- g_object_get (action, "tooltip", &tooltip, NULL);
-
- if (tooltip)
- {
- gimp_help_set_help_data (proxy, tooltip,
- g_object_get_qdata (G_OBJECT (proxy),
- GIMP_HELP_ID));
- g_free (tooltip);
- }
-}
-
-static void
gimp_action_set_proxy (GimpAction *action,
GtkWidget *proxy)
{
if (! GTK_IS_IMAGE_MENU_ITEM (proxy))
return;
-#ifdef DISABLE_MENU_TOOLTIPS
- /* This is not quite the correct check, but works fine to enable
- * tooltips only for the "Open Recent" menu items, since they are
- * the only ones having both a viewable and a tooltip. --mitch
- */
- if (action->viewable)
- {
- gimp_action_set_proxy_tooltip (action, proxy);
- }
-#else
- gimp_action_set_proxy_tooltip (action, proxy);
-#endif
-
if (action->color)
{
GtkWidget *area;
@@ -417,3 +398,35 @@
}
}
}
+
+static void
+gimp_action_set_proxy_tooltip (GimpAction *action,
+ GtkWidget *proxy)
+{
+ gchar *tooltip;
+
+ g_object_get (action, "tooltip", &tooltip, NULL);
+
+ if (tooltip)
+ {
+ gimp_help_set_help_data (proxy, tooltip,
+ g_object_get_qdata (G_OBJECT (proxy),
+ GIMP_HELP_ID));
+ g_free (tooltip);
+ }
+}
+
+static void
+gimp_action_tooltip_notify (GimpAction *action,
+ const GParamSpec *pspec,
+ gpointer data)
+{
+ GSList *list;
+
+ for (list = gtk_action_get_proxies (GTK_ACTION (action));
+ list;
+ list = g_slist_next (list))
+ {
+ gimp_action_set_proxy_tooltip (action, list->data);
+ }
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]