merge / split group chat windows on the fly
This commit is contained in:
		
							parent
							
								
									9377f0223b
								
							
						
					
					
						commit
						bce9902708
					
				
					 2 changed files with 28 additions and 4 deletions
				
			
		|  | @ -197,9 +197,11 @@ class Preferences_window: | ||||||
| 				window.window.destroy() | 				window.window.destroy() | ||||||
| 			#open new tabbed chat windows | 			#open new tabbed chat windows | ||||||
| 			for jid in jids: | 			for jid in jids: | ||||||
| 				user = self.plugin.roster.contacts[acct][jid][0] |  | ||||||
| 				if kind == 'chats': | 				if kind == 'chats': | ||||||
|  | 					user = self.plugin.roster.contacts[acct][jid][0] | ||||||
| 					self.plugin.roster.new_chat(user, acct) | 					self.plugin.roster.new_chat(user, acct) | ||||||
|  | 				if kind == 'gc': | ||||||
|  | 					self.plugin.roster.new_room(jid, saved_var[jid]['nick'], acct) | ||||||
| 				window = windows[jid] | 				window = windows[jid] | ||||||
| 				window.xmls[jid].get_widget('conversation_textview').set_buffer(\ | 				window.xmls[jid].get_widget('conversation_textview').set_buffer(\ | ||||||
| 					buf1[jid]) | 					buf1[jid]) | ||||||
|  | @ -228,9 +230,11 @@ class Preferences_window: | ||||||
| 			windows['tabbed'].window.destroy() | 			windows['tabbed'].window.destroy() | ||||||
| 			#open new tabbed chat windows | 			#open new tabbed chat windows | ||||||
| 			for jid in jids: | 			for jid in jids: | ||||||
| 				user = self.plugin.roster.contacts[acct][jid][0] |  | ||||||
| 				if kind == 'chats': | 				if kind == 'chats': | ||||||
|  | 					user = self.plugin.roster.contacts[acct][jid][0] | ||||||
| 					self.plugin.roster.new_chat(user, acct) | 					self.plugin.roster.new_chat(user, acct) | ||||||
|  | 				if kind == 'gc': | ||||||
|  | 					self.plugin.roster.new_room(jid, saved_var[jid]['nick'], acct) | ||||||
| 				window = windows[jid] | 				window = windows[jid] | ||||||
| 				window.xmls[jid].get_widget('conversation_textview').set_buffer(\ | 				window.xmls[jid].get_widget('conversation_textview').set_buffer(\ | ||||||
| 					buf1[jid]) | 					buf1[jid]) | ||||||
|  | @ -242,9 +246,11 @@ class Preferences_window: | ||||||
| 		if widget.get_active(): | 		if widget.get_active(): | ||||||
| 			gajim.config.set('usetabbedchat', True) | 			gajim.config.set('usetabbedchat', True) | ||||||
| 			self.merge_windows('chats') | 			self.merge_windows('chats') | ||||||
|  | 			self.merge_windows('gc') | ||||||
| 		else: | 		else: | ||||||
| 			gajim.config.set('usetabbedchat', False) | 			gajim.config.set('usetabbedchat', False) | ||||||
| 			self.split_windows('chats') | 			self.split_windows('chats') | ||||||
|  | 			self.split_windows('gc') | ||||||
| 		self.plugin.save_config() | 		self.plugin.save_config() | ||||||
| 	 | 	 | ||||||
| 	def update_print_time(self): | 	def update_print_time(self): | ||||||
|  |  | ||||||
|  | @ -60,6 +60,24 @@ class Groupchat_window(chat.Chat): | ||||||
| 			self.on_set_button_clicked) | 			self.on_set_button_clicked) | ||||||
| 		self.xml.signal_connect('on_configure_button_clicked', \ | 		self.xml.signal_connect('on_configure_button_clicked', \ | ||||||
| 			self.on_configure_button_clicked) | 			self.on_configure_button_clicked) | ||||||
|  | 		self.window.show_all() | ||||||
|  | 
 | ||||||
|  | 	def save_var(self, jid): | ||||||
|  | 		if not jid in self.nicks: | ||||||
|  | 			return {} | ||||||
|  | 		return { | ||||||
|  | 			'nick': self.nicks[jid], | ||||||
|  | 			'model': self.list_treeview[jid].get_model(), | ||||||
|  | 			'subject': self.subjects[jid], | ||||||
|  | 		} | ||||||
|  | 		 | ||||||
|  | 
 | ||||||
|  | 	def load_var(self, jid, var): | ||||||
|  | 		if not self.xmls.has_key(jid): | ||||||
|  | 			return | ||||||
|  | 		self.list_treeview[jid].set_model(var['model']) | ||||||
|  | 		self.list_treeview[jid].expand_all() | ||||||
|  | 		self.set_subject(jid, var['subject']) | ||||||
| 
 | 
 | ||||||
| 	def on_groupchat_window_delete_event(self, widget, event): | 	def on_groupchat_window_delete_event(self, widget, event): | ||||||
| 		"""close window""" | 		"""close window""" | ||||||
|  | @ -69,11 +87,11 @@ class Groupchat_window(chat.Chat): | ||||||
| 					room_jid.split('@')[0]) | 					room_jid.split('@')[0]) | ||||||
| 				if dialog.get_response() != gtk.RESPONSE_YES: | 				if dialog.get_response() != gtk.RESPONSE_YES: | ||||||
| 					return True #stop the propagation of the event | 					return True #stop the propagation of the event | ||||||
| 	 |  | ||||||
| 	def on_groupchat_window_destroy(self, widget): |  | ||||||
| 		for room_jid in self.xmls: | 		for room_jid in self.xmls: | ||||||
| 			gajim.connections[self.account].send_gc_status(self.nicks[room_jid], \ | 			gajim.connections[self.account].send_gc_status(self.nicks[room_jid], \ | ||||||
| 				room_jid, 'offline', 'offline') | 				room_jid, 'offline', 'offline') | ||||||
|  | 	 | ||||||
|  | 	def on_groupchat_window_destroy(self, widget): | ||||||
| 		chat.Chat.on_window_destroy(self, widget, 'gc') | 		chat.Chat.on_window_destroy(self, widget, 'gc') | ||||||
| 
 | 
 | ||||||
| 	def on_groupchat_window_focus_in_event(self, widget, event): | 	def on_groupchat_window_focus_in_event(self, widget, event): | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue