From 7cddc693b0df6761f8e1b2c52b69130baab5f341 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sun, 31 Aug 2003 23:36:37 +0000 Subject: [PATCH] Make this public again, since it's occasionally useful. (#121128, Marco 2003-09-01 Matthias Clasen * gtk/gtkuimanager.[ch] (gtk_ui_manager_ensure_update): Make this public again, since it's occasionally useful. (#121128, Marco Pesenti Gritti) * gtk/gtkaction.c: Add an "is_important" property and propagate it to toolitem proxies. (#121058, Marco Pesenti Gritti) --- ChangeLog | 9 +++++++ ChangeLog.pre-2-10 | 9 +++++++ ChangeLog.pre-2-4 | 9 +++++++ ChangeLog.pre-2-6 | 9 +++++++ ChangeLog.pre-2-8 | 9 +++++++ docs/reference/ChangeLog | 4 ++++ docs/reference/gtk/gtk-sections.txt | 1 + gtk/gtkaction.c | 37 ++++++++++++++++++++++------- gtk/gtkuimanager.c | 28 ++++++++++++++++++++-- gtk/gtkuimanager.h | 4 ++-- 10 files changed, 106 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index 45abb964f6..4fb5db4b7c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2003-09-01 Matthias Clasen + + * gtk/gtkuimanager.[ch] (gtk_ui_manager_ensure_update): Make + this public again, since it's occasionally useful. (#121128, + Marco Pesenti Gritti) + + * gtk/gtkaction.c: Add an "is_important" property and propagate + it to toolitem proxies. (#121058, Marco Pesenti Gritti) + Mon Sep 1 00:32:30 2003 Soeren Sandmann * tests/testtoolbar.c (main): connect to "delete_event" so the diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 45abb964f6..4fb5db4b7c 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,12 @@ +2003-09-01 Matthias Clasen + + * gtk/gtkuimanager.[ch] (gtk_ui_manager_ensure_update): Make + this public again, since it's occasionally useful. (#121128, + Marco Pesenti Gritti) + + * gtk/gtkaction.c: Add an "is_important" property and propagate + it to toolitem proxies. (#121058, Marco Pesenti Gritti) + Mon Sep 1 00:32:30 2003 Soeren Sandmann * tests/testtoolbar.c (main): connect to "delete_event" so the diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 45abb964f6..4fb5db4b7c 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,12 @@ +2003-09-01 Matthias Clasen + + * gtk/gtkuimanager.[ch] (gtk_ui_manager_ensure_update): Make + this public again, since it's occasionally useful. (#121128, + Marco Pesenti Gritti) + + * gtk/gtkaction.c: Add an "is_important" property and propagate + it to toolitem proxies. (#121058, Marco Pesenti Gritti) + Mon Sep 1 00:32:30 2003 Soeren Sandmann * tests/testtoolbar.c (main): connect to "delete_event" so the diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 45abb964f6..4fb5db4b7c 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,12 @@ +2003-09-01 Matthias Clasen + + * gtk/gtkuimanager.[ch] (gtk_ui_manager_ensure_update): Make + this public again, since it's occasionally useful. (#121128, + Marco Pesenti Gritti) + + * gtk/gtkaction.c: Add an "is_important" property and propagate + it to toolitem proxies. (#121058, Marco Pesenti Gritti) + Mon Sep 1 00:32:30 2003 Soeren Sandmann * tests/testtoolbar.c (main): connect to "delete_event" so the diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 45abb964f6..4fb5db4b7c 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,12 @@ +2003-09-01 Matthias Clasen + + * gtk/gtkuimanager.[ch] (gtk_ui_manager_ensure_update): Make + this public again, since it's occasionally useful. (#121128, + Marco Pesenti Gritti) + + * gtk/gtkaction.c: Add an "is_important" property and propagate + it to toolitem proxies. (#121058, Marco Pesenti Gritti) + Mon Sep 1 00:32:30 2003 Soeren Sandmann * tests/testtoolbar.c (main): connect to "delete_event" so the diff --git a/docs/reference/ChangeLog b/docs/reference/ChangeLog index 68420bc22f..2267b68ec3 100644 --- a/docs/reference/ChangeLog +++ b/docs/reference/ChangeLog @@ -1,3 +1,7 @@ +2003-09-01 Matthias Clasen + + * gtk/gtk-sections.txt: Add gtk_ui_manager_ensure_update. + 2003-08-31 Matthias Clasen * gtk/Makefile.am (IGNORE_HFILES): Add gtktoggleactionprivate.h diff --git a/docs/reference/gtk/gtk-sections.txt b/docs/reference/gtk/gtk-sections.txt index 87ca2c08d1..ba0dba9479 100644 --- a/docs/reference/gtk/gtk-sections.txt +++ b/docs/reference/gtk/gtk-sections.txt @@ -1735,6 +1735,7 @@ gtk_ui_manager_add_ui_from_string gtk_ui_manager_add_ui_from_file gtk_ui_manager_remove_ui gtk_ui_manager_get_ui +gtk_ui_manager_ensure_update GTK_TYPE_UI_MANAGER GTK_UI_MANAGER diff --git a/gtk/gtkaction.c b/gtk/gtkaction.c index f1b9e0c613..2b1cb76463 100644 --- a/gtk/gtkaction.c +++ b/gtk/gtkaction.c @@ -51,10 +51,11 @@ struct _GtkActionPrivate gchar *tooltip; gchar *stock_id; /* icon */ - guint sensitive : 1; - guint visible : 1; - guint label_set : 1; /* these two used so we can set label */ + guint sensitive : 1; + guint visible : 1; + guint label_set : 1; /* these two used so we can set label */ guint short_label_set : 1; /* based on stock id */ + guint is_important : 1; /* accelerator */ GQuark accel_quark; @@ -77,6 +78,7 @@ enum PROP_SHORT_LABEL, PROP_TOOLTIP, PROP_STOCK_ID, + PROP_IS_IMPORTANT, PROP_SENSITIVE, PROP_VISIBLE, }; @@ -196,6 +198,13 @@ gtk_action_class_init (GtkActionClass *klass) _("The stock icon displayed in widgets representing this action."), NULL, G_PARAM_READWRITE)); + g_object_class_install_property (gobject_class, + PROP_IS_IMPORTANT, + g_param_spec_boolean ("is_important", + _("Is important"), + _("Whether the action is considered important. When TRUE, toolitem proxies for this action show text in GTK_TOOLBAR_BOTH_HORIZ mode"), + FALSE, + G_PARAM_READWRITE)); g_object_class_install_property (gobject_class, PROP_SENSITIVE, g_param_spec_boolean ("sensitive", @@ -203,7 +212,6 @@ gtk_action_class_init (GtkActionClass *klass) _("Whether the action is enabled."), TRUE, G_PARAM_READWRITE)); - g_object_class_install_property (gobject_class, PROP_VISIBLE, g_param_spec_boolean ("visible", @@ -212,6 +220,7 @@ gtk_action_class_init (GtkActionClass *klass) TRUE, G_PARAM_READWRITE)); + /** * GtkAction::activate: * @action: the #GtkAction @@ -242,6 +251,7 @@ gtk_action_init (GtkAction *action) action->private_data->short_label = NULL; action->private_data->tooltip = NULL; action->private_data->stock_id = NULL; + action->private_data->is_important = FALSE; action->private_data->sensitive = TRUE; action->private_data->visible = TRUE; @@ -348,6 +358,9 @@ gtk_action_set_property (GObject *object, g_object_notify (object, "short_label"); } break; + case PROP_IS_IMPORTANT: + action->private_data->is_important = g_value_get_boolean (value); + break; case PROP_SENSITIVE: action->private_data->sensitive = g_value_get_boolean (value); break; @@ -387,6 +400,9 @@ gtk_action_get_property (GObject *object, case PROP_STOCK_ID: g_value_set_string (value, action->private_data->stock_id); break; + case PROP_IS_IMPORTANT: + g_value_set_boolean (value, action->private_data->is_important); + break; case PROP_SENSITIVE: g_value_set_boolean (value, action->private_data->sensitive); break; @@ -593,18 +609,21 @@ connect_proxy (GtkAction *action, { /* toolbar button specific synchronisers ... */ - /* synchronise the label */ g_object_set (G_OBJECT (proxy), "label", action->private_data->short_label, "use_underline", TRUE, + "stock_id", action->private_data->stock_id, + "is_important", action->private_data->is_important, NULL); g_signal_connect_object (action, "notify::short_label", G_CALLBACK (gtk_action_sync_short_label), - proxy, 0); - - g_object_set (G_OBJECT (proxy), "stock_id", action->private_data->stock_id, NULL); + proxy, 0); g_signal_connect_object (action, "notify::stock_id", - G_CALLBACK (gtk_action_sync_property), proxy, 0); + G_CALLBACK (gtk_action_sync_property), + proxy, 0); + g_signal_connect_object (action, "notify::is_important", + G_CALLBACK (gtk_action_sync_property), + 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 89ceb34e0a..d1336a0a10 100644 --- a/gtk/gtkuimanager.c +++ b/gtk/gtkuimanager.c @@ -134,7 +134,6 @@ static void gtk_ui_manager_node_prepend_ui_reference (GtkUIManagerNode *node, GQuark action_quark); static void gtk_ui_manager_node_remove_ui_reference (GtkUIManagerNode *node, guint merge_id); -static void gtk_ui_manager_ensure_update (GtkUIManager *self); enum @@ -1794,7 +1793,32 @@ gtk_ui_manager_queue_update (GtkUIManager *self) self->private_data->update_tag = g_idle_add ((GSourceFunc)do_updates, self); } -static void + +/** + * gtk_ui_manager_ensure_update: + * @self: a #GtkUIManager + * + * Makes sure that all pending updates to the UI have been completed. + * + * This may occasionally be necessary, since #GtkUIManager updates the + * UI in an idle function. A typical example where this function is + * useful is to enforce that the menubar and toolbar have been added to + * the main window before showing it: + * + * + * gtk_container_add (GTK_CONTAINER (window), vbox); + * g_signal_connect (merge, "add_widget", + * G_CALLBACK (add_widget), vbox); + * gtk_ui_manager_add_ui_from_file (merge, "my-menus"); + * gtk_ui_manager_add_ui_from_file (merge, "my-toolbars"); + * gtk_ui_manager_ensure_update (merge); + * gtk_widget_show (window); + * + * + * + * Since: 2.4 + **/ +void gtk_ui_manager_ensure_update (GtkUIManager *self) { if (self->private_data->update_tag != 0) diff --git a/gtk/gtkuimanager.h b/gtk/gtkuimanager.h index 4ee6470370..937d47112d 100644 --- a/gtk/gtkuimanager.h +++ b/gtk/gtkuimanager.h @@ -79,8 +79,6 @@ void gtk_ui_manager_set_add_tearoffs (GtkUIManager *self, gboolean add_tearoffs); gboolean gtk_ui_manager_get_add_tearoffs (GtkUIManager *self); -/* these two functions will dirty all merge nodes, as they may need to - * be connected up to different actions */ void gtk_ui_manager_insert_action_group (GtkUIManager *self, GtkActionGroup *action_group, gint pos); @@ -109,4 +107,6 @@ void gtk_ui_manager_remove_ui (GtkUIManager *self, gchar *gtk_ui_manager_get_ui (GtkUIManager *self); +void gtk_ui_manager_ensure_update (GtkUIManager *self); + #endif /* __GTK_UI_MANAGER_H__ */