]> Pileus Git - ~andy/gtk/commitdiff
Add gtktoggleactionprivate.h
authorMatthias Clasen <maclas@gmx.de>
Sun, 31 Aug 2003 13:49:15 +0000 (13:49 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Sun, 31 Aug 2003 13:49:15 +0000 (13:49 +0000)
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().

12 files changed:
ChangeLog
ChangeLog.pre-2-10
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
docs/reference/ChangeLog
docs/reference/gtk/Makefile.am
docs/reference/gtk/gtk-sections.txt
docs/reference/gtk/tmpl/gtkuimanager.sgml
gtk/gtkuimanager.c
gtk/gtkuimanager.h
tests/testmerge.c

index e62ecf6c9c8df055a86b3e5c434533e56baf36dc..016378a58d6cb8c68ebd4451e18178c7b7d73668 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 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.
index e62ecf6c9c8df055a86b3e5c434533e56baf36dc..016378a58d6cb8c68ebd4451e18178c7b7d73668 100644 (file)
@@ -1,5 +1,11 @@
 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.
index e62ecf6c9c8df055a86b3e5c434533e56baf36dc..016378a58d6cb8c68ebd4451e18178c7b7d73668 100644 (file)
@@ -1,5 +1,11 @@
 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.
index e62ecf6c9c8df055a86b3e5c434533e56baf36dc..016378a58d6cb8c68ebd4451e18178c7b7d73668 100644 (file)
@@ -1,5 +1,11 @@
 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.
index e62ecf6c9c8df055a86b3e5c434533e56baf36dc..016378a58d6cb8c68ebd4451e18178c7b7d73668 100644 (file)
@@ -1,5 +1,11 @@
 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.
index c0233b5df03d57a4bd8ade3c1698c726040b22b0..68420bc22fb8f5d6554ef05625f981c83f1ae1a2 100644 (file)
@@ -1,5 +1,11 @@
 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: 
index 52d9bceabebad09c77ebaaf989530b9a4ee049b1..511803a7676b545be30a82581da23f3bcf1faa68 100644 (file)
@@ -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.
index 5bfac533f9214d390db69d637cbef079102bc719..87ca2c08d11641af035a8996dcb6101339c993ff 100644 (file)
@@ -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
index d49356556fdcd80889479b9d28f1be049a9c04f8..3bf4e5f9cea358419bde6eef58d7d7159a586cd2 100644 (file)
@@ -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>
 
index 945ceeb071b113cfb7cb55749b2654f2ac627215..d27bbf8cddb51ef23b15f3b52ff8198671e10c93 100644 (file)
@@ -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);
-}
index 410647caf3bff4f1be8a82577a1eb8ca4c45301e..4ee64703703c0658a15ac899bb1a9f1eb85102ee 100644 (file)
@@ -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__ */
index 193861329eab7508eb773a1d16487c00e732c89d..f8c01e0302e24d881473aeb2affae129ecfc8c79 100644 (file)
@@ -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