Author: js Date: 2008-10-02 18:46:18 +0200 (Thu, 02 Oct 2008) New Revision: 10463
Modified: branches/osx_newbuildsys/src/gajim.py branches/osx_newbuildsys/src/notify.py Log: Let the dock bounce on new messages.
Modified: branches/osx_newbuildsys/src/gajim.py =================================================================== --- branches/osx_newbuildsys/src/gajim.py 2008-10-01 17:16:05 UTC (rev 10462) +++ branches/osx_newbuildsys/src/gajim.py 2008-10-02 16:46:18 UTC (rev 10463) @@ -57,6 +57,13 @@
import sys
+# We need to import this early +if sys.platform == 'darwin': + try: + import objc + except NameError: + pass + import logging consoleloghandler = logging.StreamHandler() consoleloghandler.setLevel(1)
Modified: branches/osx_newbuildsys/src/notify.py =================================================================== --- branches/osx_newbuildsys/src/notify.py 2008-10-01 17:16:05 UTC (rev 10462) +++ branches/osx_newbuildsys/src/notify.py 2008-10-02 16:46:18 UTC (rev 10463) @@ -28,6 +28,7 @@ ##
import os +import sys import time import dialogs import gobject @@ -57,6 +58,11 @@ except: USER_HAS_GROWL = False
+try: + from AppKit import * +except ImportError: + pass + def get_show_in_roster(event, account, contact, session=None): '''Return True if this event must be shown in roster, else False''' if event == 'gc_message_received': @@ -142,6 +148,7 @@ # First, find what notifications we want do_popup = False do_sound = False + do_bounce = False do_cmd = False if event == 'status_change': new_show = parameters[0] @@ -196,6 +203,8 @@ helpers.allow_sound_notification('next_message_received_unfocused', advanced_notif_num): do_sound = True + if not focused: + do_bounce = True else: print '*Event not implemeted yet*'
@@ -307,6 +316,13 @@ helpers.play_sound_file(snd_file) if snd_event: helpers.play_sound(snd_event) + + if do_bounce: + if sys.platform == 'darwin': + try: + NSApp.requestUserAttention_(NSInformationalRequest) + except NameError: + pass
if do_cmd: command = gajim.config.get_per('notifications', str(advanced_notif_num),