[gnome-shell] panelMenu: Remove usage of this.actor from Button



commit fedb8e706a0bc308bec81094defa274cd1b415db
Author: Marco Trevisan (Treviño) <mail 3v1n0 net>
Date:   Tue Apr 9 18:17:51 2019 -0500

    panelMenu: Remove usage of this.actor from Button
    
    Remove this.actor = actor, since the class is now an actor itself.
    
    https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/487

 js/ui/dateMenu.js             |  7 +++---
 js/ui/panel.js                | 52 +++++++++++++++++++++----------------------
 js/ui/panelMenu.js            | 17 +++++++-------
 js/ui/status/accessibility.js |  4 ++--
 js/ui/status/keyboard.js      |  6 ++---
 5 files changed, 42 insertions(+), 44 deletions(-)
---
diff --git a/js/ui/dateMenu.js b/js/ui/dateMenu.js
index fb32fbb2f..cf66cc1c2 100644
--- a/js/ui/dateMenu.js
+++ b/js/ui/dateMenu.js
@@ -476,10 +476,9 @@ class DateMenuButton extends PanelMenu.Button {
         box.add_actor(this._clockDisplay);
         box.add_actor(this._indicator.actor);
 
-        this.actor.label_actor = this._clockDisplay;
-        this.actor.add_actor(box);
-        this.actor.add_style_class_name ('clock-display');
-
+        this.label_actor = this._clockDisplay;
+        this.add_actor(box);
+        this.add_style_class_name ('clock-display');
 
         let layout = new FreezableBinLayout();
         let bin = new St.Widget({ layout_manager: layout });
diff --git a/js/ui/panel.js b/js/ui/panel.js
index 629fc4299..ec6ae1537 100644
--- a/js/ui/panel.js
+++ b/js/ui/panel.js
@@ -194,7 +194,7 @@ var AppMenuButton = GObject.registerClass({
     _init(panel) {
         super._init(0.0, null, true);
 
-        this.actor.accessible_role = Atk.Role.MENU;
+        this.accessible_role = Atk.Role.MENU;
 
         this._startingApps = [];
 
@@ -204,10 +204,10 @@ var AppMenuButton = GObject.registerClass({
 
         let bin = new St.Bin({ name: 'appMenu' });
         bin.connect('style-changed', this._onStyleChanged.bind(this));
-        this.actor.add_actor(bin);
+        this.add_actor(bin);
 
-        this.actor.bind_property("reactive", this.actor, "can-focus", 0);
-        this.actor.reactive = false;
+        this.bind_property("reactive", this, "can-focus", 0);
+        this.reactive = false;
 
         this._container = new St.BoxLayout({ style_class: 'panel-status-menu-box' });
         bin.set_child(this._container);
@@ -263,10 +263,10 @@ var AppMenuButton = GObject.registerClass({
             return;
 
         this._visible = true;
-        this.actor.reactive = true;
+        this.reactive = true;
         this.show();
-        Tweener.removeTweens(this.actor);
-        Tweener.addTween(this.actor,
+        Tweener.removeTweens(this);
+        Tweener.addTween(this,
                          { opacity: 255,
                            time: Overview.ANIMATION_TIME,
                            transition: 'easeOutQuad' });
@@ -277,9 +277,9 @@ var AppMenuButton = GObject.registerClass({
             return;
 
         this._visible = false;
-        this.actor.reactive = false;
-        Tweener.removeTweens(this.actor);
-        Tweener.addTween(this.actor,
+        this.reactive = false;
+        Tweener.removeTweens(this);
+        Tweener.addTween(this,
                          { opacity: 0,
                            time: Overview.ANIMATION_TIME,
                            transition: 'easeOutQuad',
@@ -402,7 +402,7 @@ var AppMenuButton = GObject.registerClass({
             if (this._targetApp) {
                 this._busyNotifyId = this._targetApp.connect('notify::busy', this._sync.bind(this));
                 this._label.set_text(this._targetApp.get_name());
-                this.actor.set_accessible_name(this._targetApp.get_name());
+                this.set_accessible_name(this._targetApp.get_name());
             }
         }
 
@@ -420,7 +420,7 @@ var AppMenuButton = GObject.registerClass({
         else
             this.stopAnimation();
 
-        this.actor.reactive = (visible && !isBusy);
+        this.reactive = (visible && !isBusy);
 
         this._syncIcon();
         this.menu.setApp(this._targetApp);
@@ -459,28 +459,28 @@ var ActivitiesButton = GObject.registerClass(
 class ActivitiesButton extends PanelMenu.Button {
     _init() {
         super._init(0.0, null, true);
-        this.actor.accessible_role = Atk.Role.TOGGLE_BUTTON;
+        this.accessible_role = Atk.Role.TOGGLE_BUTTON;
 
-        this.actor.name = 'panelActivities';
+        this.name = 'panelActivities';
 
         /* Translators: If there is no suitable word for "Activities"
            in your language, you can use the word for "Overview". */
         this._label = new St.Label({ text: _("Activities"),
                                      y_align: Clutter.ActorAlign.CENTER });
-        this.actor.add_actor(this._label);
+        this.add_actor(this._label);
 
-        this.actor.label_actor = this._label;
+        this.label_actor = this._label;
 
-        this.actor.connect('captured-event', this._onCapturedEvent.bind(this));
-        this.actor.connect_after('key-release-event', this._onKeyRelease.bind(this));
+        this.connect('captured-event', this._onCapturedEvent.bind(this));
+        this.connect_after('key-release-event', this._onKeyRelease.bind(this));
 
         Main.overview.connect('showing', () => {
-            this.actor.add_style_pseudo_class('overview');
-            this.actor.add_accessible_state (Atk.StateType.CHECKED);
+            this.add_style_pseudo_class('overview');
+            this.add_accessible_state (Atk.StateType.CHECKED);
         });
         Main.overview.connect('hiding', () => {
-            this.actor.remove_style_pseudo_class('overview');
-            this.actor.remove_accessible_state (Atk.StateType.CHECKED);
+            this.remove_style_pseudo_class('overview');
+            this.remove_accessible_state (Atk.StateType.CHECKED);
         });
 
         this._xdndTimeOut = 0;
@@ -533,7 +533,7 @@ class ActivitiesButton extends PanelMenu.Button {
         let [x, y, mask] = global.get_pointer();
         let pickedActor = global.stage.get_actor_at_pos(Clutter.PickMode.REACTIVE, x, y);
 
-        if (pickedActor == this.actor && Main.overview.shouldToggleByCornerOrButton())
+        if (pickedActor == this && Main.overview.shouldToggleByCornerOrButton())
             Main.overview.toggle();
 
         Mainloop.source_remove(this._xdndTimeOut);
@@ -747,7 +747,7 @@ class AggregateMenu extends PanelMenu.Button {
         this.menu.box.set_layout_manager(menuLayout);
 
         this._indicators = new St.BoxLayout({ style_class: 'panel-status-indicators-box' });
-        this.actor.add_child(this._indicators);
+        this.add_child(this._indicators);
 
         if (Config.HAVE_NETWORKMANAGER) {
             this._network = new imports.ui.status.network.NMApplet();
@@ -1019,7 +1019,7 @@ class Panel extends St.Widget {
             return; // menu not supported by current session mode
 
         let menu = indicator.menu;
-        if (!indicator.actor.reactive)
+        if (!indicator.reactive)
             return;
 
         menu.toggle();
@@ -1041,7 +1041,7 @@ class Panel extends St.Widget {
             return;
 
         let menu = indicator.menu;
-        if (!indicator.actor.reactive)
+        if (!indicator.reactive)
             return;
 
         menu.close();
diff --git a/js/ui/panelMenu.js b/js/ui/panelMenu.js
index bafafc11e..c311a989d 100644
--- a/js/ui/panelMenu.js
+++ b/js/ui/panelMenu.js
@@ -14,12 +14,11 @@ class ButtonBox extends St.Widget {
 
         super._init(params);
 
-        this.actor = this;
         this._delegate = this;
 
         this.container = new St.Bin({ y_fill: true,
                                       x_fill: true,
-                                      child: this.actor });
+                                      child: this });
 
         this.connect('style-changed', this._onStyleChanged.bind(this));
         this.connect('destroy', this._onDestroy.bind(this));
@@ -105,9 +104,9 @@ var Button = GObject.registerClass({
         this.connect('notify::visible', this._onVisibilityChanged.bind(this));
 
         if (dontCreateMenu)
-            this.menu = new PopupMenu.PopupDummyMenu(this.actor);
+            this.menu = new PopupMenu.PopupDummyMenu(this);
         else
-            this.setMenu(new PopupMenu.PopupMenu(this.actor, menuAlignment, St.Side.TOP, 0));
+            this.setMenu(new PopupMenu.PopupMenu(this, menuAlignment, St.Side.TOP, 0));
     }
 
     setSensitive(sensitive) {
@@ -145,7 +144,7 @@ var Button = GObject.registerClass({
         if (!this.menu)
             return;
 
-        if (!this.actor.visible)
+        if (!this.visible)
             this.menu.close();
     }
 
@@ -155,10 +154,10 @@ var Button = GObject.registerClass({
 
         let symbol = event.get_key_symbol();
         if (symbol == Clutter.KEY_Left || symbol == Clutter.KEY_Right) {
-            let group = global.focus_manager.get_group(this.actor);
+            let group = global.focus_manager.get_group(this);
             if (group) {
                 let direction = (symbol == Clutter.KEY_Left) ? St.DirectionType.LEFT : 
St.DirectionType.RIGHT;
-                group.navigate_focus(this.actor, direction, false);
+                group.navigate_focus(this, direction, false);
                 return Clutter.EVENT_STOP;
             }
         }
@@ -167,9 +166,9 @@ var Button = GObject.registerClass({
 
     _onOpenStateChanged(menu, open) {
         if (open)
-            this.actor.add_style_pseudo_class('active');
+            this.add_style_pseudo_class('active');
         else
-            this.actor.remove_style_pseudo_class('active');
+            this.remove_style_pseudo_class('active');
 
         // Setting the max-height won't do any good if the minimum height of the
         // menu is higher then the screen; it's useful if part of the menu is
diff --git a/js/ui/status/accessibility.js b/js/ui/status/accessibility.js
index 10223ec84..ae9c0df7e 100644
--- a/js/ui/status/accessibility.js
+++ b/js/ui/status/accessibility.js
@@ -39,7 +39,7 @@ class ATIndicator extends PanelMenu.Button {
                                            icon_name: 'preferences-desktop-accessibility-symbolic' }));
         this._hbox.add_child(PopupMenu.arrowIcon(St.Side.BOTTOM));
 
-        this.actor.add_child(this._hbox);
+        this.add_child(this._hbox);
 
         this._a11ySettings = new Gio.Settings({ schema_id: A11Y_SCHEMA });
         this._a11ySettings.connect('changed::' + KEY_ALWAYS_SHOW, this._queueSyncMenuVisibility.bind(this));
@@ -86,7 +86,7 @@ class ATIndicator extends PanelMenu.Button {
         let alwaysShow = this._a11ySettings.get_boolean(KEY_ALWAYS_SHOW);
         let items = this.menu._getMenuItems();
 
-        this.actor.visible = alwaysShow || items.some(f => !!f.state);
+        this.visible = alwaysShow || items.some(f => !!f.state);
 
         return GLib.SOURCE_REMOVE;
     }
diff --git a/js/ui/status/keyboard.js b/js/ui/status/keyboard.js
index c93906585..d711a5453 100644
--- a/js/ui/status/keyboard.js
+++ b/js/ui/status/keyboard.js
@@ -822,7 +822,7 @@ class InputSourceIndicator extends PanelMenu.Button {
         this._hbox.add_child(this._container);
         this._hbox.add_child(PopupMenu.arrowIcon(St.Side.BOTTOM));
 
-        this.actor.add_child(this._hbox);
+        this.add_child(this._hbox);
 
         this._propSeparator = new PopupMenu.PopupSeparatorMenuItem();
         this.menu.addMenuItem(this._propSeparator);
@@ -908,11 +908,11 @@ class InputSourceIndicator extends PanelMenu.Button {
             // We also hide if we have only one visible source unless
             // it's an IBus source with properties.
             this.menu.close();
-            this.actor.hide();
+            this.hide();
             return;
         }
 
-        this.actor.show();
+        this.show();
 
         this._buildPropSection(newSource.properties);
 


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