[gnome-shell-extensions/wip/rstrode/heads-up-display: 20/62] apps-menu: Stop taking over Activities button




commit 6fd76f992ae6b29cdce1be7843a889ed75a07480
Author: Florian Müllner <fmuellner gnome org>
Date:   Wed May 29 08:32:03 2019 +0000

    apps-menu: Stop taking over Activities button
    
    We don't want the "Activities" button in GNOME Classic, but the current
    way of handling it is confusing:
    
     - the button is hidden, but the corresponding hot corner
       sometimes works (when the application menu isn't open)
    
     - the button is effectively moved inside the menu, although
       it's clearly not an app or category
    
     - the apps-menu can be used independent from classic mode, in
       which case removing the "Activities" button may not be wanted
    
    Address those points by removing any handling of the activities button
    from the apps-menu extension. We will remove it again from the classic
    session via a session mode tweak.
    
    https://gitlab.gnome.org/GNOME/gnome-shell-extensions/merge_requests/69

 extensions/apps-menu/extension.js | 67 ++++-----------------------------------
 1 file changed, 6 insertions(+), 61 deletions(-)
---
diff --git a/extensions/apps-menu/extension.js b/extensions/apps-menu/extension.js
index 1f95c16..865a87e 100644
--- a/extensions/apps-menu/extension.js
+++ b/extensions/apps-menu/extension.js
@@ -25,22 +25,6 @@ const NAVIGATION_REGION_OVERSHOOT = 50;
 Gio._promisify(Gio._LocalFilePrototype, 'query_info_async', 'query_info_finish');
 Gio._promisify(Gio._LocalFilePrototype, 'set_attributes_async', 'set_attributes_finish');
 
-class ActivitiesMenuItem extends PopupMenu.PopupBaseMenuItem {
-    constructor(button) {
-        super();
-        this._button = button;
-        let label = new St.Label({ text: _('Activities Overview') });
-        this.actor.add_child(label);
-        this.actor.label_actor = label;
-    }
-
-    activate(event) {
-        this._button.menu.toggle();
-        Main.overview.toggle();
-        super.activate(event);
-    }
-}
-
 class ApplicationMenuItem extends PopupMenu.PopupBaseMenuItem {
     constructor(button, app) {
         super();
@@ -235,21 +219,6 @@ class ApplicationsMenu extends PopupMenu.PopupMenu {
         return false;
     }
 
-    open(animate) {
-        this._button.hotCorner.setBarrierSize(0);
-        if (this._button.hotCorner.actor) // fallback corner
-            this._button.hotCorner.actor.hide();
-        super.open(animate);
-    }
-
-    close(animate) {
-        let size = Main.layoutManager.panelBox.height;
-        this._button.hotCorner.setBarrierSize(size);
-        if (this._button.hotCorner.actor) // fallback corner
-            this._button.hotCorner.actor.show();
-        super.close(animate);
-    }
-
     toggle() {
         if (this.isOpen) {
             this._button.selectCategory(null);
@@ -383,7 +352,7 @@ Signals.addSignalMethods(DesktopTarget.prototype);
 
 let ApplicationsButton = GObject.registerClass(
 class ApplicationsButton extends PanelMenu.Button {
-    _init() {
+    _init(includeIcon) {
         super._init(1.0, null, false);
 
         this.setMenu(new ApplicationsMenu(this, 1.0, St.Side.TOP, this));
@@ -400,7 +369,8 @@ class ApplicationsButton extends PanelMenu.Button {
             '/usr/share/icons/hicolor/scalable/apps/start-here.svg');
         this._icon = new St.Icon({
             gicon: new Gio.FileIcon({ file: iconFile }),
-            style_class: 'panel-logo-icon'
+            style_class: 'panel-logo-icon',
+            visible: includeIcon
         });
         hbox.add_actor(this._icon);
 
@@ -416,8 +386,6 @@ class ApplicationsButton extends PanelMenu.Button {
         this.name = 'panelApplications';
         this.label_actor = this._label;
 
-        this.connect('captured-event', this._onCapturedEvent.bind(this));
-
         this._showingId = Main.overview.connect('showing', () => {
             this.add_accessible_state (Atk.StateType.CHECKED);
         });
@@ -459,10 +427,6 @@ class ApplicationsButton extends PanelMenu.Button {
         }
     }
 
-    get hotCorner() {
-        return Main.layoutManager.hotCorners[Main.layoutManager.primaryIndex];
-    }
-
     _createVertSeparator() {
         let separator = new St.DrawingArea({
             style_class: 'calendar-vertical-separator',
@@ -489,14 +453,6 @@ class ApplicationsButton extends PanelMenu.Button {
         this._desktopTarget.destroy();
     }
 
-    _onCapturedEvent(actor, event) {
-        if (event.type() == Clutter.EventType.BUTTON_PRESS) {
-            if (!Main.overview.shouldToggleByCornerOrButton())
-                return true;
-        }
-        return false;
-    }
-
     _onMenuKeyPress(actor, event) {
         let symbol = event.get_key_symbol();
         if (symbol == Clutter.KEY_Left || symbol == Clutter.KEY_Right) {
@@ -640,14 +596,6 @@ class ApplicationsButton extends PanelMenu.Button {
             y_align: St.Align.START
         });
 
-        let activities = new ActivitiesMenuItem(this);
-        this.leftBox.add(activities.actor, {
-            expand: false,
-            x_fill: true,
-            y_fill: false,
-            y_align: St.Align.START
-        });
-
         this.applicationsBox = new St.BoxLayout({ vertical: true });
         this.applicationsScrollBox.add_actor(this.applicationsBox);
         this.categoriesBox = new St.BoxLayout({ vertical: true });
@@ -759,19 +707,16 @@ class ApplicationsButton extends PanelMenu.Button {
 });
 
 let appsMenuButton;
-let activitiesButton;
 
 function enable() {
-    activitiesButton = Main.panel.statusArea['activities'];
-    activitiesButton.container.hide();
-    appsMenuButton = new ApplicationsButton();
-    Main.panel.addToStatusArea('apps-menu', appsMenuButton, 1, 'left');
+    let index = Main.sessionMode.panel.left.indexOf('activities') + 1;
+    appsMenuButton = new ApplicationsButton(index == 0);
+    Main.panel.addToStatusArea('apps-menu', appsMenuButton, index, 'left');
 }
 
 function disable() {
     Main.panel.menuManager.removeMenu(appsMenuButton.menu);
     appsMenuButton.destroy();
-    activitiesButton.container.show();
 }
 
 function init() {


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