Author: steve-e Date: 2007-07-10 23:57:56 +0200 (Tue, 10 Jul 2007) New Revision: 8380
Modified: trunk/src/common/config.py trunk/src/notify.py Log: Ability to disable message previews in notify popups. Fixes #3088
Modified: trunk/src/common/config.py =================================================================== --- trunk/src/common/config.py 2007-07-10 20:04:04 UTC (rev 8379) +++ trunk/src/common/config.py 2007-07-10 21:57:56 UTC (rev 8380) @@ -182,6 +182,7 @@ 'tooltip_avatar_height': [opt_int, 125], 'vcard_avatar_width': [opt_int, 200], 'vcard_avatar_height': [opt_int, 200], + 'notification_preview_message': [opt_bool, True, _('Preview new messages in notification popup?')], 'notification_position_x': [opt_int, -1], 'notification_position_y': [opt_int, -1], 'notification_avatar_width': [opt_int, 48],
Modified: trunk/src/notify.py =================================================================== --- trunk/src/notify.py 2007-07-10 20:04:04 UTC (rev 8379) +++ trunk/src/notify.py 2007-07-10 21:57:56 UTC (rev 8380) @@ -123,6 +123,7 @@ do_popup = False do_sound = False do_cmd = False + do_preview = True # defaults to true: do not reset emtpy text in new_message if event == 'status_change': new_show = parameters[0] status_message = parameters[1] @@ -154,7 +155,11 @@ message_type = parameters[0] is_first_message = parameters[1] nickname = parameters[2] - message = parameters[3] + if gajim.config.get('notification_preview_message'): + message = parameters[3] + else: + do_preview = False + message = '' if helpers.allow_showing_notification(account, 'notify_on_new_message', advanced_notif_num, is_first_message): do_popup = True @@ -235,8 +240,12 @@ img = os.path.join(gajim.DATA_DIR, 'pixmaps', 'events', 'priv_msg_recv.png') title = _('New Private Message from group chat %s') % room_name - text = _('%(nickname)s: %(message)s') % {'nickname': nickname, - 'message': message} + if do_preview: + text = _('%(nickname)s: %(message)s') % {'nickname': nickname, + 'message': message} + else: + text = _('Messaged by %(nickname)s') % {'nickname': nickname} + else: # chat message event_type = _('New Message') img = os.path.join(gajim.DATA_DIR, 'pixmaps', 'events', @@ -299,7 +308,7 @@ 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: + if not text and do_preview: text = gajim.get_name_from_jid(account, jid) # default value of text if not title: title = event_type @@ -408,8 +417,9 @@ self.jid = jid self.msg_type = msg_type
- if not text: - # default value of text + # default value of text + if not text and event_type == 'new_message': + # empty text for new_message means do_preview = False self.text = gajim.get_name_from_jid(account, jid)
if not title: