system: Pick up Settings name and icon from app
The settings action button in the system menu simply launches gnome-control-center, so we want its icon (and accessible name) to always match the app. So instead of keeping the button in-sync with Settings, just look up that information from the app itself. https://gitlab.gnome.org/GNOME/gnome-shell/issues/433
This commit is contained in:
parent
bd1c7774ee
commit
a9ad91c831
@ -261,8 +261,19 @@ var Indicator = new Lang.Class({
|
|||||||
item = new PopupMenu.PopupBaseMenuItem({ reactive: false,
|
item = new PopupMenu.PopupBaseMenuItem({ reactive: false,
|
||||||
can_focus: false });
|
can_focus: false });
|
||||||
|
|
||||||
this._settingsAction = this._createActionButton('preferences-system', _("Settings"));
|
let app = this._settingsApp = Shell.AppSystem.get_default().lookup_app(
|
||||||
this._settingsAction.connect('clicked', () => { this._onSettingsClicked(); });
|
'gnome-control-center.desktop'
|
||||||
|
);
|
||||||
|
if (app) {
|
||||||
|
let [icon, name] = [app.app_info.get_icon().names[0],
|
||||||
|
app.get_name()];
|
||||||
|
this._settingsAction = this._createActionButton(icon, name);
|
||||||
|
this._settingsAction.connect('clicked',
|
||||||
|
this._onSettingsClicked().bind(this));
|
||||||
|
} else {
|
||||||
|
log('Missing required core component Settings, expect trouble…');
|
||||||
|
this._settingsAction = new St.Widget();
|
||||||
|
}
|
||||||
item.actor.add(this._settingsAction, { expand: true, x_fill: false });
|
item.actor.add(this._settingsAction, { expand: true, x_fill: false });
|
||||||
|
|
||||||
this._orientationLockAction = this._createActionButton('', _("Orientation Lock"));
|
this._orientationLockAction = this._createActionButton('', _("Orientation Lock"));
|
||||||
@ -330,8 +341,7 @@ var Indicator = new Lang.Class({
|
|||||||
|
|
||||||
_onSettingsClicked() {
|
_onSettingsClicked() {
|
||||||
this.menu.itemActivated();
|
this.menu.itemActivated();
|
||||||
let app = Shell.AppSystem.get_default().lookup_app('gnome-control-center.desktop');
|
|
||||||
Main.overview.hide();
|
Main.overview.hide();
|
||||||
app.activate();
|
this._settingsApp.activate();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user