Remove useless function and check. Make avatar in notification works with jpeg too. See #4060.
This commit is contained in:
		
							parent
							
								
									2bb2c452c6
								
							
						
					
					
						commit
						aa749cb77b
					
				
					 4 changed files with 15 additions and 19 deletions
				
			
		|  | @ -615,16 +615,21 @@ def make_pixbuf_grayscale(pixbuf): | |||
| def get_path_to_generic_or_avatar(generic, jid = None, suffix = None): | ||||
| 	'''Chooses between avatar image and default image. | ||||
| 	Returns full path to the avatar image if it exists, | ||||
| 	otherwise returns full path to the image.''' | ||||
| 	otherwise returns full path to the image. | ||||
| 	generic must be with extension and suffix without''' | ||||
| 	if jid: | ||||
| 		# we want an avatar | ||||
| 		puny_jid = helpers.sanitize_filename(jid) | ||||
| 		path_to_file = os.path.join(gajim.AVATAR_PATH, puny_jid) + suffix | ||||
| 		filepath, extension = os.path.splitext(path_to_file)  | ||||
| 		path_to_local_file = filepath + '_local' + extension  | ||||
| 		if os.path.exists(path_to_local_file): | ||||
| 			return path_to_local_file | ||||
| 		if os.path.exists(path_to_file): | ||||
| 			return path_to_file | ||||
| 		path_to_local_file = path_to_file + '_local' | ||||
| 		for extension in ('.png', '.jpeg'): | ||||
| 			path_to_local_file_full = path_to_local_file + extension | ||||
| 			if os.path.exists(path_to_local_file_full): | ||||
| 				return path_to_local_file_full  | ||||
| 		for extension in ('.png', '.jpeg'): | ||||
| 			path_to_file_full = path_to_file + extension | ||||
| 			if os.path.exists(path_to_file_full): | ||||
| 				return path_to_file_full | ||||
| 	return os.path.abspath(generic) | ||||
| 
 | ||||
| def decode_filechooser_file_paths(file_paths): | ||||
|  |  | |||
|  | @ -205,13 +205,13 @@ def notify(event, jid, account, parameters, advanced_notif_num = None): | |||
| 		'status_change'): # Common code for popup for these three events | ||||
| 			if event == 'contact_disconnected': | ||||
| 				show_image = 'offline.png' | ||||
| 				suffix = '_notif_size_bw.png' | ||||
| 				suffix = '_notif_size_bw' | ||||
| 			else: #Status Change or Connected | ||||
| 				# FIXME: for status change, | ||||
| 				# we don't always 'online.png', but we | ||||
| 				# first need 48x48 for all status | ||||
| 				show_image = 'online.png' | ||||
| 				suffix = '_notif_size_colored.png' | ||||
| 				suffix = '_notif_size_colored' | ||||
| 			transport_name = gajim.get_transport_name_from_jid(jid) | ||||
| 			img = None | ||||
| 			if transport_name: | ||||
|  |  | |||
|  | @ -4116,7 +4116,7 @@ class RosterWindow: | |||
| 		# Update chat window | ||||
| 
 | ||||
| 		ctrl = gajim.interface.msg_win_mgr.get_control(jid, account) | ||||
| 		if ctrl and ctrl.type_id != message_control.TYPE_GC: | ||||
| 		if ctrl: | ||||
| 			ctrl.show_avatar() | ||||
| 
 | ||||
| 	def on_roster_treeview_style_set(self, treeview, style): | ||||
|  |  | |||
|  | @ -121,15 +121,6 @@ class VcardWindow: | |||
| 		self.progressbar.pulse() | ||||
| 		return True # loop forever | ||||
| 
 | ||||
| 	def update_avatar_in_gui(self): | ||||
| 		jid = self.contact.jid | ||||
| 		# Update roster | ||||
| 		gajim.interface.roster.draw_avatar(jid, self.account) | ||||
| 		# Update chat windows | ||||
| 		ctrl = gajim.interface.msg_win_mgr.get_control(jid, self.account) | ||||
| 		if ctrl and ctrl.type_id != message_control.TYPE_GC: | ||||
| 			ctrl.show_avatar() | ||||
| 
 | ||||
| 	def on_vcard_information_window_destroy(self, widget): | ||||
| 		if self.update_progressbar_timeout_id is not None: | ||||
| 			gobject.source_remove(self.update_progressbar_timeout_id) | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue