diff --git a/ChangeLog b/ChangeLog index 935a6f64f..1d0fc9b9f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2003-09-24 Matthias Clasen + + * 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 * tests/testmerge.c (main): Initially activate the JUSTIFY_RIGHT diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 935a6f64f..1d0fc9b9f 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,11 @@ +2003-09-24 Matthias Clasen + + * 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 * tests/testmerge.c (main): Initially activate the JUSTIFY_RIGHT diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 935a6f64f..1d0fc9b9f 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,11 @@ +2003-09-24 Matthias Clasen + + * 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 * tests/testmerge.c (main): Initially activate the JUSTIFY_RIGHT diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 935a6f64f..1d0fc9b9f 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,11 @@ +2003-09-24 Matthias Clasen + + * 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 * tests/testmerge.c (main): Initially activate the JUSTIFY_RIGHT diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 935a6f64f..1d0fc9b9f 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,11 @@ +2003-09-24 Matthias Clasen + + * 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 * tests/testmerge.c (main): Initially activate the JUSTIFY_RIGHT diff --git a/gtk/gtkaction.c b/gtk/gtkaction.c index e3ce12e87..38d986a7f 100644 --- a/gtk/gtkaction.c +++ b/gtk/gtkaction.c @@ -31,15 +31,16 @@ #include #include "gtkaction.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 "gtkbutton.h" +#include "gtkimage.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), diff --git a/gtk/gtkuimanager.c b/gtk/gtkuimanager.c index bdb68279c..cb19d7e23 100644 --- a/gtk/gtkuimanager.c +++ b/gtk/gtkuimanager.c @@ -31,15 +31,16 @@ #include #include -#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\n", "%*s\n", "%*s\n", - "%*s\n", + "%*s\n", "%*s\n", "%*s\n", "%*s\n", - "%*s\n", + "%*s\n", "%*s\n", "%*s\n", "%*s\n",