Commit a93cee89 authored by Matthias Clasen's avatar Matthias Clasen Committed by Matthias Clasen

Sync tooltips on toolitems.

2003-09-24  Matthias Clasen  <maclas@gmx.de>

	* gtk/gtkaction.c (connect_proxy): Sync tooltips on toolitems.

	* gtk/gtkuimanager.c (update_node): Don't complain about missing
	actions on popups. Re-set "tooltip" property on toolitems after
	adding them to parent to trigger proxy update.
parent dc16c121
2003-09-24 Matthias Clasen <maclas@gmx.de>
* gtk/gtkaction.c (connect_proxy): Sync tooltips on toolitems.
* gtk/gtkuimanager.c (update_node): Don't complain about missing
actions on popups. Re-set "tooltip" property on toolitems after
adding them to parent to trigger proxy update.
2003-09-22 Matthias Clasen <maclas@gmx.de>
* tests/testmerge.c (main): Initially activate the JUSTIFY_RIGHT
......
2003-09-24 Matthias Clasen <maclas@gmx.de>
* gtk/gtkaction.c (connect_proxy): Sync tooltips on toolitems.
* gtk/gtkuimanager.c (update_node): Don't complain about missing
actions on popups. Re-set "tooltip" property on toolitems after
adding them to parent to trigger proxy update.
2003-09-22 Matthias Clasen <maclas@gmx.de>
* tests/testmerge.c (main): Initially activate the JUSTIFY_RIGHT
......
2003-09-24 Matthias Clasen <maclas@gmx.de>
* gtk/gtkaction.c (connect_proxy): Sync tooltips on toolitems.
* gtk/gtkuimanager.c (update_node): Don't complain about missing
actions on popups. Re-set "tooltip" property on toolitems after
adding them to parent to trigger proxy update.
2003-09-22 Matthias Clasen <maclas@gmx.de>
* tests/testmerge.c (main): Initially activate the JUSTIFY_RIGHT
......
2003-09-24 Matthias Clasen <maclas@gmx.de>
* gtk/gtkaction.c (connect_proxy): Sync tooltips on toolitems.
* gtk/gtkuimanager.c (update_node): Don't complain about missing
actions on popups. Re-set "tooltip" property on toolitems after
adding them to parent to trigger proxy update.
2003-09-22 Matthias Clasen <maclas@gmx.de>
* tests/testmerge.c (main): Initially activate the JUSTIFY_RIGHT
......
2003-09-24 Matthias Clasen <maclas@gmx.de>
* gtk/gtkaction.c (connect_proxy): Sync tooltips on toolitems.
* gtk/gtkuimanager.c (update_node): Don't complain about missing
actions on popups. Re-set "tooltip" property on toolitems after
adding them to parent to trigger proxy update.
2003-09-22 Matthias Clasen <maclas@gmx.de>
* tests/testmerge.c (main): Initially activate the JUSTIFY_RIGHT
......
......@@ -31,15 +31,16 @@
#include <config.h>
#include "gtkaction.h"
#include "gtkaccellabel.h"
#include "gtkbutton.h"
#include "gtktoolbutton.h"
#include "gtkmenuitem.h"
#include "gtkimagemenuitem.h"
#include "gtkstock.h"
#include "gtklabel.h"
#include "gtkimage.h"
#include "gtkaccellabel.h"
#include "gtkimagemenuitem.h"
#include "gtkintl.h"
#include "gtklabel.h"
#include "gtkmenuitem.h"
#include "gtkstock.h"
#include "gtktoolbutton.h"
#include "gtktoolbar.h"
#define GTK_ACTION_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GTK_TYPE_ACTION, GtkActionPrivate))
......@@ -530,6 +531,25 @@ gtk_action_sync_stock_id (GtkAction *action,
}
}
static void
gtk_action_sync_tooltip (GtkAction *action,
GParamSpec *pspec,
GtkWidget *proxy)
{
g_return_if_fail (GTK_IS_TOOL_ITEM (proxy));
if (GTK_IS_TOOLBAR (gtk_widget_get_parent (proxy)))
{
GtkToolbar *toolbar = GTK_TOOLBAR (gtk_widget_get_parent (proxy));
gtk_tool_item_set_tooltip (GTK_TOOL_ITEM (proxy),
toolbar->tooltips,
action->private_data->tooltip,
NULL);
}
}
static gboolean
gtk_action_create_menu_proxy (GtkToolItem *tool_item,
GtkAction *action)
......@@ -648,6 +668,9 @@ connect_proxy (GtkAction *action,
"stock_id", action->private_data->stock_id,
"is_important", action->private_data->is_important,
NULL);
/* FIXME: we should set the tooltip here, but the current api
* doesn't allow it before the item is added to a toolbar.
*/
g_signal_connect_object (action, "notify::short_label",
G_CALLBACK (gtk_action_sync_short_label),
proxy, 0);
......@@ -657,6 +680,9 @@ connect_proxy (GtkAction *action,
g_signal_connect_object (action, "notify::is_important",
G_CALLBACK (gtk_action_sync_property),
proxy, 0);
g_signal_connect_object (action, "notify::tooltip",
G_CALLBACK (gtk_action_sync_tooltip),
proxy, 0);
g_signal_connect_object (proxy, "create_menu_proxy",
G_CALLBACK (gtk_action_create_menu_proxy),
......
......@@ -31,15 +31,16 @@
#include <config.h>
#include <string.h>
#include "gtkuimanager.h"
#include "gtktoolbar.h"
#include "gtkseparatortoolitem.h"
#include "gtkmenushell.h"
#include "gtkintl.h"
#include "gtkmarshalers.h"
#include "gtkmenu.h"
#include "gtkmenubar.h"
#include "gtkmenushell.h"
#include "gtkseparatormenuitem.h"
#include "gtkseparatortoolitem.h"
#include "gtktearoffmenuitem.h"
#include "gtkintl.h"
#include "gtktoolbar.h"
#include "gtkuimanager.h"
#undef DEBUG_UI_MANAGER
......@@ -1723,6 +1724,7 @@ update_node (GtkUIManager *self,
Node *info;
GNode *child;
GtkAction *action;
gchar *tooltip;
#ifdef DEBUG_UI_MANAGER
GList *tmp;
#endif
......@@ -1767,6 +1769,7 @@ update_node (GtkUIManager *self,
info->type != NODE_TYPE_ROOT &&
info->type != NODE_TYPE_MENUBAR &&
info->type != NODE_TYPE_TOOLBAR &&
info->type != NODE_TYPE_POPUP &&
info->type != NODE_TYPE_SEPARATOR &&
info->type != NODE_TYPE_MENU_PLACEHOLDER &&
info->type != NODE_TYPE_TOOLBAR_PLACEHOLDER)
......@@ -1984,7 +1987,7 @@ update_node (GtkUIManager *self,
if (find_menu_position (node, &menushell, &pos))
{
info->proxy = gtk_action_create_menu_item (action);
gtk_menu_shell_insert (GTK_MENU_SHELL (menushell),
info->proxy, pos);
}
......@@ -2024,7 +2027,13 @@ update_node (GtkUIManager *self,
info->proxy = gtk_action_create_tool_item (action);
gtk_toolbar_insert (GTK_TOOLBAR (toolbar),
GTK_TOOL_ITEM (info->proxy), pos);
GTK_TOOL_ITEM (info->proxy), pos);
/* FIXME: this is necessary, since tooltips on toolitems
* can't be set before the toolitem is added to the toolbar.
*/
g_object_get (G_OBJECT (action), "tooltip", &tooltip, NULL);
g_object_set (G_OBJECT (action), "tooltip", tooltip, NULL);
}
}
else
......@@ -2033,6 +2042,7 @@ update_node (GtkUIManager *self,
G_CALLBACK (update_smart_separators),
0);
gtk_action_connect_proxy (action, info->proxy);
}
g_signal_connect (info->proxy, "notify::visible",
G_CALLBACK (update_smart_separators), 0);
......@@ -2222,11 +2232,11 @@ static const gchar *open_tag_format[] = {
"%*s<UNDECIDED>\n",
"%*s<ui>\n",
"%*s<menubar name=\"%s\">\n",
"%*s<menu name='%s' action=\"%s\">\n",
"%*s<menu name=\"%s\" action=\"%s\">\n",
"%*s<toolbar name=\"%s\">\n",
"%*s<placeholder name=\"%s\">\n",
"%*s<placeholder name=\"%s\">\n",
"%*s<popup name='%s' action=\"%s\">\n",
"%*s<popup name=\"%s\">\n",
"%*s<menuitem name=\"%s\" action=\"%s\"/>\n",
"%*s<toolitem name=\"%s\" action=\"%s\"/>\n",
"%*s<separator name=\"%s\"/>\n",
......
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