[gnome-tweak-tool] extensions: Remove install/uninstall support
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-tweak-tool] extensions: Remove install/uninstall support
- Date: Tue, 11 Apr 2017 01:36:08 +0000 (UTC)
commit aecf3f9b2c85b364421d32103d5653621bd3fa1f
Author: Florian Müllner <fmuellner gnome org>
Date: Wed Dec 14 15:26:16 2016 +0100
extensions: Remove install/uninstall support
Software now supports searching, installing and removing shell
extensions, so it makes sense to integrate with that rather than
duplicating the functionality, and put the focus on managing and
configuring extensions instead.
https://bugzilla.gnome.org/show_bug.cgi?id=778677
gtweak/tweaks/tweak_group_shell_extensions.py | 119 -------------------------
1 files changed, 0 insertions(+), 119 deletions(-)
---
diff --git a/gtweak/tweaks/tweak_group_shell_extensions.py b/gtweak/tweaks/tweak_group_shell_extensions.py
index 89a15e3..fc8d629 100644
--- a/gtweak/tweaks/tweak_group_shell_extensions.py
+++ b/gtweak/tweaks/tweak_group_shell_extensions.py
@@ -108,17 +108,6 @@ class _ShellExtensionTweak(Gtk.ListBoxRow, Tweak):
btn.connect("clicked", self._on_configure_clicked, uuid)
self.hbox.pack_start(btn, False, False, 0)
- btn = Gtk.Button(label=_("Remove"))
- btn.props.vexpand = False
- btn.props.valign = Gtk.Align.CENTER
- btn.set_sensitive(False)
- self.hbox.pack_start(btn, False, False, 0)
- if ext.get("type") == GnomeShell.EXTENSION_TYPE["PER_USER"]:
- btn.get_style_context().add_class("suggested-action")
- btn.set_sensitive(True)
- btn.connect("clicked", self._on_extension_delete, uuid, ext["name"])
- self.deleteButton = btn
-
de = DisableExtension()
de.connect('disable-extension', self._on_disable_extension, sw)
@@ -137,24 +126,6 @@ class _ShellExtensionTweak(Gtk.ListBoxRow, Tweak):
else:
self._shell.enable_extension(uuid)
- def _on_extension_delete(self, btn, uuid, name):
- path = os.path.join(self._shell.EXTENSION_DIR, uuid)
- if os.path.exists(path):
- first_message = _("Uninstall Extension")
- second_message = _("Do you want to uninstall the '%s' extension?") % name
- dialog = Gtk.MessageDialog(
- transient_for=self.main_window, flags=0,
- message_type=Gtk.MessageType.QUESTION,
- buttons=Gtk.ButtonsType.YES_NO,
- text=first_message)
- dialog.format_secondary_text(second_message)
- response = dialog.run()
- if response == Gtk.ResponseType.YES:
- self._shell.uninstall_extension(uuid)
- self.set_sensitive(False)
- btn.get_style_context().remove_class("suggested-action")
- dialog.destroy()
-
def _on_extension_update(self, btn, uuid):
self._shell.uninstall_extension(uuid)
btn.get_style_context().remove_class("suggested-action")
@@ -174,7 +145,6 @@ class _ShellExtensionTweak(Gtk.ListBoxRow, Tweak):
def reply_handler(self, proxy_object, result, user_data):
if result == 's':
- self.deleteButton.show()
user_data.hide()
self.set_sensitive(True)
@@ -183,7 +153,6 @@ class _ShellExtensionTweak(Gtk.ListBoxRow, Tweak):
print result
def add_update_button(self, uuid):
- self.deleteButton.hide()
updateButton = Gtk.Button(_("Update"))
updateButton.get_style_context().add_class("suggested-action")
updateButton.connect("clicked", self._on_extension_update, uuid)
@@ -195,90 +164,6 @@ class _ShellExtensionTweak(Gtk.ListBoxRow, Tweak):
image.set_tooltip_text(tip)
return image
-class _ShellExtensionInstallerTweak(Gtk.Box, Tweak):
-
- def __init__(self, shell, **options):
- Gtk.Box.__init__(self, orientation=Gtk.Orientation.HORIZONTAL)
- Tweak.__init__(self, _("Install Shell Extension"), "", **options)
-
- self._shell = shell
-
- chooser = FileChooserButton(
- _("Select an extension"),
- True,
- ["application/zip"])
- chooser.connect("file-set", self._on_file_set)
-
- hb = Gtk.HBox(spacing=UI_BOX_SPACING)
- hb.pack_start(
- Gtk.LinkButton.new_with_label("https://extensions.gnome.org",_("Get more extensions")),
- False, False, 0)
- hb.pack_start(chooser, False, False, 0)
-
- build_label_beside_widget(self.name, hb, hbox=self)
- self.widget_for_size_group = hb
-
- self.loaded = self._shell is not None
-
- def _on_file_set(self, chooser):
- f = chooser.get_filename()
-
- with zipfile.ZipFile(f, 'r') as z:
- try:
- fragment = ()
- file_extension = None
- file_metadata = None
- for n in z.namelist():
- if n.endswith("metadata.json"):
- fragment = n.split("/")[0:-1]
- file_metadata = n
- if n.endswith("extension.js"):
- if file_extension:
- raise Exception("Only one extension per zip file")
- file_extension = n
-
- if not file_metadata:
- raise Exception("Could not find metadata.json")
- if not file_extension:
- raise Exception("Could not find extension.js")
-
- #extract the extension uuid
- extension_uuid = None
- tmp = tempfile.mkdtemp()
- z.extract(file_metadata, tmp)
- with open(os.path.join(tmp, file_metadata)) as f:
- try:
- extension_uuid = json.load(f)["uuid"]
- except:
- logging.warning("Invalid extension format", exc_info=True)
-
- ok = False
- if extension_uuid:
- ok, updated = extract_zip_file(
- z,
- "/".join(fragment),
- os.path.join(self._shell.EXTENSION_DIR, extension_uuid))
-
- if ok:
- if updated:
- verb = _("%s extension updated successfully") % extension_uuid
- else:
- verb = _("%s extension installed successfully") % extension_uuid
-
- self.notify_logout()
-
- else:
- self.notify_information(_("Error installing extension"))
-
-
- except:
- #does not look like a valid theme
- self.notify_information(_("Invalid extension"))
- logging.warning("Error parsing theme zip", exc_info=True)
-
- #set button back to default state
- chooser.unselect_all()
-
class ShellExtensionTweakGroup(ListBoxTweakGroup):
def __init__(self):
extension_tweaks = []
@@ -309,10 +194,6 @@ class ShellExtensionTweakGroup(ListBoxTweakGroup):
except:
logging.warning("Error detecting shell", exc_info=True)
- #add the extension installer
- extension_tweaks.append(
- _ShellExtensionInstallerTweak(shell, size_group=sg))
-
ListBoxTweakGroup.__init__(self,
_("Extensions"),
*extension_tweaks)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]