From 7590a57f66ed8c56464cfa667b8e037af14daf74 Mon Sep 17 00:00:00 2001 From: Yann Leboulanger Date: Sat, 17 Nov 2007 22:27:40 +0000 Subject: [PATCH] optionally attach notification to systray. fixes #3123 --- src/common/config.py | 3 ++- src/notify.py | 13 +++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/common/config.py b/src/common/config.py index 3ad709c57..c8dd7c7b2 100644 --- a/src/common/config.py +++ b/src/common/config.py @@ -237,7 +237,7 @@ class Config: 'hide_groupchat_occupants_list': [opt_bool, False, _('Hides the group chat occupants list in group chat window.')], 'chat_merge_consecutive_nickname': [opt_bool, False, _('In a chat, show the nickname at the beginning of a line only when it\'s not the same person talking than in previous message.')], 'chat_merge_consecutive_nickname_indent': [opt_str, ' ', _('Indentation when using merge consecutive nickname.')], - 'use_smooth_scrolling': [opt_bool, True, _('Smooth scroll message in conversation window')], + 'use_smooth_scrolling': [opt_bool, True, _('Smooth scroll message in conversation window')], 'gc_nicknames_colors': [ opt_str, '#a34526:#c000ff:#0012ff:#388a99:#045723:#7c7c7c:#ff8a00:#94452d:#244b5a:#32645a', _('List of colors that will be used to color nicknames in group chats.'), True ], 'ctrl_tab_go_to_next_composing': [opt_bool, True, _('Ctrl-Tab go to next composing tab when none is unread.')], 'confirm_metacontacts': [ opt_str, '', _('Should we show the confirm metacontacts creation dialog or not? Empty string means we never show the dialog.')], @@ -249,6 +249,7 @@ class Config: 'use_latex': [opt_bool, False, _('If True, Gajim will convert string between $$ and $$ to an image using dvips and convert before insterting it in chat window.')], 'change_status_window_timeout': [opt_int, 15, _('Time of inactivity needed before the change status window closes down.')], 'max_conversation_lines': [opt_int, 500, _('Maximum number of lines that are printed in conversations. Oldest lines are cleared.')], + 'attach_notifications_to_systray': [opt_bool, False, _('If True, notification windows from notification-daemon will be attached to systray icon.')], } __options_per_key = { diff --git a/src/notify.py b/src/notify.py index aae559a9c..01974d688 100644 --- a/src/notify.py +++ b/src/notify.py @@ -503,8 +503,17 @@ class DesktopNotification: except AttributeError: version = [0, 3, 1] # we're actually dealing with the newer version if version > [0, 3]: - if version >= [0, 3, 2]: + if gajim.interface.systray_enabled and \ + gajim.config.get('attach_notifications_to_systray'): + x, y = gajim.interface.systray.img_tray.window.get_position() + x_, y_, width, height, depth = \ + gajim.interface.systray.img_tray.window.get_geometry() + pos_x = x + (width / 2) + pos_y = y + (height / 2) + hints = {'x': pos_x, 'y': pos_y} + else: hints = {} + if version >= [0, 3, 2]: hints['urgency'] = dbus.Byte(0) # Low Urgency hints['category'] = dbus.String(ntype) self.notif.Notify( @@ -526,7 +535,7 @@ class DesktopNotification: dbus.String(self.title), dbus.String(self.text), dbus.String(''), - {}, + hints, dbus.UInt32(timeout*1000), reply_handler=self.attach_by_id, error_handler=self.notify_another_way)