[balsa/gtk3] Show the app menubar only in the main window



commit 4f93801793e687e29211d20b9e4f14ec05dd55d6
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date:   Sun Jul 21 16:24:34 2013 -0400

    Show the app menubar only in the main window
    
        * libbalsa/application-helpers.c (extract_accels_from_menu),
        (get_accel_group), (libbalsa_window_get_menu_bar): make the
        application-window not show the application's menubar here.
        * libbalsa/source-viewer.c (libbalsa_show_message_source):
        instead of here.

 ChangeLog                      |    8 ++++++++
 libbalsa/application-helpers.c |   10 ++++++----
 libbalsa/source-viewer.c       |    2 --
 3 files changed, 14 insertions(+), 6 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 3d62c4a..f736e5c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2013-07-21  Peter Bloomfield
 
+       * libbalsa/application-helpers.c (extract_accels_from_menu),
+       (get_accel_group), (libbalsa_window_get_menu_bar): make the
+       application-window not show the application's menubar here.
+       * libbalsa/source-viewer.c (libbalsa_show_message_source):
+       instead of here.
+
+2013-07-21  Peter Bloomfield
+
        * libbalsa/application-helpers.c (accel_info_free),
        (accel_activate), (extract_accel_from_menu_item),
        (extract_accels_from_menu), (libbalsa_window_get_accel_group),
diff --git a/libbalsa/application-helpers.c b/libbalsa/application-helpers.c
index 1d7d49d..e1e4edc 100644
--- a/libbalsa/application-helpers.c
+++ b/libbalsa/application-helpers.c
@@ -41,6 +41,7 @@
  * n_entries    length of the array
  * ui_file      filename for GtkBuilder input defining a menu named
  *              "menubar"
+ * error        GError for returning error information
  *
  * returns:     the GtkMenuBar
  */
@@ -127,12 +128,12 @@ extract_accels_from_menu(GMenuModel    * model,
                          GActionMap    * action_map,
                          GtkAccelGroup * accel_group)
 {
-    gint i;
+    gint i, n = g_menu_model_get_n_items(model);
     GMenuLinkIter *iter;
     const gchar *key;
     GMenuModel *m;
 
-    for (i = 0; i < g_menu_model_get_n_items(model); i++) {
+    for (i = 0; i < n; i++) {
         extract_accel_from_menu_item(model, i, action_map, accel_group);
 
         iter = g_menu_model_iterate_item_links(model, i);
@@ -145,7 +146,7 @@ extract_accels_from_menu(GMenuModel    * model,
 }
 
 static GtkAccelGroup *
-libbalsa_window_get_accel_group(GMenuModel * model,
+get_accel_group(GMenuModel * model,
                 GActionMap * action_map)
 {
     GtkAccelGroup *accel_group;
@@ -179,8 +180,9 @@ libbalsa_window_get_menu_bar(GtkApplicationWindow * window,
 
         menu_bar = gtk_menu_bar_new_from_model(menu_model);
 
-        accel_group = libbalsa_window_get_accel_group(menu_model, map);
+        accel_group = get_accel_group(menu_model, map);
         gtk_window_add_accel_group(GTK_WINDOW(window), accel_group);
+        gtk_application_window_set_show_menubar(window, FALSE);
     }
     g_object_unref(builder);
 
diff --git a/libbalsa/source-viewer.c b/libbalsa/source-viewer.c
index 9d00f70..32610dd 100644
--- a/libbalsa/source-viewer.c
+++ b/libbalsa/source-viewer.c
@@ -235,8 +235,6 @@ libbalsa_show_message_source(GtkApplication  * application,
     gtk_container_add(GTK_CONTAINER(interior), GTK_WIDGET(text));
 
     window = gtk_application_window_new(application);
-    gtk_application_window_set_show_menubar(GTK_APPLICATION_WINDOW(window),
-                                            FALSE);
     gtk_window_set_title(GTK_WINDOW(window), _("Message Source"));
     gtk_window_set_wmclass(GTK_WINDOW(window), "message-source", "Balsa");
     gtk_window_set_default_size(GTK_WINDOW(window), *width, *height);


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