Configurartion code for one_window_type including mailing list comments
This commit is contained in:
		
							parent
							
								
									1b4bc0dedd
								
							
						
					
					
						commit
						1db1c7eddd
					
				
					 3 changed files with 24 additions and 21 deletions
				
			
		| 
						 | 
					@ -39,7 +39,7 @@ opt_int = [ 'integer', 0 ]
 | 
				
			||||||
opt_str = [ 'string', 0 ]
 | 
					opt_str = [ 'string', 0 ]
 | 
				
			||||||
opt_bool = [ 'boolean', 0 ]
 | 
					opt_bool = [ 'boolean', 0 ]
 | 
				
			||||||
opt_color = [ 'color', '^(#[0-9a-fA-F]{6})|()$' ]
 | 
					opt_color = [ 'color', '^(#[0-9a-fA-F]{6})|()$' ]
 | 
				
			||||||
opt_single_window_types = ['never', 'always', 'peracct', 'pertype']
 | 
					opt_one_window_types = ['never', 'always', 'peracct', 'pertype']
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class Config:
 | 
					class Config:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -83,8 +83,6 @@ class Config:
 | 
				
			||||||
		'saveposition': [ opt_bool, True ],
 | 
							'saveposition': [ opt_bool, True ],
 | 
				
			||||||
		'mergeaccounts': [ opt_bool, False ],
 | 
							'mergeaccounts': [ opt_bool, False ],
 | 
				
			||||||
		'sort_by_show': [ opt_bool, True ],
 | 
							'sort_by_show': [ opt_bool, True ],
 | 
				
			||||||
		# FIXME: Remove me
 | 
					 | 
				
			||||||
		'usetabbedchat': [ opt_bool, True ],
 | 
					 | 
				
			||||||
		'use_speller': [ opt_bool, False ],
 | 
							'use_speller': [ opt_bool, False ],
 | 
				
			||||||
		'print_time': [ opt_str, 'always' ],
 | 
							'print_time': [ opt_str, 'always' ],
 | 
				
			||||||
		'useemoticons': [ opt_bool, True ],
 | 
							'useemoticons': [ opt_bool, True ],
 | 
				
			||||||
| 
						 | 
					@ -175,7 +173,7 @@ class Config:
 | 
				
			||||||
		'hide_avatar_of_transport': [opt_bool, False],
 | 
							'hide_avatar_of_transport': [opt_bool, False],
 | 
				
			||||||
		'roster_window_skip_taskbar': [opt_bool, False],
 | 
							'roster_window_skip_taskbar': [opt_bool, False],
 | 
				
			||||||
		# TODO: Need to decide Gajim default.  methinks 'always'
 | 
							# TODO: Need to decide Gajim default.  methinks 'always'
 | 
				
			||||||
		'single_message_window': [opt_str, 'never',
 | 
							'one_message_window': [opt_str, 'never',
 | 
				
			||||||
			_('Controls the window where new messages are placed.\n\'always\' - All messages are sent to a single window.\n\'never\' - All messages get their own window.\n\'peracct\' - Messages for each account are sent to a specific window.\n\'pertype\' - Each message type (e.g., chats vs. groupchats) are sent to a specific window. Note, changing this option requires restarting Gajim before the changes will take effect')],
 | 
								_('Controls the window where new messages are placed.\n\'always\' - All messages are sent to a single window.\n\'never\' - All messages get their own window.\n\'peracct\' - Messages for each account are sent to a specific window.\n\'pertype\' - Each message type (e.g., chats vs. groupchats) are sent to a specific window. Note, changing this option requires restarting Gajim before the changes will take effect')],
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -93,6 +93,8 @@ class PreferencesWindow:
 | 
				
			||||||
		self.auto_xa_message_entry = self.xml.get_widget('auto_xa_message_entry')
 | 
							self.auto_xa_message_entry = self.xml.get_widget('auto_xa_message_entry')
 | 
				
			||||||
		self.trayicon_checkbutton = self.xml.get_widget('trayicon_checkbutton')
 | 
							self.trayicon_checkbutton = self.xml.get_widget('trayicon_checkbutton')
 | 
				
			||||||
		self.notebook = self.xml.get_widget('preferences_notebook')
 | 
							self.notebook = self.xml.get_widget('preferences_notebook')
 | 
				
			||||||
 | 
							self.one_window_type_combobox =\
 | 
				
			||||||
 | 
								self.xml.get_widget('one_window_type_combobox')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		#trayicon
 | 
							#trayicon
 | 
				
			||||||
		if gajim.interface.systray_capabilities:
 | 
							if gajim.interface.systray_capabilities:
 | 
				
			||||||
| 
						 | 
					@ -154,6 +156,14 @@ class PreferencesWindow:
 | 
				
			||||||
			if gajim.config.get('iconset') == l[i]:
 | 
								if gajim.config.get('iconset') == l[i]:
 | 
				
			||||||
				self.iconset_combobox.set_active(i)
 | 
									self.iconset_combobox.set_active(i)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							# Set default for single window type
 | 
				
			||||||
 | 
							choices = common.config.opt_one_window_types
 | 
				
			||||||
 | 
							type = gajim.config.get('one_message_window')
 | 
				
			||||||
 | 
							if type in choices:
 | 
				
			||||||
 | 
								self.one_window_type_combobox.set_active(choices.index(type))
 | 
				
			||||||
 | 
							else:
 | 
				
			||||||
 | 
								self.one_window_type_combobox.set_active(0)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		# Use transports iconsets
 | 
							# Use transports iconsets
 | 
				
			||||||
		st = gajim.config.get('use_transports_iconsets')
 | 
							st = gajim.config.get('use_transports_iconsets')
 | 
				
			||||||
		self.xml.get_widget('transports_iconsets_checkbutton').set_active(st)
 | 
							self.xml.get_widget('transports_iconsets_checkbutton').set_active(st)
 | 
				
			||||||
| 
						 | 
					@ -166,10 +176,6 @@ class PreferencesWindow:
 | 
				
			||||||
		model = gtk.ListStore(str)
 | 
							model = gtk.ListStore(str)
 | 
				
			||||||
		theme_combobox.set_model(model)
 | 
							theme_combobox.set_model(model)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		#use tabbed chat window
 | 
					 | 
				
			||||||
		st = gajim.config.get('usetabbedchat')
 | 
					 | 
				
			||||||
		self.xml.get_widget('use_tabbed_chat_window_checkbutton').set_active(st)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		#use speller
 | 
							#use speller
 | 
				
			||||||
		if os.name == 'nt':
 | 
							if os.name == 'nt':
 | 
				
			||||||
			self.xml.get_widget('speller_checkbutton').set_no_show_all(True)
 | 
								self.xml.get_widget('speller_checkbutton').set_no_show_all(True)
 | 
				
			||||||
| 
						 | 
					@ -538,6 +544,7 @@ class PreferencesWindow:
 | 
				
			||||||
		gajim.interface.roster.change_roster_style(None)
 | 
							gajim.interface.roster.change_roster_style(None)
 | 
				
			||||||
		gajim.interface.save_config()
 | 
							gajim.interface.save_config()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						# FIXME: Remove or implement for new window code
 | 
				
			||||||
	def merge_windows(self, kind):
 | 
						def merge_windows(self, kind):
 | 
				
			||||||
		for acct in gajim.connections:
 | 
							for acct in gajim.connections:
 | 
				
			||||||
			# save buffers and close windows
 | 
								# save buffers and close windows
 | 
				
			||||||
| 
						 | 
					@ -564,6 +571,7 @@ class PreferencesWindow:
 | 
				
			||||||
				window.message_textviews[jid].set_buffer(buf2[jid])
 | 
									window.message_textviews[jid].set_buffer(buf2[jid])
 | 
				
			||||||
				window.load_var(jid, saved_var[jid])
 | 
									window.load_var(jid, saved_var[jid])
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						# FIXME: Remove or implement for new window code
 | 
				
			||||||
	def split_windows(self, kind):
 | 
						def split_windows(self, kind):
 | 
				
			||||||
		for acct in gajim.connections:
 | 
							for acct in gajim.connections:
 | 
				
			||||||
			# save buffers and close tabbed chat windows
 | 
								# save buffers and close tabbed chat windows
 | 
				
			||||||
| 
						 | 
					@ -593,16 +601,12 @@ class PreferencesWindow:
 | 
				
			||||||
				window.message_textviews[jid].set_buffer(buf2[jid])
 | 
									window.message_textviews[jid].set_buffer(buf2[jid])
 | 
				
			||||||
				window.load_var(jid, saved_var[jid])
 | 
									window.load_var(jid, saved_var[jid])
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	def on_use_tabbed_chat_window_checkbutton_toggled(self, widget):
 | 
						def on_one_window_type_combo_changed(self, widget):
 | 
				
			||||||
		self.on_checkbutton_toggled(widget, 'usetabbedchat')
 | 
							active = widget.get_active()
 | 
				
			||||||
 | 
							config_type = common.config.opt_one_window_types[active]
 | 
				
			||||||
		if widget.get_active():
 | 
							gajim.config.set('one_message_window', config_type)
 | 
				
			||||||
			self.merge_windows('chats')
 | 
					 | 
				
			||||||
			self.merge_windows('gc')
 | 
					 | 
				
			||||||
		else:
 | 
					 | 
				
			||||||
			self.split_windows('chats')
 | 
					 | 
				
			||||||
			self.split_windows('gc')
 | 
					 | 
				
			||||||
		gajim.interface.save_config()
 | 
							gajim.interface.save_config()
 | 
				
			||||||
 | 
							# FIXME: Update current windows? Meh
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	def apply_speller(self, kind):
 | 
						def apply_speller(self, kind):
 | 
				
			||||||
		for acct in gajim.connections:
 | 
							for acct in gajim.connections:
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -3686,7 +3686,7 @@ Agent JID - node</property>
 | 
				
			||||||
		  <child>
 | 
							  <child>
 | 
				
			||||||
		    <widget class="GtkLabel" id="label379">
 | 
							    <widget class="GtkLabel" id="label379">
 | 
				
			||||||
		      <property name="visible">True</property>
 | 
							      <property name="visible">True</property>
 | 
				
			||||||
		      <property name="label" translatable="yes">Single message _window:</property>
 | 
							      <property name="label" translatable="yes">One message _window:</property>
 | 
				
			||||||
		      <property name="use_underline">True</property>
 | 
							      <property name="use_underline">True</property>
 | 
				
			||||||
		      <property name="use_markup">False</property>
 | 
							      <property name="use_markup">False</property>
 | 
				
			||||||
		      <property name="justify">GTK_JUSTIFY_LEFT</property>
 | 
							      <property name="justify">GTK_JUSTIFY_LEFT</property>
 | 
				
			||||||
| 
						 | 
					@ -3709,14 +3709,15 @@ Agent JID - node</property>
 | 
				
			||||||
		  </child>
 | 
							  </child>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		  <child>
 | 
							  <child>
 | 
				
			||||||
		    <widget class="GtkComboBox" id="message_window_type_combo">
 | 
							    <widget class="GtkComboBox" id="one_window_type_combobox">
 | 
				
			||||||
		      <property name="visible">True</property>
 | 
							      <property name="visible">True</property>
 | 
				
			||||||
		      <property name="items" translatable="yes">Always
 | 
							      <property name="items" translatable="yes">Never
 | 
				
			||||||
Never
 | 
					Always
 | 
				
			||||||
Per account
 | 
					Per account
 | 
				
			||||||
Per type</property>
 | 
					Per type</property>
 | 
				
			||||||
		      <property name="add_tearoffs">False</property>
 | 
							      <property name="add_tearoffs">False</property>
 | 
				
			||||||
		      <property name="focus_on_click">True</property>
 | 
							      <property name="focus_on_click">True</property>
 | 
				
			||||||
 | 
							      <signal name="changed" handler="on_single_window_type_combo_changed" last_modification_time="Wed, 28 Dec 2005 01:44:51 GMT"/>
 | 
				
			||||||
		    </widget>
 | 
							    </widget>
 | 
				
			||||||
		    <packing>
 | 
							    <packing>
 | 
				
			||||||
		      <property name="padding">0</property>
 | 
							      <property name="padding">0</property>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue