[geary] Fix app & desktop becoming unresponsive when clicking the gear menu.



commit 18755f6d7a799928549eeaa4e40979e444d27148
Author: Michael James Gratton <mike vee net>
Date:   Thu Apr 28 11:45:30 2016 +1000

    Fix app & desktop becoming unresponsive when clicking the gear menu.
    
    When the shell is not showing the app menu, we are adding a gear menu and
    using that for the app menu to work around an issue in Mint Cinnamon
    always showing a menu bar when an app menu was present. However under
    gnome-shell, this causes both Geary and gnome-shell to both start fully
    consuming the CPU when the gear menu was activated.
    
    Perhaps GtkApplication{Window} was notifying or querying shell about the
    state of the actions since they are in the in the "app" namespace, but
    shell not knowing or caring about them was returning an error, causing
    Geary to retry?
    
    Removing the gear menu and letting GTK+ add its own app menu to the
    header when shell is not showing it fixes the issue.
    
    We could load the app_menu actions into the "win" namespace, but that
    would require adding yet more workarounds (at least a duplicate
    app_menu.ui file or something else similary sucky) for someone else's bug
    and for users that will never see or need the fix.
    
    Bug 759980.
    
    * src/client/application/geary-controller.vala: Always set the
      application's app_menu.
    
    * src/client/components/main-toolbar.vala,
      src/client/composer/composer-headerbar.vala: Remove gear menu.
    
    * src/client/components/main-window.vala: Set show-menubar to false
      so we either get the shell managed app-menu or GTK managed one
      in the header bar.

 src/client/application/geary-controller.vala |   12 +-----------
 src/client/components/main-toolbar.vala      |   12 +-----------
 src/client/components/main-window.vala       |    1 +
 src/client/composer/composer-headerbar.vala  |   17 +----------------
 4 files changed, 4 insertions(+), 38 deletions(-)
---
diff --git a/src/client/application/geary-controller.vala b/src/client/application/geary-controller.vala
index 8d7f806..bf7a981 100644
--- a/src/client/application/geary-controller.vala
+++ b/src/client/application/geary-controller.vala
@@ -97,8 +97,6 @@ public class GearyController : Geary.BaseObject {
     
     public LoginDialog? login_dialog { get; private set; default = null; }
     
-    public MenuModel app_menu { get; private set; }
-    
     private Geary.Account? current_account = null;
     private Gee.HashMap<Geary.Account, Geary.App.EmailStore> email_stores
         = new Gee.HashMap<Geary.Account, Geary.App.EmailStore>();
@@ -591,15 +589,7 @@ public class GearyController : Geary.BaseObject {
         GearyApplication.instance.ui_manager.insert_action_group(action_group, 0);
         
         Gtk.Builder builder = GearyApplication.instance.create_builder("app_menu.interface");
-        app_menu = (MenuModel) builder.get_object("app-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(app_menu);
+        GearyApplication.instance.set_app_menu((MenuModel) builder.get_object("app-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 a03a37f..4fa9055 100644
--- a/src/client/components/main-toolbar.vala
+++ b/src/client/components/main-toolbar.vala
@@ -131,17 +131,7 @@ public class MainToolbar : Gtk.Box {
 #if !GTK_3_12
         conversation_header.add_end(archive_trash_delete);
         conversation_header.add_end(undo);
-#endif
-        // 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();
-            Gtk.Menu application_menu = new Gtk.Menu.from_model(
-                GearyApplication.instance.controller.app_menu);
-            insert.add(conversation_header.create_menu_button("emblem-system-symbolic",
-                application_menu, GearyController.ACTION_GEAR_MENU));
-            conversation_header.add_end(conversation_header.create_pill_buttons(insert));
-        }
-#if GTK_3_12
+#else
         conversation_header.add_end(undo);
         conversation_header.add_end(archive_trash_delete);
 #endif
diff --git a/src/client/components/main-window.vala b/src/client/components/main-window.vala
index 5a42312..a26fdce 100644
--- a/src/client/components/main-window.vala
+++ b/src/client/components/main-window.vala
@@ -38,6 +38,7 @@ public class MainWindow : Gtk.ApplicationWindow {
     
     public MainWindow(GearyApplication application) {
         Object(application: application);
+        set_show_menubar(false);
         
         conversation_list_view = new ConversationListView(conversation_list_store);
         
diff --git a/src/client/composer/composer-headerbar.vala b/src/client/composer/composer-headerbar.vala
index 018a562..9670ce2 100644
--- a/src/client/composer/composer-headerbar.vala
+++ b/src/client/composer/composer-headerbar.vala
@@ -87,22 +87,7 @@ public class ComposerHeaderbar : PillHeaderbar {
         add_end(send_button);
         add_end(close_buttons);
         add_end(detach_end);
-#endif
-        // Application button for when taking over main header bar.  If we exported an app menu,
-        // we don't need this.
-        if (!Gtk.Settings.get_default().gtk_shell_shows_app_menu) {
-            Gtk.Menu application_menu = new Gtk.Menu.from_model(
-                GearyApplication.instance.controller.app_menu);
-            Gtk.Button menu_button = create_menu_button(null, application_menu,
-                ComposerWidget.ACTION_GEAR_MENU);
-            add_end(menu_button);
-            bind_property("state", menu_button, "visible", BindingFlags.SYNC_CREATE,
-                (binding, source_value, ref target_value) => {
-                    target_value = (state == ComposerWidget.ComposerState.NEW);
-                    return true;
-                });
-        }
-#if GTK_3_12
+#else
         add_end(detach_end);
         add_end(close_buttons);
         add_end(send_button);


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