Bug 241531 - Notification action is never called
Notification action is never called
Status: CLOSED RAWHIDE
Product: Fedora
Classification: Fedora
Component: system-config-printer (Show other bugs)
rawhide
x86_64 Linux
medium Severity medium
: ---
: ---
Assigned To: Tim Waugh
:
Depends On:
Blocks: 157324
  Show dependency treegraph
 
Reported: 2007-05-27 08:03 EDT by Tim Waugh
Modified: 2007-11-30 17:12 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2007-07-05 07:53:51 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
test-server.py (855 bytes, text/x-python)
2007-05-27 08:03 EDT, Tim Waugh
no flags Details
test-client.py (286 bytes, text/x-python)
2007-05-27 08:04 EDT, Tim Waugh
no flags Details
test-client.py (667 bytes, text/x-python)
2007-06-05 08:36 EDT, Tim Waugh
no flags Details
test-server.py (612 bytes, text/x-python)
2007-06-05 08:37 EDT, Tim Waugh
no flags Details

  None (edit)
Description Tim Waugh 2007-05-27 08:03:38 EDT
Description of problem:
When I converted a working Python class that made use of notification actions
(add_action()) into a D-Bus service object, the actions stopped working.

Version-Release number of selected component (if applicable):
notify-python-0.1.0-3.fc6
dbus-1.0.1-12.fc6

How reproducible:
100%

Steps to Reproduce:
1.python ./test-server.py
2.python ./test-client.py (in another window)
3.Click "Configure" in the notification
  
Actual results:
No output in the server terminal window.

Expected results:
configure clicked

Additional info:
Works fine if you take out the D-Bus bits and trigger the notification from a
timeout.
Comment 1 Tim Waugh 2007-05-27 08:03:38 EDT
Created attachment 155518 [details]
test-server.py
Comment 2 Tim Waugh 2007-05-27 08:04:05 EDT
Created attachment 155519 [details]
test-client.py
Comment 3 Tim Waugh 2007-05-29 13:12:13 EDT
Hmm, maybe pynotify.init() needs to be called before connecting to the bus.  But
why would that be?
Comment 4 Tim Waugh 2007-06-05 08:35:28 EDT
No, that isn't it.  Here is a revised test case.

WORKS FINE on Fedora Core 6:

libnotify-0.4.2-5.fc6
notify-python-0.1.0-3.fc6

FAILS on Fedora 7:

libnotify-0.4.4-2.fc7
notify-python-0.1.0-4.fc7

Comment 5 Tim Waugh 2007-06-05 08:36:37 EDT
Created attachment 156211 [details]
test-client.py
Comment 6 Tim Waugh 2007-06-05 08:37:04 EDT
Created attachment 156212 [details]
test-server.py
Comment 7 Tim Waugh 2007-06-05 08:46:56 EDT
In fact, here is a much simpler test case:

==>
#!/usr/bin/python
import pynotify
import gobject

class Note:
    def __init__ (self, loop):
        self.loop = loop

    def show (self):
        n = pynotify.Notification ('title', 'text')
        n.set_timeout (pynotify.EXPIRES_NEVER)
        n.add_action ("configure", "Configure", self.configure)
        n.show ()

    def configure (self, *args):
        print args
        self.loop.quit ()

pynotify.init ("foo")
loop = gobject.MainLoop ()
n = Note(loop)
n.show ()
loop.run ()
<==

How to reproduce:
1. Run the python code
2. Click the 'Configure' button

Actual results:
Program continues to run.

Expected results:
Program displays output and stops.

Additional information:
Works fine in FC6, fails in F7.
Comment 8 Luke Macken 2007-06-06 18:56:17 EDT
`notify-send foo` doesn't seem to even work in rawhide.
Comment 9 Tim Waugh 2007-06-14 11:43:21 EDT
'notify-send foo' does work in rawhide now anyway, but the simple test case in
comment #7 still fails to trigger the action (in rawhide).  It does work in FC-6
and F-7.

I installed the libnotify-debuginfo package and put a breakpoint on
_action_signal_handler().  It was never called -- however, 'dbus-monitor
--session' showed that the ActionInvoked signal was sent.

dbus-1.0.2-4.fc7
dbus-glib-0.73-1.fc7
notification-daemon-0.3.7-4.fc8
libnotify-0.4.4-6.fc8
notify-python-0.1.0-4.fc7
Comment 10 Tim Waugh 2007-06-14 11:43:53 EDT
Reassigned to libnotify owner.
Comment 11 Matthias Clasen 2007-06-14 13:46:07 EDT
Oddly enough, a very similar testcase works:

#!/usr/bin/env python
import gobject
import pynotify

def foo_cb(n, action):
        print "button clicked"
        n.close()

if __name__ == '__main__':
        pynotify.init ("foo")
        loop = gobject.MainLoop ()
        n = pynotify.Notification("title", "text")
        n.set_timeout (pynotify.EXPIRES_NEVER)
        n.add_action ("foo", "foo", foo_cb)
        n.show()
        loop.run ()
Comment 12 Tim Waugh 2007-06-15 07:40:42 EDT
Argh!  I see the problem now with the test case in comment #7 -- n (the
pynotify.Notification object) goes out of scope as soon as Note.show() returns..!

Sorry for the noise.

Note You need to log in before you can comment on or make changes to this bug.