differenciate popup_image and popup_image_path un notification when we path an icon name or an image path

This commit is contained in:
Yann Leboulanger 2013-02-18 20:52:04 +01:00
parent 3b50fb89a5
commit d5ee84a329
2 changed files with 10 additions and 6 deletions

View File

@ -2350,7 +2350,7 @@ class NotificationEvent(nec.NetworkIncomingEvent):
iconset = gajim.config.get('iconset')
img_path = os.path.join(helpers.get_iconset_path(iconset),
'48x48', show_image)
self.popup_image = self.get_path_to_generic_or_avatar(img_path,
self.popup_image_path = self.get_path_to_generic_or_avatar(img_path,
jid=self.jid, suffix=suffix)
self.popup_timeout = gajim.config.get('notification_timeout')
@ -2399,6 +2399,7 @@ class NotificationEvent(nec.NetworkIncomingEvent):
self.popup_event_type = ''
self.popup_msg_type = ''
self.popup_image = ''
self.popup_image_path = ''
self.popup_timeout = -1
self.do_command = False

View File

@ -156,13 +156,16 @@ class Notification:
def _nec_notification(self, obj):
if obj.do_popup:
if isinstance(obj.popup_image, str):
icon_path = gtkgui_helpers.get_icon_path(obj.popup_image,
48)
if obj.popup_image:
icon_path = gtkgui_helpers.get_icon_path(obj.popup_image, 48)
if icon_path:
obj.popup_image = icon_path
image_path = icon_path
elif obj.popup_image_path:
image_path = obj.popup_image_path
else:
image_path = ''
popup(obj.popup_event_type, obj.jid, obj.conn.name,
obj.popup_msg_type, path_to_image=obj.popup_image,
obj.popup_msg_type, path_to_image=image_path,
title=obj.popup_title, text=obj.popup_text,
timeout=obj.popup_timeout)