[gtk+] Separators not correctly placed



commit bb6cce4e6f9452280b09ad41513bb9c748b6b9cc
Author: Bastien Nocera <hadess hadess net>
Date:   Wed Jun 1 15:58:22 2016 +0200

    Separators not correctly placed
    
    What it should look like:
      Bold
    ----
    /Size/
      x 0.5
      x 1.0
    
    What it looks like:
      Bold
      /Size/
    ----
      x 0.5
      x 1.0
    
    https://bugzilla.gnome.org/show_bug.cgi?id=767108

 tests/testgmenu.c |   24 ++++++++++++++++++++++--
 1 files changed, 22 insertions(+), 2 deletions(-)
---
diff --git a/tests/testgmenu.c b/tests/testgmenu.c
index 1b4fae3..c92b143 100644
--- a/tests/testgmenu.c
+++ b/tests/testgmenu.c
@@ -66,6 +66,9 @@ static const gchar menu_markup[] =
   "      <attribute name='label' translatable='yes'>Bold</attribute>\n"
   "      <attribute name='action'>actions.bold</attribute>\n"
   "    </item>\n"
+  "    <section id=\"size-placeholder\">\n"
+  "      <attribute name=\"label\">Size</attribute>"
+  "    </section>\n"
   "    <submenu>\n"
   "      <attribute name='label' translatable='yes'>Language</attribute>\n"
   "      <item>\n"
@@ -93,15 +96,32 @@ get_model (void)
 {
   GError *error = NULL;
   GtkBuilder *builder;
-  GMenuModel *menu;
+  GMenuModel *menu, *section;
+  float i;
 
   builder = gtk_builder_new ();
   gtk_builder_add_from_string (builder, menu_markup, -1, &error);
   g_assert_no_error (error);
 
   menu = g_object_ref (gtk_builder_get_object (builder, "edit-menu"));
+
+  section = g_object_ref (gtk_builder_get_object (builder, "size-placeholder"));
   g_object_unref (builder);
 
+  for (i = 0.5; i <= 2.0; i += 0.5)
+    {
+      GMenuItem *item;
+      char *target;
+      char *label;
+
+      target = g_strdup_printf ("actions.size::%.1f", i);
+      label = g_strdup_printf ("x %.1f", i);
+      item = g_menu_item_new (label, target);
+      g_menu_append_item (G_MENU (section), item);
+      g_free (label);
+      g_free (target);
+    }
+
   return menu;
 }
 
@@ -659,7 +679,7 @@ main (int argc, char *argv[])
     {
       button = gtk_menu_button_new ();
       gtk_button_set_label (GTK_BUTTON (button), "Click here");
-      gtk_menu_button_set_use_popover (GTK_MENU_BUTTON (button), FALSE);
+      gtk_menu_button_set_use_popover (GTK_MENU_BUTTON (button), TRUE);
       gtk_menu_button_set_menu_model (GTK_MENU_BUTTON (button), model);
       gtk_widget_insert_action_group (button, "actions", group);
       gtk_container_add (GTK_CONTAINER (box), button);


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