[gnome-tweaks] shellwrapper: Remove some ancient compatibility code
- From: Evan Welsh <ewlsh src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-tweaks] shellwrapper: Remove some ancient compatibility code
- Date: Fri, 23 Oct 2020 23:57:11 +0000 (UTC)
commit 57c676c1f8df0ac107318d45ec0c488812a41e5d
Author: Florian Müllner <fmuellner gnome org>
Date: Fri Feb 7 21:58:24 2020 +0100
shellwrapper: Remove some ancient compatibility code
It is hard to imagine anyone using an up-to-date GNOME Tweaks with
GNOME 3.0, 3.2, 3.4 or 3.6 - those versions have been unsupported
upstream for at least seven years.
Besides the README suggests a minimum shell version of 3.24.
https://gitlab.gnome.org/GNOME/gnome-tweaks/issues/272
gtweak/gshellwrapper.py | 81 ++++++++++---------------------------------------
1 file changed, 16 insertions(+), 65 deletions(-)
---
diff --git a/gtweak/gshellwrapper.py b/gtweak/gshellwrapper.py
index 16736570..9174baf4 100644
--- a/gtweak/gshellwrapper.py
+++ b/gtweak/gshellwrapper.py
@@ -24,7 +24,6 @@ class _ShellProxy:
'org.gnome.Shell',
None)
- # GNOME Shell > 3.5 added a separate extension interface
self.proxy_extensions = Gio.DBusProxy.new_sync(
d, 0, None,
'org.gnome.Shell',
@@ -32,31 +31,19 @@ class _ShellProxy:
'org.gnome.Shell.Extensions',
None)
- # GNOME Shell > 3.7.2 added the Mode to the DBus API
val = self.proxy.get_cached_property("Mode")
if val is not None:
self._mode = val.unpack()
else:
- js = 'global.session_mode'
- result, output = self.proxy.Eval('(s)', js)
- if result and output:
- self._mode = json.loads(output)
- else:
- logging.warning("Error getting shell mode via Eval JS")
- self._mode = "user"
-
- # GNOME Shell > 3.3 added the Version to the DBus API and disabled execute_js
+ logging.warning("Error getting shell mode")
+ self._mode = "user"
+
val = self.proxy.get_cached_property("ShellVersion")
if val is not None:
self._version = val.unpack()
else:
- js = 'const Config = imports.misc.config; Config.PACKAGE_VERSION'
- result, output = self.proxy.Eval('(s)', js)
- if result and output:
- self._version = json.loads(output)
- else:
- logging.critical("Error getting shell version via Eval JS")
- self._version = "0.0.0"
+ logging.critical("Error getting shell version")
+ self._version = "0.0.0"
@property
def mode(self):
@@ -85,6 +72,8 @@ class GnomeShell:
DATA_DIR = os.path.join(GLib.get_user_data_dir(), "gnome-shell")
EXTENSION_DIR = os.path.join(GLib.get_user_data_dir(), "gnome-shell", "extensions")
+ EXTENSION_ENABLED_KEY = "enabled-extensions"
+ SUPPORTS_EXTENSION_PREFS = True
def __init__(self, shellproxy, shellsettings):
self._proxy = shellproxy
@@ -102,26 +91,6 @@ class GnomeShell:
def reload_theme(self):
self._execute_js('const Main = imports.ui.main; Main.loadTheme();')
- def uninstall_extension(self, uuid):
- pass
-
- @property
- def mode(self):
- return self._proxy.mode
-
- @property
- def version(self):
- return self._proxy.version
-
-
-class GnomeShell32(GnomeShell):
-
- EXTENSION_ENABLED_KEY = "enabled-extensions"
- SUPPORTS_EXTENSION_PREFS = False
-
- def list_extensions(self):
- return self._proxy.proxy.ListExtensions()
-
def extension_is_active(self, state, uuid):
return state == GnomeShell.EXTENSION_STATE["ENABLED"] and \
self._settings.setting_is_in_list(self.EXTENSION_ENABLED_KEY, uuid)
@@ -132,23 +101,6 @@ class GnomeShell32(GnomeShell):
def disable_extension(self, uuid):
self._settings.setting_remove_from_list(self.EXTENSION_ENABLED_KEY, uuid)
-
-class GnomeShell34(GnomeShell32):
-
- SUPPORTS_EXTENSION_PREFS = True
-
- def restart(self):
- logging.warning("Restarting Shell Not Supported")
-
- def reload_theme(self):
- logging.warning("Reloading Theme Not Supported")
-
- def uninstall_extension(self, uuid):
- return self._proxy.proxy.UninstallExtension('(s)', uuid)
-
-
-class GnomeShell36(GnomeShell34):
-
def list_extensions(self):
return self._proxy.proxy_extensions.ListExtensions()
@@ -159,6 +111,14 @@ class GnomeShell36(GnomeShell34):
self._proxy.proxy_extensions.InstallRemoteExtension('(s)', uuid,
result_handler=reply_handler, error_handler=error_handler, user_data=user_data)
+ @property
+ def mode(self):
+ return self._proxy.mode
+
+ @property
+ def version(self):
+ return self._proxy.version
+
@gtweak.utils.singleton
class GnomeShellFactory:
@@ -168,16 +128,7 @@ class GnomeShellFactory:
settings = GSettingsSetting("org.gnome.shell")
v = list(map(int, proxy.version.split(".")))
- if v >= [3, 5, 0]:
- self.shell = GnomeShell36(proxy, settings)
- elif v >= [3, 3, 2]:
- self.shell = GnomeShell34(proxy, settings)
- elif v >= [3, 1, 4]:
- self.shell = GnomeShell32(proxy, settings)
-
- else:
- logging.warn("Shell version not supported")
- self.shell = None
+ self.shell = GnomeShell(proxy, settings)
logging.debug("Shell version: %s", str(v))
except:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]