[gnome-shell] panel: Hide app menu when disabled by settings



commit 36ee4e6c3b8490e41c5665deceac649d810d28ce
Author: Florian Müllner <fmuellner gnome org>
Date:   Tue Mar 10 15:33:50 2015 +0100

    panel: Hide app menu when disabled by settings
    
    While the GtkSettings::gtk-shell-shows-app-menu property is meant to
    reflect a desktop capability (i.e. in the GNOME case: the app menu is
    shown in the top bar), it is possible for users to overwrite it.
    Respect the setting and actually hide the menu in that case.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=745919

 js/ui/panel.js |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/js/ui/panel.js b/js/ui/panel.js
index a1b89a6..1933681 100644
--- a/js/ui/panel.js
+++ b/js/ui/panel.js
@@ -95,6 +95,7 @@ const AppMenuButton = new Lang.Class({
         this._startingApps = [];
 
         this._menuManager = panel.menuManager;
+        this._gtkSettings = Gtk.Settings.get_default();
         this._targetApp = null;
         this._appMenuNotifyId = 0;
         this._actionGroupNotifyId = 0;
@@ -123,11 +124,14 @@ const AppMenuButton = new Lang.Class({
         this._arrow = PopupMenu.arrowIcon(St.Side.BOTTOM);
         this._container.add_actor(this._arrow);
 
-        this._visible = !Main.overview.visible;
+        this._visible = this._gtkSettings.gtk_shell_shows_app_menu &&
+                        !Main.overview.visible;
         if (!this._visible)
             this.actor.hide();
         this._overviewHidingId = Main.overview.connect('hiding', Lang.bind(this, this._sync));
         this._overviewShowingId = Main.overview.connect('showing', Lang.bind(this, this._sync));
+        this._showsAppMenuId = this._gtkSettings.connect('notify::gtk-shell-shows-app-menu',
+                                                         Lang.bind(this, this._sync));
 
         this._stop = true;
 
@@ -305,7 +309,9 @@ const AppMenuButton = new Lang.Class({
             }
         }
 
-        let visible = (this._targetApp != null && !Main.overview.visibleTarget);
+        let visible = (this._targetApp != null &&
+                       this._gtkSettings.gtk_shell_shows_app_menu &&
+                       !Main.overview.visibleTarget);
         if (visible)
             this.show();
         else
@@ -378,6 +384,10 @@ const AppMenuButton = new Lang.Class({
             Main.overview.disconnect(this._overviewShowingId);
             this._overviewShowingId = 0;
         }
+        if (this._showsAppMenuId > 0) {
+            this._gtkSettings.disconnect(this._showsAppMenuId);
+            this._showsAppMenuId = 0;
+        }
         if (this._switchWorkspaceNotifyId > 0) {
             global.window_manager.disconnect(this._switchWorkspaceNotifyId);
             this._switchWorkspaceNotifyId = 0;


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