added ability to do periodic plugin update checks (every 24 hours) and resized window to fit omemo plugin name properly

This commit is contained in:
tmolitor
2016-07-05 23:44:44 +02:00
parent 50d19f3cbd
commit 8dadcaf9ee
2 changed files with 31 additions and 3 deletions

View File

@@ -5,8 +5,8 @@
<property name="can_focus">False</property>
<child>
<object class="GtkHPaned" id="hpaned2">
<property name="width_request">600</property>
<property name="height_request">350</property>
<property name="width_request">1024</property>
<property name="height_request">480</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="position">340</property>
@@ -363,6 +363,25 @@
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="check_update_periodically">
<property name="label" translatable="yes">Check update every 24 hours</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="receives_default">False</property>
<property name="use_action_appearance">False</property>
<property name="focus_on_click">False</property>
<property name="xalign">0.5</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="on_check_update_periodically_toggled" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="TLS">
<property name="label" translatable="yes">Use TLS transport</property>
@@ -379,7 +398,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
<property name="position">3</property>
</packing>
</child>
</object>

View File

@@ -68,6 +68,7 @@ class PluginInstaller(GajimPlugin):
self.config_dialog = PluginInstallerPluginConfigDialog(self)
self.config_default_values = {'ftp_server': ('ftp.gajim.org', ''),
'check_update': (True, ''),
'check_update_periodically': (True, ''),
'TLS': (True, ''),}
self.window = None
self.progressbar = None
@@ -150,6 +151,9 @@ class PluginInstaller(GajimPlugin):
to_update.append(config.get('info', 'name'))
con.quit()
GLib.idle_add(self.warn_update, to_update)
# check for updates at least once every 24 hours
if self.config['check_update_periodically']:
self.timeout_id = GLib.timeout_add_seconds(24*3600, self.check_update)
except Exception as e:
log.debug('Ftp error when check updates: %s' % str(e))
ftp = Ftp(self)
@@ -631,6 +635,8 @@ class PluginInstallerPluginConfigDialog(GajimPluginConfigDialog):
widget.set_text(str(self.plugin.config['ftp_server']))
self.xml.get_object('check_update').set_active(
self.plugin.config['check_update'])
self.xml.get_object('check_update_periodically').set_active(
self.plugin.config['check_update_periodically'])
self.xml.get_object('TLS').set_active(self.plugin.config['TLS'])
def on_hide(self, widget):
@@ -640,5 +646,8 @@ class PluginInstallerPluginConfigDialog(GajimPluginConfigDialog):
def on_check_update_toggled(self, widget):
self.plugin.config['check_update'] = widget.get_active()
def on_check_update_periodically_toggled(self, widget):
self.plugin.config['check_update_periodically'] = widget.get_active()
def on_tls_toggled(self, widget):
self.plugin.config['TLS'] = widget.get_active()