[balsa/remove-app-menu] Remove application menu



commit 075f014c6540a860bf16cb9070b0372f389ed7e7
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date:   Sun Jan 20 20:16:29 2019 -0500

    Remove application menu
    
    GNOME has decided that application menus, shown in the top bar
    of the GNOME desktop, are a bad idea. It was kind of a stretch
    for Balsa to implement one, so it shouldn't be too hard to drop
    it.
    
    * src/main-window.c (settings_activated),
      (bw_add_win_action_entries), (balsa_window_add_action_entries),
      (bw_set_menus): move the appmenu items that are not already
      duplicate in the File: menu back there;
    * ui/main-window.ui: ditto.

 ChangeLog         |  15 ++++++
 src/main-window.c |  41 ++++----------
 ui/main-window.ui | 158 +++++++++++++++++++++++-------------------------------
 3 files changed, 91 insertions(+), 123 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 7e1e13854..cdf257068 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2019-01-20  Peter Bloomfield  <pbloomfield bellsouth net>
+
+       Remove application menu
+
+       GNOME has decided that application menus, shown in the top bar
+       of the GNOME desktop, are a bad idea. It was kind of a stretch
+       for Balsa to implement one, so it shouldn't be too hard to drop
+       it.
+
+       * src/main-window.c (settings_activated),
+       (bw_add_win_action_entries), (balsa_window_add_action_entries),
+       (bw_set_menus): move the appmenu items that are not already
+       duplicate in the File: menu back there;
+       * ui/main-window.ui: ditto.
+
 2018-01-20  Albrecht Dreß  <albrecht dress arcor de>
 
        Do not trigger a CRITICAL message when request for a Message
diff --git a/src/main-window.c b/src/main-window.c
index 6c6922324..47a34f68e 100644
--- a/src/main-window.c
+++ b/src/main-window.c
@@ -894,9 +894,9 @@ autocrypt_db_activated(GSimpleAction G_GNUC_UNUSED *action,
 #endif
 
 static void
-prefs_activated(GSimpleAction * action,
-                GVariant      * parameter,
-                gpointer        user_data)
+settings_activated(GSimpleAction * action,
+                   GVariant      * parameter,
+                   gpointer        user_data)
 {
     open_preferences_manager(NULL, user_data);
 }
@@ -1873,36 +1873,15 @@ threading_change_state(GSimpleAction * action,
  */
 
 static void
-bw_add_app_action_entries(GActionMap * action_map, gpointer user_data)
+bw_add_win_action_entries(GActionMap * action_map)
 {
-    static GActionEntry app_entries[] = {
+    static GActionEntry win_entries[] = {
         {"new-message",           new_message_activated},
         {"new-mbox",              new_mbox_activated},
         {"new-maildir",           new_maildir_activated},
         {"new-mh",                new_mh_activated},
         {"new-imap-folder",       new_imap_folder_activated},
         {"new-imap-subfolder",    new_imap_subfolder_activated},
-        {"toolbars",              toolbars_activated},
-        {"identities",            identities_activated},
-        {"address-book",          address_book_activated},
-#ifdef ENABLE_AUTOCRYPT
-        {"autocrypt-db",          autocrypt_db_activated},
-#endif
-        {"prefs",                 prefs_activated},
-        {"help",                  help_activated},
-        {"about",                 about_activated},
-        {"quit",                  quit_activated}
-    };
-
-    g_action_map_add_action_entries(action_map, app_entries,
-                                    G_N_ELEMENTS(app_entries), user_data);
-}
-
-static void
-bw_add_win_action_entries(GActionMap * action_map)
-{
-    static GActionEntry win_entries[] = {
-        {"new-message",           new_message_activated},
         {"continue",              continue_activated},
         {"get-new-mail",          get_new_mail_activated},
         {"send-queued-mail",      send_queued_mail_activated},
@@ -1913,6 +1892,11 @@ bw_add_win_action_entries(GActionMap * action_map)
 #ifdef ENABLE_AUTOCRYPT
         {"autocrypt-db",          autocrypt_db_activated},
 #endif
+        {"settings",              settings_activated},
+        {"toolbars",              toolbars_activated},
+        {"identities",            identities_activated},
+        {"help",                  help_activated},
+        {"about",                 about_activated},
         {"quit",                  quit_activated},
         {"copy",                  copy_activated},
         {"select-all",            select_all_activated},
@@ -2006,7 +1990,6 @@ bw_add_win_action_entries(GActionMap * action_map)
 void
 balsa_window_add_action_entries(GActionMap * action_map)
 {
-    bw_add_app_action_entries(action_map, NULL);
     bw_add_win_action_entries(action_map);
 }
 
@@ -2018,14 +2001,10 @@ bw_set_menus(BalsaWindow * window)
     const gchar resource_path[] = "/org/desktop/Balsa/main-window.ui";
     GError *err = NULL;
 
-    bw_add_app_action_entries(G_ACTION_MAP(application), window);
     bw_add_win_action_entries(G_ACTION_MAP(window));
 
     builder = gtk_builder_new();
     if (gtk_builder_add_from_resource(builder, resource_path, &err)) {
-        gtk_application_set_app_menu(application,
-                                     G_MENU_MODEL(gtk_builder_get_object
-                                                  (builder, "app-menu")));
         gtk_application_set_menubar(application,
                                     G_MENU_MODEL(gtk_builder_get_object
                                                  (builder, "menubar")));
diff --git a/ui/main-window.ui b/ui/main-window.ui
index 4fdd3ef80..967242696 100644
--- a/ui/main-window.ui
+++ b/ui/main-window.ui
@@ -1,100 +1,46 @@
 <interface>
-  <menu id='app-menu'>
-    <submenu>
-      <attribute name='label' translatable='yes' context='appmenu' comments='Translators: app menu item - 
New message or mailbox'>_New</attribute>
-      <section>
-        <item>
-          <attribute name='label' translatable='yes'>_Message</attribute>
-          <attribute name='action'>app.new-message</attribute>
-        </item>
-      </section>
-      <section>
-        <item>
-          <attribute name='label'
-            translatable='yes'>Local mbox mailbox…</attribute>
-          <attribute name='action'>app.new-mbox</attribute>
-        </item>
-        <item>
-          <attribute name='label'
-            translatable='yes'>Local Maildir mailbox…</attribute>
-          <attribute name='action'>app.new-maildir</attribute>
-        </item>
-        <item>
-          <attribute name='label'
-            translatable='yes'>Local MH mailbox…</attribute>
-          <attribute name='action'>app.new-mh</attribute>
-        </item>
-      </section>
-      <section>
-        <item>
-          <attribute name='label'
-            translatable='yes'>Remote IMAP folder…</attribute>
-          <attribute name='action'>app.new-imap-folder</attribute>
-        </item>
-        <item>
-          <attribute name='label'
-            translatable='yes'>Remote IMAP subfolder…</attribute>
-          <attribute name='action'>app.new-imap-subfolder</attribute>
-        </item>
-      </section>
-    </submenu>
-    <submenu>
-      <attribute name='label' translatable='yes'>_Settings</attribute>
-      <section>
-        <item>
-          <attribute name='label'
-            translatable='yes'>_Toolbars…</attribute>
-          <attribute name='action'>app.toolbars</attribute>
-        </item>
-        <item>
-          <attribute name='label'
-            translatable='yes'>_Identities…</attribute>
-          <attribute name='action'>app.identities</attribute>
-        </item>
-      </section>
-    </submenu>
-    <section>
-      <item>
-        <attribute name='label'
-          translatable='yes'>_Address Book</attribute>
-        <attribute name='action'>app.address-book</attribute>
-      </item>
-      <item>
-        <attribute name='label'
-          translatable='yes'>A_utocrypt Database</attribute>
-        <attribute name='action'>app.autocrypt-db</attribute>
-      </item>
-    </section>
-    <section>
-      <item>
-        <attribute name='label' translatable='yes'>_Preferences</attribute>
-        <attribute name='action'>app.prefs</attribute>
-      </item>
-    </section>
-    <section>
-      <item>
-        <attribute name='label' translatable='yes'>_Help</attribute>
-        <attribute name='action'>app.help</attribute>
-      </item>
-      <item>
-        <attribute name='label' translatable='yes'>_About</attribute>
-        <attribute name='action'>app.about</attribute>
-      </item>
-      <item>
-        <attribute name='label' translatable='yes'>_Quit</attribute>
-        <attribute name='action'>app.quit</attribute>
-      </item>
-    </section>
-  </menu>
   <menu id='menubar'>
     <submenu>
       <attribute name='label' translatable='yes'>_File</attribute>
       <section>
-        <item>
-          <attribute name='label' translatable='yes'>New _Message</attribute>
-          <attribute name='action'>win.new-message</attribute>
-          <attribute name='accel'>m</attribute>
-        </item>
+        <submenu>
+          <attribute name='label' translatable='yes' context='window menu' comments='Translators: window 
menu item - New message or mailbox'>_New</attribute>
+          <section>
+            <item>
+              <attribute name='label' translatable='yes'>_Message</attribute>
+              <attribute name='action'>win.new-message</attribute>
+            </item>
+          </section>
+          <section>
+            <item>
+              <attribute name='label'
+                translatable='yes'>Local mbox mailbox…</attribute>
+              <attribute name='action'>win.new-mbox</attribute>
+            </item>
+            <item>
+              <attribute name='label'
+                translatable='yes'>Local Maildir mailbox…</attribute>
+              <attribute name='action'>win.new-maildir</attribute>
+            </item>
+            <item>
+              <attribute name='label'
+                translatable='yes'>Local MH mailbox…</attribute>
+              <attribute name='action'>win.new-mh</attribute>
+            </item>
+          </section>
+          <section>
+            <item>
+              <attribute name='label'
+                translatable='yes'>Remote IMAP folder…</attribute>
+              <attribute name='action'>win.new-imap-folder</attribute>
+            </item>
+            <item>
+              <attribute name='label'
+                translatable='yes'>Remote IMAP subfolder…</attribute>
+              <attribute name='action'>win.new-imap-subfolder</attribute>
+            </item>
+          </section>
+        </submenu>
       </section>
       <section>
         <item>
@@ -151,6 +97,34 @@
                </item>
       </section>
       <section>
+        <submenu>
+          <attribute name='label' translatable='yes'>_Preferences</attribute>
+          <item>
+            <attribute name='label'
+              translatable='yes'>_Settings…</attribute>
+            <attribute name='action'>win.settings</attribute>
+          </item>
+          <item>
+            <attribute name='label'
+              translatable='yes'>_Toolbars…</attribute>
+            <attribute name='action'>win.toolbars</attribute>
+          </item>
+          <item>
+            <attribute name='label'
+              translatable='yes'>_Identities…</attribute>
+            <attribute name='action'>win.identities</attribute>
+          </item>
+        </submenu>
+      </section>
+      <section>
+        <item>
+          <attribute name='label' translatable='yes'>_Help</attribute>
+          <attribute name='action'>win.help</attribute>
+        </item>
+        <item>
+          <attribute name='label' translatable='yes'>_About Balsa</attribute>
+          <attribute name='action'>win.about</attribute>
+        </item>
         <item>
           <attribute name='label' translatable='yes'>_Quit</attribute>
           <attribute name='action'>win.quit</attribute>


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