Flatpak: Disable install from ZIP

This commit is contained in:
Daniel Brötzmann 2019-03-24 15:33:03 +01:00 committed by Philipp Hörist
parent 40cf9488b7
commit 64bda9cf79
2 changed files with 22 additions and 7 deletions

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.22.0 -->
<!-- Generated with glade 3.22.1 -->
<interface>
<requires lib="gtk+" version="3.20"/>
<object class="GtkWindow" id="plugins_window">
@ -13,6 +13,9 @@
<property name="type_hint">dialog</property>
<signal name="destroy" handler="on_plugins_window_destroy" swapped="no"/>
<signal name="key-press-event" handler="on_key_press_event" swapped="no"/>
<child type="titlebar">
<placeholder/>
</child>
<child>
<object class="GtkNotebook" id="plugins_notebook">
<property name="visible">True</property>
@ -232,6 +235,7 @@
<property name="wrap">True</property>
<property name="wrap_mode">word-char</property>
<property name="selectable">True</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="expand">False</property>
@ -375,9 +379,6 @@
</child>
</object>
</child>
<child type="titlebar">
<placeholder/>
</child>
</object>
<object class="GtkTextBuffer" id="textbuffer1">
<property name="text" translatable="yes">Plug-in decription should be displayed here. This text will be erased during PluginsWindow initialization.</property>

View File

@ -36,6 +36,9 @@ from gajim.gtk.dialogs import YesNoDialog
from gajim.gtk.filechoosers import ArchiveChooserDialog
from gajim.common import app
from gajim.common import configpaths
from gajim.common.exceptions import PluginsystemError
from gajim.common.helpers import launch_browser_mailer
from gajim.plugins.helpers import log_calls
from gajim.plugins.helpers import GajimPluginActivateException
from gajim.plugins.plugins_i18n import _
@ -63,14 +66,21 @@ class PluginsWindow:
widgets_to_extract = ('plugins_notebook', 'plugin_name_label',
'plugin_version_label', 'plugin_authors_label',
'plugin_homepage_linkbutton', 'uninstall_plugin_button',
'configure_plugin_button', 'installed_plugins_treeview',
'available_text', 'available_text_label')
'plugin_homepage_linkbutton', 'install_plugin_button',
'uninstall_plugin_button', 'configure_plugin_button',
'installed_plugins_treeview', 'available_text',
'available_text_label')
for widget_name in widgets_to_extract:
setattr(self, widget_name, builder.get_object(widget_name))
self.plugin_description_textview = builder.get_object('description')
# Disable 'Install from ZIP' for Flatpak installs
if app.is_flatpak():
self.install_plugin_button.set_tooltip_text(
_('Click to view Gajim\'s wiki page on how to install plugins in Flatpak.'))
self.installed_plugins_model = Gtk.ListStore(object, str, bool, bool,
GdkPixbuf.Pixbuf)
self.installed_plugins_treeview.set_model(self.installed_plugins_model)
@ -237,6 +247,10 @@ class PluginsWindow:
@log_calls('PluginsWindow')
def on_install_plugin_button_clicked(self, widget):
if app.is_flatpak():
launch_browser_mailer('url', 'https://dev.gajim.org/gajim/gajim/wikis/help/flathub')
return
def show_warn_dialog():
text = _('Archive is malformed')
dialog = WarningDialog(text, '', transient_for=self.window)