diff --git a/data/glade/preferences_window.glade b/data/glade/preferences_window.glade index f5aceb5ff..62e7c260a 100644 --- a/data/glade/preferences_window.glade +++ b/data/glade/preferences_window.glade @@ -18,7 +18,6 @@ GDK_WINDOW_TYPE_HINT_NORMAL GDK_GRAVITY_NORTH_WEST True - False @@ -147,6 +146,26 @@ + + + True + True + Enable link-local messaging (Zeroconf) + True + GTK_RELIEF_NORMAL + True + False + False + True + + + + 0 + False + False + + + True diff --git a/src/common/config.py b/src/common/config.py index 43f717404..f9f0dacac 100644 --- a/src/common/config.py +++ b/src/common/config.py @@ -79,6 +79,7 @@ class Config: 'saveposition': [ opt_bool, True ], 'mergeaccounts': [ opt_bool, False, '', True ], 'sort_by_show': [ opt_bool, True, '', True ], + 'enable_zeroconf': [opt_bool, False, _('Enable link-local/zeroconf messaging')], 'use_speller': [ opt_bool, False, ], 'speller_language': [ opt_str, '', _('Language used by speller')], 'print_time': [ opt_str, 'always', _('\'always\' - print time for every message.\n\'sometimes\' - print time every print_ichat_every_foo_minutes minute.\n\'never\' - never print time.')], @@ -205,7 +206,6 @@ class Config: 'chat_merge_consecutive_nickname_indent': [opt_str, ' ', _('Indentation when using merge consecutive nickame.')], 'gc_nicknames_colors': [ opt_str, '#a34526:#c000ff:#0012ff:#388a99:#38995d:#519938:#ff8a00:#94452d:#244b5a:#32645a', _('List of colors that will be used to color nicknames in group chats.'), True ], 'ctrl_tab_go_to_next_composing': [opt_bool, True, _('Ctrl-Tab go to next composing tab when none is unread.')], - 'zeroconf_enabled': [opt_bool, True, _('Enable zeroconf network')], } __options_per_key = { diff --git a/src/common/zeroconf/connection_zeroconf.py b/src/common/zeroconf/connection_zeroconf.py index 726f7f0d0..c811db939 100644 --- a/src/common/zeroconf/connection_zeroconf.py +++ b/src/common/zeroconf/connection_zeroconf.py @@ -262,6 +262,7 @@ class ConnectionZeroconf(ConnectionHandlersZeroconf): txt['msg'] = msg check = check and self.zeroconf.update_txt(txt) + #stay offline when zeroconf does something wrong if check: self.dispatch('STATUS', show) else: diff --git a/src/config.py b/src/config.py index dd8e7bce3..5397d397f 100644 --- a/src/config.py +++ b/src/config.py @@ -94,6 +94,10 @@ class PreferencesWindow: st = gajim.config.get('sort_by_show') self.xml.get_widget('sort_by_show_checkbutton').set_active(st) + # enable zeroconf + st = gajim.config.get('enable_zeroconf') + self.xml.get_widget('enable_zeroconf_checkbutton').set_active(st) + # Display avatars in roster st = gajim.config.get('show_avatars_in_roster') self.xml.get_widget('show_avatars_in_roster_checkbutton').set_active(st) @@ -522,6 +526,10 @@ class PreferencesWindow: def on_sort_by_show_checkbutton_toggled(self, widget): self.on_checkbutton_toggled(widget, 'sort_by_show') gajim.interface.roster.draw_roster() + + def on_enable_zeroconf_checkbutton_toggled(self, widget): + self.on_checkbutton_toggled(widget, 'enable_zeroconf') + #TODO: add calls to close/restart zeroconf things and temporarily hide/show the account def on_show_status_msgs_in_roster_checkbutton_toggled(self, widget): self.on_checkbutton_toggled(widget, 'show_status_msgs_in_roster') @@ -1096,7 +1104,7 @@ class AccountModificationWindow: '''set or unset sensitivity of widgets when widget is toggled''' for w in widgets: w.set_sensitive(widget.get_active()) - + def init_account_gpg(self): keyid = gajim.config.get_per('accounts', self.account, 'keyid') keyname = gajim.config.get_per('accounts', self.account, 'keyname') diff --git a/src/gajim.py b/src/gajim.py index a15c769cd..a925c9628 100755 --- a/src/gajim.py +++ b/src/gajim.py @@ -1852,7 +1852,7 @@ class Interface: self.handle_event_file_progress) gajim.proxy65_manager = proxy65_manager.Proxy65Manager(gajim.idlequeue) self.register_handlers() - if gajim.config.get('zeroconf_enabled'): + if gajim.config.get('enable_zeroconf'): gajim.connections['zeroconf'] = common.zeroconf.connection_zeroconf.ConnectionZeroconf('zeroconf') for account in gajim.config.get_per('accounts'): if account != 'zeroconf':