After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 589408 - Add respond button to notifications
Add respond button to notifications
Status: RESOLVED FIXED
Product: empathy
Classification: Core
Component: Notifications
unspecified
Other Linux
: Normal normal
: ---
Assigned To: empathy-maint
sjoerd[moblin]
Depends on:
Blocks: 597124
 
 
Reported: 2009-07-22 17:04 UTC by Sjoerd Simons
Modified: 2009-10-05 11:08 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
proposed fix: http://git.collabora.co.uk/?p=user/cassidy/empathy;a=shortlog;h=refs/heads/notify-button-589408 (3.16 KB, patch)
2009-10-02 12:28 UTC, Guillaume Desmottes
rejected Details | Review
tabs fixed (3.13 KB, patch)
2009-10-02 13:15 UTC, Guillaume Desmottes
accepted-commit_now Details | Review

Description Sjoerd Simons 2009-07-22 17:04:09 UTC
Empathy's notify bubbles don't have buttons, so you always have to click on the status icon to react on them. This is annoying and a not very usefull if you don't have a status icon.
Comment 1 Nicolò Chieffo 2009-07-22 17:09:12 UTC
Don't forget to check for capabilities before adding actions to notifications
Comment 2 William Jon McCann 2009-09-29 01:26:05 UTC
Perhaps we should present the chat window when the user clicks on the bubble?  This is done by setting a "default" action.
Comment 3 Guillaume Desmottes 2009-10-02 12:28:29 UTC
Created attachment 144587 [details] [review]
proposed fix: http://git.collabora.co.uk/?p=user/cassidy/empathy;a=shortlog;h=refs/heads/notify-button-589408

 src/empathy-status-icon.c |   39 +++++++++++++++++++++++++++++++++++++++
 src/empathy.c             |    4 +++-
 2 files changed, 42 insertions(+), 1 deletions(-)
Comment 4 Cosimo Cecchi 2009-10-02 12:36:10 UTC
Comment on attachment 144587 [details] [review]
proposed fix: http://git.collabora.co.uk/?p=user/cassidy/empathy;a=shortlog;h=refs/heads/notify-button-589408

Looks fine to me, except for these things:

>+			if (priv->notify_supports_actions)
>+				{

Indentation is wrong here, empathy-status-icon.c uses another stile for braces.

>@@ -538,6 +564,7 @@ empathy_status_icon_init (EmpathyStatusIcon *icon)

>+  GList *list, *l;

Indentation.

>+	for (l = list; l != NULL; l = g_list_next (l))
>+		{

See previous comment for wrt braces indentation.

>+			if (!tp_strdiff (caps, "actions"))
>+				priv->notify_supports_actions = TRUE;

You should break the cycle when this is found.
Comment 5 Guillaume Desmottes 2009-10-02 13:15:59 UTC
Created attachment 144594 [details] [review]
tabs fixed

 src/empathy-status-icon.c |   37 +++++++++++++++++++++++++++++++++++++
 src/empathy.c             |    3 ++-
 2 files changed, 39 insertions(+), 1 deletions(-)
Comment 6 Guillaume Desmottes 2009-10-02 13:17:26 UTC
(In reply to comment #4)
> You should break the cycle when this is found.

No because all the caps strings have to be freed.
Comment 7 Cosimo Cecchi 2009-10-02 13:22:11 UTC
Comment on attachment 144594 [details] [review]
tabs fixed

Looks good.
Comment 8 William Jon McCann 2009-10-02 13:31:36 UTC
Is there a reason why we can't just use the default action?
Comment 9 Guillaume Desmottes 2009-10-02 13:32:43 UTC
William: What do you mean by default action? Didn't see anything about that in the libnotify doc.
Comment 10 William Jon McCann 2009-10-02 13:35:46 UTC
http://www.galago-project.org/specs/notification/0.9/x81.html (Table 1):
"The default action (usually invoked my clicking the notification) should have a key named "default". The name can be anything, though implementations are free not to display it."
Comment 11 Guillaume Desmottes 2009-10-02 13:36:17 UTC
(In reply to comment #7)
> (From update of attachment 144594 [details] [review])
> Looks good.

Actually this patch is wrong. As Xavier mentioned it, this "respond" button only make sense for new incoming chat events; not for tubes, invites, subscriptions requests etc.

It could make sense for the audio/video events as well but with current code it just display the incoming call dialog re-asking if we want to accept the call or not.

A simple hackish solution could be to add a boolean attribute to EmpathyEvent saying if we want to display this button or not.
It would be better to have a more generic mechanism but that probably involves some non trivial refactoring.
Comment 12 Xavier Claessens 2009-10-02 13:48:16 UTC
I think best way is to mimick GtkDialog's api, to add buttons. In EmpathyEventManager:

 - event_manager_add can be modified to get a list of button text and respond id.
 - EventFunc can have an extra param which is respond id.

All that is private functions, so it does not need to change any API.
Comment 13 Guillaume Desmottes 2009-10-02 14:04:11 UTC
(In reply to comment #10)
> http://www.galago-project.org/specs/notification/0.9/x81.html (Table 1):
> "The default action (usually invoked my clicking the notification) should have
> a key named "default". The name can be anything, though implementations are
> free not to display it."

Thanks, I was looking in the libnotify API. We are not convinced that's the right way to do it. Most people click on the notification bubble to make them dissappear so accepting the chat sounds like a bad idea.
Comment 14 Guillaume Desmottes 2009-10-02 14:50:58 UTC
After discussions, we agreed to add this feature for now (as Moblin really needs it) and do it properly during the 2.29 cycle (bug #597124).
Comment 15 Guillaume Desmottes 2009-10-02 15:10:10 UTC
Merged to master

commit ce8d523beb33cd57df62715ae1cf1fad6a601366
Author: Guillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Date:   Fri Oct 2 14:12:34 2009 +0100

    fix coding styles

commit 817bde504ebb05cfefb136ba77450eab0c374dfa
Author: Guillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Date:   Fri Oct 2 13:02:25 2009 +0100

    empathy-status-icon: check if notification daemon supports actions

commit d734b80c282ebb9120c630e1d6e7a8bad289daff
Author: Guillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Date:   Fri Oct 2 12:50:48 2009 +0100

    initialize libnotify earlier in main()
    
    The status icon will have to query the notify daemon during its
    construction so libnotify has to be already initialized.

commit ea995fbc6cc94712a4d10d931f48121c939db437
Author: Rob Bradford <rob@linux.intel.com>
Date:   Fri Oct 2 12:27:23 2009 +0100

    Add a "Respond" button to notifications to provide a positive action (#589408)
    
    The positive action is the same positive action that would be
    accomplished by clicking on the status icon.
Comment 16 Xavier Claessens 2009-10-05 07:15:14 UTC
I don't understand how it can be good for moblin if it is obviously the bad thing to do...
Comment 17 Guillaume Desmottes 2009-10-05 11:08:46 UTC
Moblin doesn't have any status icon so notifications are the only way to go.