Commit fe395446 authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

add tooltips to the menu items of open and recently closed docks.

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.


svn path=/trunk/; revision=25684
parent 18502898
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.
2008-05-17 Michael Natterer <mitch@gimp.org>
* tools/pdbgen/pdb/gradient.pdb: applied patch from Lars-Peter
......
......@@ -327,7 +327,8 @@ windows_actions_dock_notify (GimpDock *dock,
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 @@ windows_actions_recent_add (GimpContainer *container,
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;
......
......@@ -52,19 +52,25 @@ enum
};
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 @@ gimp_action_init (GimpAction *action)
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 @@ gimp_action_connect_proxy (GtkAction *action,
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);
}
......@@ -277,23 +288,6 @@ gimp_action_name_compare (GimpAction *action1,
/* 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)
......@@ -301,19 +295,6 @@ gimp_action_set_proxy (GimpAction *action,
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 @@ gimp_action_set_proxy (GimpAction *action,
}
}
}
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);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment