Commit 2c41fc09 authored by Matthias Clasen's avatar Matthias Clasen Committed by Matthias Clasen

Add gtktoggleactionprivate.h

2003-08-31  Matthias Clasen  <maclas@gmx.de>

	* gtk/Makefile.am (IGNORE_HFILES): Add gtktoggleactionprivate.h

	* gtk/tmpl/gtkuimanager.sgml:
	* gtk/gtk-sections.txt: Replace gtk_ui_manager_activate by
	gtk_ui_manager_get_action.

	* gtk/gtkuimanager.[ch] (gtk_ui_manager_get_action): New function,
	replaces gtk_ui_manager_activate().  (#120658)

	* tests/testmerge.c: Use gtk_ui_manager_get_action() instead of
	gtk_ui_manager_activate().
parent 320bba9f
2003-08-31 Matthias Clasen <maclas@gmx.de>
* gtk/gtkuimanager.[ch] (gtk_ui_manager_get_action): New function,
replaces gtk_ui_manager_activate(). (#120658)
* tests/testmerge.c: Use gtk_ui_manager_get_action() instead of
gtk_ui_manager_activate().
* gtk/gtkaction.c:
* gtk/gtkactiongroup.c: Some doc tweaks.
......@@ -21,7 +27,7 @@
* gtk/gtkuimanager.[hc]: Add a boolean property, "add_tearoffs" with
setter and getter. If it is set, add tearoff menu items to regular
menus, but not to popups. Add a signal "changed", which gets emitted
when the merged ui has changed.
when the merged ui has changed. (#120649, #120656)
* tests/testmerge.c: Add button to test the generation of tearoff
menu items.
......
2003-08-31 Matthias Clasen <maclas@gmx.de>
* gtk/gtkuimanager.[ch] (gtk_ui_manager_get_action): New function,
replaces gtk_ui_manager_activate(). (#120658)
* tests/testmerge.c: Use gtk_ui_manager_get_action() instead of
gtk_ui_manager_activate().
* gtk/gtkaction.c:
* gtk/gtkactiongroup.c: Some doc tweaks.
......@@ -21,7 +27,7 @@
* gtk/gtkuimanager.[hc]: Add a boolean property, "add_tearoffs" with
setter and getter. If it is set, add tearoff menu items to regular
menus, but not to popups. Add a signal "changed", which gets emitted
when the merged ui has changed.
when the merged ui has changed. (#120649, #120656)
* tests/testmerge.c: Add button to test the generation of tearoff
menu items.
......
2003-08-31 Matthias Clasen <maclas@gmx.de>
* gtk/gtkuimanager.[ch] (gtk_ui_manager_get_action): New function,
replaces gtk_ui_manager_activate(). (#120658)
* tests/testmerge.c: Use gtk_ui_manager_get_action() instead of
gtk_ui_manager_activate().
* gtk/gtkaction.c:
* gtk/gtkactiongroup.c: Some doc tweaks.
......@@ -21,7 +27,7 @@
* gtk/gtkuimanager.[hc]: Add a boolean property, "add_tearoffs" with
setter and getter. If it is set, add tearoff menu items to regular
menus, but not to popups. Add a signal "changed", which gets emitted
when the merged ui has changed.
when the merged ui has changed. (#120649, #120656)
* tests/testmerge.c: Add button to test the generation of tearoff
menu items.
......
2003-08-31 Matthias Clasen <maclas@gmx.de>
* gtk/gtkuimanager.[ch] (gtk_ui_manager_get_action): New function,
replaces gtk_ui_manager_activate(). (#120658)
* tests/testmerge.c: Use gtk_ui_manager_get_action() instead of
gtk_ui_manager_activate().
* gtk/gtkaction.c:
* gtk/gtkactiongroup.c: Some doc tweaks.
......@@ -21,7 +27,7 @@
* gtk/gtkuimanager.[hc]: Add a boolean property, "add_tearoffs" with
setter and getter. If it is set, add tearoff menu items to regular
menus, but not to popups. Add a signal "changed", which gets emitted
when the merged ui has changed.
when the merged ui has changed. (#120649, #120656)
* tests/testmerge.c: Add button to test the generation of tearoff
menu items.
......
2003-08-31 Matthias Clasen <maclas@gmx.de>
* gtk/gtkuimanager.[ch] (gtk_ui_manager_get_action): New function,
replaces gtk_ui_manager_activate(). (#120658)
* tests/testmerge.c: Use gtk_ui_manager_get_action() instead of
gtk_ui_manager_activate().
* gtk/gtkaction.c:
* gtk/gtkactiongroup.c: Some doc tweaks.
......@@ -21,7 +27,7 @@
* gtk/gtkuimanager.[hc]: Add a boolean property, "add_tearoffs" with
setter and getter. If it is set, add tearoff menu items to regular
menus, but not to popups. Add a signal "changed", which gets emitted
when the merged ui has changed.
when the merged ui has changed. (#120649, #120656)
* tests/testmerge.c: Add button to test the generation of tearoff
menu items.
......
2003-08-31 Matthias Clasen <maclas@gmx.de>
* gtk/Makefile.am (IGNORE_HFILES): Add gtktoggleactionprivate.h
* gtk/tmpl/gtkuimanager.sgml:
* gtk/gtk-sections.txt: Replace gtk_ui_manager_activate by
gtk_ui_manager_get_action.
* gtk/tmpl/gtkuimanager.sgml:
* gtk/tmpl/gtkactiongroup.sgml:
* gtk/tmpl/gtkaction.sgml:
......
......@@ -47,7 +47,8 @@ IGNORE_HFILES= \
gtktextutil.h \
gtktypebuiltins.h \
gtkxembed.h \
xembed.h
xembed.h \
gtktoggleactionprivate.h
# CFLAGS and LDFLAGS for compiling scan program. Only needed
# if $(DOC_MODULE).types is non-empty.
......
......@@ -1730,11 +1730,11 @@ gtk_ui_manager_remove_action_group
gtk_ui_manager_get_action_groups
gtk_ui_manager_get_accel_group
gtk_ui_manager_get_widget
gtk_ui_manager_get_action
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_activate
<SUBSECTION Standard>
GTK_TYPE_UI_MANAGER
GTK_UI_MANAGER
......
......@@ -63,7 +63,7 @@ siblings in the partially constructed tree. If it is "top", the widget is prepen
otherwise it is appended.
</para>
</refsect2>
<!-- ##### SECTION See_Also ##### -->
<para>
......@@ -148,6 +148,16 @@ otherwise it is appended.
@Returns:
<!-- ##### FUNCTION gtk_ui_manager_get_action ##### -->
<para>
</para>
@self:
@path:
@Returns:
<!-- ##### FUNCTION gtk_ui_manager_add_ui_from_string ##### -->
<para>
......@@ -189,15 +199,6 @@ otherwise it is appended.
@Returns:
<!-- ##### FUNCTION gtk_ui_manager_activate ##### -->
<para>
</para>
@self:
@path:
<!-- ##### SIGNAL GtkUIManager::add-widget ##### -->
<para>
......
......@@ -388,7 +388,7 @@ gtk_ui_manager_set_add_tearoffs (GtkUIManager *self,
* gtk_ui_manager_insert_action_group:
* @self: a #GtkUIManager object
* @action_group: the action group to be inserted
* @pos: the position at which the group will be inserted
* @pos: the position at which the group will be inserted.
*
* Inserts an action group into the list of action groups associated
* with @self.
......@@ -513,6 +513,42 @@ gtk_ui_manager_get_widget (GtkUIManager *self,
return NODE_INFO (node)->proxy;
}
/**
* gtk_ui_manager_get_action:
* @self: a #GtkUIManager
* @path: a path
*
* Looks up an action by following a path. The path consists of the names
* specified in the XML description of the UI. separated by '/'. Elements
* which don't have a name attribute in the XML (e.g. &lt;popup&gt;) can be
* addressed by their XML element name (e.g. "popup"). The root element
* (&lt;ui&gt;) can be omitted in the path.
*
* Return value: the action whose proxy widget is found by following the path,
* or %NULL if no widget was found.
*
* Since: 2.4
**/
GtkAction *
gtk_ui_manager_get_action (GtkUIManager *self,
const gchar *path)
{
GNode *node;
g_return_val_if_fail (GTK_IS_UI_MANAGER (self), NULL);
/* ensure that there are no pending updates before we get
* the action */
gtk_ui_manager_ensure_update (self);
node = gtk_ui_manager_get_node (self, path, GTK_UI_MANAGER_UNDECIDED, FALSE);
if (node == NULL)
return NULL;
return NODE_INFO (node)->action;
}
static GNode *
get_child_node (GtkUIManager *self,
GNode *parent,
......@@ -1845,31 +1881,3 @@ gtk_ui_manager_get_ui (GtkUIManager *self)
return g_string_free (buffer, FALSE);
}
/**
* gtk_ui_manager_activate:
* @self: a #GtkUIManager
* @path: a path
*
* Activates the action whose proxy is found by following the given path.
*
* Since: 2.4
**/
void
gtk_ui_manager_activate (GtkUIManager *self,
const gchar *path)
{
GNode *node;
g_return_if_fail (GTK_IS_UI_MANAGER (self));
/* ensure that there are no pending updates before we activate
* the action */
gtk_ui_manager_ensure_update (self);
node = gtk_ui_manager_get_node (self, path, GTK_UI_MANAGER_UNDECIDED, FALSE);
if (node == NULL || NODE_INFO (node)->action == NULL)
return;
gtk_action_activate (NODE_INFO (node)->action);
}
......@@ -90,9 +90,10 @@ GList *gtk_ui_manager_get_action_groups (GtkUIManager *self);
GtkAccelGroup *gtk_ui_manager_get_accel_group (GtkUIManager *self);
GtkWidget *gtk_ui_manager_get_widget (GtkUIManager *self,
const gchar *path);
GtkAction *gtk_ui_manager_get_action (GtkUIManager *self,
const gchar *path);
/* these two functions are for adding UI elements to the merged user
* interface */
......@@ -108,7 +109,4 @@ void gtk_ui_manager_remove_ui (GtkUIManager *self,
gchar *gtk_ui_manager_get_ui (GtkUIManager *self);
void gtk_ui_manager_activate (GtkUIManager *self,
const gchar *path);
#endif /* __GTK_UI_MANAGER_H__ */
......@@ -371,7 +371,12 @@ static void
activate_path (GtkWidget *button,
GtkUIManager *merge)
{
gtk_ui_manager_activate (merge, "/menubar/HelpMenu/About");
GtkAction *action = gtk_ui_manager_get_action (merge,
"/menubar/HelpMenu/About");
if (action)
gtk_action_activate (action);
else
g_message ("no action found");
}
int
......
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