add checkbutton to preferences window to toggle zeroconf

This commit is contained in:
Stefan Bethge 2006-09-17 15:49:47 +00:00
parent 77d45f5d2c
commit 5116cb0205
5 changed files with 32 additions and 4 deletions

View File

@ -18,7 +18,6 @@
<property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
<property name="focus_on_map">True</property>
<property name="urgency_hint">False</property>
<signal name="key_press_event" handler="on_preferences_window_key_press_event" last_modification_time="Fri, 08 Apr 2005 01:08:08 GMT"/>
<signal name="destroy" handler="on_preferences_window_destroy" last_modification_time="Sun, 05 Mar 2006 11:50:52 GMT"/>
@ -147,6 +146,26 @@
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="enable_zeroconf_checkbutton">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Enable link-local messaging (Zeroconf)</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="on_enable_zeroconf_checkbutton_toggled" last_modification_time="Sun, 17 Sep 2006 15:13:22 GMT"/>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkFrame" id="frame35">
<property name="visible">True</property>

View File

@ -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 = {

View File

@ -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:

View File

@ -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')

View File

@ -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':