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

Changes to make cross-process merging feasible:

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

	Changes to make cross-process merging feasible:

	* gtk/gtkuimanager.[hc]: Add a readonly "ui" property which holds the
	merged UI definition. Remove the "changed" signal, since its role
	is now filled by "notify::ui". Instead add a "actions-changed" signal
	which gets emitted when the set of actions changes.

	* gtk/gtktoggleactionprivate.h:
	* gtk/gtktoggleaction.[hc] (gtk_toggle_action_[sg]et_draw_as_radio):
	Add a "draw_as_radio" property to toggle actions so that they can be
	used as proxies for radio actions much like the "draw_as_radio"
	property on check menu items enables them to operate as proxies for
	radio actions.

	Prevent the "show_all" trap for action-based menus (see
	http://mail.gnome.org/archives/gtk-devel-list/2003-September/
	msg00260.html):

	* gtk/gtkmenu.c (gtk_menu_{hide,show}_all): Remove g_return_if_fail()
	calls from static functions.

	* gtk/gtkuimanager.c (update_node):
	* gtk/gtkaction.c (connect_proxy): Set "no_show_all" on constructed
	widgets whose visibility is externally controlled.

	* gtk/gtkwidget.[hc] (gtk_widget_[gs]et_no_show_all): Add a boolean
	"no_show_all" property with setter and getter. When TRUE, it keeps
	gtk_widget_{hide,show}_all() from modifying the visibility of the
	widget and its children.
parent 8be8d7f6
2003-09-21 Matthias Clasen <maclas@gmx.de>
Changes to make cross-process merging feasible:
* gtk/gtkuimanager.[hc]: Add a readonly "ui" property which holds the
merged UI definition. Remove the "changed" signal, since its role
is now filled by "notify::ui". Instead add a "actions-changed" signal
which gets emitted when the set of actions changes.
* gtk/gtktoggleactionprivate.h:
* gtk/gtktoggleaction.[hc] (gtk_toggle_action_[sg]et_draw_as_radio):
Add a "draw_as_radio" property to toggle actions so that they can be
used as proxies for radio actions much like the "draw_as_radio"
property on check menu items enables them to operate as proxies for
radio actions.
Prevent the "show_all" trap for action-based menus (see
http://mail.gnome.org/archives/gtk-devel-list/2003-September/
msg00260.html):
* gtk/gtkmenu.c (gtk_menu_{hide,show}_all): Remove g_return_if_fail()
calls from static functions.
* gtk/gtkuimanager.c (update_node):
* gtk/gtkaction.c (connect_proxy): Set "no_show_all" on constructed
widgets whose visibility is externally controlled.
* gtk/gtkwidget.[hc] (gtk_widget_[gs]et_no_show_all): Add a boolean
"no_show_all" property with setter and getter. When TRUE, it keeps
gtk_widget_{hide,show}_all() from modifying the visibility of the
widget and its children.
Sun Sep 21 23:13:37 2003 Soeren Sandmann <sandmann@daimi.au.dk> Sun Sep 21 23:13:37 2003 Soeren Sandmann <sandmann@daimi.au.dk>
* gtk/gtktextview.[ch]: Add new "tab moves focus" property (#122709) * gtk/gtktextview.[ch]: Add new "tab moves focus" property (#122709)
......
2003-09-21 Matthias Clasen <maclas@gmx.de>
Changes to make cross-process merging feasible:
* gtk/gtkuimanager.[hc]: Add a readonly "ui" property which holds the
merged UI definition. Remove the "changed" signal, since its role
is now filled by "notify::ui". Instead add a "actions-changed" signal
which gets emitted when the set of actions changes.
* gtk/gtktoggleactionprivate.h:
* gtk/gtktoggleaction.[hc] (gtk_toggle_action_[sg]et_draw_as_radio):
Add a "draw_as_radio" property to toggle actions so that they can be
used as proxies for radio actions much like the "draw_as_radio"
property on check menu items enables them to operate as proxies for
radio actions.
Prevent the "show_all" trap for action-based menus (see
http://mail.gnome.org/archives/gtk-devel-list/2003-September/
msg00260.html):
* gtk/gtkmenu.c (gtk_menu_{hide,show}_all): Remove g_return_if_fail()
calls from static functions.
* gtk/gtkuimanager.c (update_node):
* gtk/gtkaction.c (connect_proxy): Set "no_show_all" on constructed
widgets whose visibility is externally controlled.
* gtk/gtkwidget.[hc] (gtk_widget_[gs]et_no_show_all): Add a boolean
"no_show_all" property with setter and getter. When TRUE, it keeps
gtk_widget_{hide,show}_all() from modifying the visibility of the
widget and its children.
Sun Sep 21 23:13:37 2003 Soeren Sandmann <sandmann@daimi.au.dk> Sun Sep 21 23:13:37 2003 Soeren Sandmann <sandmann@daimi.au.dk>
* gtk/gtktextview.[ch]: Add new "tab moves focus" property (#122709) * gtk/gtktextview.[ch]: Add new "tab moves focus" property (#122709)
......
2003-09-21 Matthias Clasen <maclas@gmx.de>
Changes to make cross-process merging feasible:
* gtk/gtkuimanager.[hc]: Add a readonly "ui" property which holds the
merged UI definition. Remove the "changed" signal, since its role
is now filled by "notify::ui". Instead add a "actions-changed" signal
which gets emitted when the set of actions changes.
* gtk/gtktoggleactionprivate.h:
* gtk/gtktoggleaction.[hc] (gtk_toggle_action_[sg]et_draw_as_radio):
Add a "draw_as_radio" property to toggle actions so that they can be
used as proxies for radio actions much like the "draw_as_radio"
property on check menu items enables them to operate as proxies for
radio actions.
Prevent the "show_all" trap for action-based menus (see
http://mail.gnome.org/archives/gtk-devel-list/2003-September/
msg00260.html):
* gtk/gtkmenu.c (gtk_menu_{hide,show}_all): Remove g_return_if_fail()
calls from static functions.
* gtk/gtkuimanager.c (update_node):
* gtk/gtkaction.c (connect_proxy): Set "no_show_all" on constructed
widgets whose visibility is externally controlled.
* gtk/gtkwidget.[hc] (gtk_widget_[gs]et_no_show_all): Add a boolean
"no_show_all" property with setter and getter. When TRUE, it keeps
gtk_widget_{hide,show}_all() from modifying the visibility of the
widget and its children.
Sun Sep 21 23:13:37 2003 Soeren Sandmann <sandmann@daimi.au.dk> Sun Sep 21 23:13:37 2003 Soeren Sandmann <sandmann@daimi.au.dk>
* gtk/gtktextview.[ch]: Add new "tab moves focus" property (#122709) * gtk/gtktextview.[ch]: Add new "tab moves focus" property (#122709)
......
2003-09-21 Matthias Clasen <maclas@gmx.de>
Changes to make cross-process merging feasible:
* gtk/gtkuimanager.[hc]: Add a readonly "ui" property which holds the
merged UI definition. Remove the "changed" signal, since its role
is now filled by "notify::ui". Instead add a "actions-changed" signal
which gets emitted when the set of actions changes.
* gtk/gtktoggleactionprivate.h:
* gtk/gtktoggleaction.[hc] (gtk_toggle_action_[sg]et_draw_as_radio):
Add a "draw_as_radio" property to toggle actions so that they can be
used as proxies for radio actions much like the "draw_as_radio"
property on check menu items enables them to operate as proxies for
radio actions.
Prevent the "show_all" trap for action-based menus (see
http://mail.gnome.org/archives/gtk-devel-list/2003-September/
msg00260.html):
* gtk/gtkmenu.c (gtk_menu_{hide,show}_all): Remove g_return_if_fail()
calls from static functions.
* gtk/gtkuimanager.c (update_node):
* gtk/gtkaction.c (connect_proxy): Set "no_show_all" on constructed
widgets whose visibility is externally controlled.
* gtk/gtkwidget.[hc] (gtk_widget_[gs]et_no_show_all): Add a boolean
"no_show_all" property with setter and getter. When TRUE, it keeps
gtk_widget_{hide,show}_all() from modifying the visibility of the
widget and its children.
Sun Sep 21 23:13:37 2003 Soeren Sandmann <sandmann@daimi.au.dk> Sun Sep 21 23:13:37 2003 Soeren Sandmann <sandmann@daimi.au.dk>
* gtk/gtktextview.[ch]: Add new "tab moves focus" property (#122709) * gtk/gtktextview.[ch]: Add new "tab moves focus" property (#122709)
......
2003-09-21 Matthias Clasen <maclas@gmx.de>
Changes to make cross-process merging feasible:
* gtk/gtkuimanager.[hc]: Add a readonly "ui" property which holds the
merged UI definition. Remove the "changed" signal, since its role
is now filled by "notify::ui". Instead add a "actions-changed" signal
which gets emitted when the set of actions changes.
* gtk/gtktoggleactionprivate.h:
* gtk/gtktoggleaction.[hc] (gtk_toggle_action_[sg]et_draw_as_radio):
Add a "draw_as_radio" property to toggle actions so that they can be
used as proxies for radio actions much like the "draw_as_radio"
property on check menu items enables them to operate as proxies for
radio actions.
Prevent the "show_all" trap for action-based menus (see
http://mail.gnome.org/archives/gtk-devel-list/2003-September/
msg00260.html):
* gtk/gtkmenu.c (gtk_menu_{hide,show}_all): Remove g_return_if_fail()
calls from static functions.
* gtk/gtkuimanager.c (update_node):
* gtk/gtkaction.c (connect_proxy): Set "no_show_all" on constructed
widgets whose visibility is externally controlled.
* gtk/gtkwidget.[hc] (gtk_widget_[gs]et_no_show_all): Add a boolean
"no_show_all" property with setter and getter. When TRUE, it keeps
gtk_widget_{hide,show}_all() from modifying the visibility of the
widget and its children.
Sun Sep 21 23:13:37 2003 Soeren Sandmann <sandmann@daimi.au.dk> Sun Sep 21 23:13:37 2003 Soeren Sandmann <sandmann@daimi.au.dk>
* gtk/gtktextview.[ch]: Add new "tab moves focus" property (#122709) * gtk/gtktextview.[ch]: Add new "tab moves focus" property (#122709)
......
2003-09-21 Matthias Clasen <maclas@gmx.de>
* gtk/gtk-sections.txt: Add gtk_widget_[gs]et_no_show_all.
Add gtk_toggle_action_[gs]et_draw_as_radio.
2003-09-18 Matthias Clasen <maclas@gmx.de> 2003-09-18 Matthias Clasen <maclas@gmx.de>
* gtk/gtk-sections.txt: * gtk/gtk-sections.txt:
......
...@@ -2893,6 +2893,9 @@ GtkToggleAction ...@@ -2893,6 +2893,9 @@ GtkToggleAction
gtk_toggle_action_toggled gtk_toggle_action_toggled
gtk_toggle_action_set_active gtk_toggle_action_set_active
gtk_toggle_action_get_active gtk_toggle_action_get_active
gtk_toggle_action_set_draw_as_radio
gtk_toggle_action_get_draw_as_radio
<SUBSECTION Standard> <SUBSECTION Standard>
GTK_TYPE_TOGGLE_ACTION GTK_TYPE_TOGGLE_ACTION
GTK_TOGGLE_ACTION GTK_TOGGLE_ACTION
...@@ -4032,6 +4035,8 @@ gtk_widget_set_default_visual ...@@ -4032,6 +4035,8 @@ gtk_widget_set_default_visual
gtk_widget_set_size_request gtk_widget_set_size_request
gtk_widget_set_visual gtk_widget_set_visual
gtk_widget_thaw_child_notify gtk_widget_thaw_child_notify
gtk_widget_set_no_show_all
gtk_widget_get_no_show_all
<SUBSECTION> <SUBSECTION>
gtk_requisition_copy gtk_requisition_copy
gtk_requisition_free gtk_requisition_free
......
...@@ -568,6 +568,7 @@ connect_proxy (GtkAction *action, ...@@ -568,6 +568,7 @@ connect_proxy (GtkAction *action,
gtk_widget_show (proxy); gtk_widget_show (proxy);
else else
gtk_widget_hide (proxy); gtk_widget_hide (proxy);
gtk_widget_set_no_show_all (proxy, TRUE);
if (GTK_IS_MENU_ITEM (proxy)) if (GTK_IS_MENU_ITEM (proxy))
{ {
......
...@@ -3540,8 +3540,6 @@ gtk_menu_reparent (GtkMenu *menu, ...@@ -3540,8 +3540,6 @@ gtk_menu_reparent (GtkMenu *menu,
static void static void
gtk_menu_show_all (GtkWidget *widget) gtk_menu_show_all (GtkWidget *widget)
{ {
g_return_if_fail (GTK_IS_MENU (widget));
/* Show children, but not self. */ /* Show children, but not self. */
gtk_container_foreach (GTK_CONTAINER (widget), (GtkCallback) gtk_widget_show_all, NULL); gtk_container_foreach (GTK_CONTAINER (widget), (GtkCallback) gtk_widget_show_all, NULL);
} }
...@@ -3550,8 +3548,6 @@ gtk_menu_show_all (GtkWidget *widget) ...@@ -3550,8 +3548,6 @@ gtk_menu_show_all (GtkWidget *widget)
static void static void
gtk_menu_hide_all (GtkWidget *widget) gtk_menu_hide_all (GtkWidget *widget)
{ {
g_return_if_fail (GTK_IS_MENU (widget));
/* Hide children, but not self. */ /* Hide children, but not self. */
gtk_container_foreach (GTK_CONTAINER (widget), (GtkCallback) gtk_widget_hide_all, NULL); gtk_container_foreach (GTK_CONTAINER (widget), (GtkCallback) gtk_widget_hide_all, NULL);
} }
......
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
#include <config.h> #include <config.h>
#include "gtkintl.h"
#include "gtktoggleaction.h" #include "gtktoggleaction.h"
#include "gtktoggleactionprivate.h" #include "gtktoggleactionprivate.h"
#include "gtktoggletoolbutton.h" #include "gtktoggletoolbutton.h"
...@@ -42,6 +43,11 @@ enum ...@@ -42,6 +43,11 @@ enum
LAST_SIGNAL LAST_SIGNAL
}; };
enum {
PROP_0,
PROP_DRAW_AS_RADIO
};
static void gtk_toggle_action_init (GtkToggleAction *action); static void gtk_toggle_action_init (GtkToggleAction *action);
static void gtk_toggle_action_class_init (GtkToggleActionClass *class); static void gtk_toggle_action_class_init (GtkToggleActionClass *class);
...@@ -73,12 +79,22 @@ gtk_toggle_action_get_type (void) ...@@ -73,12 +79,22 @@ gtk_toggle_action_get_type (void)
return type; return type;
} }
static void gtk_toggle_action_activate (GtkAction *action); static void gtk_toggle_action_activate (GtkAction *action);
static void gtk_toggle_action_real_toggled (GtkToggleAction *action); static void gtk_toggle_action_real_toggled (GtkToggleAction *action);
static void connect_proxy (GtkAction *action, static void connect_proxy (GtkAction *action,
GtkWidget *proxy); GtkWidget *proxy);
static void disconnect_proxy (GtkAction *action, static void disconnect_proxy (GtkAction *action,
GtkWidget *proxy); GtkWidget *proxy);
static void set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec);
static void get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec);
static GtkWidget *create_menu_item (GtkAction *action);
static GObjectClass *parent_class = NULL; static GObjectClass *parent_class = NULL;
static guint action_signals[LAST_SIGNAL] = { 0 }; static guint action_signals[LAST_SIGNAL] = { 0 };
...@@ -93,6 +109,9 @@ gtk_toggle_action_class_init (GtkToggleActionClass *klass) ...@@ -93,6 +109,9 @@ gtk_toggle_action_class_init (GtkToggleActionClass *klass)
gobject_class = G_OBJECT_CLASS (klass); gobject_class = G_OBJECT_CLASS (klass);
action_class = GTK_ACTION_CLASS (klass); action_class = GTK_ACTION_CLASS (klass);
gobject_class->set_property = set_property;
gobject_class->get_property = get_property;
action_class->activate = gtk_toggle_action_activate; action_class->activate = gtk_toggle_action_activate;
action_class->connect_proxy = connect_proxy; action_class->connect_proxy = connect_proxy;
action_class->disconnect_proxy = disconnect_proxy; action_class->disconnect_proxy = disconnect_proxy;
...@@ -100,8 +119,18 @@ gtk_toggle_action_class_init (GtkToggleActionClass *klass) ...@@ -100,8 +119,18 @@ gtk_toggle_action_class_init (GtkToggleActionClass *klass)
action_class->menu_item_type = GTK_TYPE_CHECK_MENU_ITEM; action_class->menu_item_type = GTK_TYPE_CHECK_MENU_ITEM;
action_class->toolbar_item_type = GTK_TYPE_TOGGLE_TOOL_BUTTON; action_class->toolbar_item_type = GTK_TYPE_TOGGLE_TOOL_BUTTON;
action_class->create_menu_item = create_menu_item;
klass->toggled = gtk_toggle_action_real_toggled; klass->toggled = gtk_toggle_action_real_toggled;
g_object_class_install_property (gobject_class,
PROP_DRAW_AS_RADIO,
g_param_spec_boolean ("draw_as_radio",
_("Create the same proxies as a radio action"),
_("Whether the proxies for this action look like radio action proxies"),
FALSE,
G_PARAM_READWRITE));
action_signals[TOGGLED] = action_signals[TOGGLED] =
g_signal_new ("toggled", g_signal_new ("toggled",
G_OBJECT_CLASS_TYPE (klass), G_OBJECT_CLASS_TYPE (klass),
...@@ -119,6 +148,46 @@ gtk_toggle_action_init (GtkToggleAction *action) ...@@ -119,6 +148,46 @@ gtk_toggle_action_init (GtkToggleAction *action)
{ {
action->private_data = GTK_TOGGLE_ACTION_GET_PRIVATE (action); action->private_data = GTK_TOGGLE_ACTION_GET_PRIVATE (action);
action->private_data->active = FALSE; action->private_data->active = FALSE;
action->private_data->draw_as_radio = FALSE;
}
static void
get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
GtkToggleAction *action = GTK_TOGGLE_ACTION (object);
switch (prop_id)
{
case PROP_DRAW_AS_RADIO:
g_value_set_boolean (value, gtk_toggle_action_get_draw_as_radio (action));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
GtkToggleAction *action = GTK_TOGGLE_ACTION (object);
switch (prop_id)
{
case PROP_DRAW_AS_RADIO:
gtk_toggle_action_set_draw_as_radio (action, g_value_get_boolean (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
} }
static void static void
...@@ -251,3 +320,56 @@ gtk_toggle_action_get_active (GtkToggleAction *action) ...@@ -251,3 +320,56 @@ gtk_toggle_action_get_active (GtkToggleAction *action)
return action->private_data->active; return action->private_data->active;
} }
/**
* gtk_toggle_action_set_draw_as_radio:
* @action: the action object
* @draw_as_radio: whether the action should have proxies like a radio
* action
*
* Sets whether the action should have proxies like a radio action.
*
* Since: 2.4
*/
void
gtk_toggle_action_set_draw_as_radio (GtkToggleAction *action,
gboolean draw_as_radio)
{
g_return_if_fail (GTK_IS_TOGGLE_ACTION (action));
draw_as_radio = draw_as_radio != FALSE;
if (action->private_data->draw_as_radio != draw_as_radio)
{
action->private_data->draw_as_radio = draw_as_radio;
g_object_notify (G_OBJECT (action), "draw_as_radio");
}
}
/**
* gtk_toggle_action_get_draw_as_radio:
* @action: the action object
*
* Returns: whether the action should have proxies like a radio action.
*
* Since: 2.4
*/
gboolean
gtk_toggle_action_get_draw_as_radio (GtkToggleAction *action)
{
g_return_val_if_fail (GTK_IS_TOGGLE_ACTION (action), FALSE);
return action->private_data->draw_as_radio;
}
static GtkWidget *
create_menu_item (GtkAction *action)
{
GtkToggleAction *toggle_action = GTK_TOGGLE_ACTION (action);
return g_object_new (GTK_TYPE_CHECK_MENU_ITEM,
"draw_as_radio", toggle_action->private_data->draw_as_radio,
NULL);
}
...@@ -65,12 +65,14 @@ struct _GtkToggleActionClass ...@@ -65,12 +65,14 @@ struct _GtkToggleActionClass
void (*_gtk_reserved4) (void); void (*_gtk_reserved4) (void);
}; };
GType gtk_toggle_action_get_type (void); GType gtk_toggle_action_get_type (void);
void gtk_toggle_action_toggled (GtkToggleAction *action);
void gtk_toggle_action_toggled (GtkToggleAction *action); void gtk_toggle_action_set_active (GtkToggleAction *action,
void gtk_toggle_action_set_active (GtkToggleAction *action, gboolean is_active);
gboolean is_active); gboolean gtk_toggle_action_get_active (GtkToggleAction *action);
gboolean gtk_toggle_action_get_active (GtkToggleAction *action); void gtk_toggle_action_set_draw_as_radio (GtkToggleAction *action,
gboolean draw_as_radio);
gboolean gtk_toggle_action_get_draw_as_radio (GtkToggleAction *action);
#endif /* __GTK_TOGGLE_ACTION_H__ */ #endif /* __GTK_TOGGLE_ACTION_H__ */
...@@ -36,7 +36,8 @@ ...@@ -36,7 +36,8 @@
struct _GtkToggleActionPrivate struct _GtkToggleActionPrivate
{ {
guint active : 1; guint active : 1;
guint draw_as_radio : 1;
}; };
#endif /* __GTK_TOGGLE_ACTION_PRIVATE_H__ */ #endif /* __GTK_TOGGLE_ACTION_PRIVATE_H__ */
...@@ -139,14 +139,15 @@ static void node_remove_ui_reference (Node *node, ...@@ -139,14 +139,15 @@ static void node_remove_ui_reference (Node *node,
enum enum
{ {
ADD_WIDGET, ADD_WIDGET,
CHANGED, ACTIONS_CHANGED,
LAST_SIGNAL LAST_SIGNAL
}; };
enum enum
{ {
PROP_0, PROP_0,
PROP_ADD_TEAROFFS PROP_ADD_TEAROFFS,
PROP_UI
}; };
static guint merge_signals[LAST_SIGNAL] = { 0 }; static guint merge_signals[LAST_SIGNAL] = { 0 };
...@@ -213,8 +214,17 @@ gtk_ui_manager_class_init (GtkUIManagerClass *klass) ...@@ -213,8 +214,17 @@ gtk_ui_manager_class_init (GtkUIManagerClass *klass)
_("Add tearoffs to menus"), _("Add tearoffs to menus"),
_("Whether tearoff menu items should be added to menus"), _("Whether tearoff menu items should be added to menus"),
FALSE, FALSE,
G_PARAM_READABLE | G_PARAM_WRITABLE)); G_PARAM_READWRITE));
g_object_class_install_property (gobject_class,
PROP_UI,
g_param_spec_string ("ui",
_("Merged UI definition"),
_("An XML string describing the merged UI"),
NULL,
G_PARAM_READABLE));
/** /**
* GtkUIManager::add-widget: * GtkUIManager::add-widget:
* @merge: a #GtkUIManager * @merge: a #GtkUIManager
...@@ -236,18 +246,20 @@ gtk_ui_manager_class_init (GtkUIManagerClass *klass) ...@@ -236,18 +246,20 @@ gtk_ui_manager_class_init (GtkUIManagerClass *klass)
GTK_TYPE_WIDGET); GTK_TYPE_WIDGET);
/** /**
* GtkUIManager::changed: * GtkUIManager::actions-changed:
* @merge: a #GtkUIManager * @merge: a #GtkUIManager
* *
* The "changed" signal is emitted whenever the merged UI changes. * The "actions-changed" signal is emitted whenever the set of actions
* changes.
* *
* Since: 2.4 * Since: 2.4
*/ */
merge_signals[CHANGED] = merge_signals[ACTIONS_CHANGED] =
g_signal_new ("changed", g_signal_new ("actions_changed",
G_OBJECT_CLASS_TYPE (klass), G_OBJECT_CLASS_TYPE (klass),
G_SIGNAL_RUN_FIRST | G_SIGNAL_NO_RECURSE, G_SIGNAL_RUN_FIRST | G_SIGNAL_NO_RECURSE,
G_STRUCT_OFFSET (GtkUIManagerClass, changed), NULL, NULL, G_STRUCT_OFFSET (GtkUIManagerClass, actions_changed),
NULL, NULL,
g_cclosure_marshal_VOID__VOID, g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0); G_TYPE_NONE, 0);
...@@ -335,6 +347,9 @@ gtk_ui_manager_get_property (GObject *object, ...@@ -335,6 +347,9 @@ gtk_ui_manager_get_property (GObject *object,
case PROP_ADD_TEAROFFS: case PROP_ADD_TEAROFFS:
g_value_set_boolean (value, self->private_data->add_tearoffs); g_value_set_boolean (value, self->private_data->add_tearoffs);
break; break;
case PROP_UI:
g_value_set_string (value, gtk_ui_manager_get_ui (self));
break;
default: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break; break;
...@@ -437,6 +452,8 @@ gtk_ui_manager_insert_action_group (GtkUIManager *self, ...@@ -437,6 +452,8 @@ gtk_ui_manager_insert_action_group (GtkUIManager *self,
/* dirty all nodes, as action bindings may change */ /* dirty all nodes, as action bindings may change */
dirty_all_nodes (self); dirty_all_nodes (self);
g_signal_emit (self, merge_signals[ACTIONS_CHANGED], 0);
} }
/** /**
...@@ -464,6 +481,8 @@ gtk_ui_manager_remove_action_group (GtkUIManager *self, ...@@ -464,6 +481,8 @@ gtk_ui_manager_remove_action_group (GtkUIManager *self,
/* dirty all nodes, as action bindings may change */ /* dirty all nodes, as action bindings may change */
dirty_all_nodes (self); dirty_all_nodes (self);
g_signal_emit (self, merge_signals[ACTIONS_CHANGED], 0);
} }
/** /**
...@@ -1185,7 +1204,7 @@ add_ui_from_string (GtkUIManager *self, ...@@ -1185,7 +1204,7 @@ add_ui_from_string (GtkUIManager *self,
queue_update (self); queue_update (self);
g_signal_emit (self, merge_signals[CHANGED], 0); g_object_notify (G_OBJECT (self), "ui");
return ctx.merge_id; return ctx.merge_id;
...@@ -1416,7 +1435,7 @@ gtk_ui_manager_add_ui (GtkUIManager *self, ...@@ -1416,7 +1435,7 @@ gtk_ui_manager_add_ui (GtkUIManager *self,
queue_update (self); queue_update (self);
g_signal_emit (self, merge_signals[CHANGED], 0); g_object_notify (G_OBJECT (self), "ui");
} }
static gboolean static gboolean
...@@ -1449,7 +1468,7 @@ gtk_ui_manager_remove_ui (GtkUIManager *self, ...@@ -1449,7 +1468,7 @@ gtk_ui_manager_remove_ui (GtkUIManager *self,
queue_update (self); queue_update (self);
g_signal_emit (self, merge_signals[CHANGED], 0); g_object_notify (G_OBJECT (self), "ui");
} }
/* -------------------- Updates -------------------- */ /* -------------------- Updates -------------------- */
...@@ -1457,7 +1476,7 @@ gtk_ui_manager_remove_ui (GtkUIManager *self, ...@@ -1457,7 +1476,7 @@ gtk_ui_manager_remove_ui (GtkUIManager *self,
static GtkAction * static GtkAction *
get_action_by_name (GtkUIManager *merge, get_action_by_name (GtkUIManager *merge,
const char *action_name) const gchar *action_name)
{ {
GList *tmp; GList *tmp;
...@@ -1826,6 +1845,7 @@ update_node (GtkUIManager *self, ...@@ -1826,6 +1845,7 @@ update_node (GtkUIManager *self,
info->proxy = gtk_action_create_menu_item (action); info->proxy = gtk_action_create_menu_item (action);
menu = gtk_menu_new (); menu = gtk_menu_new ();
tearoff = gtk_tearoff_menu_item_new (); tearoff = gtk_tearoff_menu_item_new ();
gtk_widget_set_no_show_all (tearoff, TRUE);
gtk_menu_shell_append (GTK_MENU_SHELL (menu), tearoff); gtk_menu_shell_append (GTK_MENU_SHELL (menu), tearoff);
gtk_menu_item_set_submenu (GTK_MENU_ITEM (info->proxy), menu); gtk_menu_item_set_submenu (GTK_MENU_ITEM (info->proxy), menu);
gtk_menu_shell_insert (GTK_MENU_SHELL (menushell), info->proxy, pos); gtk_menu_shell_insert (GTK_MENU_SHELL (menushell), info->proxy, pos);
...@@ -2036,6 +2056,7 @@ update_node (GtkUIManager *self, ...@@ -2036,6 +2056,7 @@ update_node (GtkUIManager *self,
GtkToolItem *item = gtk_separator_tool_item_new (); GtkToolItem *item = gtk_separator_tool_item_new ();
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, pos); gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, pos);
info->proxy = GTK_WIDGET (item); info->proxy = GTK_WIDGET (item);
gtk_widget_set_no_show_all (info->proxy, TRUE);
g_object_set_data (G_OBJECT (info->proxy), g_object_set_data (G_OBJECT (info->proxy),
"gtk-separator-mode", "gtk-separator-mode",
GINT_TO_POINTER (SEPARATOR_MODE_SMART)); GINT_TO_POINTER (SEPARATOR_MODE_SMART));
...@@ -2057,6 +2078,7 @@ update_node (GtkUIManager *self, ...@@ -2057,6 +2078,7 @@ update_node (GtkUIManager *self,
if (find_menu_position (node, &menushell, &pos)) if (find_menu_position (node, &menushell, &pos))
{ {
info->proxy = gtk_separator_menu_item_new (); info->proxy = gtk_separator_menu_item_new ();
gtk_widget_set_no_show_all (info->proxy, TRUE);
g_object_set_data (G_OBJECT (info->proxy), g_object_set_data (G_OBJECT (info->proxy),
"gtk-separator-mode", "gtk-separator-mode",
GINT_TO_POINTER (SEPARATOR_MODE_SMART)); GINT_TO_POINTER (SEPARATOR_MODE_SMART));
......
...@@ -61,9 +61,9 @@ struct _GtkUIManager { ...@@ -61,9 +61,9 @@ struct _GtkUIManager {
struct _GtkUIManagerClass { struct _GtkUIManagerClass {
GObjectClass parent_class; GObjectClass parent_class;
void (* add_widget) (GtkUIManager *merge, void (* add_widget) (GtkUIManager *merge,
GtkWidget *widget); GtkWidget *widget);
void (* changed) (GtkUIManager *merge); void (* actions_changed) (GtkUIManager *merge);
/* Padding for future expansion */ /* Padding for future expansion */
void (*_gtk_reserved1) (void); void (*_gtk_reserved1) (void);
......
...@@ -138,7 +138,8 @@ enum { ...@@ -138,7 +138,8 @@ enum {
PROP_COMPOSITE_CHILD, PROP_COMPOSITE_CHILD,
PROP_STYLE, PROP_STYLE,
PROP_EVENTS,