Commit 7227ea05 authored by sb's avatar sb

moved enable link-local messaging to accounts window

added tooltip to it
parent af6450bc
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd"> <!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
<glade-interface> <glade-interface>
<widget class="GtkWindow" id="accounts_window"> <widget class="GtkWindow" id="accounts_window">
<property name="border_width">12</property> <property name="border_width">12</property>
<property name="title" translatable="yes">Accounts</property> <property name="title" translatable="yes">Accounts</property>
...@@ -80,6 +81,37 @@ ...@@ -80,6 +81,37 @@
</packing> </packing>
</child> </child>
<child>
<widget class="GtkHSeparator" id="hseparator1">
<property name="visible">True</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="enable_zeroconf_checkbutton">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">If you check it, all local contacts that use a Bonjour compatible chat client (like iChat, Adium, Trillian or gaim) will be shown in roster. You don't need a jabber server for it.</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">_Enable link-local messaging</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>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child> <child>
<widget class="GtkHButtonBox" id="hbuttonbox15"> <widget class="GtkHButtonBox" id="hbuttonbox15">
<property name="visible">True</property> <property name="visible">True</property>
...@@ -267,4 +299,5 @@ ...@@ -267,4 +299,5 @@
</widget> </widget>
</child> </child>
</widget> </widget>
</glade-interface> </glade-interface>
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
<property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property> <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property> <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
<property name="focus_on_map">True</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="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"/> <signal name="destroy" handler="on_preferences_window_destroy" last_modification_time="Sun, 05 Mar 2006 11:50:52 GMT"/>
...@@ -146,118 +147,6 @@ ...@@ -146,118 +147,6 @@
</packing> </packing>
</child> </child>
<child>
<widget class="GtkHBox" id="hbox3023">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<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="GtkButton" id="properties_button">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<signal name="clicked" handler="on_zeroconf_properties_button_clicked" last_modification_time="Tue, 19 Sep 2006 21:20:04 GMT"/>
<child>
<widget class="GtkAlignment" id="alignment91">
<property name="visible">True</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xscale">0</property>
<property name="yscale">0</property>
<property name="top_padding">0</property>
<property name="bottom_padding">0</property>
<property name="left_padding">0</property>
<property name="right_padding">0</property>
<child>
<widget class="GtkHBox" id="hbox3024">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">2</property>
<child>
<widget class="GtkImage" id="image1372">
<property name="visible">True</property>
<property name="stock">gtk-properties</property>
<property name="icon_size">4</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label385">
<property name="visible">True</property>
<property name="label" translatable="yes">Pr_operties</property>
<property name="use_underline">True</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
</child>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child> <child>
<widget class="GtkFrame" id="frame35"> <widget class="GtkFrame" id="frame35">
<property name="visible">True</property> <property name="visible">True</property>
......
...@@ -68,7 +68,7 @@ ...@@ -68,7 +68,7 @@
<child> <child>
<widget class="GtkImageMenuItem" id="zeroconf_properties_menuitem"> <widget class="GtkImageMenuItem" id="zeroconf_properties_menuitem">
<property name="visible">True</property> <property name="visible">True</property>
<property name="label" translatable="yes">_Zeroconf Properties...</property> <property name="label" translatable="yes">_Properties...</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<child internal-child="image"> <child internal-child="image">
......
...@@ -98,7 +98,7 @@ class ConnectionZeroconf(ConnectionHandlersZeroconf): ...@@ -98,7 +98,7 @@ class ConnectionZeroconf(ConnectionHandlersZeroconf):
print 'Creating zeroconf account' print 'Creating zeroconf account'
gajim.config.add_per('accounts', 'zeroconf') gajim.config.add_per('accounts', 'zeroconf')
gajim.config.set_per('accounts', 'zeroconf', 'autoconnect', True) gajim.config.set_per('accounts', 'zeroconf', 'autoconnect', True)
gajim.config.set_per('accounts', 'zeroconf', 'no_log_for', False) gajim.config.set_per('accounts', 'zeroconf', 'no_log_for', '')
gajim.config.set_per('accounts', 'zeroconf', 'password', 'zeroconf') gajim.config.set_per('accounts', 'zeroconf', 'password', 'zeroconf')
gajim.config.set_per('accounts', 'zeroconf', 'sync_with_global_status', True) gajim.config.set_per('accounts', 'zeroconf', 'sync_with_global_status', True)
......
...@@ -95,10 +95,6 @@ class PreferencesWindow: ...@@ -95,10 +95,6 @@ class PreferencesWindow:
st = gajim.config.get('sort_by_show') st = gajim.config.get('sort_by_show')
self.xml.get_widget('sort_by_show_checkbutton').set_active(st) 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 # Display avatars in roster
st = gajim.config.get('show_avatars_in_roster') st = gajim.config.get('show_avatars_in_roster')
self.xml.get_widget('show_avatars_in_roster_checkbutton').set_active(st) self.xml.get_widget('show_avatars_in_roster_checkbutton').set_active(st)
...@@ -528,75 +524,6 @@ class PreferencesWindow: ...@@ -528,75 +524,6 @@ class PreferencesWindow:
self.on_checkbutton_toggled(widget, 'sort_by_show') self.on_checkbutton_toggled(widget, 'sort_by_show')
gajim.interface.roster.draw_roster() gajim.interface.roster.draw_roster()
def on_enable_zeroconf_checkbutton_toggled(self, widget):
if gajim.config.get('enable_zeroconf'):
# disable
gajim.interface.roster.close_all('zeroconf')
gajim.connections['zeroconf'].disable_account()
del gajim.connections['zeroconf']
gajim.interface.save_config()
del gajim.interface.instances['zeroconf']
del gajim.nicks['zeroconf']
del gajim.block_signed_in_notifications['zeroconf']
del gajim.groups['zeroconf']
gajim.contacts.remove_account('zeroconf')
del gajim.gc_connected['zeroconf']
del gajim.automatic_rooms['zeroconf']
del gajim.to_be_removed['zeroconf']
del gajim.newly_added['zeroconf']
del gajim.sleeper_state['zeroconf']
del gajim.encrypted_chats['zeroconf']
del gajim.last_message_time['zeroconf']
del gajim.status_before_autoaway['zeroconf']
if len(gajim.connections) >= 2: # Do not merge accounts if only one exists
gajim.interface.roster.regroup = gajim.config.get('mergeaccounts')
else:
gajim.interface.roster.regroup = False
gajim.interface.roster.draw_roster()
gajim.interface.roster.actions_menu_needs_rebuild = True
if gajim.interface.instances.has_key('accounts'):
gajim.interface.instances['accounts'].init_accounts()
else:
#enable (will create new account if not present)
gajim.connections['zeroconf'] = common.zeroconf.connection_zeroconf.ConnectionZeroconf('zeroconf')
# update variables
gajim.interface.instances['zeroconf'] = {'infos': {}, 'disco': {},
'gc_config': {}}
gajim.connections['zeroconf'].connected = 0
gajim.groups['zeroconf'] = {}
gajim.contacts.add_account('zeroconf')
gajim.gc_connected['zeroconf'] = {}
gajim.automatic_rooms['zeroconf'] = {}
gajim.newly_added['zeroconf'] = []
gajim.to_be_removed['zeroconf'] = []
gajim.nicks['zeroconf'] = 'zeroconf'
gajim.block_signed_in_notifications['zeroconf'] = True
gajim.sleeper_state['zeroconf'] = 'off'
gajim.encrypted_chats['zeroconf'] = []
gajim.last_message_time['zeroconf'] = {}
gajim.status_before_autoaway['zeroconf'] = ''
# refresh accounts window
if gajim.interface.instances.has_key('accounts'):
gajim.interface.instances['accounts'].init_accounts()
# refresh roster
if len(gajim.connections) >= 2: # Do not merge accounts if only one exists
gajim.interface.roster.regroup = gajim.config.get('mergeaccounts')
else:
gajim.interface.roster.regroup = False
gajim.interface.roster.draw_roster()
gajim.interface.roster.actions_menu_needs_rebuild = True
gajim.interface.save_config()
gajim.connections['zeroconf'].change_status('online', '')
self.on_checkbutton_toggled(widget, 'enable_zeroconf')
def on_zeroconf_properties_button_clicked(self, widget):
if gajim.interface.instances.has_key('zeroconf_properties'):
gajim.interface.instances['zeroconf_properties'].window.present()
else:
gajim.interface.instances['zeroconf_properties'] = \
ZeroconfPropertiesWindow()
def on_show_status_msgs_in_roster_checkbutton_toggled(self, widget): def on_show_status_msgs_in_roster_checkbutton_toggled(self, widget):
self.on_checkbutton_toggled(widget, 'show_status_msgs_in_roster') self.on_checkbutton_toggled(widget, 'show_status_msgs_in_roster')
gajim.interface.roster.draw_roster() gajim.interface.roster.draw_roster()
...@@ -1831,6 +1758,12 @@ class AccountsWindow: ...@@ -1831,6 +1758,12 @@ 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)
# enable zeroconf
st = gajim.config.get('enable_zeroconf')
w = self.xml.get_widget('enable_zeroconf_checkbutton')
w.set_active(st)
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):
if event.keyval == gtk.keysyms.Escape: if event.keyval == gtk.keysyms.Escape:
self.window.destroy() self.window.destroy()
...@@ -1842,9 +1775,8 @@ class AccountsWindow: ...@@ -1842,9 +1775,8 @@ class AccountsWindow:
model = self.accounts_treeview.get_model() model = self.accounts_treeview.get_model()
model.clear() model.clear()
for account in gajim.connections: for account in gajim.connections:
# if account != 'zeroconf': iter = model.append()
iter = model.append() model.set(iter, 0, account, 1, gajim.get_hostname_from_account(account))
model.set(iter, 0, account, 1, gajim.get_hostname_from_account(account))
def on_accounts_treeview_cursor_changed(self, widget): def on_accounts_treeview_cursor_changed(self, widget):
'''Activate delete and modify buttons when a row is selected''' '''Activate delete and modify buttons when a row is selected'''
...@@ -1885,7 +1817,14 @@ class AccountsWindow: ...@@ -1885,7 +1817,14 @@ class AccountsWindow:
if not iter: if not iter:
return return
account = model[iter][0].decode('utf-8') account = model[iter][0].decode('utf-8')
self.show_modification_window(account) if account == 'zeroconf':
if gajim.interface.instances.has_key('zeroconf_properties'):
gajim.interface.instances['zeroconf_properties'].window.present()
else:
gajim.interface.instances['zeroconf_properties'] = \
ZeroconfPropertiesWindow()
else:
self.show_modification_window(account)
def on_accounts_treeview_row_activated(self, widget, path, column): def on_accounts_treeview_row_activated(self, widget, path, column):
model = widget.get_model() model = widget.get_model()
...@@ -1899,15 +1838,85 @@ class AccountsWindow: ...@@ -1899,15 +1838,85 @@ class AccountsWindow:
gajim.interface.instances[account]['account_modification'] = \ gajim.interface.instances[account]['account_modification'] = \
AccountModificationWindow(account) AccountModificationWindow(account)
def on_merge_checkbutton_toggled(self, widget): def on_checkbutton_toggled(self, widget, config_name,
gajim.config.set('mergeaccounts', widget.get_active()) change_sensitivity_widgets = None):
gajim.config.set(config_name, widget.get_active())
if change_sensitivity_widgets:
for w in change_sensitivity_widgets:
w.set_sensitive(widget.get_active())
gajim.interface.save_config() gajim.interface.save_config()
def on_merge_checkbutton_toggled(self, widget):
self.on_checkbutton_toggled(widget, 'mergeaccounts')
if len(gajim.connections) >= 2: # Do not merge accounts if only one exists if len(gajim.connections) >= 2: # Do not merge accounts if only one exists
gajim.interface.roster.regroup = gajim.config.get('mergeaccounts') gajim.interface.roster.regroup = gajim.config.get('mergeaccounts')
else: else:
gajim.interface.roster.regroup = False gajim.interface.roster.regroup = False
gajim.interface.roster.draw_roster() gajim.interface.roster.draw_roster()
def on_enable_zeroconf_checkbutton_toggled(self, widget):
if gajim.config.get('enable_zeroconf'):
#disable
gajim.interface.roster.close_all('zeroconf')
gajim.connections['zeroconf'].disable_account()
del gajim.connections['zeroconf']
gajim.interface.save_config()
del gajim.interface.instances['zeroconf']
del gajim.nicks['zeroconf']
del gajim.block_signed_in_notifications['zeroconf']
del gajim.groups['zeroconf']
gajim.contacts.remove_account('zeroconf')
del gajim.gc_connected['zeroconf']
del gajim.automatic_rooms['zeroconf']
del gajim.to_be_removed['zeroconf']
del gajim.newly_added['zeroconf']
del gajim.sleeper_state['zeroconf']
del gajim.encrypted_chats['zeroconf']
del gajim.last_message_time['zeroconf']
del gajim.status_before_autoaway['zeroconf']
if len(gajim.connections) >= 2: # Do not merge accounts if only one exists
gajim.interface.roster.regroup = gajim.config.get('mergeaccounts')
else:
gajim.interface.roster.regroup = False
gajim.interface.roster.draw_roster()
gajim.interface.roster.actions_menu_needs_rebuild = True
if gajim.interface.instances.has_key('accounts'):
gajim.interface.instances['accounts'].init_accounts()
else:
# enable (will create new account if not present)
gajim.connections['zeroconf'] = common.zeroconf.connection_zeroconf.ConnectionZeroconf('zeroconf')
# update variables
gajim.interface.instances['zeroconf'] = {'infos': {}, 'disco': {},
'gc_config': {}}
gajim.connections['zeroconf'].connected = 0
gajim.groups['zeroconf'] = {}
gajim.contacts.add_account('zeroconf')
gajim.gc_connected['zeroconf'] = {}
gajim.automatic_rooms['zeroconf'] = {}
gajim.newly_added['zeroconf'] = []
gajim.to_be_removed['zeroconf'] = []
gajim.nicks['zeroconf'] = 'zeroconf'
gajim.block_signed_in_notifications['zeroconf'] = True
gajim.sleeper_state['zeroconf'] = 'off'
gajim.encrypted_chats['zeroconf'] = []
gajim.last_message_time['zeroconf'] = {}
gajim.status_before_autoaway['zeroconf'] = ''
# refresh accounts window
if gajim.interface.instances.has_key('accounts'):
gajim.interface.instances['accounts'].init_accounts()
# refresh roster
if len(gajim.connections) >= 2: # Do not merge accounts if only one exists
gajim.interface.roster.regroup = gajim.config.get('mergeaccounts')
else:
gajim.interface.roster.regroup = False
gajim.interface.roster.draw_roster()
gajim.interface.roster.actions_menu_needs_rebuild = True
gajim.interface.save_config()
gajim.connections['zeroconf'].change_status('online', '')
self.on_checkbutton_toggled(widget, 'enable_zeroconf')
class DataFormWindow: class DataFormWindow:
def __init__(self, account, config): def __init__(self, account, config):
self.account = account self.account = account
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment