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
This commit is contained in:
parent
1be933bc49
commit
fedb8e706a
@ -476,10 +476,9 @@ class DateMenuButton extends PanelMenu.Button {
|
|||||||
box.add_actor(this._clockDisplay);
|
box.add_actor(this._clockDisplay);
|
||||||
box.add_actor(this._indicator.actor);
|
box.add_actor(this._indicator.actor);
|
||||||
|
|
||||||
this.actor.label_actor = this._clockDisplay;
|
this.label_actor = this._clockDisplay;
|
||||||
this.actor.add_actor(box);
|
this.add_actor(box);
|
||||||
this.actor.add_style_class_name ('clock-display');
|
this.add_style_class_name ('clock-display');
|
||||||
|
|
||||||
|
|
||||||
let layout = new FreezableBinLayout();
|
let layout = new FreezableBinLayout();
|
||||||
let bin = new St.Widget({ layout_manager: layout });
|
let bin = new St.Widget({ layout_manager: layout });
|
||||||
|
@ -194,7 +194,7 @@ var AppMenuButton = GObject.registerClass({
|
|||||||
_init(panel) {
|
_init(panel) {
|
||||||
super._init(0.0, null, true);
|
super._init(0.0, null, true);
|
||||||
|
|
||||||
this.actor.accessible_role = Atk.Role.MENU;
|
this.accessible_role = Atk.Role.MENU;
|
||||||
|
|
||||||
this._startingApps = [];
|
this._startingApps = [];
|
||||||
|
|
||||||
@ -204,10 +204,10 @@ var AppMenuButton = GObject.registerClass({
|
|||||||
|
|
||||||
let bin = new St.Bin({ name: 'appMenu' });
|
let bin = new St.Bin({ name: 'appMenu' });
|
||||||
bin.connect('style-changed', this._onStyleChanged.bind(this));
|
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.bind_property("reactive", this, "can-focus", 0);
|
||||||
this.actor.reactive = false;
|
this.reactive = false;
|
||||||
|
|
||||||
this._container = new St.BoxLayout({ style_class: 'panel-status-menu-box' });
|
this._container = new St.BoxLayout({ style_class: 'panel-status-menu-box' });
|
||||||
bin.set_child(this._container);
|
bin.set_child(this._container);
|
||||||
@ -263,10 +263,10 @@ var AppMenuButton = GObject.registerClass({
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
this._visible = true;
|
this._visible = true;
|
||||||
this.actor.reactive = true;
|
this.reactive = true;
|
||||||
this.show();
|
this.show();
|
||||||
Tweener.removeTweens(this.actor);
|
Tweener.removeTweens(this);
|
||||||
Tweener.addTween(this.actor,
|
Tweener.addTween(this,
|
||||||
{ opacity: 255,
|
{ opacity: 255,
|
||||||
time: Overview.ANIMATION_TIME,
|
time: Overview.ANIMATION_TIME,
|
||||||
transition: 'easeOutQuad' });
|
transition: 'easeOutQuad' });
|
||||||
@ -277,9 +277,9 @@ var AppMenuButton = GObject.registerClass({
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
this._visible = false;
|
this._visible = false;
|
||||||
this.actor.reactive = false;
|
this.reactive = false;
|
||||||
Tweener.removeTweens(this.actor);
|
Tweener.removeTweens(this);
|
||||||
Tweener.addTween(this.actor,
|
Tweener.addTween(this,
|
||||||
{ opacity: 0,
|
{ opacity: 0,
|
||||||
time: Overview.ANIMATION_TIME,
|
time: Overview.ANIMATION_TIME,
|
||||||
transition: 'easeOutQuad',
|
transition: 'easeOutQuad',
|
||||||
@ -402,7 +402,7 @@ var AppMenuButton = GObject.registerClass({
|
|||||||
if (this._targetApp) {
|
if (this._targetApp) {
|
||||||
this._busyNotifyId = this._targetApp.connect('notify::busy', this._sync.bind(this));
|
this._busyNotifyId = this._targetApp.connect('notify::busy', this._sync.bind(this));
|
||||||
this._label.set_text(this._targetApp.get_name());
|
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
|
else
|
||||||
this.stopAnimation();
|
this.stopAnimation();
|
||||||
|
|
||||||
this.actor.reactive = (visible && !isBusy);
|
this.reactive = (visible && !isBusy);
|
||||||
|
|
||||||
this._syncIcon();
|
this._syncIcon();
|
||||||
this.menu.setApp(this._targetApp);
|
this.menu.setApp(this._targetApp);
|
||||||
@ -459,28 +459,28 @@ var ActivitiesButton = GObject.registerClass(
|
|||||||
class ActivitiesButton extends PanelMenu.Button {
|
class ActivitiesButton extends PanelMenu.Button {
|
||||||
_init() {
|
_init() {
|
||||||
super._init(0.0, null, true);
|
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"
|
/* Translators: If there is no suitable word for "Activities"
|
||||||
in your language, you can use the word for "Overview". */
|
in your language, you can use the word for "Overview". */
|
||||||
this._label = new St.Label({ text: _("Activities"),
|
this._label = new St.Label({ text: _("Activities"),
|
||||||
y_align: Clutter.ActorAlign.CENTER });
|
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.connect('captured-event', this._onCapturedEvent.bind(this));
|
||||||
this.actor.connect_after('key-release-event', this._onKeyRelease.bind(this));
|
this.connect_after('key-release-event', this._onKeyRelease.bind(this));
|
||||||
|
|
||||||
Main.overview.connect('showing', () => {
|
Main.overview.connect('showing', () => {
|
||||||
this.actor.add_style_pseudo_class('overview');
|
this.add_style_pseudo_class('overview');
|
||||||
this.actor.add_accessible_state (Atk.StateType.CHECKED);
|
this.add_accessible_state (Atk.StateType.CHECKED);
|
||||||
});
|
});
|
||||||
Main.overview.connect('hiding', () => {
|
Main.overview.connect('hiding', () => {
|
||||||
this.actor.remove_style_pseudo_class('overview');
|
this.remove_style_pseudo_class('overview');
|
||||||
this.actor.remove_accessible_state (Atk.StateType.CHECKED);
|
this.remove_accessible_state (Atk.StateType.CHECKED);
|
||||||
});
|
});
|
||||||
|
|
||||||
this._xdndTimeOut = 0;
|
this._xdndTimeOut = 0;
|
||||||
@ -533,7 +533,7 @@ class ActivitiesButton extends PanelMenu.Button {
|
|||||||
let [x, y, mask] = global.get_pointer();
|
let [x, y, mask] = global.get_pointer();
|
||||||
let pickedActor = global.stage.get_actor_at_pos(Clutter.PickMode.REACTIVE, x, y);
|
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();
|
Main.overview.toggle();
|
||||||
|
|
||||||
Mainloop.source_remove(this._xdndTimeOut);
|
Mainloop.source_remove(this._xdndTimeOut);
|
||||||
@ -747,7 +747,7 @@ class AggregateMenu extends PanelMenu.Button {
|
|||||||
this.menu.box.set_layout_manager(menuLayout);
|
this.menu.box.set_layout_manager(menuLayout);
|
||||||
|
|
||||||
this._indicators = new St.BoxLayout({ style_class: 'panel-status-indicators-box' });
|
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) {
|
if (Config.HAVE_NETWORKMANAGER) {
|
||||||
this._network = new imports.ui.status.network.NMApplet();
|
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
|
return; // menu not supported by current session mode
|
||||||
|
|
||||||
let menu = indicator.menu;
|
let menu = indicator.menu;
|
||||||
if (!indicator.actor.reactive)
|
if (!indicator.reactive)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
menu.toggle();
|
menu.toggle();
|
||||||
@ -1041,7 +1041,7 @@ class Panel extends St.Widget {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
let menu = indicator.menu;
|
let menu = indicator.menu;
|
||||||
if (!indicator.actor.reactive)
|
if (!indicator.reactive)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
menu.close();
|
menu.close();
|
||||||
|
@ -14,12 +14,11 @@ class ButtonBox extends St.Widget {
|
|||||||
|
|
||||||
super._init(params);
|
super._init(params);
|
||||||
|
|
||||||
this.actor = this;
|
|
||||||
this._delegate = this;
|
this._delegate = this;
|
||||||
|
|
||||||
this.container = new St.Bin({ y_fill: true,
|
this.container = new St.Bin({ y_fill: true,
|
||||||
x_fill: true,
|
x_fill: true,
|
||||||
child: this.actor });
|
child: this });
|
||||||
|
|
||||||
this.connect('style-changed', this._onStyleChanged.bind(this));
|
this.connect('style-changed', this._onStyleChanged.bind(this));
|
||||||
this.connect('destroy', this._onDestroy.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));
|
this.connect('notify::visible', this._onVisibilityChanged.bind(this));
|
||||||
|
|
||||||
if (dontCreateMenu)
|
if (dontCreateMenu)
|
||||||
this.menu = new PopupMenu.PopupDummyMenu(this.actor);
|
this.menu = new PopupMenu.PopupDummyMenu(this);
|
||||||
else
|
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) {
|
setSensitive(sensitive) {
|
||||||
@ -145,7 +144,7 @@ var Button = GObject.registerClass({
|
|||||||
if (!this.menu)
|
if (!this.menu)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!this.actor.visible)
|
if (!this.visible)
|
||||||
this.menu.close();
|
this.menu.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -155,10 +154,10 @@ var Button = GObject.registerClass({
|
|||||||
|
|
||||||
let symbol = event.get_key_symbol();
|
let symbol = event.get_key_symbol();
|
||||||
if (symbol == Clutter.KEY_Left || symbol == Clutter.KEY_Right) {
|
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) {
|
if (group) {
|
||||||
let direction = (symbol == Clutter.KEY_Left) ? St.DirectionType.LEFT : St.DirectionType.RIGHT;
|
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;
|
return Clutter.EVENT_STOP;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -167,9 +166,9 @@ var Button = GObject.registerClass({
|
|||||||
|
|
||||||
_onOpenStateChanged(menu, open) {
|
_onOpenStateChanged(menu, open) {
|
||||||
if (open)
|
if (open)
|
||||||
this.actor.add_style_pseudo_class('active');
|
this.add_style_pseudo_class('active');
|
||||||
else
|
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
|
// 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
|
// menu is higher then the screen; it's useful if part of the menu is
|
||||||
|
@ -39,7 +39,7 @@ class ATIndicator extends PanelMenu.Button {
|
|||||||
icon_name: 'preferences-desktop-accessibility-symbolic' }));
|
icon_name: 'preferences-desktop-accessibility-symbolic' }));
|
||||||
this._hbox.add_child(PopupMenu.arrowIcon(St.Side.BOTTOM));
|
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 = new Gio.Settings({ schema_id: A11Y_SCHEMA });
|
||||||
this._a11ySettings.connect('changed::' + KEY_ALWAYS_SHOW, this._queueSyncMenuVisibility.bind(this));
|
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 alwaysShow = this._a11ySettings.get_boolean(KEY_ALWAYS_SHOW);
|
||||||
let items = this.menu._getMenuItems();
|
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;
|
return GLib.SOURCE_REMOVE;
|
||||||
}
|
}
|
||||||
|
@ -822,7 +822,7 @@ class InputSourceIndicator extends PanelMenu.Button {
|
|||||||
this._hbox.add_child(this._container);
|
this._hbox.add_child(this._container);
|
||||||
this._hbox.add_child(PopupMenu.arrowIcon(St.Side.BOTTOM));
|
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._propSeparator = new PopupMenu.PopupSeparatorMenuItem();
|
||||||
this.menu.addMenuItem(this._propSeparator);
|
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
|
// We also hide if we have only one visible source unless
|
||||||
// it's an IBus source with properties.
|
// it's an IBus source with properties.
|
||||||
this.menu.close();
|
this.menu.close();
|
||||||
this.actor.hide();
|
this.hide();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.actor.show();
|
this.show();
|
||||||
|
|
||||||
this._buildPropSection(newSource.properties);
|
this._buildPropSection(newSource.properties);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user