🔧 Add switch to UI
This commit is contained in:
@@ -89,15 +89,11 @@ class Extension {
|
|||||||
'/org/freedesktop/UPower');
|
'/org/freedesktop/UPower');
|
||||||
|
|
||||||
// This is used to get the current power profile.
|
// This is used to get the current power profile.
|
||||||
// Ab 41??
|
|
||||||
const PowerProfilesProxy = Gio.DBusProxy.makeProxyWrapper(
|
const PowerProfilesProxy = Gio.DBusProxy.makeProxyWrapper(
|
||||||
utils.getStringResource('/interfaces/net.hadess.PowerProfiles.xml'));
|
utils.getStringResource('/interfaces/net.hadess.PowerProfiles.xml'));
|
||||||
this._powerProfilesProxy = new PowerProfilesProxy(
|
this._powerProfilesProxy = new PowerProfilesProxy(
|
||||||
Gio.DBus.system, 'net.hadess.PowerProfiles', '/net/hadess/PowerProfiles');
|
Gio.DBus.system, 'net.hadess.PowerProfiles', '/net/hadess/PowerProfiles');
|
||||||
|
|
||||||
utils.debug(this._powerProfilesProxy);
|
|
||||||
utils.debug(this._powerProfilesProxy.get_connection());
|
|
||||||
|
|
||||||
// We will monkey-patch these methods. Let's store the original ones.
|
// We will monkey-patch these methods. Let's store the original ones.
|
||||||
this._origAddWindowClone = Workspace.prototype._addWindowClone;
|
this._origAddWindowClone = Workspace.prototype._addWindowClone;
|
||||||
this._origWindowRemoved = Workspace.prototype._windowRemoved;
|
this._origWindowRemoved = Workspace.prototype._windowRemoved;
|
||||||
|
|||||||
@@ -104,6 +104,7 @@ var PreferencesDialog = class PreferencesDialog {
|
|||||||
// Bind general options properties.
|
// Bind general options properties.
|
||||||
this.bindSwitch('destroy-dialogs');
|
this.bindSwitch('destroy-dialogs');
|
||||||
this.bindSwitch('disable-on-battery');
|
this.bindSwitch('disable-on-battery');
|
||||||
|
this.bindSwitch('disable-on-power-save');
|
||||||
|
|
||||||
// Starting with GNOME Shell 42, the settings dialog uses libadwaita (at least most of
|
// Starting with GNOME Shell 42, the settings dialog uses libadwaita (at least most of
|
||||||
// the time - it seems that pop!_OS does not support libadwaita even on GNOME 42). We
|
// the time - it seems that pop!_OS does not support libadwaita even on GNOME 42). We
|
||||||
|
|||||||
@@ -91,6 +91,28 @@ SPDX-License-Identifier: GPL-3.0-or-later
|
|||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<object class="AdwActionRow" id="disable-on-power-save-row">
|
||||||
|
<property name="title" translatable="yes">Disable in Power-Save Mode</property>
|
||||||
|
<property name="activatable-widget">disable-on-power-save</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkSwitch" id="disable-on-power-save">
|
||||||
|
<property name="valign">center</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkButton" id="reset-disable-on-power-save">
|
||||||
|
<property name="icon-name">edit-clear-symbolic</property>
|
||||||
|
<property name="valign">center</property>
|
||||||
|
<property name="tooltip-text" translatable="yes">Reset to Default Value</property>
|
||||||
|
<style>
|
||||||
|
<class name="flat" />
|
||||||
|
</style>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
|
|
||||||
|
|||||||
@@ -277,6 +277,50 @@ SPDX-License-Identifier: GPL-3.0-or-later
|
|||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<object class="GtkListBoxRow" id="disable-on-power-save-row">
|
||||||
|
<property name="margin-start">10</property>
|
||||||
|
<property name="margin-end">10</property>
|
||||||
|
<property name="margin-top">10</property>
|
||||||
|
<property name="margin-bottom">10</property>
|
||||||
|
<property name="activatable">0</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkBox">
|
||||||
|
<property name="spacing">8</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel">
|
||||||
|
<property name="label" translatable="yes">Disable in Power-Save Mode</property>
|
||||||
|
<property name="xalign">0</property>
|
||||||
|
<property name="halign">start</property>
|
||||||
|
<property name="valign">center</property>
|
||||||
|
<property name="hexpand">1</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkSwitch" id="disable-on-power-save">
|
||||||
|
<property name="halign">end</property>
|
||||||
|
<property name="valign">center</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkButton" id="reset-disable-on-power-save">
|
||||||
|
<child>
|
||||||
|
<object class="GtkImage">
|
||||||
|
<property name="icon-name">edit-clear-symbolic</property>
|
||||||
|
<property name="icon-size">1</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<property name="tooltip-text" translatable="yes">Reset to Default Value</property>
|
||||||
|
<style>
|
||||||
|
<class name="flat" />
|
||||||
|
</style>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
|
|||||||
@@ -214,6 +214,40 @@ SPDX-License-Identifier: GPL-3.0-or-later
|
|||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<object class="GtkListBoxRow" id="disable-on-power-save-row">
|
||||||
|
<property name="activatable">0</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkBox">
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel">
|
||||||
|
<property name="label" translatable="yes">Disable in Power-Save Mode</property>
|
||||||
|
<property name="xalign">0</property>
|
||||||
|
<property name="halign">start</property>
|
||||||
|
<property name="valign">center</property>
|
||||||
|
<property name="hexpand">1</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkSwitch" id="disable-on-power-save">
|
||||||
|
<property name="halign">end</property>
|
||||||
|
<property name="valign">center</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkButton" id="reset-disable-on-power-save">
|
||||||
|
<property name="icon-name">edit-clear-symbolic</property>
|
||||||
|
<property name="tooltip-text" translatable="yes">Reset to Default Value</property>
|
||||||
|
<style>
|
||||||
|
<class name="flat" />
|
||||||
|
</style>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
|
|||||||
Reference in New Issue
Block a user