[gnome-shell/wip/hadess/PrefersNonDefaultGPU: 1/3] appDisplay: Use global switcheroo-control D-Bus proxy
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/wip/hadess/PrefersNonDefaultGPU: 1/3] appDisplay: Use global switcheroo-control D-Bus proxy
- Date: Wed, 29 Apr 2020 10:21:04 +0000 (UTC)
commit 41b5b349094bdda66564a27b23277c998b2d896c
Author: Bastien Nocera <hadess hadess net>
Date: Tue Apr 28 17:37:29 2020 +0200
appDisplay: Use global switcheroo-control D-Bus proxy
Rather than creating our own.
https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1226
js/ui/appDisplay.js | 27 ++++-----------------------
1 file changed, 4 insertions(+), 23 deletions(-)
---
diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js
index 99a023fa26..569e0b637e 100644
--- a/js/ui/appDisplay.js
+++ b/js/ui/appDisplay.js
@@ -46,11 +46,6 @@ const FOLDER_DIALOG_ANIMATION_TIME = 200;
const OVERSHOOT_THRESHOLD = 20;
const OVERSHOOT_TIMEOUT = 1000;
-const SWITCHEROO_BUS_NAME = 'net.hadess.SwitcherooControl';
-const SWITCHEROO_OBJECT_PATH = '/net/hadess/SwitcherooControl';
-
-const SwitcherooProxyInterface = loadInterfaceXML('net.hadess.SwitcherooControl');
-const SwitcherooProxy = Gio.DBusProxy.makeProxyWrapper(SwitcherooProxyInterface);
let discreteGpuAvailable = false;
function _getCategories(info) {
@@ -1162,13 +1157,10 @@ class AppDisplay extends St.BoxLayout {
this._showView(initialView);
this._updateFrequentVisibility();
- Gio.DBus.system.watch_name(SWITCHEROO_BUS_NAME,
- Gio.BusNameWatcherFlags.NONE,
- this._switcherooProxyAppeared.bind(this),
- () => {
- this._switcherooProxy = null;
- this._updateDiscreteGpuAvailable();
- });
+ this._switcherooNotifyId = global.connect('notify::switcheroo-control', () => {
+ this._switcherooProxy = global.get_switcheroo_control();
+ this._updateDiscreteGpuAvailable();
+ });
}
_updateDiscreteGpuAvailable() {
@@ -1178,17 +1170,6 @@ class AppDisplay extends St.BoxLayout {
discreteGpuAvailable = this._switcherooProxy.HasDualGpu;
}
- _switcherooProxyAppeared() {
- this._switcherooProxy = new SwitcherooProxy(Gio.DBus.system, SWITCHEROO_BUS_NAME,
SWITCHEROO_OBJECT_PATH,
- (proxy, error) => {
- if (error) {
- log(error.message);
- return;
- }
- this._updateDiscreteGpuAvailable();
- });
- }
-
animate(animationDirection, onComplete) {
let currentView = this._views.filter(v => v.control.has_style_pseudo_class('checked')).pop().view;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]