move some lines back to up
This commit is contained in:
parent
c914a0d058
commit
4ba60d14bf
1 changed files with 12 additions and 11 deletions
|
@ -79,7 +79,7 @@ class NotificationResponseManager:
|
||||||
self.interface = dbus_support.get_notifications_interface()
|
self.interface = dbus_support.get_notifications_interface()
|
||||||
self.interface.connect_to_signal('ActionInvoked', self.on_action_invoked)
|
self.interface.connect_to_signal('ActionInvoked', self.on_action_invoked)
|
||||||
self.interface.connect_to_signal('NotificationClosed', self.on_closed)
|
self.interface.connect_to_signal('NotificationClosed', self.on_closed)
|
||||||
|
|
||||||
def on_action_invoked(self, id, reason):
|
def on_action_invoked(self, id, reason):
|
||||||
if self.pending.has_key(id):
|
if self.pending.has_key(id):
|
||||||
notification = self.pending[id]
|
notification = self.pending[id]
|
||||||
|
@ -93,7 +93,7 @@ class NotificationResponseManager:
|
||||||
def on_closed(self, id, reason):
|
def on_closed(self, id, reason):
|
||||||
if self.pending.has_key(id):
|
if self.pending.has_key(id):
|
||||||
del self.pending[id]
|
del self.pending[id]
|
||||||
|
|
||||||
notification_response_manager = NotificationResponseManager()
|
notification_response_manager = NotificationResponseManager()
|
||||||
|
|
||||||
class DesktopNotification:
|
class DesktopNotification:
|
||||||
|
@ -110,6 +110,11 @@ class DesktopNotification:
|
||||||
else:
|
else:
|
||||||
actor = jid
|
actor = jid
|
||||||
|
|
||||||
|
# failsafe values
|
||||||
|
img = 'chat_msg_recv.png' # img to display
|
||||||
|
ntype = 'im' # Notification Type
|
||||||
|
txt = actor # default value of txt
|
||||||
|
|
||||||
if event_type == _('Contact Signed In'):
|
if event_type == _('Contact Signed In'):
|
||||||
img = 'contact_online.png'
|
img = 'contact_online.png'
|
||||||
ntype = 'presence.online'
|
ntype = 'presence.online'
|
||||||
|
@ -146,7 +151,7 @@ class DesktopNotification:
|
||||||
if file_props['type'] == 'r':
|
if file_props['type'] == 'r':
|
||||||
# get the name of the sender, as it is in the roster
|
# get the name of the sender, as it is in the roster
|
||||||
sender = unicode(file_props['sender']).split('/')[0]
|
sender = unicode(file_props['sender']).split('/')[0]
|
||||||
name = gajim.get_first_contact_instance_from_jid(
|
name = gajim.get_first_contact_instance_from_jid(
|
||||||
account, sender).name
|
account, sender).name
|
||||||
filename = os.path.basename(file_props['file-name'])
|
filename = os.path.basename(file_props['file-name'])
|
||||||
if event_type == _('File Transfer Completed'):
|
if event_type == _('File Transfer Completed'):
|
||||||
|
@ -163,7 +168,7 @@ class DesktopNotification:
|
||||||
receiver = receiver.jid
|
receiver = receiver.jid
|
||||||
receiver = receiver.split('/')[0]
|
receiver = receiver.split('/')[0]
|
||||||
# get the name of the contact, as it is in the roster
|
# get the name of the contact, as it is in the roster
|
||||||
name = gajim.get_first_contact_instance_from_jid(
|
name = gajim.get_first_contact_instance_from_jid(
|
||||||
account, receiver).name
|
account, receiver).name
|
||||||
filename = os.path.basename(file_props['file-name'])
|
filename = os.path.basename(file_props['file-name'])
|
||||||
if event_type == _('File Transfer Completed'):
|
if event_type == _('File Transfer Completed'):
|
||||||
|
@ -176,24 +181,20 @@ class DesktopNotification:
|
||||||
img = 'ft_stopped.png'
|
img = 'ft_stopped.png'
|
||||||
else:
|
else:
|
||||||
txt = ''
|
txt = ''
|
||||||
else: # failsafe values
|
|
||||||
img = 'chat_msg_recv.png' # img to display
|
|
||||||
ntype = 'im' # Notification Type
|
|
||||||
txt = actor # default value of txt
|
|
||||||
|
|
||||||
path = os.path.join(gajim.DATA_DIR, 'pixmaps', 'events', img)
|
path = os.path.join(gajim.DATA_DIR, 'pixmaps', 'events', img)
|
||||||
path = os.path.abspath(path)
|
path = os.path.abspath(path)
|
||||||
|
|
||||||
self.notif = dbus_support.get_notifications_interface()
|
self.notif = dbus_support.get_notifications_interface()
|
||||||
if self.notif is None:
|
if self.notif is None:
|
||||||
raise dbus.DBusException()
|
raise dbus.DBusException()
|
||||||
self.id = self.notif.Notify(dbus.String(_('Gajim')),
|
self.id = self.notif.Notify(dbus.String(_('Gajim')),
|
||||||
dbus.String(path), dbus.UInt32(0), ntype, dbus.Byte(0),
|
dbus.String(path), dbus.UInt32(0), ntype, dbus.Byte(0),
|
||||||
dbus.String(event_type), dbus.String(txt),
|
dbus.String(event_type), dbus.String(txt),
|
||||||
[dbus.String(path)], {'default':0}, [''], True, dbus.UInt32(5))
|
[dbus.String(path)], {'default':0}, [''], True, dbus.UInt32(5))
|
||||||
notification_response_manager.attach_to_interface()
|
notification_response_manager.attach_to_interface()
|
||||||
notification_response_manager.pending[self.id] = self
|
notification_response_manager.pending[self.id] = self
|
||||||
|
|
||||||
def on_action_invoked(self, id, reason):
|
def on_action_invoked(self, id, reason):
|
||||||
if self.notif is None:
|
if self.notif is None:
|
||||||
return
|
return
|
||||||
|
|
Loading…
Add table
Reference in a new issue