optionally attach notification to systray. fixes #3123

This commit is contained in:
Yann Leboulanger 2007-11-17 22:27:40 +00:00
parent 377d8e9081
commit 7590a57f66
2 changed files with 13 additions and 3 deletions

View File

@ -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 = {

View File

@ -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)