|
|
006048 |
From 970f199e2c34edb92e5e67080365926ef51e63d4 Mon Sep 17 00:00:00 2001
|
|
|
006048 |
From: Rui Matos <tiagomatos@gmail.com>
|
|
|
006048 |
Date: Thu, 7 Nov 2013 21:40:56 +0100
|
|
|
006048 |
Subject: [PATCH 4/6] Add tweaks for shell extensions installed after startup
|
|
|
006048 |
|
|
|
006048 |
---
|
|
|
006048 |
gtweak/tweaks/tweak_shell_extensions.py | 29 +++++++++++++++++++++++++++++
|
|
|
006048 |
1 file changed, 29 insertions(+)
|
|
|
006048 |
|
|
|
006048 |
diff --git a/gtweak/tweaks/tweak_shell_extensions.py b/gtweak/tweaks/tweak_shell_extensions.py
|
|
|
006048 |
index 648a4ca..e3ef7b6 100644
|
|
|
006048 |
--- a/gtweak/tweaks/tweak_shell_extensions.py
|
|
|
006048 |
+++ b/gtweak/tweaks/tweak_shell_extensions.py
|
|
|
006048 |
@@ -203,14 +203,22 @@ class ShellExtensionTweakGroup(TweakGroup):
|
|
|
006048 |
def __init__(self):
|
|
|
006048 |
TweakGroup.__init__(self, N_("Shell Extensions"))
|
|
|
006048 |
|
|
|
006048 |
+ self._shell = None
|
|
|
006048 |
+ self._uuids = set()
|
|
|
006048 |
+
|
|
|
006048 |
extension_tweaks = []
|
|
|
006048 |
sg = build_horizontal_sizegroup()
|
|
|
006048 |
+ self._sg = sg
|
|
|
006048 |
|
|
|
006048 |
#check the shell is running
|
|
|
006048 |
try:
|
|
|
006048 |
shell = GnomeShellFactory().get_shell()
|
|
|
006048 |
if shell is None:
|
|
|
006048 |
raise Exception("Shell not running or DBus service not available")
|
|
|
006048 |
+ else:
|
|
|
006048 |
+ self._shell = shell
|
|
|
006048 |
+
|
|
|
006048 |
+ shell.extensions_proxy.connect('g-signal', self._extensions_signal)
|
|
|
006048 |
|
|
|
006048 |
#add the extension installer
|
|
|
006048 |
extension_tweaks.append(
|
|
|
006048 |
@@ -223,6 +231,7 @@ class ShellExtensionTweakGroup(TweakGroup):
|
|
|
006048 |
try:
|
|
|
006048 |
extension_tweaks.append(
|
|
|
006048 |
_ShellExtensionTweak(shell, extension, size_group=sg))
|
|
|
006048 |
+ self._uuids.add(extension["uuid"])
|
|
|
006048 |
except:
|
|
|
006048 |
logging.warning("Invalid extension", exc_info=True)
|
|
|
006048 |
except:
|
|
|
006048 |
@@ -232,6 +241,26 @@ class ShellExtensionTweakGroup(TweakGroup):
|
|
|
006048 |
|
|
|
006048 |
self.set_tweaks(*extension_tweaks)
|
|
|
006048 |
|
|
|
006048 |
+ def _extensions_signal(self, proxy, sender, signal, params):
|
|
|
006048 |
+ if signal != 'ExtensionStatusChanged':
|
|
|
006048 |
+ return
|
|
|
006048 |
+
|
|
|
006048 |
+ uuid = params[0]
|
|
|
006048 |
+ if uuid in self._uuids:
|
|
|
006048 |
+ return
|
|
|
006048 |
+
|
|
|
006048 |
+ try:
|
|
|
006048 |
+ extension = self._shell.extensions_proxy.GetExtensionInfo('(s)', uuid)
|
|
|
006048 |
+ try:
|
|
|
006048 |
+ self.set_tweaks(_ShellExtensionTweak(self._shell, extension, size_group=self._sg))
|
|
|
006048 |
+ self._uuids.add(uuid)
|
|
|
006048 |
+ self.model.tweaks_changed(self)
|
|
|
006048 |
+ except:
|
|
|
006048 |
+ logging.warning("Invalid extension", exc_info=True)
|
|
|
006048 |
+ except:
|
|
|
006048 |
+ logging.warning("Error getting extension info", exc_info=True)
|
|
|
006048 |
+
|
|
|
006048 |
+
|
|
|
006048 |
TWEAK_GROUPS = (
|
|
|
006048 |
ShellExtensionTweakGroup(),
|
|
|
006048 |
)
|
|
|
006048 |
--
|
|
|
006048 |
1.8.3.1
|
|
|
006048 |
|