Author: js Date: 2008-11-29 10:24:56 +0100 (Sat, 29 Nov 2008) New Revision: 10717
Modified: branches/osx_newbuildsys/src/notify.py Log: Don't mess with variables that are also used by other notifications. See #4517. Didn't commit this to trunk yet as I only tested on OS X so far.
Modified: branches/osx_newbuildsys/src/notify.py =================================================================== --- branches/osx_newbuildsys/src/notify.py 2008-11-28 18:47:04 UTC (rev 10716) +++ branches/osx_newbuildsys/src/notify.py 2008-11-29 09:24:56 UTC (rev 10717) @@ -328,13 +328,13 @@ '''Notifies a user of an event. It first tries to a valid implementation of the Desktop Notification Specification. If that fails, then we fall back to the older style PopupNotificationWindow method.''' - # escape text like <3 - text = gobject.markup_escape_text(text) - title = gobject.markup_escape_text(title) + + # try via D-Bus if gajim.config.get('use_notif_daemon') and dbus_support.supported: try: DesktopNotification(event_type, jid, account, msg_type, - path_to_image, title, text) + path_to_image, gobject.markup_escape(title), + gobject.markup_escape(text)) return # sucessfully did D-Bus Notification procedure! except dbus.DBusException, e: # Connection to D-Bus failed @@ -342,21 +342,31 @@ except TypeError, e: # This means that we sent the message incorrectly gajim.log.debug(str(e)) + # we failed to speak to notification daemon via D-Bus if USER_HAS_PYNOTIFY: # try via libnotify if not text and event_type == 'new_message': # empty text for new_message means do_preview = False - text = gajim.get_name_from_jid(account, jid) # default value of text + # default value for text + _text = gobject.escape_markup(gajim.get_name_from_jid(account, jid)) + else: + _text = gobject.escape_markup(text) + if not title: - title = event_type + # FIXME: This is a bad idea, it's not translatable and contains a _ + _title = event_typ + else: + _title = gobject.escape_markup(title) + # default image if not path_to_image: - path_to_image = os.path.abspath( + _path_to_image = os.path.abspath( os.path.join(gajim.DATA_DIR, 'pixmaps', 'events', 'chat_msg_recv.png')) # img to display + else: + _path_to_image = path_to_image
- - notification = pynotify.Notification(title, text) + notification = pynotify.Notification(_title, _text) timeout = gajim.config.get('notification_timeout') * 1000 # make it ms notification.set_timeout(timeout)
@@ -365,7 +375,7 @@ notification.set_data('jid', jid) notification.set_data('account', account) notification.set_data('msg_type', msg_type) - notification.set_property('icon-name', path_to_image) + notification.set_property('icon-name', _path_to_image) notification.add_action('default', 'Default Action', on_pynotify_notification_clicked)
@@ -375,6 +385,7 @@ except gobject.GError, e: # Connection to notification-daemon failed, see #2893 gajim.log.debug(str(e)) + # try os/x growl if USER_HAS_GROWL: osx.growler.notify(event_type, jid, account, msg_type, path_to_image,