use C_NAME instead of 0 1 2 3 4 5 6 in roster py
This commit is contained in:
		
							parent
							
								
									2e4b5245c1
								
							
						
					
					
						commit
						02be379d83
					
				
					 1 changed files with 66 additions and 54 deletions
				
			
		| 
						 | 
					@ -44,6 +44,18 @@ APP = i18n.APP
 | 
				
			||||||
gtk.glade.bindtextdomain(APP, i18n.DIR)
 | 
					gtk.glade.bindtextdomain(APP, i18n.DIR)
 | 
				
			||||||
gtk.glade.textdomain(APP)
 | 
					gtk.glade.textdomain(APP)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#(icon, name, type, jid, account, editable, s)
 | 
				
			||||||
 | 
					(
 | 
				
			||||||
 | 
					C_IMG, # image to show state (online, new message etc)
 | 
				
			||||||
 | 
					C_NAME, # cellrenderer text that holds contact nickame
 | 
				
			||||||
 | 
					C_TYPE, # account, group or contact?
 | 
				
			||||||
 | 
					C_JID, # the jid of the row <nk is not sure>
 | 
				
			||||||
 | 
					C_ACCOUNT, # cellrenderer text that holds account name
 | 
				
			||||||
 | 
					C_EDITABLE, # cellrenderer text that holds name editable or not?
 | 
				
			||||||
 | 
					C_SECPIXBUF, # econdary_pixbuf
 | 
				
			||||||
 | 
					) = range(7)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
GTKGUI_GLADE = 'gtkgui.glade'
 | 
					GTKGUI_GLADE = 'gtkgui.glade'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class RosterWindow:
 | 
					class RosterWindow:
 | 
				
			||||||
| 
						 | 
					@ -647,10 +659,10 @@ class RosterWindow:
 | 
				
			||||||
			except:
 | 
								except:
 | 
				
			||||||
				self.tooltip.hide_tooltip()
 | 
									self.tooltip.hide_tooltip()
 | 
				
			||||||
				return
 | 
									return
 | 
				
			||||||
			if model[iter][2] == 'contact':
 | 
								if model[iter][C_TYPE] == 'contact':
 | 
				
			||||||
				account = model[iter][4].decode('utf-8')
 | 
									account = model[iter][C_ACCOUNT].decode('utf-8')
 | 
				
			||||||
				jid = model[iter][3].decode('utf-8')
 | 
									jid = model[iter][C_JID].decode('utf-8')
 | 
				
			||||||
				img = model[iter][0]
 | 
									img = model[iter][C_IMG]
 | 
				
			||||||
				if self.tooltip.timeout == 0 or self.tooltip.id != props[0]:
 | 
									if self.tooltip.timeout == 0 or self.tooltip.id != props[0]:
 | 
				
			||||||
					self.tooltip.id = row
 | 
										self.tooltip.id = row
 | 
				
			||||||
					self.tooltip.timeout = gobject.timeout_add(500,
 | 
										self.tooltip.timeout = gobject.timeout_add(500,
 | 
				
			||||||
| 
						 | 
					@ -692,17 +704,17 @@ class RosterWindow:
 | 
				
			||||||
	def on_rename(self, widget, iter, path):
 | 
						def on_rename(self, widget, iter, path):
 | 
				
			||||||
		model = self.tree.get_model()
 | 
							model = self.tree.get_model()
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		row_type = model[iter][2]
 | 
							row_type = model[iter][C_TYPE]
 | 
				
			||||||
		jid = model[iter][3].decode('utf-8')
 | 
							jid = model[iter][C_JID].decode('utf-8')
 | 
				
			||||||
		account = model[iter][4].decode('utf-8')
 | 
							account = model[iter][C_ACCOUNT].decode('utf-8')
 | 
				
			||||||
		if row_type == 'contact':
 | 
							if row_type == 'contact':
 | 
				
			||||||
			# it's jid
 | 
								# it's jid
 | 
				
			||||||
			#Remove resource indicator (Name (2))
 | 
								#Remove resource indicator (Name (2))
 | 
				
			||||||
			contacts = gajim.contacts[account][jid]
 | 
								contacts = gajim.contacts[account][jid]
 | 
				
			||||||
			name = contacts[0].name
 | 
								name = contacts[0].name
 | 
				
			||||||
			model[iter][1] = name
 | 
								model[iter][C_NAME] = name
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		model[iter][5] = True # set 'editable' to True
 | 
							model[iter][C_EDITABLE] = True # set 'editable' to True
 | 
				
			||||||
		self.tree.set_cursor(path, self.tree.get_column(0), True)
 | 
							self.tree.set_cursor(path, self.tree.get_column(0), True)
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
	def on_assign_pgp_key(self, widget, user, account):
 | 
						def on_assign_pgp_key(self, widget, user, account):
 | 
				
			||||||
| 
						 | 
					@ -761,9 +773,9 @@ class RosterWindow:
 | 
				
			||||||
	def mk_menu_user(self, event, iter):
 | 
						def mk_menu_user(self, event, iter):
 | 
				
			||||||
		'''Make contact's popup menu'''
 | 
							'''Make contact's popup menu'''
 | 
				
			||||||
		model = self.tree.get_model()
 | 
							model = self.tree.get_model()
 | 
				
			||||||
		jid = model[iter][3].decode('utf-8')
 | 
							jid = model[iter][C_JID].decode('utf-8')
 | 
				
			||||||
		path = model.get_path(iter)
 | 
							path = model.get_path(iter)
 | 
				
			||||||
		account = model[iter][4].decode('utf-8')
 | 
							account = model[iter][C_ACCOUNT].decode('utf-8')
 | 
				
			||||||
		contact = gajim.get_highest_prio_contact_from_contacts(
 | 
							contact = gajim.get_highest_prio_contact_from_contacts(
 | 
				
			||||||
			gajim.contacts[account][jid])
 | 
								gajim.contacts[account][jid])
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
| 
						 | 
					@ -864,9 +876,9 @@ class RosterWindow:
 | 
				
			||||||
	def mk_menu_agent(self, event, iter):
 | 
						def mk_menu_agent(self, event, iter):
 | 
				
			||||||
		'''Make agent's popup menu'''
 | 
							'''Make agent's popup menu'''
 | 
				
			||||||
		model = self.tree.get_model()
 | 
							model = self.tree.get_model()
 | 
				
			||||||
		jid = model[iter][3].decode('utf-8')
 | 
							jid = model[iter][C_JID].decode('utf-8')
 | 
				
			||||||
		path = model.get_path(iter)
 | 
							path = model.get_path(iter)
 | 
				
			||||||
		account = model[iter][4].decode('utf-8')
 | 
							account = model[iter][C_ACCOUNT].decode('utf-8')
 | 
				
			||||||
		user = gajim.contacts[account][jid][0]
 | 
							user = gajim.contacts[account][jid][0]
 | 
				
			||||||
		menu = gtk.Menu()
 | 
							menu = gtk.Menu()
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
| 
						 | 
					@ -928,7 +940,7 @@ class RosterWindow:
 | 
				
			||||||
	def mk_menu_account(self, event, iter):
 | 
						def mk_menu_account(self, event, iter):
 | 
				
			||||||
		'''Make account's popup menu'''
 | 
							'''Make account's popup menu'''
 | 
				
			||||||
		model = self.tree.get_model()
 | 
							model = self.tree.get_model()
 | 
				
			||||||
		account = model[iter][3].decode('utf-8')
 | 
							account = model[iter][C_JID].decode('utf-8')
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		#FIXME: make most menuitems of this menu insensitive if account is offline
 | 
							#FIXME: make most menuitems of this menu insensitive if account is offline
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1046,7 +1058,7 @@ _('If "%s" accepts this request you will know his status.') %jid)
 | 
				
			||||||
			model, iter = treeselection.get_selected()
 | 
								model, iter = treeselection.get_selected()
 | 
				
			||||||
			if not iter:
 | 
								if not iter:
 | 
				
			||||||
				return
 | 
									return
 | 
				
			||||||
			type = model[iter][2]
 | 
								type = model[iter][C_TYPE]
 | 
				
			||||||
			if type in ('contact', 'group'):
 | 
								if type in ('contact', 'group'):
 | 
				
			||||||
				path = model.get_path(iter)
 | 
									path = model.get_path(iter)
 | 
				
			||||||
				self.on_rename(widget, iter, path)
 | 
									self.on_rename(widget, iter, path)
 | 
				
			||||||
| 
						 | 
					@ -1056,9 +1068,9 @@ _('If "%s" accepts this request you will know his status.') %jid)
 | 
				
			||||||
			model, iter = treeselection.get_selected()
 | 
								model, iter = treeselection.get_selected()
 | 
				
			||||||
			if not iter:
 | 
								if not iter:
 | 
				
			||||||
				return
 | 
									return
 | 
				
			||||||
			jid = model[iter][3].decode('utf-8')
 | 
								jid = model[iter][C_JID].decode('utf-8')
 | 
				
			||||||
			account = model[iter][4].decode('utf-8')
 | 
								account = model[iter][C_ACCOUNT].decode('utf-8')
 | 
				
			||||||
			type = model[iter][2]
 | 
								type = model[iter][C_TYPE]
 | 
				
			||||||
			if type in ('account', 'group'):
 | 
								if type in ('account', 'group'):
 | 
				
			||||||
				return
 | 
									return
 | 
				
			||||||
			user = gajim.contacts[account][jid][0]
 | 
								user = gajim.contacts[account][jid][0]
 | 
				
			||||||
| 
						 | 
					@ -1069,7 +1081,7 @@ _('If "%s" accepts this request you will know his status.') %jid)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	def show_appropriate_context_menu(self, event, iter):
 | 
						def show_appropriate_context_menu(self, event, iter):
 | 
				
			||||||
		model = self.tree.get_model()
 | 
							model = self.tree.get_model()
 | 
				
			||||||
		type = model[iter][2]
 | 
							type = model[iter][C_TYPE]
 | 
				
			||||||
		if type == 'group':
 | 
							if type == 'group':
 | 
				
			||||||
			self.mk_menu_g(event, iter)
 | 
								self.mk_menu_g(event, iter)
 | 
				
			||||||
		elif type == 'agent':
 | 
							elif type == 'agent':
 | 
				
			||||||
| 
						 | 
					@ -1119,10 +1131,10 @@ _('If "%s" accepts this request you will know his status.') %jid)
 | 
				
			||||||
			self.tree.get_selection().select_path(path)
 | 
								self.tree.get_selection().select_path(path)
 | 
				
			||||||
			model = self.tree.get_model()
 | 
								model = self.tree.get_model()
 | 
				
			||||||
			iter = model.get_iter(path)
 | 
								iter = model.get_iter(path)
 | 
				
			||||||
			type = model[iter][2]
 | 
								type = model[iter][C_TYPE]
 | 
				
			||||||
			if type in ('agent', 'contact'):
 | 
								if type in ('agent', 'contact'):
 | 
				
			||||||
				account = model[iter][4].decode('utf-8')
 | 
									account = model[iter][C_ACCOUNT].decode('utf-8')
 | 
				
			||||||
				jid = model[iter][3].decode('utf-8')
 | 
									jid = model[iter][C_JID].decode('utf-8')
 | 
				
			||||||
				if self.plugin.windows[account]['chats'].has_key(jid):
 | 
									if self.plugin.windows[account]['chats'].has_key(jid):
 | 
				
			||||||
					self.plugin.windows[account]['chats'][jid].set_active_tab(jid)
 | 
										self.plugin.windows[account]['chats'][jid].set_active_tab(jid)
 | 
				
			||||||
				elif gajim.contacts[account].has_key(jid):
 | 
									elif gajim.contacts[account].has_key(jid):
 | 
				
			||||||
| 
						 | 
					@ -1141,7 +1153,7 @@ _('If "%s" accepts this request you will know his status.') %jid)
 | 
				
			||||||
				return False
 | 
									return False
 | 
				
			||||||
			model = self.tree.get_model()
 | 
								model = self.tree.get_model()
 | 
				
			||||||
			iter = model.get_iter(path)
 | 
								iter = model.get_iter(path)
 | 
				
			||||||
			type = model[iter][2]
 | 
								type = model[iter][C_TYPE]
 | 
				
			||||||
			if type == 'group':
 | 
								if type == 'group':
 | 
				
			||||||
				if x < 20: # first cell in 1st column (the arrow SINGLE clicked)
 | 
									if x < 20: # first cell in 1st column (the arrow SINGLE clicked)
 | 
				
			||||||
					if (self.tree.row_expanded(path)):
 | 
										if (self.tree.row_expanded(path)):
 | 
				
			||||||
| 
						 | 
					@ -1609,9 +1621,9 @@ _('If "%s" accepts this request you will know his status.') %jid)
 | 
				
			||||||
		'''When an iter is double clicked: open the chat window'''
 | 
							'''When an iter is double clicked: open the chat window'''
 | 
				
			||||||
		model = self.tree.get_model()
 | 
							model = self.tree.get_model()
 | 
				
			||||||
		iter = model.get_iter(path)
 | 
							iter = model.get_iter(path)
 | 
				
			||||||
		account = model[iter][4].decode('utf-8')
 | 
							account = model[iter][C_ACCOUNT].decode('utf-8')
 | 
				
			||||||
		type = model[iter][2]
 | 
							type = model[iter][C_TYPE]
 | 
				
			||||||
		jid = model[iter][3].decode('utf-8')
 | 
							jid = model[iter][C_JID].decode('utf-8')
 | 
				
			||||||
		if type in ('group', 'account'):
 | 
							if type in ('group', 'account'):
 | 
				
			||||||
			if self.tree.row_expanded(path):
 | 
								if self.tree.row_expanded(path):
 | 
				
			||||||
				self.tree.collapse_row(path)
 | 
									self.tree.collapse_row(path)
 | 
				
			||||||
| 
						 | 
					@ -1632,11 +1644,11 @@ _('If "%s" accepts this request you will know his status.') %jid)
 | 
				
			||||||
		if gajim.config.get('mergeaccounts') or len(gajim.connections) == 1:
 | 
							if gajim.config.get('mergeaccounts') or len(gajim.connections) == 1:
 | 
				
			||||||
			accounts = gajim.connections.keys()
 | 
								accounts = gajim.connections.keys()
 | 
				
			||||||
		else:
 | 
							else:
 | 
				
			||||||
			accounts = [model[iter][4].decode('utf-8')]
 | 
								accounts = [model[iter][C_ACCOUNT].decode('utf-8')]
 | 
				
			||||||
		type = model[iter][2]
 | 
							type = model[iter][C_TYPE]
 | 
				
			||||||
		if type == 'group':
 | 
							if type == 'group':
 | 
				
			||||||
			model.set_value(iter, 0, self.jabber_state_images['opened'])
 | 
								model.set_value(iter, 0, self.jabber_state_images['opened'])
 | 
				
			||||||
			jid = model[iter][3].decode('utf-8')
 | 
								jid = model[iter][C_JID].decode('utf-8')
 | 
				
			||||||
			for account in accounts:
 | 
								for account in accounts:
 | 
				
			||||||
				if gajim.groups[account].has_key(jid): # This account has this group
 | 
									if gajim.groups[account].has_key(jid): # This account has this group
 | 
				
			||||||
					gajim.groups[account][jid]['expand'] = True
 | 
										gajim.groups[account][jid]['expand'] = True
 | 
				
			||||||
| 
						 | 
					@ -1659,11 +1671,11 @@ _('If "%s" accepts this request you will know his status.') %jid)
 | 
				
			||||||
		if gajim.config.get('mergeaccounts') or len(gajim.connections) == 1:
 | 
							if gajim.config.get('mergeaccounts') or len(gajim.connections) == 1:
 | 
				
			||||||
			accounts = gajim.connections.keys()
 | 
								accounts = gajim.connections.keys()
 | 
				
			||||||
		else:
 | 
							else:
 | 
				
			||||||
			accounts = [model[iter][4].decode('utf-8')]
 | 
								accounts = [model[iter][C_ACCOUNT].decode('utf-8')]
 | 
				
			||||||
		type = model[iter][2]
 | 
							type = model[iter][C_TYPE]
 | 
				
			||||||
		if type == 'group':
 | 
							if type == 'group':
 | 
				
			||||||
			model.set_value(iter, 0, self.jabber_state_images['closed'])
 | 
								model.set_value(iter, 0, self.jabber_state_images['closed'])
 | 
				
			||||||
			jid = model[iter][3].decode('utf-8')
 | 
								jid = model[iter][C_JID].decode('utf-8')
 | 
				
			||||||
			for account in accounts:
 | 
								for account in accounts:
 | 
				
			||||||
				if gajim.groups[account].has_key(jid): # This account has this group
 | 
									if gajim.groups[account].has_key(jid): # This account has this group
 | 
				
			||||||
					gajim.groups[account][jid]['expand'] = False
 | 
										gajim.groups[account][jid]['expand'] = False
 | 
				
			||||||
| 
						 | 
					@ -1689,14 +1701,14 @@ _('If "%s" accepts this request you will know his status.') %jid)
 | 
				
			||||||
		self.editing_path = None
 | 
							self.editing_path = None
 | 
				
			||||||
		model = self.tree.get_model()
 | 
							model = self.tree.get_model()
 | 
				
			||||||
		iter = model.get_iter(path)
 | 
							iter = model.get_iter(path)
 | 
				
			||||||
		account = model[iter][4].decode('utf-8')
 | 
							account = model[iter][C_ACCOUNT].decode('utf-8')
 | 
				
			||||||
		jid = model[iter][3].decode('utf-8')
 | 
							jid = model[iter][C_JID].decode('utf-8')
 | 
				
			||||||
		type = model[iter][2]
 | 
							type = model[iter][C_TYPE]
 | 
				
			||||||
		# restore the number of resources string at the end of contact name
 | 
							# restore the number of resources string at the end of contact name
 | 
				
			||||||
		if type == 'contact' and len(gajim.contacts[account][jid]) > 1:
 | 
							if type == 'contact' and len(gajim.contacts[account][jid]) > 1:
 | 
				
			||||||
			self.draw_contact(jid, account)
 | 
								self.draw_contact(jid, account)
 | 
				
			||||||
		# reset editable to False
 | 
							# reset editable to False
 | 
				
			||||||
		model[iter][5] = False
 | 
							model[iter][C_EDITABLE] = False
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	def on_cell_edited(self, cell, row, new_text):
 | 
						def on_cell_edited(self, cell, row, new_text):
 | 
				
			||||||
		'''When an iter is edited:
 | 
							'''When an iter is edited:
 | 
				
			||||||
| 
						 | 
					@ -1715,9 +1727,9 @@ _('If "%s" accepts this request you will know his status.') %jid)
 | 
				
			||||||
			return
 | 
								return
 | 
				
			||||||
		self.editing_path = None
 | 
							self.editing_path = None
 | 
				
			||||||
		new_text = new_text.decode('utf-8')
 | 
							new_text = new_text.decode('utf-8')
 | 
				
			||||||
		account = model[iter][4].decode('utf-8')
 | 
							account = model[iter][C_ACCOUNT].decode('utf-8')
 | 
				
			||||||
		jid = model[iter][3].decode('utf-8')
 | 
							jid = model[iter][C_JID].decode('utf-8')
 | 
				
			||||||
		type = model[iter][2]
 | 
							type = model[iter][C_TYPE]
 | 
				
			||||||
		if type == 'contact':
 | 
							if type == 'contact':
 | 
				
			||||||
			old_text = gajim.contacts[account][jid][0].name
 | 
								old_text = gajim.contacts[account][jid][0].name
 | 
				
			||||||
			if old_text != new_text:
 | 
								if old_text != new_text:
 | 
				
			||||||
| 
						 | 
					@ -1726,7 +1738,7 @@ _('If "%s" accepts this request you will know his status.') %jid)
 | 
				
			||||||
				gajim.connections[account].update_contact(jid, new_text, u.groups)
 | 
									gajim.connections[account].update_contact(jid, new_text, u.groups)
 | 
				
			||||||
			self.draw_contact(jid, account)
 | 
								self.draw_contact(jid, account)
 | 
				
			||||||
		elif type == 'group':
 | 
							elif type == 'group':
 | 
				
			||||||
			old_name = model[iter][1].decode('utf-8')
 | 
								old_name = model[iter][C_NAME].decode('utf-8')
 | 
				
			||||||
			#  Groups maynot change name from or to 'not in the roster'
 | 
								#  Groups maynot change name from or to 'not in the roster'
 | 
				
			||||||
			if _('not in the roster') in (new_text, old_name):
 | 
								if _('not in the roster') in (new_text, old_name):
 | 
				
			||||||
				return
 | 
									return
 | 
				
			||||||
| 
						 | 
					@ -1789,7 +1801,7 @@ _('If "%s" accepts this request you will know his status.') %jid)
 | 
				
			||||||
		model = self.status_combobox.get_model()
 | 
							model = self.status_combobox.get_model()
 | 
				
			||||||
		iter = model.get_iter_root()
 | 
							iter = model.get_iter_root()
 | 
				
			||||||
		while iter:
 | 
							while iter:
 | 
				
			||||||
			model.set_value(iter, 1, self.jabber_state_images[model[iter][2]])
 | 
								model.set_value(iter, 1, self.jabber_state_images[model[iter][C_TYPE]])
 | 
				
			||||||
			iter = model.iter_next(iter)
 | 
								iter = model.iter_next(iter)
 | 
				
			||||||
		# Update the systray
 | 
							# Update the systray
 | 
				
			||||||
		if self.plugin.systray_enabled:
 | 
							if self.plugin.systray_enabled:
 | 
				
			||||||
| 
						 | 
					@ -1823,17 +1835,17 @@ _('If "%s" accepts this request you will know his status.') %jid)
 | 
				
			||||||
	def iconCellDataFunc(self, column, renderer, model, iter, data = None):
 | 
						def iconCellDataFunc(self, column, renderer, model, iter, data = None):
 | 
				
			||||||
		'''When a row is added, set properties for icon renderer'''
 | 
							'''When a row is added, set properties for icon renderer'''
 | 
				
			||||||
		theme = gajim.config.get('roster_theme')
 | 
							theme = gajim.config.get('roster_theme')
 | 
				
			||||||
		if model[iter][2] == 'account':
 | 
							if model[iter][C_TYPE] == 'account':
 | 
				
			||||||
			renderer.set_property('cell-background', 
 | 
								renderer.set_property('cell-background', 
 | 
				
			||||||
				gajim.config.get_per('themes', theme, 'accountbgcolor'))
 | 
									gajim.config.get_per('themes', theme, 'accountbgcolor'))
 | 
				
			||||||
			renderer.set_property('xalign', 0)
 | 
								renderer.set_property('xalign', 0)
 | 
				
			||||||
		elif model[iter][2] == 'group':
 | 
							elif model[iter][C_TYPE] == 'group':
 | 
				
			||||||
			renderer.set_property('cell-background', 
 | 
								renderer.set_property('cell-background', 
 | 
				
			||||||
				gajim.config.get_per('themes', theme, 'groupbgcolor'))
 | 
									gajim.config.get_per('themes', theme, 'groupbgcolor'))
 | 
				
			||||||
			renderer.set_property('xalign', 0.5)
 | 
								renderer.set_property('xalign', 0.5)
 | 
				
			||||||
		else:
 | 
							else:
 | 
				
			||||||
			jid = model[iter][3].decode('utf-8')
 | 
								jid = model[iter][C_JID].decode('utf-8')
 | 
				
			||||||
			account = model[iter][4].decode('utf-8')
 | 
								account = model[iter][C_ACCOUNT].decode('utf-8')
 | 
				
			||||||
			if jid in gajim.newly_added[account]:
 | 
								if jid in gajim.newly_added[account]:
 | 
				
			||||||
				renderer.set_property('cell-background', '#adc3c6')
 | 
									renderer.set_property('cell-background', '#adc3c6')
 | 
				
			||||||
			elif jid in gajim.to_be_removed[account]:
 | 
								elif jid in gajim.to_be_removed[account]:
 | 
				
			||||||
| 
						 | 
					@ -1847,7 +1859,7 @@ _('If "%s" accepts this request you will know his status.') %jid)
 | 
				
			||||||
	def nameCellDataFunc(self, column, renderer, model, iter, data = None):
 | 
						def nameCellDataFunc(self, column, renderer, model, iter, data = None):
 | 
				
			||||||
		'''When a row is added, set properties for name renderer'''
 | 
							'''When a row is added, set properties for name renderer'''
 | 
				
			||||||
		theme = gajim.config.get('roster_theme')
 | 
							theme = gajim.config.get('roster_theme')
 | 
				
			||||||
		if model[iter][2] == 'account':
 | 
							if model[iter][C_TYPE] == 'account':
 | 
				
			||||||
			renderer.set_property('foreground', 
 | 
								renderer.set_property('foreground', 
 | 
				
			||||||
				gajim.config.get_per('themes', theme, 'accounttextcolor'))
 | 
									gajim.config.get_per('themes', theme, 'accounttextcolor'))
 | 
				
			||||||
			renderer.set_property('cell-background', 
 | 
								renderer.set_property('cell-background', 
 | 
				
			||||||
| 
						 | 
					@ -1856,7 +1868,7 @@ _('If "%s" accepts this request you will know his status.') %jid)
 | 
				
			||||||
				gajim.config.get_per('themes', theme, 'accountfont'))
 | 
									gajim.config.get_per('themes', theme, 'accountfont'))
 | 
				
			||||||
			renderer.set_property('xpad', 0)
 | 
								renderer.set_property('xpad', 0)
 | 
				
			||||||
			renderer.set_property('width', 3)
 | 
								renderer.set_property('width', 3)
 | 
				
			||||||
		elif model[iter][2] == 'group':
 | 
							elif model[iter][C_TYPE] == 'group':
 | 
				
			||||||
			renderer.set_property('foreground', 
 | 
								renderer.set_property('foreground', 
 | 
				
			||||||
				gajim.config.get_per('themes', theme, 'grouptextcolor'))
 | 
									gajim.config.get_per('themes', theme, 'grouptextcolor'))
 | 
				
			||||||
			renderer.set_property('cell-background', 
 | 
								renderer.set_property('cell-background', 
 | 
				
			||||||
| 
						 | 
					@ -1865,8 +1877,8 @@ _('If "%s" accepts this request you will know his status.') %jid)
 | 
				
			||||||
				gajim.config.get_per('themes', theme, 'groupfont'))
 | 
									gajim.config.get_per('themes', theme, 'groupfont'))
 | 
				
			||||||
			renderer.set_property('xpad', 4)
 | 
								renderer.set_property('xpad', 4)
 | 
				
			||||||
		else:
 | 
							else:
 | 
				
			||||||
			jid = model[iter][3].decode('utf-8')
 | 
								jid = model[iter][C_JID].decode('utf-8')
 | 
				
			||||||
			account = model[iter][4].decode('utf-8')
 | 
								account = model[iter][C_ACCOUNT].decode('utf-8')
 | 
				
			||||||
			renderer.set_property('foreground', 
 | 
								renderer.set_property('foreground', 
 | 
				
			||||||
				gajim.config.get_per('themes', theme, 'contacttextcolor'))
 | 
									gajim.config.get_per('themes', theme, 'contacttextcolor'))
 | 
				
			||||||
			if jid in gajim.newly_added[account]:
 | 
								if jid in gajim.newly_added[account]:
 | 
				
			||||||
| 
						 | 
					@ -1883,15 +1895,15 @@ _('If "%s" accepts this request you will know his status.') %jid)
 | 
				
			||||||
	def fill_secondary_pixbuf_rederer(self, column, renderer, model, iter, data=None):
 | 
						def fill_secondary_pixbuf_rederer(self, column, renderer, model, iter, data=None):
 | 
				
			||||||
		'''When a row is added, set properties for secondary renderer (avatar or tls)'''
 | 
							'''When a row is added, set properties for secondary renderer (avatar or tls)'''
 | 
				
			||||||
		theme = gajim.config.get('roster_theme')
 | 
							theme = gajim.config.get('roster_theme')
 | 
				
			||||||
		if model[iter][2] == 'account':
 | 
							if model[iter][C_TYPE] == 'account':
 | 
				
			||||||
			renderer.set_property('cell-background', 
 | 
								renderer.set_property('cell-background', 
 | 
				
			||||||
				gajim.config.get_per('themes', theme, 'accountbgcolor'))
 | 
									gajim.config.get_per('themes', theme, 'accountbgcolor'))
 | 
				
			||||||
		elif model[iter][2] == 'group':
 | 
							elif model[iter][C_TYPE] == 'group':
 | 
				
			||||||
			renderer.set_property('cell-background', 
 | 
								renderer.set_property('cell-background', 
 | 
				
			||||||
				gajim.config.get_per('themes', theme, 'groupbgcolor'))
 | 
									gajim.config.get_per('themes', theme, 'groupbgcolor'))
 | 
				
			||||||
		else:
 | 
							else:
 | 
				
			||||||
			jid = model[iter][3].decode('utf-8')
 | 
								jid = model[iter][C_JID].decode('utf-8')
 | 
				
			||||||
			account = model[iter][4].decode('utf-8')
 | 
								account = model[iter][C_ACCOUNT].decode('utf-8')
 | 
				
			||||||
			if jid in gajim.newly_added[account]:
 | 
								if jid in gajim.newly_added[account]:
 | 
				
			||||||
				renderer.set_property('cell-background', '#adc3c6')
 | 
									renderer.set_property('cell-background', '#adc3c6')
 | 
				
			||||||
			elif jid in gajim.to_be_removed[account]:
 | 
								elif jid in gajim.to_be_removed[account]:
 | 
				
			||||||
| 
						 | 
					@ -1971,7 +1983,7 @@ _('If "%s" accepts this request you will know his status.') %jid)
 | 
				
			||||||
		if gajim.config.get('mergeaccounts') or len(gajim.connections) == 1:
 | 
							if gajim.config.get('mergeaccounts') or len(gajim.connections) == 1:
 | 
				
			||||||
			merge = 1
 | 
								merge = 1
 | 
				
			||||||
		if len(path) == 3 - merge:
 | 
							if len(path) == 3 - merge:
 | 
				
			||||||
			data = model[iter][3]
 | 
								data = model[iter][C_JID]
 | 
				
			||||||
		selection.set(selection.target, 8, data)
 | 
							selection.set(selection.target, 8, data)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	def drag_data_received_data(self, treeview, context, x, y, selection, info,
 | 
						def drag_data_received_data(self, treeview, context, x, y, selection, info,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue