[gnome-tweak-tool] add the delete option for extensions from the user's home



commit 95e9c894b6ba2eb73b355a0cd5243e121df58eb4
Author: Alex Muñoz <AlexMuDoz gmail com>
Date:   Wed Mar 20 23:23:14 2013 -0400

    add the delete option for extensions from the user's home
    
    https://bugzilla.gnome.org/show_bug.cgi?id=695983

 gtweak/gshellwrapper.py                 |    6 ++++++
 gtweak/tweaks/tweak_shell_extensions.py |   19 +++++++++++++++++++
 2 files changed, 25 insertions(+), 0 deletions(-)
---
diff --git a/gtweak/gshellwrapper.py b/gtweak/gshellwrapper.py
index 67a260d..5d33f25 100644
--- a/gtweak/gshellwrapper.py
+++ b/gtweak/gshellwrapper.py
@@ -113,6 +113,9 @@ class GnomeShell:
     def reload_theme(self):
         self._execute_js('const Main = imports.ui.main; Main.loadTheme();')
 
+    def uninstall_extension(self, uuid):
+        return self._proxy.proxy_extensions.UninstallExtension('(s)', uuid)
+
     @property
     def mode(self):
         return self._proxy.mode
@@ -150,6 +153,9 @@ class GnomeShell34(GnomeShell32):
     def reload_theme(self):
         logging.warning("Reloading Theme Not Supported")
 
+    def uninstall_extension(self, uuid):
+        return self._proxy.proxy_extensions.UninstallExtension('(s)', uuid)
+
 class GnomeShell36(GnomeShell34):
 
     def list_extensions(self):
diff --git a/gtweak/tweaks/tweak_shell_extensions.py b/gtweak/tweaks/tweak_shell_extensions.py
index 7b6d1f2..9070530 100644
--- a/gtweak/tweaks/tweak_shell_extensions.py
+++ b/gtweak/tweaks/tweak_shell_extensions.py
@@ -54,6 +54,11 @@ class _ShellExtensionTweak(Tweak):
                 cfg.connect("clicked", self._on_configure_clicked, uuid)
                 widgets.append(cfg)
 
+        if ext.get("type") == GnomeShell.EXTENSION_TYPE["PER_USER"]:
+            deleteButton = build_tight_button(Gtk.STOCK_DELETE)
+            deleteButton.connect("clicked", self._on_extension_delete, uuid, ext["name"])
+            widgets.append(deleteButton)
+
         widgets.append(sw)
 
         self.widget = build_label_beside_widget(
@@ -77,6 +82,20 @@ class _ShellExtensionTweak(Tweak):
                 _("Restart"),
                 self._shell.restart)
 
+    def _on_extension_delete(self, btn, uuid, name):
+        path = os.path.join(self._shell.EXTENSION_DIR, uuid)
+        if os.path.exists(path):
+            first_message = _("Delete an extension")        
+            second_message = _("Do you want to delete the extension ")+name+"?"
+            dialog = Gtk.MessageDialog(None,0,type=Gtk.MessageType.QUESTION,
+                                   buttons=Gtk.ButtonsType.YES_NO,
+                                   message_format=first_message)
+            dialog.format_secondary_text(second_message)
+            response = dialog.run()
+            if response == Gtk.ResponseType.YES:
+                self._shell.uninstall_extension(uuid)
+            dialog.destroy()
+
 class _ShellExtensionInstallerTweak(Tweak):
 
     def __init__(self, shell, **options):


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]