[balsa/gtk3] Remove old accel group before setting new one



commit ee0dcd2d9db083f3cf42a7d5aaf272fcd378a1ad
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date:   Fri Feb 20 18:41:33 2015 -0500

    Remove old accel group before setting new one
    
        * libbalsa/application-helpers.c (libbalsa_window_get_menu_bar),
        (libbalsa_window_set_accels): remove old accel group before
        setting new one.

 ChangeLog                      |    6 ++++++
 libbalsa/application-helpers.c |   15 ++++++++-------
 2 files changed, 14 insertions(+), 7 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index a442de0..98a6463 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2015-02-20  Peter Bloomfield  <pbloomfield bellsouth net>
+
+       * libbalsa/application-helpers.c (libbalsa_window_get_menu_bar),
+       (libbalsa_window_set_accels): remove old accel group before
+       setting new one.
+
 2015-02-19  Peter Bloomfield  <pbloomfield bellsouth net>
 
        Make the address book editor accelerators actually work
diff --git a/libbalsa/application-helpers.c b/libbalsa/application-helpers.c
index cd28972..498fe2c 100644
--- a/libbalsa/application-helpers.c
+++ b/libbalsa/application-helpers.c
@@ -173,19 +173,12 @@ libbalsa_window_get_menu_bar(GtkApplicationWindow * window,
     builder = gtk_builder_new();
     if (gtk_builder_add_from_file(builder, ui_file, error)) {
         GMenuModel *menu_model;
-        GSList *accel_groups;
 
         menu_model =
             G_MENU_MODEL(gtk_builder_get_object(builder, "menubar"));
 
         menu_bar = gtk_menu_bar_new_from_model(menu_model);
 
-        /* Remove main-window accelerators: */
-        accel_groups = gtk_accel_groups_from_object(G_OBJECT(window));
-        if (accel_groups)
-            /* Last is first... */
-            gtk_window_remove_accel_group(GTK_WINDOW(window),
-                                          accel_groups->data);
         libbalsa_window_set_accels(window, menu_model);
         gtk_application_window_set_show_menubar(window, FALSE);
     }
@@ -208,8 +201,16 @@ void
 libbalsa_window_set_accels(GtkApplicationWindow * window,
                            GMenuModel           * menu_model)
 {
+    GSList *accel_groups;
     GtkAccelGroup *accel_group;
 
+    /* Remove current accelerators: */
+    accel_groups = gtk_accel_groups_from_object(G_OBJECT(window));
+    if (accel_groups)
+        /* Last is first... */
+        gtk_window_remove_accel_group(GTK_WINDOW(window),
+                                      accel_groups->data);
+
     accel_group = get_accel_group(menu_model, G_ACTION_MAP(window));
     gtk_window_add_accel_group(GTK_WINDOW(window), accel_group);
     g_object_unref(accel_group);


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