Author: js Date: 2008-11-29 14:38:47 +0100 (Sat, 29 Nov 2008) New Revision: 10721
Modified: branches/osx_newbuildsys/po/fr.po branches/osx_newbuildsys/src/dialogs.py branches/osx_newbuildsys/src/notify.py Log: Merge trunk r10720.
Modified: branches/osx_newbuildsys/po/fr.po =================================================================== --- branches/osx_newbuildsys/po/fr.po 2008-11-29 13:37:06 UTC (rev 10720) +++ branches/osx_newbuildsys/po/fr.po 2008-11-29 13:38:47 UTC (rev 10721) @@ -8438,7 +8438,7 @@
#: ../src/groupchat_control.py:603 msgid "Conversation with " -msgstr "Conversation avec" +msgstr "Conversation avec "
#: ../src/groupchat_control.py:605 msgid "Continued conversation"
Modified: branches/osx_newbuildsys/src/dialogs.py =================================================================== --- branches/osx_newbuildsys/src/dialogs.py 2008-11-29 13:37:06 UTC (rev 10720) +++ branches/osx_newbuildsys/src/dialogs.py 2008-11-29 13:38:47 UTC (rev 10721) @@ -2038,10 +2038,11 @@ if not text: text = gajim.get_name_from_jid(account, jid) # default value of text if not title: - title = event_type + title = ''
event_type_label.set_markup( - '<span foreground="black" weight="bold">%s</span>' % title) + '<span foreground="black" weight="bold">%s</span>' % + gobject.markup_escape_text(title))
# set colors [ http://www.pitt.edu/~nisg/cis/web/cgi/rgb.html ] self.window.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse('black')) @@ -2075,8 +2076,8 @@ popup_bg_color = gtk.gdk.color_parse(bg_color) close_button.modify_bg(gtk.STATE_NORMAL, popup_bg_color) eventbox.modify_bg(gtk.STATE_NORMAL, popup_bg_color) - event_description_label.set_markup( - '<span foreground="black">%s</span>' % text) + event_description_label.set_markup('<span foreground="black">%s</span>' % + gobject.markup_escape_text(text))
# set the image image.set_from_file(path_to_image)
Modified: branches/osx_newbuildsys/src/notify.py =================================================================== --- branches/osx_newbuildsys/src/notify.py 2008-11-29 13:37:06 UTC (rev 10720) +++ branches/osx_newbuildsys/src/notify.py 2008-11-29 13:38:47 UTC (rev 10721) @@ -329,12 +329,25 @@ the Desktop Notification Specification. If that fails, then we fall back to the older style PopupNotificationWindow method.'''
- # try via D-Bus + # default image + if not path_to_image: + path_to_image = os.path.abspath( + os.path.join(gajim.DATA_DIR, 'pixmaps', 'events', + 'chat_msg_recv.png')) # img to display + + # Try Growl first, as we might have D-Bus and notification daemon running + # on OS X for some reason. + if USER_HAS_GROWL: + osx.growler.notify(event_type, jid, account, msg_type, path_to_image, + title, text) + return + + # Try to show our popup via D-Bus and notification daemon if gajim.config.get('use_notif_daemon') and dbus_support.supported: try: DesktopNotification(event_type, jid, account, msg_type, - path_to_image, gobject.markup_escape(title), - gobject.markup_escape(text)) + path_to_image, gobject.markup_escape_text(title), + gobject.markup_escape_text(text)) return # sucessfully did D-Bus Notification procedure! except dbus.DBusException, e: # Connection to D-Bus failed @@ -343,28 +356,20 @@ # 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 + # Ok, that failed. Let's try pynotify, which also uses notification daemon + if gajim.config.get('use_notif_daemon') and USER_HAS_PYNOTIFY: if not text and event_type == 'new_message': # empty text for new_message means do_preview = False - # default value for text - _text = gobject.escape_markup(gajim.get_name_from_jid(account, jid)) + # -> default value for text + _text = gobject.markup_escape_text( + gajim.get_name_from_jid(account, jid)) else: - _text = gobject.escape_markup(text) + _text = gobject.markup_escape_text(text)
if not title: - # FIXME: This is a bad idea, it's not translatable and contains a _ - _title = event_type - else: - _title = gobject.escape_markup(title) - - # default image - if not path_to_image: - _path_to_image = os.path.abspath( - os.path.join(gajim.DATA_DIR, 'pixmaps', 'events', - 'chat_msg_recv.png')) # img to display + _title = '' else: - _path_to_image = path_to_image + _title = gobject.markup_escape_text(title)
notification = pynotify.Notification(_title, _text) timeout = gajim.config.get('notification_timeout') * 1000 # make it ms @@ -375,7 +380,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)
@@ -385,14 +390,8 @@ 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, - title, text) - return
- # go old style + # Either nothing succeeded or the user wants old-style notifications instance = dialogs.PopupNotificationWindow(event_type, jid, account, msg_type, path_to_image, title, text) gajim.interface.roster.popup_notification_windows.append(instance)