[lorien420] popup notifications now use notification-daemon if there so they look nicer thanks to Andrew Sayman. I go play some Crack Attack! in return

This commit is contained in:
Nikos Kouremenos 2005-11-11 19:06:48 +00:00
parent 92c879ee0f
commit 3556d134bd
2 changed files with 12 additions and 24 deletions

View File

@ -847,7 +847,7 @@ class PopupNotificationWindow:
account, receiver).name account, receiver).name
txt = _('To %s') % name txt = _('To %s') % name
else: else:
txt='' txt = ''
event_description_label.set_text(txt) event_description_label.set_text(txt)
# position the window to bottom-right of screen # position the window to bottom-right of screen
window_width, self.window_height = self.window.get_size() window_width, self.window_height = self.window.get_size()

View File

@ -74,18 +74,17 @@ import getopt
import time import time
import base64 import base64
from common import socks5
import gtkgui_helpers import gtkgui_helpers
import vcard import vcard
import notify
import common.sleepy import common.sleepy
import check_for_new_version import check_for_new_version
from common import socks5
from common import gajim from common import gajim
from common import connection from common import connection
from common import helpers from common import helpers
from common import optparser from common import optparser
profile = '' profile = ''
@ -364,9 +363,7 @@ class Interface:
elif gajim.connections[account].connected in (2, 3): # we're online or chat elif gajim.connections[account].connected in (2, 3): # we're online or chat
show_notification = True show_notification = True
if show_notification: if show_notification:
instance = dialogs.PopupNotificationWindow( notify.notify(_('Contact Signed In'), jid, account)
_('Contact Signed In'), jid, account)
self.roster.popup_notification_windows.append(instance)
if self.remote and self.remote.is_enabled(): if self.remote and self.remote.is_enabled():
self.remote.raise_signal('ContactPresence', self.remote.raise_signal('ContactPresence',
(account, array)) (account, array))
@ -385,9 +382,7 @@ class Interface:
elif gajim.connections[account].connected in (2, 3): # we're online or chat elif gajim.connections[account].connected in (2, 3): # we're online or chat
show_notification = True show_notification = True
if show_notification: if show_notification:
instance = dialogs.PopupNotificationWindow( notify.notify(_('Contact Signed Out'), jid, account)
_('Contact Signed Out'), jid, account)
self.roster.popup_notification_windows.append(instance)
if self.remote and self.remote.is_enabled(): if self.remote and self.remote.is_enabled():
self.remote.raise_signal('ContactAbsence', (account, array)) self.remote.raise_signal('ContactAbsence', (account, array))
# stop non active file transfers # stop non active file transfers
@ -421,9 +416,8 @@ class Interface:
if not self.windows[account]['chats'].has_key(fjid) and \ if not self.windows[account]['chats'].has_key(fjid) and \
not gajim.awaiting_events[account].has_key(fjid): not gajim.awaiting_events[account].has_key(fjid):
if show_notification: if show_notification:
instance = dialogs.PopupNotificationWindow( notify.notify(
_('New Private Message'), fjid, account, 'pm') _('New Private Message'), fjid, account, 'pm')
self.roster.popup_notification_windows.append(instance)
self.windows[account]['gc'][jid].on_private_message(jid, nick, self.windows[account]['gc'][jid].on_private_message(jid, nick,
array[1], array[2]) array[1], array[2])
@ -466,14 +460,12 @@ class Interface:
show_notification = True show_notification = True
if show_notification: if show_notification:
if msg_type == 'normal': # single message if msg_type == 'normal': # single message
instance = dialogs.PopupNotificationWindow( notify.notify(
_('New Single Message'), jid, account, msg_type) _('New Single Message'), jid, account, msg_type)
else: # chat message else: # chat message
instance = dialogs.PopupNotificationWindow( notify.notify(
_('New Message'), jid, account, msg_type) _('New Message'), jid, account, msg_type)
self.roster.popup_notification_windows.append(instance)
# array : (contact, msg, time, encrypted, msg_type, subject) # array : (contact, msg, time, encrypted, msg_type, subject)
self.roster.on_message(jid, array[1], array[2], account, array[3], self.roster.on_message(jid, array[1], array[2], account, array[3],
msg_type, array[5], resource) msg_type, array[5], resource)
@ -791,9 +783,8 @@ class Interface:
self.add_event(account, jid, 'file-send-error', file_props) self.add_event(account, jid, 'file-send-error', file_props)
if gajim.show_notification(account): if gajim.show_notification(account):
instance = dialogs.PopupNotificationWindow(_('File Transfer Error'), notify.notify(_('File Transfer Error'),
jid, account, 'file-send-error', file_props) jid, account, 'file-send-error', file_props)
self.roster.popup_notification_windows.append(instance)
def add_event(self, account, jid, typ, args): def add_event(self, account, jid, typ, args):
'''add an event to the awaiting_events var''' '''add an event to the awaiting_events var'''
@ -849,9 +840,8 @@ class Interface:
if gajim.show_notification(account): if gajim.show_notification(account):
# check if we should be notified # check if we should be notified
instance = dialogs.PopupNotificationWindow(_('File Transfer Error'), notify.notify(_('File Transfer Error'),
jid, account, msg_type, file_props) jid, account, msg_type, file_props)
self.roster.popup_notification_windows.append(instance)
def handle_event_file_request(self, account, array): def handle_event_file_request(self, account, array):
jid = array[0] jid = array[0]
@ -868,9 +858,8 @@ class Interface:
self.add_event(account, jid, 'file-request', file_props) self.add_event(account, jid, 'file-request', file_props)
if gajim.show_notification(account): if gajim.show_notification(account):
instance = dialogs.PopupNotificationWindow(_('File Transfer Request'), notify.notify(_('File Transfer Request'),
jid, account, 'file-request') jid, account, 'file-request')
self.roster.popup_notification_windows.append(instance)
def handle_event_file_progress(self, account, file_props): def handle_event_file_progress(self, account, file_props):
self.windows['file_transfers'].set_progress(file_props['type'], self.windows['file_transfers'].set_progress(file_props['type'],
@ -912,9 +901,8 @@ class Interface:
gajim.connections[account].connected in (2, 3)): gajim.connections[account].connected in (2, 3)):
# we want to be notified and we are online/chat or we don't mind # we want to be notified and we are online/chat or we don't mind
# bugged when away/na/busy # bugged when away/na/busy
instance = dialogs.PopupNotificationWindow(event_type, jid, account, notify.notify(event_type, jid, account,
msg_type, file_props) msg_type, file_props)
self.roster.popup_notification_windows.append(instance)
def handle_event_stanza_arrived(self, account, stanza): def handle_event_stanza_arrived(self, account, stanza):
if not self.windows.has_key(account): if not self.windows.has_key(account):