More fixes for #1386 - Window titles and one_message_window PERTYPE mode
This commit is contained in:
		
							parent
							
								
									f7d4bd7913
								
							
						
					
					
						commit
						3ab1fb3539
					
				
					 4 changed files with 14 additions and 10 deletions
				
			
		| 
						 | 
				
			
			@ -75,8 +75,8 @@ class ChatControlBase(MessageControl):
 | 
			
		|||
	def handle_message_textview_mykey_press(self, widget, event_keyval, event_keymod):
 | 
			
		||||
		pass # Derived should implement this rather than connecting to the event itself.
 | 
			
		||||
 | 
			
		||||
	def __init__(self, type_id, parent_win, widget_name, display_name, contact, acct):
 | 
			
		||||
		MessageControl.__init__(self, type_id, parent_win, widget_name, display_name,
 | 
			
		||||
	def __init__(self, type_id, parent_win, widget_name, display_names, contact, acct):
 | 
			
		||||
		MessageControl.__init__(self, type_id, parent_win, widget_name, display_names,
 | 
			
		||||
					contact, acct);
 | 
			
		||||
 | 
			
		||||
		# FIXME: These are hidden from 0.8 on, but IMO all these things need
 | 
			
		||||
| 
						 | 
				
			
			@ -695,7 +695,7 @@ class ChatControl(ChatControlBase):
 | 
			
		|||
 | 
			
		||||
	def __init__(self, parent_win, contact, acct):
 | 
			
		||||
		ChatControlBase.__init__(self, self.TYPE_ID, parent_win, 'chat_child_vbox',
 | 
			
		||||
				         _('Chat'), contact, acct)
 | 
			
		||||
					(_('Chat'), _('Chats')), contact, acct)
 | 
			
		||||
		self.compact_view_always = gajim.config.get('always_compact_view_chat')
 | 
			
		||||
		self.set_compact_view(self.compact_view_always)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -69,7 +69,7 @@ class PrivateChatControl(ChatControl):
 | 
			
		|||
	def __init__(self, parent_win, contact, acct):
 | 
			
		||||
		ChatControl.__init__(self, parent_win, contact, acct)
 | 
			
		||||
		self.TYPE_ID = 'pm'
 | 
			
		||||
		self.display_name = _('Private chat')
 | 
			
		||||
		self.display_names = (_('Private Chat'), _('Private Chats'))
 | 
			
		||||
 | 
			
		||||
	def send_message(self, message):
 | 
			
		||||
		'''call this function to send our message'''
 | 
			
		||||
| 
						 | 
				
			
			@ -99,7 +99,8 @@ class GroupchatControl(ChatControlBase):
 | 
			
		|||
 | 
			
		||||
	def __init__(self, parent_win, contact, acct):
 | 
			
		||||
		ChatControlBase.__init__(self, self.TYPE_ID, parent_win,
 | 
			
		||||
					'muc_child_vbox', _('Group Chat'), contact, acct);
 | 
			
		||||
					'muc_child_vbox', (_('Group Chat'), _('Group Chats')),
 | 
			
		||||
					contact, acct);
 | 
			
		||||
 | 
			
		||||
		self.room_jid = self.contact.jid
 | 
			
		||||
		self.nick = contact.name
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -37,11 +37,13 @@ GTKGUI_GLADE = 'gtkgui.glade'
 | 
			
		|||
class MessageControl:
 | 
			
		||||
	'''An abstract base widget that can embed in the gtk.Notebook of a MessageWindow'''
 | 
			
		||||
 | 
			
		||||
	def __init__(self, type_id, parent_win, widget_name, display_name, contact, account):
 | 
			
		||||
	def __init__(self, type_id, parent_win, widget_name, display_names, contact, account):
 | 
			
		||||
		'''The display_names argument is a two element tuple containing the desired
 | 
			
		||||
		display name (pretty string) for the control in both singular and plural form'''
 | 
			
		||||
		self.type_id = type_id
 | 
			
		||||
		self.parent_win = parent_win
 | 
			
		||||
		self.widget_name = widget_name
 | 
			
		||||
		self.display_name = display_name
 | 
			
		||||
		self.display_names = display_names
 | 
			
		||||
		self.contact = contact
 | 
			
		||||
		self.account = account
 | 
			
		||||
		self.compact_view_always = False
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -220,10 +220,11 @@ class MessageWindow:
 | 
			
		|||
			name = control.contact.get_shown_name()
 | 
			
		||||
 | 
			
		||||
		window_mode = gajim.interface.msg_win_mgr.mode
 | 
			
		||||
		if window_mode == MessageWindowMgr.ONE_MSG_WINDOW_PERTYPE:
 | 
			
		||||
			label = control.display_name
 | 
			
		||||
		elif self.get_num_controls() == 1:
 | 
			
		||||
		if self.get_num_controls() == 1:
 | 
			
		||||
			label = name
 | 
			
		||||
		elif window_mode == MessageWindowMgr.ONE_MSG_WINDOW_PERTYPE:
 | 
			
		||||
			# Show the plural form since number of tabs > 1
 | 
			
		||||
			label = control.display_names[1]
 | 
			
		||||
		else:
 | 
			
		||||
			label = _('Messages')
 | 
			
		||||
		title = _('%s - Gajim') % label
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue