[geary] Either export the app menu or show the gear menu



commit 7abfb64cf859e2e947db5b4d6f22be7648d5eb71
Author: Charles Lindsay <chaz yorba org>
Date:   Thu Dec 12 17:17:07 2013 -0800

    Either export the app menu or show the gear menu
    
    But not both.
    
    Closes: bgo#720347

 src/client/application/geary-controller.vala |    9 ++++++++-
 src/client/components/main-toolbar.vala      |   10 ++++++----
 2 files changed, 14 insertions(+), 5 deletions(-)
---
diff --git a/src/client/application/geary-controller.vala b/src/client/application/geary-controller.vala
index cd600c2..1cbed51 100644
--- a/src/client/application/geary-controller.vala
+++ b/src/client/application/geary-controller.vala
@@ -428,7 +428,14 @@ public class GearyController : Geary.BaseObject {
             error("Unable to parse app_menu.interface: %s", e.message);
         }
         MenuModel menu = (MenuModel) builder.get_object("app-menu");
-        GearyApplication.instance.set_app_menu(menu);
+        
+        // We'd *like* to always export an app menu and just let the shell
+        // decide whether to display it or not.  Unfortunately Mint (Cinnamon,
+        // I believe) and maybe others will insert a menu bar for your
+        // application, even if you didn't have one otherwise, if you export
+        // the app menu.  So, we only export it if the shell claims to show it.
+        if (Gtk.Settings.get_default().gtk_shell_shows_app_menu)
+            GearyApplication.instance.set_app_menu(menu);
     }
     
     private void open_account(Geary.Account account) {
diff --git a/src/client/components/main-toolbar.vala b/src/client/components/main-toolbar.vala
index 1c4c949..b8fc3ce 100644
--- a/src/client/components/main-toolbar.vala
+++ b/src/client/components/main-toolbar.vala
@@ -96,10 +96,12 @@ public class MainToolbar : PillToolbar {
         search_entry.get_preferred_width(out minimum_width, out natural_width);
         search_upgrade_progress_bar.width_request = minimum_width;
         
-        // Application button.
-        insert.clear();
-        insert.add(create_menu_button("emblem-system-symbolic", application_menu, 
GearyController.ACTION_GEAR_MENU));
-        add(create_pill_buttons(insert));
+        // Application button.  If we exported an app menu, we don't need this.
+        if (!Gtk.Settings.get_default().gtk_shell_shows_app_menu) {
+            insert.clear();
+            insert.add(create_menu_button("emblem-system-symbolic", application_menu, 
GearyController.ACTION_GEAR_MENU));
+            add(create_pill_buttons(insert));
+        }
         
         set_search_placeholder_text(DEFAULT_SEARCH_TEXT);
     }


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