From aa749cb77b92b64fd500484d96a8d7f872f61e3f Mon Sep 17 00:00:00 2001 From: Jean-Marie Traissard Date: Sun, 27 Jul 2008 10:21:51 +0000 Subject: [PATCH] Remove useless function and check. Make avatar in notification works with jpeg too. See #4060. --- src/gtkgui_helpers.py | 19 ++++++++++++------- src/notify.py | 4 ++-- src/roster_window.py | 2 +- src/vcard.py | 9 --------- 4 files changed, 15 insertions(+), 19 deletions(-) diff --git a/src/gtkgui_helpers.py b/src/gtkgui_helpers.py index 824a77d0d..fe2fcbcf8 100644 --- a/src/gtkgui_helpers.py +++ b/src/gtkgui_helpers.py @@ -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): diff --git a/src/notify.py b/src/notify.py index 7e60286fe..63abdc526 100644 --- a/src/notify.py +++ b/src/notify.py @@ -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: diff --git a/src/roster_window.py b/src/roster_window.py index d2fd5d10a..960ed1cf2 100644 --- a/src/roster_window.py +++ b/src/roster_window.py @@ -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): diff --git a/src/vcard.py b/src/vcard.py index fea82ae61..ce9fb069e 100644 --- a/src/vcard.py +++ b/src/vcard.py @@ -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)