check if avahi is available and we're not on windows,

otherwise checkbutton is not sensitive
This commit is contained in:
Stefan Bethge 2006-09-29 17:40:11 +00:00
parent 6a38879014
commit d07dc39830
3 changed files with 28 additions and 16 deletions

View File

@ -95,7 +95,8 @@
<child> <child>
<widget class="GtkCheckButton" id="enable_zeroconf_checkbutton"> <widget class="GtkCheckButton" id="enable_zeroconf_checkbutton">
<property name="visible">True</property> <property name="visible">True</property>
<property name="tooltip" translatable="yes">If checked, all local contacts that use a Bonjour compatible chat client (like iChat, Trillian or Gaim) will be shown in roster. You don't need a jabber server for it.</property> <property name="tooltip" translatable="yes">If checked, all local contacts that use a Bonjour compatible chat client (like iChat, Trillian or Gaim) will be shown in roster. You don't need to be connected to a jabber server for it to work.
This is only available if python-avahi is installed and avahi-daemon is running.</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="label" translatable="yes">_Enable link-local messaging</property> <property name="label" translatable="yes">_Enable link-local messaging</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>

View File

@ -256,6 +256,7 @@ class ConnectionZeroconf(ConnectionHandlersZeroconf):
self.zeroconf.disconnect() self.zeroconf.disconnect()
def reconnect(self, new_port): def reconnect(self, new_port):
if self.connected:
txt = {} txt = {}
txt['1st'] = gajim.config.get_per('accounts', gajim.ZEROCONF_ACC_NAME, 'zeroconf_first_name') txt['1st'] = gajim.config.get_per('accounts', gajim.ZEROCONF_ACC_NAME, 'zeroconf_first_name')
txt['last'] = gajim.config.get_per('accounts', gajim.ZEROCONF_ACC_NAME, 'zeroconf_last_name') txt['last'] = gajim.config.get_per('accounts', gajim.ZEROCONF_ACC_NAME, 'zeroconf_last_name')

View File

@ -1790,10 +1790,20 @@ class AccountsWindow:
st = gajim.config.get('mergeaccounts') st = gajim.config.get('mergeaccounts')
self.xml.get_widget('merge_checkbutton').set_active(st) self.xml.get_widget('merge_checkbutton').set_active(st)
import os
avahi_error = False
try:
import avahi
except ImportError:
avahi_error = True
# enable zeroconf # enable zeroconf
st = gajim.config.get('enable_zeroconf') st = gajim.config.get('enable_zeroconf')
w = self.xml.get_widget('enable_zeroconf_checkbutton') w = self.xml.get_widget('enable_zeroconf_checkbutton')
w.set_active(st) w.set_active(st)
if os.name == 'nt' or avahi_error:
w.set_sensitive(False)
w.connect('toggled', self.on_enable_zeroconf_checkbutton_toggled) w.connect('toggled', self.on_enable_zeroconf_checkbutton_toggled)
def on_accounts_window_key_press_event(self, widget, event): def on_accounts_window_key_press_event(self, widget, event):