moved enable link-local messaging to accounts window
added tooltip to it
This commit is contained in:
		
							parent
							
								
									af6450bcfc
								
							
						
					
					
						commit
						7227ea0550
					
				
					 5 changed files with 124 additions and 193 deletions
				
			
		|  | @ -2,6 +2,7 @@ | |||
| <!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd"> | ||||
| 
 | ||||
| <glade-interface> | ||||
| 
 | ||||
| <widget class="GtkWindow" id="accounts_window"> | ||||
|   <property name="border_width">12</property> | ||||
|   <property name="title" translatable="yes">Accounts</property> | ||||
|  | @ -80,6 +81,37 @@ | |||
| 	</packing> | ||||
|       </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> | ||||
| 	<widget class="GtkHButtonBox" id="hbuttonbox15"> | ||||
| 	  <property name="visible">True</property> | ||||
|  | @ -267,4 +299,5 @@ | |||
|     </widget> | ||||
|   </child> | ||||
| </widget> | ||||
| 
 | ||||
| </glade-interface> | ||||
|  |  | |||
|  | @ -18,6 +18,7 @@ | |||
|   <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"/> | ||||
| 
 | ||||
|  | @ -146,118 +147,6 @@ | |||
| 		</packing> | ||||
| 	      </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> | ||||
| 		<widget class="GtkFrame" id="frame35"> | ||||
| 		  <property name="visible">True</property> | ||||
|  |  | |||
|  | @ -68,7 +68,7 @@ | |||
|   <child> | ||||
|     <widget class="GtkImageMenuItem" id="zeroconf_properties_menuitem"> | ||||
|       <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> | ||||
| 
 | ||||
|       <child internal-child="image"> | ||||
|  |  | |||
|  | @ -98,7 +98,7 @@ class ConnectionZeroconf(ConnectionHandlersZeroconf): | |||
| 			print 'Creating zeroconf account' | ||||
| 			gajim.config.add_per('accounts', 'zeroconf') | ||||
| 			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', 'sync_with_global_status', True) | ||||
| 
 | ||||
|  |  | |||
							
								
								
									
										167
									
								
								src/config.py
									
										
									
									
									
								
							
							
						
						
									
										167
									
								
								src/config.py
									
										
									
									
									
								
							|  | @ -95,10 +95,6 @@ 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) | ||||
|  | @ -528,75 +524,6 @@ class PreferencesWindow: | |||
| 		self.on_checkbutton_toggled(widget, 'sort_by_show') | ||||
| 		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): | ||||
| 		self.on_checkbutton_toggled(widget, 'show_status_msgs_in_roster') | ||||
| 		gajim.interface.roster.draw_roster() | ||||
|  | @ -1831,6 +1758,12 @@ class AccountsWindow: | |||
| 		st = gajim.config.get('mergeaccounts') | ||||
| 		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): | ||||
| 		if event.keyval == gtk.keysyms.Escape: | ||||
| 			self.window.destroy() | ||||
|  | @ -1842,9 +1775,8 @@ class AccountsWindow: | |||
| 		model = self.accounts_treeview.get_model() | ||||
| 		model.clear() | ||||
| 		for account in gajim.connections: | ||||
| #			if account != 'zeroconf': | ||||
| 				iter = model.append() | ||||
| 				model.set(iter, 0, account, 1, gajim.get_hostname_from_account(account)) | ||||
| 			iter = model.append() | ||||
| 			model.set(iter, 0, account, 1, gajim.get_hostname_from_account(account)) | ||||
| 
 | ||||
| 	def on_accounts_treeview_cursor_changed(self, widget): | ||||
| 		'''Activate delete and modify buttons when a row is selected''' | ||||
|  | @ -1885,7 +1817,14 @@ class AccountsWindow: | |||
| 		if not iter: | ||||
| 			return | ||||
| 		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): | ||||
| 		model = widget.get_model() | ||||
|  | @ -1899,15 +1838,85 @@ class AccountsWindow: | |||
| 			gajim.interface.instances[account]['account_modification'] = \ | ||||
| 				AccountModificationWindow(account) | ||||
| 
 | ||||
| 	def on_merge_checkbutton_toggled(self, widget): | ||||
| 		gajim.config.set('mergeaccounts', widget.get_active()) | ||||
| 	def on_checkbutton_toggled(self, widget, config_name, | ||||
| 		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() | ||||
| 
 | ||||
| 	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 | ||||
| 			gajim.interface.roster.regroup = gajim.config.get('mergeaccounts') | ||||
| 		else: | ||||
| 			gajim.interface.roster.regroup = False | ||||
| 		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: | ||||
| 	def __init__(self, account, config): | ||||
| 		self.account = account | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue