Hello,

I'll first thanks you for gajim.

I've been musing with GNOME notification daemon recently and patched
gajim so it attachs its notifiations under the systray icon (if
present).

This is done on 0.9.1 since it is what I use here but I ported my
patch to current SVN version (although I didn't test this one).

It is a bit ugly since src/notify.py must then know about current
systray icon (so it can calculate x,y to position the window) but
I couldn't find another way (and probably don't know enough about
gajim internals to it properly).

Anyway here it is attached and keep up the good work.


Regards,

        Frederic
Index: src/notify.py
===================================================================
--- src/notify.py       (révision 5480)
+++ src/notify.py       (copie de travail)
@@ -147,6 +147,22 @@
                            (name, version, version, spec_version) = 
self.notif.GetServerInformation()
                        except:
                            version = '0.3.1'
+            
+               import systray
+               hints = {}
+               if systray.current_systray and systray.current_systray.t:
+                       x, y = systray.current_systray.t.window.get_origin()
+                       w, h = systray.current_systray.t.size_request()
+                       x += w/2
+                       if y < 100:
+                               # top-panel
+                               y += h
+                       else:
+                               # bottom-panel
+                               y -= h
+                       hints['x'] = x
+                       hints['y'] = y
+
                if version.startswith('0.2'):
                        try:
                                self.id = 
self.notif.Notify(dbus.String(_('Gajim')),
@@ -160,11 +176,11 @@
                        if version >= ( 0, 3, 2):
                            self.id = self.notif.Notify(dbus.String(_('Gajim')),
                                    dbus.UInt32(0), dbus.String(path_to_image), 
dbus.String(event_type),
-                                   dbus.String(text), ( dbus.String(ntype), 
dbus.String(event_type) ), {}, dbus.UInt32(timeout*1000))
+                                   dbus.String(text), ( dbus.String(ntype), 
dbus.String(event_type) ), events, dbus.UInt32(timeout*1000))
                        else:
                            self.id = self.notif.Notify(dbus.String(_('Gajim')),
                                    dbus.String(path_to_image), dbus.UInt32(0), 
dbus.String(event_type),
-                                   dbus.String(text), dbus.String(''), {}, 
dbus.UInt32(timeout*1000))
+                                   dbus.String(text), dbus.String(''), events, 
dbus.UInt32(timeout*1000))
                notification_response_manager.attach_to_interface()
                notification_response_manager.pending[self.id] = self
 
Index: src/systray.py
===================================================================
--- src/systray.py      (révision 5480)
+++ src/systray.py      (copie de travail)
@@ -53,6 +53,8 @@
 
 GTKGUI_GLADE = 'gtkgui.glade'
 
+current_systray = None
+
 class Systray:
        '''Class for icon in the notification area
        This class is both base class (for systraywin32.py) and normal class
@@ -68,6 +70,9 @@
                self.systray_context_menu = 
self.xml.get_widget('systray_context_menu')
                self.xml.signal_autoconnect(self)
 
+               global current_systray
+               current_systray = self
+
        def set_img(self):
                if len(self.jids) > 0:
                        state = 'message'
_______________________________________________
Gajim-devel mailing list
[EMAIL PROTECTED]
https://lists.gajim.org/cgi-bin/listinfo/gajim-devel

Reply via email to