[gtk+/popover-menu: 16/17] Simplify GtkPopoverMenu



commit 45524e30b08b0fc864129a58764ae808d8103104
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun Oct 26 11:28:32 2014 -0400

    Simplify GtkPopoverMenu
    
    Change things so each submenu is a single child, and users are
    required to create the box themselves. Add API to open a submenu.
    Adapt the example.

 gtk/gtkpopovermenu.c |  209 +++++-------
 gtk/gtkpopovermenu.h |    4 +
 tests/popover2.ui    |  886 ++++++++++++++++++++++++--------------------------
 3 files changed, 513 insertions(+), 586 deletions(-)
---
diff --git a/gtk/gtkpopovermenu.c b/gtk/gtkpopovermenu.c
index 9fe558d..10efde5 100644
--- a/gtk/gtkpopovermenu.c
+++ b/gtk/gtkpopovermenu.c
@@ -27,17 +27,17 @@
  * SECTION:gtkpopovermenu
  * @Short_description: Popovers to use as menus
  *
- * GtkPopoverMenu is a subclass of #GtkPopover that can group
- * its childen in submenus and switch between them. It is meant
- * to be used primarily together with #GtkModelButton, but any
- * widget can be used, such as #GtkSpinButton or #GtkScale.
+ * GtkPopoverMenu is a subclass of #GtkPopover that treats its
+ * childen like menus and allows switching between them. It is
+ * meant to be used primarily together with #GtkModelButton, but
+ * any widget can be used, such as #GtkSpinButton or #GtkScale.
  *
- * To place a child into a submenu, set the #GtkPopoverMenu:submenu
+ * To add a child as a submenu, set the #GtkPopoverMenu:submenu
  * child property to the name of the submenu. To let the user open
  * this submenu, add a #GtkModelButton whose #GtkModelButton:menu-name
  * property is set to the name you've given to the submenu.
  *
- * By convention, the first item of a submenu should be a #GtkModelButton
+ * By convention, the first child of a submenu should be a #GtkModelButton
  * to switch back to the parent menu. Such a button should use the
  * #GtkModelButton:inverted and #GtkModelButton:centered properties
  * to achieve a title-like appearance and place the submenu indicator
@@ -58,99 +58,6 @@ enum {
 
 G_DEFINE_TYPE (GtkPopoverMenu, gtk_popover_menu, GTK_TYPE_POPOVER)
 
-static GtkWidget *
-gtk_popover_menu_ensure_submenu (GtkPopoverMenu *popover,
-                                 const gchar    *name)
-{
-  GtkWidget *stack;
-  GtkWidget *submenu;
-
-  stack = gtk_bin_get_child (GTK_BIN (popover));
-  submenu = gtk_stack_get_child_by_name (GTK_STACK (stack), name);
-  if (submenu == NULL)
-    {
-      submenu = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
-      gtk_widget_set_halign (submenu, GTK_ALIGN_FILL);
-      g_object_set (submenu, "margin", 10, NULL);
-      gtk_widget_show (submenu);
-      gtk_size_group_add_widget (popover->size_group, submenu);
-      gtk_stack_add_named (GTK_STACK (stack), submenu, name);
-    }
-
-  return submenu;
-}
-
-static void
-gtk_popover_menu_child_set_submenu (GtkPopoverMenu *popover,
-                                    GtkWidget      *child,
-                                    const gchar    *name)
-{
-  const gchar *old_name;
-  GtkWidget *submenu;
-
-  old_name = g_object_get_data (G_OBJECT (child), "GtkPopoverMenu:submenu");
-
-  if (g_strcmp0 (old_name, name) == 0)
-    return; 
-  
-  submenu = gtk_popover_menu_ensure_submenu (popover, name);
-
-  g_object_ref (child);
-  gtk_container_remove (GTK_CONTAINER (gtk_widget_get_parent (child)), child);
-  gtk_container_add (GTK_CONTAINER (submenu), child);
-  g_object_unref (child);
-
-  g_object_set_data_full (G_OBJECT (child), "GtkPopoverMenu:submenu", g_strdup (name), g_free);
-
-  gtk_container_child_notify (GTK_CONTAINER (popover), child, "submenu");
-}
-
-static const gchar *
-gtk_popover_menu_child_get_submenu (GtkPopoverMenu *popover,
-                                    GtkWidget      *child)
-{
-  return (const gchar *)g_object_get_data (G_OBJECT (child), "GtkPopoverMenu:submenu");
-}
-
-static void
-gtk_popover_menu_add_item (GtkPopoverMenu *popover,
-                           GtkWidget      *item)
-{
-  const gchar *name;
-  GtkWidget *submenu;
-
-  name = gtk_popover_menu_child_get_submenu (popover, item);
-  if (name == NULL)
-    name = "main";
-
-  submenu = gtk_popover_menu_ensure_submenu (popover, name);
-  gtk_container_add (GTK_CONTAINER (submenu), item);
-}
-
-static void
-gtk_popover_menu_remove_item (GtkPopoverMenu *popover,
-                              GtkWidget      *item)
-{
-  const gchar *name;
-  GtkWidget *submenu;
-  GList *children;
-
-  name = gtk_popover_menu_child_get_submenu (popover, item);
-  if (name == NULL)
-    name = "main";
-
-  submenu = gtk_popover_menu_ensure_submenu (popover, name);
-
-  g_assert (submenu == gtk_widget_get_parent (item));
-  gtk_container_remove (GTK_CONTAINER (submenu), item);
-
-  children = gtk_container_get_children (GTK_CONTAINER (submenu));
-  if (children == NULL)
-    gtk_container_remove (GTK_CONTAINER (gtk_bin_get_child (GTK_BIN (popover))), submenu);
-  else
-    g_list_free (children);
-}
-
 static void
 gtk_popover_menu_init (GtkPopoverMenu *popover)
 {
@@ -162,7 +69,6 @@ gtk_popover_menu_init (GtkPopoverMenu *popover)
   gtk_widget_show (stack);
   gtk_container_add (GTK_CONTAINER (popover), stack);
   popover->size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
-  gtk_popover_menu_ensure_submenu (popover, "main");
 }
 
 static void
@@ -176,25 +82,18 @@ gtk_popover_menu_finalize (GObject *object)
 }
 
 static void
-back_to_main (GtkWidget *popover)
-{
-  GtkWidget *stack;
-
-  stack = gtk_bin_get_child (GTK_BIN (popover));
-  gtk_stack_set_visible_child_name (GTK_STACK (stack), "main");
-}
-
-static void
 gtk_popover_menu_map (GtkWidget *widget)
 {
   GTK_WIDGET_CLASS (gtk_popover_menu_parent_class)->map (widget);
-  back_to_main (widget);
+
+  gtk_popover_menu_open_submenu (GTK_POPOVER_MENU (widget), "main");
 }
 
 static void
 gtk_popover_menu_unmap (GtkWidget *widget)
 {
-  back_to_main (widget);
+  gtk_popover_menu_open_submenu (GTK_POPOVER_MENU (widget), "main");
+
   GTK_WIDGET_CLASS (gtk_popover_menu_parent_class)->unmap (widget);
 }
 
@@ -202,24 +101,41 @@ static void
 gtk_popover_menu_add (GtkContainer *container,
                       GtkWidget    *child)
 {
+  GtkWidget *stack;
 
-  if (!gtk_bin_get_child (GTK_BIN (container)))
+  stack = gtk_bin_get_child (GTK_BIN (container));
+
+  if (stack == NULL)
     {
       gtk_widget_set_parent (child, GTK_WIDGET (container));
       _gtk_bin_set_child (GTK_BIN (container), child);
     }
   else
-    gtk_popover_menu_add_item (GTK_POPOVER_MENU (container), child);
+    {
+      gchar *name;
+
+      if (gtk_stack_get_child_by_name (GTK_STACK (stack), "main"))
+        name = "submenu";
+      else
+        name = "main";
+
+      gtk_stack_add_named (GTK_STACK (stack), child, name);
+      gtk_size_group_add_widget (GTK_POPOVER_MENU (container)->size_group, child);
+    }
 }
 
 static void
 gtk_popover_menu_remove (GtkContainer *container,
                          GtkWidget    *child)
 {
-  if (child == gtk_bin_get_child (GTK_BIN (container)))
+  GtkWidget *stack;
+
+  stack = gtk_bin_get_child (GTK_BIN (container));
+
+  if (child == stack)
     GTK_CONTAINER_CLASS (gtk_popover_menu_parent_class)->remove (container, child);
   else
-    gtk_popover_menu_remove_item (GTK_POPOVER_MENU (container), child);
+    gtk_container_remove (GTK_CONTAINER (stack), child);
 }
 
 static void
@@ -229,13 +145,21 @@ gtk_popover_menu_get_child_property (GtkContainer *container,
                                      GValue       *value,
                                      GParamSpec   *pspec)
 {
-  if (child == gtk_bin_get_child (GTK_BIN (container)))
+  GtkWidget *stack;
+
+  stack = gtk_bin_get_child (GTK_BIN (container));
+
+  if (child == stack)
     return;
 
   switch (property_id)
     {
     case CHILD_PROP_SUBMENU:
-      g_value_set_string (value, gtk_popover_menu_child_get_submenu (GTK_POPOVER_MENU (container), child));
+      {
+        gchar *name;
+        gtk_container_child_get (GTK_CONTAINER (stack), child, "name", &name, NULL);
+        g_value_set_string (value, name);
+      }
       break;
 
     default:
@@ -251,13 +175,21 @@ gtk_popover_menu_set_child_property (GtkContainer *container,
                                      const GValue *value,
                                      GParamSpec   *pspec)
 {
-  if (child == gtk_bin_get_child (GTK_BIN (container)))
+  GtkWidget *stack;
+
+  stack = gtk_bin_get_child (GTK_BIN (container));
+
+  if (child == stack)
     return;
 
   switch (property_id)
     {
     case CHILD_PROP_SUBMENU:
-      gtk_popover_menu_child_set_submenu (GTK_POPOVER_MENU (container), child, g_value_get_string (value));
+      {
+        const gchar *name;
+        name = g_value_get_string (value);
+        gtk_container_child_set (GTK_CONTAINER (stack), child, "name", name, NULL);
+      }
       break;
 
     default:
@@ -286,9 +218,9 @@ gtk_popover_menu_class_init (GtkPopoverMenuClass *klass)
   /**
    * GtkPopoverMenu:submenu:
    *
-   * The submenu child property specifies the name of the submenu to
-   * place the child in. If it is %NULL or "main", the child is placed
-   * in the main menu.
+   * The submenu child property specifies the name of the submenu
+   * If it is %NULL or "main", the child is used as the main menu,
+   * which is shown initially when the popover is mapped.
    *
    * Since: 3.16
    */
@@ -296,9 +228,9 @@ gtk_popover_menu_class_init (GtkPopoverMenuClass *klass)
                                               CHILD_PROP_SUBMENU,
                                               g_param_spec_string ("submenu",
                                                                    P_("Submenu"),
-                                                                   P_("The name of the submenu to place this 
child in"),
+                                                                   P_("The name of the submenu"),
                                                                    NULL,
-                                                                   G_PARAM_READWRITE));
+                                                                   G_PARAM_READWRITE | 
G_PARAM_STATIC_STRINGS));
 }
 
 /**
@@ -315,3 +247,32 @@ gtk_popover_menu_new (void)
 {
   return g_object_new (GTK_TYPE_POPOVER_MENU, NULL);
 }
+
+/**
+ * gtk_popover_menu_open_submenu:
+ * @popover: a #GtkPopoverMenu
+ * @name: the name of the menu to switch to
+ *
+ * Opens a submenu of the @popover. The @name
+ * must be one of the names given to the submenus
+ * of @popover with #GtkPopoverMenu:submenu, or
+ * "main" to switch back to the main menu.
+ *
+ * #GtkModelButton will open submenus automatically
+ * when the #GtkModelButton:menu-name property is set,
+ * so this function is only needed when you are using
+ * other kinds of widgets to initiate menu changes.
+ *
+ * Since: 3.16
+ */
+void
+gtk_popover_menu_open_submenu (GtkPopoverMenu *popover,
+                               const gchar    *name)
+{
+  GtkWidget *stack;
+
+  g_return_if_fail (GTK_IS_POPOVER_MENU (popover));
+
+  stack = gtk_bin_get_child (GTK_BIN (popover));
+  gtk_stack_set_visible_child_name (GTK_STACK (stack), name);
+}
diff --git a/gtk/gtkpopovermenu.h b/gtk/gtkpopovermenu.h
index 1cfaf70..9d60af3 100644
--- a/gtk/gtkpopovermenu.h
+++ b/gtk/gtkpopovermenu.h
@@ -52,6 +52,10 @@ GType       gtk_popover_menu_get_type (void) G_GNUC_CONST;
 GDK_AVAILABLE_IN_3_16
 GtkWidget * gtk_popover_menu_new      (void);
 
+GDK_AVAILABLE_IN_3_16
+void        gtk_popover_menu_open_submenu (GtkPopoverMenu *popover,
+                                           const gchar    *name);
+
 G_END_DECLS
 
 #endif /* __GTK_POPOVER_MENU_H__ */
diff --git a/tests/popover2.ui b/tests/popover2.ui
index e0646e4..25bef9c 100644
--- a/tests/popover2.ui
+++ b/tests/popover2.ui
@@ -5,332 +5,445 @@
       <object class="GtkBox">
         <property name="visible">True</property>
         <property name="orientation">vertical</property>
-        <property name="margin-start">12</property>
-        <property name="margin-end">12</property>
-        <property name="margin-top">6</property>
-        <property name="margin-bottom">3</property>
+        <property name="margin">10</property>
         <child>
-          <object class="GtkLabel">
+          <object class="GtkBox">
             <property name="visible">True</property>
-            <property name="halign">start</property>
-            <property name="label">Edit</property>
-            <style>
-              <class name="separator"/>
-            </style>
+            <property name="orientation">vertical</property>
+            <property name="margin-start">12</property>
+            <property name="margin-end">12</property>
+            <property name="margin-top">6</property>
+            <property name="margin-bottom">3</property>
+            <child>
+              <object class="GtkLabel">
+                <property name="visible">True</property>
+                <property name="halign">start</property>
+                <property name="label">Edit</property>
+                <style>
+                  <class name="separator"/>
+                </style>
+              </object>
+            </child>
+            <child>
+              <object class="GtkSeparator">
+                <property name="visible">True</property>
+                <property name="orientation">horizontal</property>
+              </object>
+            </child>
           </object>
         </child>
         <child>
-          <object class="GtkSeparator">
+          <object class="GtkModelButton">
             <property name="visible">True</property>
-            <property name="orientation">horizontal</property>
+            <property name="action-name">top.cut</property>
+            <property name="text">Cut</property>
           </object>
         </child>
-      </object>
-    </child>
-    <child>
-      <object class="GtkModelButton">
-        <property name="visible">True</property>
-        <property name="action-name">top.cut</property>
-        <property name="text">Cut</property>
-      </object>
-    </child>
-    <child>
-      <object class="GtkModelButton">
-        <property name="visible">True</property>
-        <property name="action-name">top.copy</property>
-        <property name="text">Copy</property>
-      </object>
-    </child>
-    <child>
-      <object class="GtkModelButton">
-        <property name="visible">True</property>
-        <property name="action-name">top.paste</property>
-        <property name="text">Paste</property>
-      </object>
-    </child>
-    <child>
-      <object class="GtkSeparator">
-        <property name="visible">True</property>
-        <property name="orientation">horizontal</property>
-        <property name="margin-start">12</property>
-        <property name="margin-end">12</property>
-        <property name="margin-top">3</property>
-        <property name="margin-bottom">3</property>
-      </object>
-    </child>
-    <child>
-      <object class="GtkModelButton">
-        <property name="visible">True</property>
-        <property name="action-name">action1</property>
-        <property name="text">No action</property>
-      </object>
-    </child>
-    <child>
-      <object class="GtkModelButton">
-        <property name="visible">True</property>
-        <property name="action-name">top.action2</property>
-        <property name="text">Toggle</property>
-      </object>
-    </child>
-    <child>
-      <object class="GtkModelButton">
-        <property name="visible">True</property>
-        <property name="action-name">top.action2a</property>
-        <property name="text">Another Toggle</property>
-      </object>
-    </child>
-    <child>
-      <object class="GtkBox">
-        <property name="visible">True</property>
-        <property name="orientation">vertical</property>
-        <property name="margin-start">12</property>
-        <property name="margin-end">12</property>
-        <property name="margin-top">6</property>
-        <property name="margin-bottom">3</property>
         <child>
-          <object class="GtkLabel">
+          <object class="GtkModelButton">
             <property name="visible">True</property>
-            <property name="halign">start</property>
-            <property name="label">Middle Section</property>
-            <style>
-              <class name="separator"/>
-            </style>
+            <property name="action-name">top.copy</property>
+            <property name="text">Copy</property>
+          </object>
+        </child>
+        <child>
+          <object class="GtkModelButton">
+            <property name="visible">True</property>
+            <property name="action-name">top.paste</property>
+            <property name="text">Paste</property>
           </object>
         </child>
         <child>
           <object class="GtkSeparator">
             <property name="visible">True</property>
             <property name="orientation">horizontal</property>
+            <property name="margin-start">12</property>
+            <property name="margin-end">12</property>
+            <property name="margin-top">3</property>
+            <property name="margin-bottom">3</property>
+          </object>
+        </child>
+        <child>
+          <object class="GtkModelButton">
+            <property name="visible">True</property>
+            <property name="action-name">action1</property>
+            <property name="text">No action</property>
+          </object>
+        </child>
+        <child>
+          <object class="GtkModelButton">
+            <property name="visible">True</property>
+            <property name="action-name">top.action2</property>
+            <property name="text">Toggle</property>
+          </object>
+        </child>
+        <child>
+          <object class="GtkModelButton">
+            <property name="visible">True</property>
+            <property name="action-name">top.action2a</property>
+            <property name="text">Another Toggle</property>
+          </object>
+        </child>
+        <child>
+          <object class="GtkBox">
+            <property name="visible">True</property>
+            <property name="orientation">vertical</property>
+            <property name="margin-start">12</property>
+            <property name="margin-end">12</property>
+            <property name="margin-top">6</property>
+            <property name="margin-bottom">3</property>
+            <child>
+              <object class="GtkLabel">
+                <property name="visible">True</property>
+                <property name="halign">start</property>
+                <property name="label">Middle Section</property>
+                <style>
+                  <class name="separator"/>
+                </style>
+              </object>
+            </child>
+            <child>
+              <object class="GtkSeparator">
+                <property name="visible">True</property>
+                <property name="orientation">horizontal</property>
+              </object>
+            </child>
+          </object>
+        </child>
+        <child>
+          <object class="GtkModelButton">
+            <property name="visible">True</property>
+            <property name="action-name">top.action3</property>
+            <property name="action-target">'three'</property>
+            <property name="text">Radio 1</property>
+          </object>
+        </child>
+        <child>
+          <object class="GtkModelButton">
+            <property name="visible">True</property>
+            <property name="action-name">top.action3</property>
+            <property name="action-target">'four'</property>
+            <property name="text">Radio 2</property>
+          </object>
+        </child>
+        <child>
+          <object class="GtkModelButton">
+            <property name="visible">True</property>
+            <property name="text">Submenu 1</property>
+            <property name="menu-name">submenu1</property>
+          </object>
+        </child>
+        <child>
+          <object class="GtkModelButton">
+            <property name="visible">True</property>
+            <property name="text">Submenu 2</property>
+            <property name="menu-name">submenu2</property>
+          </object>
+        </child>
+        <child>
+          <object class="GtkBox">
+            <property name="visible">True</property>
+            <property name="orientation">vertical</property>
+            <property name="margin-start">12</property>
+            <property name="margin-end">12</property>
+            <property name="margin-top">6</property>
+            <property name="margin-bottom">3</property>
+            <child>
+              <object class="GtkLabel">
+                <property name="visible">True</property>
+                <property name="halign">start</property>
+                <property name="label">End Section</property>
+                <style>
+                  <class name="separator"/>
+                </style>
+              </object>
+            </child>
+            <child>
+              <object class="GtkSeparator">
+                <property name="visible">True</property>
+                <property name="orientation">horizontal</property>
+              </object>
+            </child>
+          </object>
+        </child>
+        <child>
+          <object class="GtkModelButton">
+            <property name="visible">True</property>
+            <property name="action-name">top.action9</property>
+            <property name="text">Another Item 9</property>
+            <property name="icon">icon9</property>
+          </object>
+        </child>
+        <child>
+          <object class="GtkModelButton">
+            <property name="visible">True</property>
+            <property name="action-name">top.action10</property>
+            <property name="text">Another Item 10</property>
           </object>
         </child>
-      </object>
-    </child>
-    <child>
-      <object class="GtkModelButton">
-        <property name="visible">True</property>
-        <property name="action-name">top.action3</property>
-        <property name="action-target">'three'</property>
-        <property name="text">Radio 1</property>
-      </object>
-    </child>
-    <child>
-      <object class="GtkModelButton">
-        <property name="visible">True</property>
-        <property name="action-name">top.action3</property>
-        <property name="action-target">'four'</property>
-        <property name="text">Radio 2</property>
-      </object>
-    </child>
-    <child>
-      <object class="GtkModelButton">
-        <property name="visible">True</property>
-        <property name="text">Submenu 1</property>
-        <property name="menu-name">submenu1</property>
-      </object>
-    </child>
-    <child>
-      <object class="GtkModelButton">
-        <property name="visible">True</property>
-        <property name="text">Submenu 2</property>
-        <property name="menu-name">submenu2</property>
       </object>
     </child>
     <child>
       <object class="GtkBox">
         <property name="visible">True</property>
         <property name="orientation">vertical</property>
-        <property name="margin-start">12</property>
-        <property name="margin-end">12</property>
-        <property name="margin-top">6</property>
-        <property name="margin-bottom">3</property>
+        <property name="margin">10</property>
+        <child>
+          <object class="GtkModelButton">
+            <property name="visible">True</property>
+            <property name="text">Submenu 1</property>
+            <property name="inverted">True</property>
+            <property name="centered">True</property>
+            <property name="menu-name">main</property>
+          </object>
+        </child>
+        <child>
+          <object class="GtkBox">
+            <property name="visible">True</property>
+            <property name="orientation">vertical</property>
+            <property name="margin-start">12</property>
+            <property name="margin-end">12</property>
+            <property name="margin-top">6</property>
+            <property name="margin-bottom">3</property>
+            <child>
+              <object class="GtkLabel">
+                <property name="visible">True</property>
+                <property name="halign">start</property>
+                <property name="label">5555</property>
+                <style>
+                  <class name="separator"/>
+                </style>
+              </object>
+            </child>
+            <child>
+              <object class="GtkSeparator">
+                <property name="visible">True</property>
+                <property name="orientation">horizontal</property>
+              </object>
+            </child>
+          </object>
+        </child>
+        <child>
+          <object class="GtkModelButton">
+            <property name="visible">True</property>
+            <property name="action-name">top.action5</property>
+            <property name="text">Item 5</property>
+          </object>
+        </child>
+        <child>
+          <object class="GtkModelButton">
+            <property name="visible">True</property>
+            <property name="action-name">top.action5</property>
+            <property name="text">Item 5a</property>
+          </object>
+        </child>
+        <child>
+          <object class="GtkModelButton">
+            <property name="visible">True</property>
+            <property name="action-name">top.action5</property>
+            <property name="text">Item 5b</property>
+          </object>
+        </child>
         <child>
-          <object class="GtkLabel">
+          <object class="GtkBox">
             <property name="visible">True</property>
-            <property name="halign">start</property>
-            <property name="label">End Section</property>
+            <property name="orientation">horizontal</property>
+            <property name="halign">fill</property>
+            <property name="margin-top">10</property>
             <style>
-              <class name="separator"/>
+              <class name="linked"/>
             </style>
+            <child>
+              <object class="GtkModelButton">
+                <property name="visible">True</property>
+                <property name="text">List</property>
+                <property name="action-name">top.set-view</property>
+                <property name="action-target">'list'</property>
+                <property name="iconic">True</property>
+                <property name="centered">True</property>
+                <property name="icon">icon-list</property>
+              </object>
+              <packing>
+                <property name="expand">True</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkModelButton">
+                <property name="visible">True</property>
+                <property name="text">Grid</property>
+                <property name="action-name">top.set-view</property>
+                <property name="action-target">'grid'</property>
+                <property name="iconic">True</property>
+                <property name="centered">True</property>
+                <property name="icon">icon-grid</property>
+              </object>
+              <packing>
+                <property name="expand">True</property>
+              </packing>
+            </child>
           </object>
         </child>
         <child>
-          <object class="GtkSeparator">
+          <object class="GtkModelButton">
             <property name="visible">True</property>
-            <property name="orientation">horizontal</property>
+            <property name="action-name">top.action5</property>
+            <property name="text">Item 5c</property>
+          </object>
+        </child>
+        <child>
+          <object class="GtkModelButton">
+            <property name="visible">True</property>
+            <property name="action-name">top.action5</property>
+            <property name="text">Item 5d</property>
           </object>
         </child>
-      </object>
-    </child>
-    <child>
-      <object class="GtkModelButton">
-        <property name="visible">True</property>
-        <property name="action-name">top.action9</property>
-        <property name="text">Another Item 9</property>
-        <property name="icon">icon9</property>
-      </object>
-    </child>
-    <child>
-      <object class="GtkModelButton">
-        <property name="visible">True</property>
-        <property name="action-name">top.action10</property>
-        <property name="text">Another Item 10</property>
-      </object>
-    </child>
-    <child>
-      <object class="GtkModelButton">
-        <property name="visible">True</property>
-        <property name="text">Submenu 1</property>
-        <property name="inverted">True</property>
-        <property name="centered">True</property>
-        <property name="menu-name">main</property>
-      </object>
-      <packing>
-        <property name="submenu">submenu1</property>
-      </packing>
-    </child>
-    <child>
-      <object class="GtkBox">
-        <property name="visible">True</property>
-        <property name="orientation">vertical</property>
-        <property name="margin-start">12</property>
-        <property name="margin-end">12</property>
-        <property name="margin-top">6</property>
-        <property name="margin-bottom">3</property>
         <child>
-          <object class="GtkLabel">
+          <object class="GtkBox">
             <property name="visible">True</property>
-            <property name="halign">start</property>
-            <property name="label">5555</property>
+            <property name="orientation">vertical</property>
+            <property name="margin-start">12</property>
+            <property name="margin-end">12</property>
+            <property name="margin-top">6</property>
+            <property name="margin-bottom">3</property>
+            <child>
+              <object class="GtkLabel">
+                <property name="visible">True</property>
+                <property name="halign">start</property>
+                <property name="label">Format</property>
+                <style>
+                  <class name="separator"/>
+                </style>
+              </object>
+            </child>
+            <child>
+              <object class="GtkSeparator">
+                <property name="visible">True</property>
+                <property name="orientation">horizontal</property>
+              </object>
+            </child>
+          </object>
+        </child>
+        <child>
+          <object class="GtkBox">
+            <property name="visible">True</property>
+            <property name="orientation">horizontal</property>
+            <property name="halign">fill</property>
+            <property name="margin-top">10</property>
             <style>
-              <class name="separator"/>
+              <class name="linked"/>
             </style>
+            <child>
+              <object class="GtkModelButton">
+                <property name="visible">True</property>
+                <property name="text">Bold</property>
+                <property name="action-name">top.bold</property>
+                <property name="iconic">True</property>
+                <property name="centered">True</property>
+              </object>
+              <packing>
+                <property name="expand">True</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkModelButton">
+                <property name="visible">True</property>
+                <property name="text">Italic</property>
+                <property name="action-name">top.italic</property>
+                <property name="iconic">True</property>
+                <property name="centered">True</property>
+                <property name="icon">icon-italic</property>
+              </object>
+              <packing>
+                <property name="expand">True</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkModelButton">
+                <property name="visible">True</property>
+                <property name="text">Strikethrough</property>
+                <property name="action-name">top.strikethrough</property>
+                <property name="iconic">True</property>
+                <property name="centered">True</property>
+                <property name="icon">icon-strikethrough</property>
+              </object>
+              <packing>
+                <property name="expand">True</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkModelButton">
+                <property name="visible">True</property>
+                <property name="text">Underline</property>
+                <property name="action-name">top.underline</property>
+                <property name="iconic">True</property>
+                <property name="centered">True</property>
+                <property name="icon">icon-underline</property>
+              </object>
+              <packing>
+                <property name="expand">True</property>
+              </packing>
+            </child>
           </object>
         </child>
         <child>
-          <object class="GtkSeparator">
+          <object class="GtkBox">
             <property name="visible">True</property>
-            <property name="orientation">horizontal</property>
+            <property name="orientation">vertical</property>
+            <property name="margin-start">12</property>
+            <property name="margin-end">12</property>
+            <property name="margin-top">6</property>
+            <property name="margin-bottom">3</property>
+            <child>
+              <object class="GtkLabel">
+                <property name="visible">True</property>
+                <property name="halign">start</property>
+                <property name="label">6666</property>
+                <style>
+                  <class name="separator"/>
+                </style>
+              </object>
+            </child>
+            <child>
+              <object class="GtkSeparator">
+                <property name="visible">True</property>
+                <property name="orientation">horizontal</property>
+              </object>
+            </child>
           </object>
         </child>
-      </object>
-      <packing>
-        <property name="submenu">submenu1</property>
-      </packing>
-    </child>
-    <child>
-      <object class="GtkModelButton">
-        <property name="visible">True</property>
-        <property name="action-name">top.action5</property>
-        <property name="text">Item 5</property>
-      </object>
-      <packing>
-        <property name="submenu">submenu1</property>
-      </packing>
-    </child>
-    <child>
-      <object class="GtkModelButton">
-        <property name="visible">True</property>
-        <property name="action-name">top.action5</property>
-        <property name="text">Item 5a</property>
-      </object>
-      <packing>
-        <property name="submenu">submenu1</property>
-      </packing>
-    </child>
-    <child>
-      <object class="GtkModelButton">
-        <property name="visible">True</property>
-        <property name="action-name">top.action5</property>
-        <property name="text">Item 5b</property>
-      </object>
-      <packing>
-        <property name="submenu">submenu1</property>
-      </packing>
-    </child>
-    <child>
-      <object class="GtkBox">
-        <property name="visible">True</property>
-        <property name="orientation">horizontal</property>
-        <property name="halign">fill</property>
-        <property name="margin-top">10</property>
-        <style>
-          <class name="linked"/>
-        </style>
         <child>
           <object class="GtkModelButton">
             <property name="visible">True</property>
-            <property name="text">List</property>
-            <property name="action-name">top.set-view</property>
-            <property name="action-target">'list'</property>
-            <property name="iconic">True</property>
-            <property name="centered">True</property>
-            <property name="icon">icon-list</property>
+            <property name="action-name">top.action6</property>
+            <property name="text">Item 6</property>
           </object>
-          <packing>
-            <property name="expand">True</property>
-          </packing>
         </child>
         <child>
           <object class="GtkModelButton">
             <property name="visible">True</property>
-            <property name="text">Grid</property>
-            <property name="action-name">top.set-view</property>
-            <property name="action-target">'grid'</property>
-            <property name="iconic">True</property>
-            <property name="centered">True</property>
-            <property name="icon">icon-grid</property>
+            <property name="action-name">top.action6</property>
+            <property name="text">Item 6a</property>
           </object>
-          <packing>
-            <property name="expand">True</property>
-          </packing>
         </child>
-      </object>
-      <packing>
-        <property name="submenu">submenu1</property>
-      </packing>
-    </child>
-    <child>
-      <object class="GtkModelButton">
-        <property name="visible">True</property>
-        <property name="action-name">top.action5</property>
-        <property name="text">Item 5c</property>
-      </object>
-      <packing>
-        <property name="submenu">submenu1</property>
-      </packing>
-    </child>
-    <child>
-      <object class="GtkModelButton">
-        <property name="visible">True</property>
-        <property name="action-name">top.action5</property>
-        <property name="text">Item 5d</property>
-      </object>
-      <packing>
-        <property name="submenu">submenu1</property>
-      </packing>
-    </child>
-    <child>
-      <object class="GtkBox">
-        <property name="visible">True</property>
-        <property name="orientation">vertical</property>
-        <property name="margin-start">12</property>
-        <property name="margin-end">12</property>
-        <property name="margin-top">6</property>
-        <property name="margin-bottom">3</property>
         <child>
-          <object class="GtkLabel">
+          <object class="GtkModelButton">
             <property name="visible">True</property>
-            <property name="halign">start</property>
-            <property name="label">Format</property>
-            <style>
-              <class name="separator"/>
-            </style>
+            <property name="action-name">top.action6</property>
+            <property name="text">Item 6b</property>
           </object>
         </child>
         <child>
-          <object class="GtkSeparator">
+          <object class="GtkModelButton">
             <property name="visible">True</property>
-            <property name="orientation">horizontal</property>
+            <property name="action-name">top.action6</property>
+            <property name="text">Item 6c</property>
+          </object>
+        </child>
+        <child>
+          <object class="GtkModelButton">
+            <property name="visible">True</property>
+            <property name="action-name">top.action6</property>
+            <property name="text">Item 6d</property>
           </object>
         </child>
       </object>
@@ -341,240 +454,89 @@
     <child>
       <object class="GtkBox">
         <property name="visible">True</property>
-        <property name="orientation">horizontal</property>
-        <property name="halign">fill</property>
-        <property name="margin-top">10</property>
-        <style>
-          <class name="linked"/>
-        </style>
+        <property name="orientation">vertical</property>
+        <property name="margin">10</property>
         <child>
           <object class="GtkModelButton">
             <property name="visible">True</property>
-            <property name="text">Bold</property>
-            <property name="action-name">top.bold</property>
-            <property name="iconic">True</property>
+            <property name="text">Submenu 2</property>
+            <property name="inverted">True</property>
             <property name="centered">True</property>
+            <property name="menu-name">main</property>
           </object>
-          <packing>
-            <property name="expand">True</property>
-          </packing>
         </child>
         <child>
           <object class="GtkModelButton">
             <property name="visible">True</property>
-            <property name="text">Italic</property>
-            <property name="action-name">top.italic</property>
-            <property name="iconic">True</property>
-            <property name="centered">True</property>
-            <property name="icon">icon-italic</property>
+            <property name="action-name">top.action7</property>
+            <property name="text">Item 7</property>
           </object>
-          <packing>
-            <property name="expand">True</property>
-          </packing>
         </child>
         <child>
-          <object class="GtkModelButton">
+          <object class="GtkScale">
             <property name="visible">True</property>
-            <property name="text">Strikethrough</property>
-            <property name="action-name">top.strikethrough</property>
-            <property name="iconic">True</property>
-            <property name="centered">True</property>
-            <property name="icon">icon-strikethrough</property>
+            <property name="draw-value">False</property>
+            <property name="adjustment">adjustment</property>
           </object>
-          <packing>
-            <property name="expand">True</property>
-          </packing>
         </child>
         <child>
           <object class="GtkModelButton">
             <property name="visible">True</property>
-            <property name="text">Underline</property>
-            <property name="action-name">top.underline</property>
-            <property name="iconic">True</property>
-            <property name="centered">True</property>
-            <property name="icon">icon-underline</property>
+            <property name="text">Subsubmenu</property>
+            <property name="icon">icon9</property>
+            <property name="menu-name">subsubmenu</property>
           </object>
-          <packing>
-            <property name="expand">True</property>
-          </packing>
         </child>
       </object>
       <packing>
-        <property name="submenu">submenu1</property>
+        <property name="submenu">submenu2</property>
       </packing>
     </child>
     <child>
       <object class="GtkBox">
         <property name="visible">True</property>
         <property name="orientation">vertical</property>
-        <property name="margin-start">12</property>
-        <property name="margin-end">12</property>
-        <property name="margin-top">6</property>
-        <property name="margin-bottom">3</property>
+        <property name="margin">10</property>
         <child>
-          <object class="GtkLabel">
+          <object class="GtkModelButton">
             <property name="visible">True</property>
-            <property name="halign">start</property>
-            <property name="label">6666</property>
-            <style>
-              <class name="separator"/>
-            </style>
+            <property name="text">Subsubmenu</property>
+            <property name="inverted">True</property>
+            <property name="centered">True</property>
+            <property name="menu-name">submenu2</property>
+          </object>
+        </child>
+        <child>
+          <object class="GtkModelButton">
+            <property name="visible">True</property>
+            <property name="action-name">action8</property>
+            <property name="text">Item 8</property>
           </object>
         </child>
         <child>
           <object class="GtkSeparator">
             <property name="visible">True</property>
             <property name="orientation">horizontal</property>
+            <property name="margin-start">12</property>
+            <property name="margin-end">12</property>
+            <property name="margin-top">3</property>
+            <property name="margin-bottom">3</property>
+          </object>
+        </child>
+        <child>
+          <object class="GtkModelButton">
+            <property name="visible">True</property>
+            <property name="action-name">top.action9</property>
+            <property name="text">Item 9</property>
+          </object>
+        </child>
+        <child>
+          <object class="GtkModelButton">
+            <property name="visible">True</property>
+            <property name="action-name">top.action10</property>
+            <property name="text">Item 10</property>
           </object>
         </child>
-      </object>
-      <packing>
-        <property name="submenu">submenu1</property>
-      </packing>
-    </child>
-    <child>
-      <object class="GtkModelButton">
-        <property name="visible">True</property>
-        <property name="action-name">top.action6</property>
-        <property name="text">Item 6</property>
-      </object>
-      <packing>
-        <property name="submenu">submenu1</property>
-      </packing>
-    </child>
-    <child>
-      <object class="GtkModelButton">
-        <property name="visible">True</property>
-        <property name="action-name">top.action6</property>
-        <property name="text">Item 6a</property>
-      </object>
-      <packing>
-        <property name="submenu">submenu1</property>
-      </packing>
-    </child>
-    <child>
-      <object class="GtkModelButton">
-        <property name="visible">True</property>
-        <property name="action-name">top.action6</property>
-        <property name="text">Item 6b</property>
-      </object>
-      <packing>
-        <property name="submenu">submenu1</property>
-      </packing>
-    </child>
-    <child>
-      <object class="GtkModelButton">
-        <property name="visible">True</property>
-        <property name="action-name">top.action6</property>
-        <property name="text">Item 6c</property>
-      </object>
-      <packing>
-        <property name="submenu">submenu1</property>
-      </packing>
-    </child>
-    <child>
-      <object class="GtkModelButton">
-        <property name="visible">True</property>
-        <property name="action-name">top.action6</property>
-        <property name="text">Item 6d</property>
-      </object>
-      <packing>
-        <property name="submenu">submenu1</property>
-      </packing>
-    </child>
-    <child>
-      <object class="GtkModelButton">
-        <property name="visible">True</property>
-        <property name="text">Submenu 2</property>
-        <property name="inverted">True</property>
-        <property name="centered">True</property>
-        <property name="menu-name">main</property>
-      </object>
-      <packing>
-        <property name="submenu">submenu2</property>
-      </packing>
-    </child>
-    <child>
-      <object class="GtkModelButton">
-        <property name="visible">True</property>
-        <property name="action-name">top.action7</property>
-        <property name="text">Item 7</property>
-      </object>
-      <packing>
-        <property name="submenu">submenu2</property>
-      </packing>
-    </child>
-    <child>
-      <object class="GtkScale">
-        <property name="visible">True</property>
-        <property name="draw-value">False</property>
-        <property name="adjustment">adjustment</property>
-      </object>
-      <packing>
-        <property name="submenu">submenu2</property>
-      </packing>
-    </child>
-    <child>
-      <object class="GtkModelButton">
-        <property name="visible">True</property>
-        <property name="text">Subsubmenu</property>
-        <property name="icon">icon9</property>
-        <property name="menu-name">subsubmenu</property>
-      </object>
-      <packing>
-        <property name="submenu">submenu2</property>
-      </packing>
-    </child>
-    <child>
-      <object class="GtkModelButton">
-        <property name="visible">True</property>
-        <property name="text">Subsubmenu</property>
-        <property name="inverted">True</property>
-        <property name="centered">True</property>
-        <property name="menu-name">submenu2</property>
-      </object>
-      <packing>
-        <property name="submenu">subsubmenu</property>
-      </packing>
-    </child>
-    <child>
-      <object class="GtkModelButton">
-        <property name="visible">True</property>
-        <property name="action-name">action8</property>
-        <property name="text">Item 8</property>
-      </object>
-      <packing>
-        <property name="submenu">subsubmenu</property>
-      </packing>
-    </child>
-    <child>
-      <object class="GtkSeparator">
-        <property name="visible">True</property>
-        <property name="orientation">horizontal</property>
-        <property name="margin-start">12</property>
-        <property name="margin-end">12</property>
-        <property name="margin-top">3</property>
-        <property name="margin-bottom">3</property>
-      </object>
-      <packing>
-        <property name="submenu">subsubmenu</property>
-      </packing>
-    </child>
-    <child>
-      <object class="GtkModelButton">
-        <property name="visible">True</property>
-        <property name="action-name">top.action9</property>
-        <property name="text">Item 9</property>
-      </object>
-      <packing>
-        <property name="submenu">subsubmenu</property>
-      </packing>
-    </child>
-    <child>
-      <object class="GtkModelButton">
-        <property name="visible">True</property>
-        <property name="action-name">top.action10</property>
-        <property name="text">Item 10</property>
       </object>
       <packing>
         <property name="submenu">subsubmenu</property>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]