Bug 241531 - Notification action is never called
Summary: Notification action is never called
Alias: None
Product: Fedora
Classification: Fedora
Component: system-config-printer   
(Show other bugs)
Version: rawhide
Hardware: x86_64
OS: Linux
Target Milestone: ---
Assignee: Tim Waugh
QA Contact:
Depends On:
Blocks: 157324
TreeView+ depends on / blocked
Reported: 2007-05-27 12:03 UTC by Tim Waugh
Modified: 2007-11-30 22:12 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2007-07-05 11:53:51 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
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 12:03 UTC, Tim Waugh
no flags Details
test-client.py (286 bytes, text/x-python)
2007-05-27 12:04 UTC, Tim Waugh
no flags Details
test-client.py (667 bytes, text/x-python)
2007-06-05 12:36 UTC, Tim Waugh
no flags Details
test-server.py (612 bytes, text/x-python)
2007-06-05 12:37 UTC, Tim Waugh
no flags Details

Description Tim Waugh 2007-05-27 12:03:38 UTC
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):

How reproducible:

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

Comment 1 Tim Waugh 2007-05-27 12:03:38 UTC
Created attachment 155518 [details]

Comment 2 Tim Waugh 2007-05-27 12:04:05 UTC
Created attachment 155519 [details]

Comment 3 Tim Waugh 2007-05-29 17:12:13 UTC
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 12:35:28 UTC
No, that isn't it.  Here is a revised test case.

WORKS FINE on Fedora Core 6:


FAILS on Fedora 7:


Comment 5 Tim Waugh 2007-06-05 12:36:37 UTC
Created attachment 156211 [details]

Comment 6 Tim Waugh 2007-06-05 12:37:04 UTC
Created attachment 156212 [details]

Comment 7 Tim Waugh 2007-06-05 12:46:56 UTC
In fact, here is a much simpler test case:

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 22:56:17 UTC
`notify-send foo` doesn't seem to even work in rawhide.

Comment 9 Tim Waugh 2007-06-14 15:43:21 UTC
'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.


Comment 10 Tim Waugh 2007-06-14 15:43:53 UTC
Reassigned to libnotify owner.

Comment 11 Matthias Clasen 2007-06-14 17:46:07 UTC
Oddly enough, a very similar testcase works:

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

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

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)
        loop.run ()

Comment 12 Tim Waugh 2007-06-15 11:40:42 UTC
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.