Commit 3bd8c449 authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer
Browse files

added virtual functions GtkUIManager::get_widget() and ::get_action().

2004-12-01  Michael Natterer  <mitch@gimp.org>

	* gtk/gtkuimanager.[ch]: added virtual functions
	GtkUIManager::get_widget() and ::get_action(). Moved the code from
	gtk_ui_manager_get_widget() and get_action() to the default
	implementations. Fixes bug #160096.

	(gtk_ui_manager_get_toplevels): added missing precondition check
	for GTK_IS_UI_MANAGER(self).
parent 692bb512
2004-12-01 Michael Natterer <mitch@gimp.org>
* gtk/gtkuimanager.[ch]: added virtual functions
GtkUIManager::get_widget() and ::get_action(). Moved the code from
gtk_ui_manager_get_widget() and get_action() to the default
implementations. Fixes bug #160096.
(gtk_ui_manager_get_toplevels): added missing precondition check
for GTK_IS_UI_MANAGER(self).
2004-12-01 Dom Lachowicz <cinamod@hotmail.com> 2004-12-01 Dom Lachowicz <cinamod@hotmail.com>
* modules/engines/ms-windows/Theme/gtk-2.0/gtkrc: use MS Windows button order, not Gnome HIG order * modules/engines/ms-windows/Theme/gtk-2.0/gtkrc: use MS Windows button order, not Gnome HIG order
......
2004-12-01 Michael Natterer <mitch@gimp.org>
* gtk/gtkuimanager.[ch]: added virtual functions
GtkUIManager::get_widget() and ::get_action(). Moved the code from
gtk_ui_manager_get_widget() and get_action() to the default
implementations. Fixes bug #160096.
(gtk_ui_manager_get_toplevels): added missing precondition check
for GTK_IS_UI_MANAGER(self).
2004-12-01 Dom Lachowicz <cinamod@hotmail.com> 2004-12-01 Dom Lachowicz <cinamod@hotmail.com>
* modules/engines/ms-windows/Theme/gtk-2.0/gtkrc: use MS Windows button order, not Gnome HIG order * modules/engines/ms-windows/Theme/gtk-2.0/gtkrc: use MS Windows button order, not Gnome HIG order
......
2004-12-01 Michael Natterer <mitch@gimp.org>
* gtk/gtkuimanager.[ch]: added virtual functions
GtkUIManager::get_widget() and ::get_action(). Moved the code from
gtk_ui_manager_get_widget() and get_action() to the default
implementations. Fixes bug #160096.
(gtk_ui_manager_get_toplevels): added missing precondition check
for GTK_IS_UI_MANAGER(self).
2004-12-01 Dom Lachowicz <cinamod@hotmail.com> 2004-12-01 Dom Lachowicz <cinamod@hotmail.com>
* modules/engines/ms-windows/Theme/gtk-2.0/gtkrc: use MS Windows button order, not Gnome HIG order * modules/engines/ms-windows/Theme/gtk-2.0/gtkrc: use MS Windows button order, not Gnome HIG order
......
2004-12-01 Michael Natterer <mitch@gimp.org>
* gtk/gtkuimanager.[ch]: added virtual functions
GtkUIManager::get_widget() and ::get_action(). Moved the code from
gtk_ui_manager_get_widget() and get_action() to the default
implementations. Fixes bug #160096.
(gtk_ui_manager_get_toplevels): added missing precondition check
for GTK_IS_UI_MANAGER(self).
2004-12-01 Dom Lachowicz <cinamod@hotmail.com> 2004-12-01 Dom Lachowicz <cinamod@hotmail.com>
* modules/engines/ms-windows/Theme/gtk-2.0/gtkrc: use MS Windows button order, not Gnome HIG order * modules/engines/ms-windows/Theme/gtk-2.0/gtkrc: use MS Windows button order, not Gnome HIG order
......
...@@ -104,37 +104,41 @@ struct _NodeUIReference ...@@ -104,37 +104,41 @@ struct _NodeUIReference
GQuark action_quark; GQuark action_quark;
}; };
static void gtk_ui_manager_class_init (GtkUIManagerClass *class); static void gtk_ui_manager_class_init (GtkUIManagerClass *class);
static void gtk_ui_manager_init (GtkUIManager *self); static void gtk_ui_manager_init (GtkUIManager *self);
static void gtk_ui_manager_finalize (GObject *object); static void gtk_ui_manager_finalize (GObject *object);
static void gtk_ui_manager_set_property (GObject *object, static void gtk_ui_manager_set_property (GObject *object,
guint prop_id, guint prop_id,
const GValue *value, const GValue *value,
GParamSpec *pspec); GParamSpec *pspec);
static void gtk_ui_manager_get_property (GObject *object, static void gtk_ui_manager_get_property (GObject *object,
guint prop_id, guint prop_id,
GValue *value, GValue *value,
GParamSpec *pspec); GParamSpec *pspec);
static void queue_update (GtkUIManager *self); static GtkWidget * gtk_ui_manager_real_get_widget (GtkUIManager *manager,
static void dirty_all_nodes (GtkUIManager *self); const gchar *path);
static void mark_node_dirty (GNode *node); static GtkAction * gtk_ui_manager_real_get_action (GtkUIManager *manager,
static GNode * get_child_node (GtkUIManager *self, const gchar *path);
GNode *parent, static void queue_update (GtkUIManager *self);
const gchar *childname, static void dirty_all_nodes (GtkUIManager *self);
gint childname_length, static void mark_node_dirty (GNode *node);
NodeType node_type, static GNode * get_child_node (GtkUIManager *self,
gboolean create, GNode *parent,
gboolean top); const gchar *childname,
static GNode * get_node (GtkUIManager *self, gint childname_length,
const gchar *path, NodeType node_type,
NodeType node_type, gboolean create,
gboolean create); gboolean top);
static gboolean free_node (GNode *node); static GNode * get_node (GtkUIManager *self,
static void node_prepend_ui_reference (GNode *node, const gchar *path,
guint merge_id, NodeType node_type,
GQuark action_quark); gboolean create);
static void node_remove_ui_reference (GNode *node, static gboolean free_node (GNode *node);
guint merge_id); static void node_prepend_ui_reference (GNode *node,
guint merge_id,
GQuark action_quark);
static void node_remove_ui_reference (GNode *node,
guint merge_id);
enum enum
...@@ -204,7 +208,9 @@ gtk_ui_manager_class_init (GtkUIManagerClass *klass) ...@@ -204,7 +208,9 @@ gtk_ui_manager_class_init (GtkUIManagerClass *klass)
gobject_class->finalize = gtk_ui_manager_finalize; gobject_class->finalize = gtk_ui_manager_finalize;
gobject_class->set_property = gtk_ui_manager_set_property; gobject_class->set_property = gtk_ui_manager_set_property;
gobject_class->get_property = gtk_ui_manager_get_property; gobject_class->get_property = gtk_ui_manager_get_property;
klass->get_widget = gtk_ui_manager_real_get_widget;
klass->get_action = gtk_ui_manager_real_get_action;
/** /**
* GtkUIManager:add-tearoffs: * GtkUIManager:add-tearoffs:
* *
...@@ -468,6 +474,42 @@ gtk_ui_manager_get_property (GObject *object, ...@@ -468,6 +474,42 @@ gtk_ui_manager_get_property (GObject *object,
} }
} }
static GtkWidget *
gtk_ui_manager_real_get_widget (GtkUIManager *self,
const gchar *path)
{
GNode *node;
/* ensure that there are no pending updates before we get the
* widget */
gtk_ui_manager_ensure_update (self);
node = get_node (self, path, NODE_TYPE_UNDECIDED, FALSE);
if (node == NULL)
return NULL;
return NODE_INFO (node)->proxy;
}
static GtkAction *
gtk_ui_manager_real_get_action (GtkUIManager *self,
const gchar *path)
{
GNode *node;
/* ensure that there are no pending updates before we get
* the action */
gtk_ui_manager_ensure_update (self);
node = get_node (self, path, NODE_TYPE_UNDECIDED, FALSE);
if (node == NULL)
return NULL;
return NODE_INFO (node)->action;
}
/** /**
* gtk_ui_manager_new: * gtk_ui_manager_new:
...@@ -701,24 +743,13 @@ gtk_ui_manager_get_accel_group (GtkUIManager *self) ...@@ -701,24 +743,13 @@ gtk_ui_manager_get_accel_group (GtkUIManager *self)
* Since: 2.4 * Since: 2.4
**/ **/
GtkWidget * GtkWidget *
gtk_ui_manager_get_widget (GtkUIManager *self, gtk_ui_manager_get_widget (GtkUIManager *self,
const gchar *path) const gchar *path)
{ {
GNode *node;
g_return_val_if_fail (GTK_IS_UI_MANAGER (self), NULL); g_return_val_if_fail (GTK_IS_UI_MANAGER (self), NULL);
g_return_val_if_fail (path != NULL, NULL); g_return_val_if_fail (path != NULL, NULL);
/* ensure that there are no pending updates before we get the return GTK_UI_MANAGER_GET_CLASS (self)->get_widget (self, path);
* widget */
gtk_ui_manager_ensure_update (self);
node = get_node (self, path, NODE_TYPE_UNDECIDED, FALSE);
if (node == NULL)
return NULL;
return NODE_INFO (node)->proxy;
} }
static void static void
...@@ -770,6 +801,7 @@ gtk_ui_manager_get_toplevels (GtkUIManager *self, ...@@ -770,6 +801,7 @@ gtk_ui_manager_get_toplevels (GtkUIManager *self,
GSList *list; GSList *list;
} data; } data;
g_return_val_if_fail (GTK_IS_UI_MANAGER (self), NULL);
g_return_val_if_fail ((~(GTK_UI_MANAGER_MENUBAR | g_return_val_if_fail ((~(GTK_UI_MANAGER_MENUBAR |
GTK_UI_MANAGER_TOOLBAR | GTK_UI_MANAGER_TOOLBAR |
GTK_UI_MANAGER_POPUP) & types) == 0, NULL); GTK_UI_MANAGER_POPUP) & types) == 0, NULL);
...@@ -799,25 +831,14 @@ gtk_ui_manager_get_toplevels (GtkUIManager *self, ...@@ -799,25 +831,14 @@ gtk_ui_manager_get_toplevels (GtkUIManager *self,
* *
* Since: 2.4 * Since: 2.4
**/ **/
GtkAction * GtkAction *
gtk_ui_manager_get_action (GtkUIManager *self, gtk_ui_manager_get_action (GtkUIManager *self,
const gchar *path) const gchar *path)
{ {
GNode *node;
g_return_val_if_fail (GTK_IS_UI_MANAGER (self), NULL); g_return_val_if_fail (GTK_IS_UI_MANAGER (self), NULL);
g_return_val_if_fail (path != NULL, NULL); g_return_val_if_fail (path != NULL, NULL);
/* ensure that there are no pending updates before we get
* the action */
gtk_ui_manager_ensure_update (self);
node = get_node (self, path, NODE_TYPE_UNDECIDED, FALSE);
if (node == NULL) return GTK_UI_MANAGER_GET_CLASS (self)->get_action (self, path);
return NULL;
return NODE_INFO (node)->action;
} }
static GNode * static GNode *
......
...@@ -78,11 +78,15 @@ struct _GtkUIManagerClass { ...@@ -78,11 +78,15 @@ struct _GtkUIManagerClass {
void (* post_activate) (GtkUIManager *merge, void (* post_activate) (GtkUIManager *merge,
GtkAction *action); GtkAction *action);
/* Virtual functions */
GtkWidget * (* get_widget) (GtkUIManager *manager,
const gchar *path);
GtkAction * (* get_action) (GtkUIManager *manager,
const gchar *path);
/* Padding for future expansion */ /* Padding for future expansion */
void (*_gtk_reserved1) (void); void (*_gtk_reserved1) (void);
void (*_gtk_reserved2) (void); void (*_gtk_reserved2) (void);
void (*_gtk_reserved3) (void);
void (*_gtk_reserved4) (void);
}; };
typedef enum { typedef enum {
......
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