status/powerProfiles: Set profile name as subtitle
Just like with network names, set the name of the power profile as the subtitle of the quick settings pill. This allows more of the power profile name to be visible, and reduces chances of ellipsing the name. Rename the 'title' variable to 'name', to be more semantic and better represent what it is now. Related: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/5770 Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2619>
This commit is contained in:
parent
88dcf695c0
commit
ec397cf604
@ -17,17 +17,17 @@ const PowerProfilesProxy = Gio.DBusProxy.makeProxyWrapper(PowerProfilesIface);
|
|||||||
|
|
||||||
const PROFILE_PARAMS = {
|
const PROFILE_PARAMS = {
|
||||||
'performance': {
|
'performance': {
|
||||||
title: C_('Power profile', 'Performance'),
|
name: C_('Power profile', 'Performance'),
|
||||||
iconName: 'power-profile-performance-symbolic',
|
iconName: 'power-profile-performance-symbolic',
|
||||||
},
|
},
|
||||||
|
|
||||||
'balanced': {
|
'balanced': {
|
||||||
title: C_('Power profile', 'Balanced'),
|
name: C_('Power profile', 'Balanced'),
|
||||||
iconName: 'power-profile-balanced-symbolic',
|
iconName: 'power-profile-balanced-symbolic',
|
||||||
},
|
},
|
||||||
|
|
||||||
'power-saver': {
|
'power-saver': {
|
||||||
title: C_('Power profile', 'Power Saver'),
|
name: C_('Power profile', 'Power Saver'),
|
||||||
iconName: 'power-profile-power-saver-symbolic',
|
iconName: 'power-profile-power-saver-symbolic',
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@ -37,7 +37,7 @@ const LAST_PROFILE_KEY = 'last-selected-power-profile';
|
|||||||
const PowerProfilesToggle = GObject.registerClass(
|
const PowerProfilesToggle = GObject.registerClass(
|
||||||
class PowerProfilesToggle extends QuickMenuToggle {
|
class PowerProfilesToggle extends QuickMenuToggle {
|
||||||
_init() {
|
_init() {
|
||||||
super._init();
|
super._init({title: _('Power Mode')});
|
||||||
|
|
||||||
this._profileItems = new Map();
|
this._profileItems = new Map();
|
||||||
|
|
||||||
@ -83,11 +83,11 @@ class PowerProfilesToggle extends QuickMenuToggle {
|
|||||||
.map(p => p.Profile.unpack())
|
.map(p => p.Profile.unpack())
|
||||||
.reverse();
|
.reverse();
|
||||||
for (const profile of profiles) {
|
for (const profile of profiles) {
|
||||||
const {title, iconName} = PROFILE_PARAMS[profile];
|
const {name, iconName} = PROFILE_PARAMS[profile];
|
||||||
if (!title)
|
if (!name)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
const item = new PopupMenu.PopupImageMenuItem(title, iconName);
|
const item = new PopupMenu.PopupImageMenuItem(name, iconName);
|
||||||
item.connect('activate',
|
item.connect('activate',
|
||||||
() => (this._proxy.ActiveProfile = profile));
|
() => (this._proxy.ActiveProfile = profile));
|
||||||
this._profileItems.set(profile, item);
|
this._profileItems.set(profile, item);
|
||||||
@ -111,7 +111,9 @@ class PowerProfilesToggle extends QuickMenuToggle {
|
|||||||
: PopupMenu.Ornament.NONE);
|
: PopupMenu.Ornament.NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.set(PROFILE_PARAMS[activeProfile]);
|
const {name: subtitle, iconName} = PROFILE_PARAMS[activeProfile];
|
||||||
|
this.set({subtitle, iconName});
|
||||||
|
|
||||||
this.checked = activeProfile !== 'balanced';
|
this.checked = activeProfile !== 'balanced';
|
||||||
|
|
||||||
if (this.checked)
|
if (this.checked)
|
||||||
|
Loading…
Reference in New Issue
Block a user