plugin_installer. add option to enable / disable the check update after start.

This commit is contained in:
Denis Fomin
2012-08-08 18:52:50 +04:00
parent 54d1694fa8
commit 2216487e1f
3 changed files with 42 additions and 12 deletions

View File

@@ -264,27 +264,50 @@
</object> </object>
<object class="GtkWindow" id="window2"> <object class="GtkWindow" id="window2">
<child> <child>
<object class="GtkHBox" id="hbox111"> <object class="GtkVBox" id="vbox11">
<property name="visible">True</property> <property name="visible">True</property>
<property name="orientation">vertical</property>
<child> <child>
<object class="GtkLabel" id="label1"> <object class="GtkHBox" id="hbox1">
<property name="visible">True</property> <property name="visible">True</property>
<property name="xalign">0</property> <child>
<property name="label" translatable="yes">Ftp server:</property> <object class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Ftp server:</property>
</object>
<packing>
<property name="expand">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="ftp_server">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char">&#x25CF;</property>
</object>
<packing>
<property name="position">1</property>
</packing>
</child>
</object> </object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property> <property name="position">0</property>
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkEntry" id="ftp_server"> <object class="GtkCheckButton" id="check_update">
<property name="label" translatable="yes">Check update after start</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="invisible_char">&#x25CF;</property> <property name="receives_default">False</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="on_check_update_toggled"/>
</object> </object>
<packing> <packing>
<property name="expand">False</property>
<property name="position">1</property> <property name="position">1</property>
</packing> </packing>
</child> </child>

View File

@@ -1,7 +1,7 @@
[info] [info]
name: Plugin Installer name: Plugin Installer
short_name: plugin_installer short_name: plugin_installer
version: 0.8.2 version: 0.9
description: Install and upgrade plugins from ftp description: Install and upgrade plugins from ftp
authors: Denis Fomin <fominde@gmail.com> authors: Denis Fomin <fominde@gmail.com>
Yann Leboulanger <asterix@lagaule.org> Yann Leboulanger <asterix@lagaule.org>

View File

@@ -49,7 +49,8 @@ class PluginInstaller(GajimPlugin):
def init(self): def init(self):
self.description = _('Install and upgrade plugins from ftp') self.description = _('Install and upgrade plugins from ftp')
self.config_dialog = PluginInstallerPluginConfigDialog(self) self.config_dialog = PluginInstallerPluginConfigDialog(self)
self.config_default_values = {'ftp_server': ('ftp.gajim.org', '')} self.config_default_values = {'ftp_server': ('ftp.gajim.org', ''),
'check_update': (True, ''),}
self.window = None self.window = None
self.progressbar = None self.progressbar = None
self.available_plugins_model = None self.available_plugins_model = None
@@ -62,7 +63,8 @@ class PluginInstaller(GajimPlugin):
self.id_ = self.pl_menuitem.connect_after('activate', self.on_activate) self.id_ = self.pl_menuitem.connect_after('activate', self.on_activate)
if 'plugins' in gajim.interface.instances: if 'plugins' in gajim.interface.instances:
self.on_activate(None) self.on_activate(None)
gobject.timeout_add_seconds(30, self.check_update) if self.config['check_update']:
gobject.timeout_add_seconds(30, self.check_update)
@log_calls('PluginInstallerPlugin') @log_calls('PluginInstallerPlugin')
def warn_update(self, plugins): def warn_update(self, plugins):
@@ -535,8 +537,8 @@ class PluginInstallerPluginConfigDialog(GajimPluginConfigDialog):
'config_dialog.ui') 'config_dialog.ui')
self.xml = gtk.Builder() self.xml = gtk.Builder()
self.xml.set_translation_domain('gajim_plugins') self.xml.set_translation_domain('gajim_plugins')
self.xml.add_objects_from_file(self.GTK_BUILDER_FILE_PATH, ['hbox111']) self.xml.add_objects_from_file(self.GTK_BUILDER_FILE_PATH, ['vbox11'])
hbox = self.xml.get_object('hbox111') hbox = self.xml.get_object('vbox11')
self.child.pack_start(hbox) self.child.pack_start(hbox)
self.xml.connect_signals(self) self.xml.connect_signals(self)
@@ -545,7 +547,12 @@ class PluginInstallerPluginConfigDialog(GajimPluginConfigDialog):
def on_run(self): def on_run(self):
widget = self.xml.get_object('ftp_server') widget = self.xml.get_object('ftp_server')
widget.set_text(str(self.plugin.config['ftp_server'])) widget.set_text(str(self.plugin.config['ftp_server']))
self.xml.get_object('check_update').set_active(
self.plugin.config['check_update'])
def on_hide(self, widget): def on_hide(self, widget):
widget = self.xml.get_object('ftp_server') widget = self.xml.get_object('ftp_server')
self.plugin.config['ftp_server'] = widget.get_text() self.plugin.config['ftp_server'] = widget.get_text()
def on_check_update_toggled(self, widget):
self.plugin.config['check_update'] = widget.get_active()