pspp-dev
[Top][All Lists]
Advanced

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

[datasets 02/18] gui: Put a separator line before list of windows in Win


From: Ben Pfaff
Subject: [datasets 02/18] gui: Put a separator line before list of windows in Windows menus.
Date: Sat, 30 Apr 2011 22:36:30 -0700

I found it a bit confusing before, that the list of windows in the
Windows menu was not separated from the list of actions of windows.
This fixes the problem.

Simply adding a separator item to the .ui files doesn't work, because
GtkUIManager removes it.  The same thing happens if we add a separator
without adding a real menu item at the same time.

Thanks to John Darrington for suggesting the root of the problem.
---
 src/ui/gui/psppire-window.c |   15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/src/ui/gui/psppire-window.c b/src/ui/gui/psppire-window.c
index e03732f..cf610f6 100644
--- a/src/ui/gui/psppire-window.c
+++ b/src/ui/gui/psppire-window.c
@@ -304,9 +304,20 @@ menu_activate (GtkMenuItem *mi, gpointer data)
 static void
 insert_menuitem_into_menu (PsppireWindow *window, gpointer key)
 {
-  gchar *filename = g_filename_display_name (key);
-  GtkWidget *item = gtk_check_menu_item_new_with_label (filename);
+  gchar *filename;
+  GtkWidget *item;
 
+  /* Add a separator before adding the first real item.  If we add a separator
+     at any other time, sometimes GtkUIManager removes it. */
+  if (g_hash_table_size (window->menuitem_table) == 0)
+    {
+      GtkWidget *separator = gtk_separator_menu_item_new ();
+      gtk_widget_show (separator);
+      gtk_menu_shell_append (window->menu, separator);
+    }
+
+  filename = g_filename_display_name (key);
+  item = gtk_check_menu_item_new_with_label (filename);
   g_free (filename);
 
   g_signal_connect (item, "toggled", G_CALLBACK (menu_toggled), NULL);
-- 
1.7.2.5




reply via email to

[Prev in Thread] Current Thread [Next in Thread]