fix clicking on notification-daemon sign-in notification
This commit is contained in:
parent
ad5248f3dc
commit
4ddadc68d9
1 changed files with 17 additions and 18 deletions
|
@ -131,7 +131,7 @@ def get_advanced_notification(event, account, contact):
|
||||||
notif = gajim.config.get_per('notifications', str(num))
|
notif = gajim.config.get_per('notifications', str(num))
|
||||||
|
|
||||||
def notify(event, jid, account, parameters, advanced_notif_num = None):
|
def notify(event, jid, account, parameters, advanced_notif_num = None):
|
||||||
'''Check what type of notifications we want, depending on basic
|
'''Check what type of notifications we want, depending on basic
|
||||||
and the advanced configuration of notifications and do these notifications;
|
and the advanced configuration of notifications and do these notifications;
|
||||||
advanced_notif_num holds the number of the first (top most) advanced
|
advanced_notif_num holds the number of the first (top most) advanced
|
||||||
notification'''
|
notification'''
|
||||||
|
@ -198,8 +198,8 @@ def notify(event, jid, account, parameters, advanced_notif_num = None):
|
||||||
if advanced_notif_num is not None and gajim.config.get_per('notifications',
|
if advanced_notif_num is not None and gajim.config.get_per('notifications',
|
||||||
str(advanced_notif_num), 'run_command'):
|
str(advanced_notif_num), 'run_command'):
|
||||||
do_cmd = True
|
do_cmd = True
|
||||||
|
|
||||||
# Do the wanted notifications
|
# Do the wanted notifications
|
||||||
if do_popup:
|
if do_popup:
|
||||||
if event in ('contact_connected', 'contact_disconnected',
|
if event in ('contact_connected', 'contact_disconnected',
|
||||||
'status_change'): # Common code for popup for these three events
|
'status_change'): # Common code for popup for these three events
|
||||||
|
@ -208,15 +208,15 @@ def notify(event, jid, account, parameters, advanced_notif_num = None):
|
||||||
suffix = '_notif_size_bw.png'
|
suffix = '_notif_size_bw.png'
|
||||||
else: #Status Change or Connected
|
else: #Status Change or Connected
|
||||||
# FIXME: for status change,
|
# FIXME: for status change,
|
||||||
# we don't always 'online.png', but we
|
# we don't always 'online.png', but we
|
||||||
# first need 48x48 for all status
|
# first need 48x48 for all status
|
||||||
show_image = 'online.png'
|
show_image = 'online.png'
|
||||||
suffix = '_notif_size_colored.png'
|
suffix = '_notif_size_colored.png'
|
||||||
transport_name = gajim.get_transport_name_from_jid(jid)
|
transport_name = gajim.get_transport_name_from_jid(jid)
|
||||||
img = None
|
img = None
|
||||||
if transport_name:
|
if transport_name:
|
||||||
img = os.path.join(helpers.get_transport_path(transport_name),
|
img = os.path.join(helpers.get_transport_path(transport_name),
|
||||||
'48x48', show_image)
|
'48x48', show_image)
|
||||||
if not img or not os.path.isfile(img):
|
if not img or not os.path.isfile(img):
|
||||||
iconset = gajim.config.get('iconset')
|
iconset = gajim.config.get('iconset')
|
||||||
img = os.path.join(helpers.get_iconset_path(iconset), '48x48',
|
img = os.path.join(helpers.get_iconset_path(iconset), '48x48',
|
||||||
|
@ -340,12 +340,12 @@ def popup(event_type, jid, account, msg_type = '', path_to_image = None,
|
||||||
path_to_image = os.path.abspath(
|
path_to_image = os.path.abspath(
|
||||||
os.path.join(gajim.DATA_DIR, 'pixmaps', 'events',
|
os.path.join(gajim.DATA_DIR, 'pixmaps', 'events',
|
||||||
'chat_msg_recv.png')) # img to display
|
'chat_msg_recv.png')) # img to display
|
||||||
|
|
||||||
|
|
||||||
notification = pynotify.Notification(title, text)
|
notification = pynotify.Notification(title, text)
|
||||||
timeout = gajim.config.get('notification_timeout') * 1000 # make it ms
|
timeout = gajim.config.get('notification_timeout') * 1000 # make it ms
|
||||||
notification.set_timeout(timeout)
|
notification.set_timeout(timeout)
|
||||||
|
|
||||||
notification.set_category(event_type)
|
notification.set_category(event_type)
|
||||||
notification.set_data('event_type', event_type)
|
notification.set_data('event_type', event_type)
|
||||||
notification.set_data('jid', jid)
|
notification.set_data('jid', jid)
|
||||||
|
@ -497,14 +497,14 @@ class DesktopNotification:
|
||||||
self.notif.Notify(
|
self.notif.Notify(
|
||||||
dbus.String(_('Gajim')),
|
dbus.String(_('Gajim')),
|
||||||
dbus.String(self.path_to_image),
|
dbus.String(self.path_to_image),
|
||||||
dbus.UInt32(0),
|
dbus.UInt32(0),
|
||||||
ntype,
|
ntype,
|
||||||
dbus.Byte(0),
|
dbus.Byte(0),
|
||||||
dbus.String(self.title),
|
dbus.String(self.title),
|
||||||
dbus.String(self.text),
|
dbus.String(self.text),
|
||||||
[dbus.String(self.path_to_image)],
|
[dbus.String(self.path_to_image)],
|
||||||
{'default': 0},
|
{'default': 0},
|
||||||
[''],
|
[''],
|
||||||
True,
|
True,
|
||||||
dbus.UInt32(timeout),
|
dbus.UInt32(timeout),
|
||||||
reply_handler=self.attach_by_id,
|
reply_handler=self.attach_by_id,
|
||||||
|
@ -530,16 +530,16 @@ class DesktopNotification:
|
||||||
dbus.UInt32(0), # this notification does not replace other
|
dbus.UInt32(0), # this notification does not replace other
|
||||||
dbus.String(self.path_to_image),
|
dbus.String(self.path_to_image),
|
||||||
dbus.String(self.title),
|
dbus.String(self.title),
|
||||||
dbus.String(self.text),
|
dbus.String(self.text),
|
||||||
( dbus.String('default'), dbus.String(self.event_type) ),
|
( dbus.String('default'), dbus.String(self.event_type) ),
|
||||||
hints,
|
hints,
|
||||||
dbus.UInt32(timeout*1000),
|
dbus.UInt32(timeout*1000),
|
||||||
reply_handler=self.attach_by_id,
|
reply_handler=self.attach_by_id,
|
||||||
error_handler=self.notify_another_way)
|
error_handler=self.notify_another_way)
|
||||||
else:
|
else:
|
||||||
self.notif.Notify(
|
self.notif.Notify(
|
||||||
dbus.String(_('Gajim')),
|
dbus.String(_('Gajim')),
|
||||||
dbus.String(self.path_to_image),
|
dbus.String(self.path_to_image),
|
||||||
dbus.UInt32(0),
|
dbus.UInt32(0),
|
||||||
dbus.String(self.title),
|
dbus.String(self.title),
|
||||||
dbus.String(self.text),
|
dbus.String(self.text),
|
||||||
|
@ -563,8 +563,7 @@ class DesktopNotification:
|
||||||
return
|
return
|
||||||
self.notif.CloseNotification(dbus.UInt32(id))
|
self.notif.CloseNotification(dbus.UInt32(id))
|
||||||
self.notif = None
|
self.notif = None
|
||||||
if not self.msg_type:
|
|
||||||
self.msg_type = 'chat'
|
|
||||||
gajim.interface.handle_event(self.account, self.jid, self.msg_type)
|
gajim.interface.handle_event(self.account, self.jid, self.msg_type)
|
||||||
|
|
||||||
def version_reply_handler(self, name, vendor, version, spec_version = None):
|
def version_reply_handler(self, name, vendor, version, spec_version = None):
|
||||||
|
|
Loading…
Add table
Reference in a new issue