Merge lp:~macslow/unity-notifications/fix-1295762 into lp:unity-notifications

Proposed by Mirco Müller
Status: Merged
Approved by: Antti Kaijanmäki
Approved revision: 205
Merged at revision: 207
Proposed branch: lp:~macslow/unity-notifications/fix-1295762
Merge into: lp:unity-notifications
Diff against target: 94 lines (+20/-7)
5 files modified
examples/example.py (+3/-0)
examples/sd-example-password-entry.py (+4/-3)
examples/sd-example-user-auth.py (+4/-3)
include/notify-backend.h.in (+1/-0)
src/NotificationServer.cpp (+8/-1)
To merge this branch: bzr merge lp:~macslow/unity-notifications/fix-1295762
Reviewer Review Type Date Requested Status
Lars Karlitski (community) Disapprove
Antti Kaijanmäki (community) Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+218648@code.launchpad.net

Commit message

Added a snap-decisions-specific hint to allow control over the timeout of a notification.

Description of the change

Added a snap-decisions-specific hint to allow control over the timeout of a notification. If the default 60-seconds timeout is too short for a specific snap-decisions notification, an app can use the "x-canonical-snap-decisions-timeout" (integer) hint to state a longer timeout. The value is interpreted as milliseconds. This fixes LP #1295762 and LP #1315419.

Since this is meant to only address the timeout of snap-decisions notifications, the standard libnotify-way of stating a custom timeout - applied to any type of notification - has intentionally not been chosen.

* Are there any related MPs required for this MP to build/function as expected? Please list.
No.

* Did you perform an exploratory manual test run of your code change and any related functionality?
Compiled code, verified new feature works as expected on desktop, phone and tablet.

* Did you make sure that your branch does not contain spurious tags?
Yes.

* If you changed the packaging (debian), did you subscribe the ubuntu-unity team to this MP?
na

* If you changed the UI, has there been a design review?
na

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Antti Kaijanmäki (kaijanmaki) wrote :

LGTM.

review: Approve
Revision history for this message
Antti Kaijanmäki (kaijanmaki) wrote :

Tested this on n4. now the indicator-network dialogs do not expire after 60 seconds and the rest of the snap decisions do. So. TESTING DONE.

Revision history for this message
Lars Karlitski (larsu) wrote :

> Since this is meant to only address the timeout of snap-decisions
> notifications, the standard libnotify-way of stating a custom timeout -
> applied to any type of notification - has intentionally not been chosen.

A snap decision is just a normal notification? Why can't we just reuse the standard expiration timeout, which is not used for anything now.

As for the bug that is supposedely fixing: shouldn't indicator-network simply pass 0 as timeout to get have the bubble stay on screen until the user interacts with it?

review: Disapprove
Revision history for this message
Jussi Pakkanen (jpakkane) wrote :

We don't use that because design explicitly told us not to.

Revision history for this message
Lars Karlitski (larsu) wrote :

> We don't use that because design explicitly told us not to.

What? Since when does design care about parameters to D-Bus methods?

Revision history for this message
Jussi Pakkanen (jpakkane) wrote :

Senders of snap notifications are not allowed to affect how long they are shown. This behaviour is defined only in the notification service. Thus the only way to do that is to ignore the timeout argument.

Revision history for this message
Antti Kaijanmäki (kaijanmaki) wrote :

> Senders of snap notifications are not allowed to affect how long they are
> shown. This behaviour is defined only in the notification service. Thus the
> only way to do that is to ignore the timeout argument.

Jussi probably meant here to say "Senders of regular notifications are not.."

Anyway, we have certain scenarios where we need the snap decisions to never expire (see the bug description) and this branch fixes that.

Revision history for this message
Lars Karlitski (larsu) wrote :

> Senders of snap notifications are not allowed to affect how long they are
> shown. This behaviour is defined only in the notification service. Thus the
> only way to do that is to ignore the timeout argument.

But the proposed patch allows senders to affect the timeout, doesn't it? Why do we have the hint if we don't allow setting it?

Revision history for this message
Lars Karlitski (larsu) wrote :

> > Senders of snap notifications are not allowed to affect how long they are
> > shown. This behaviour is defined only in the notification service. Thus the
> > only way to do that is to ignore the timeout argument.
>
> Jussi probably meant here to say "Senders of regular notifications are not.."

That makes more sense. But we could just ignore the timeout parameter for non-snap-decision notifications.

> Anyway, we have certain scenarios where we need the snap decisions to never
> expire (see the bug description) and this branch fixes that.

Are there any snap decisions that _do_ expire? Maybe we can simply define them as never expiring?

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'examples/example.py'
2--- examples/example.py 2013-12-04 17:38:52 +0000
3+++ examples/example.py 2014-05-07 15:39:33 +0000
4@@ -49,6 +49,7 @@
5 'x-canonical-private-icon-only': False,
6 'x-canonical-truncation': False,
7 'x-canonical-snap-decisions': False,
8+ 'x-canonical-snap-decisions-timeout':False,
9 'x-canonical-switch-to-application': False,
10 'x-canonical-secondary-icon': False,
11 'x-canonical-private-button-tint': False,
12@@ -107,6 +108,8 @@
13 print "\tx-canonical-truncation"
14 if capabilities['x-canonical-snap-decisions']:
15 print "\tx-canonical-snap-decisions"
16+ if capabilities['x-canonical-snap-decisions-timeout']:
17+ print "\tx-canonical-snap-decisions-timeout"
18 if capabilities['x-canonical-switch-to-application']:
19 print "\tx-canonical-switch-to-application"
20 if capabilities['x-canonical-secondary-icon']:
21
22=== modified file 'examples/sd-example-password-entry.py'
23--- examples/sd-example-password-entry.py 2013-10-31 12:55:18 +0000
24+++ examples/sd-example-password-entry.py 2014-05-07 15:39:33 +0000
25@@ -118,9 +118,10 @@
26 n.set_hint ("x-canonical-private-menu-model", menu_model_paths.end ());
27
28 # indicate to the notification-daemon, that we want to use snap-decisions
29- n.set_hint_string ("x-canonical-snap-decisions", "true");
30- n.set_hint_string ("x-canonical-private-button-tint", "true");
31- n.set_hint_string ("x-canonical-non-shaped-icon", "true");
32+ n.set_hint ("x-canonical-snap-decisions", GLib.Variant.new_string("true"));
33+ n.set_hint ("x-canonical-snap-decisions-timeout", GLib.Variant.new_int32(90000));
34+ n.set_hint ("x-canonical-private-button-tint", GLib.Variant.new_string("true"));
35+ n.set_hint ("x-canonical-non-shaped-icon", GLib.Variant.new_string("true"));
36
37 Gio.bus_own_name(Gio.BusType.SESSION, APPLICATION_ID, 0, bus_acquired, None, None)
38
39
40=== modified file 'examples/sd-example-user-auth.py'
41--- examples/sd-example-user-auth.py 2013-10-31 12:55:18 +0000
42+++ examples/sd-example-user-auth.py 2014-05-07 15:39:33 +0000
43@@ -132,9 +132,10 @@
44 n.set_hint ("x-canonical-private-menu-model", menu_model_paths.end ());
45
46 # indicate to the notification-daemon, that we want to use snap-decisions
47- n.set_hint_string ("x-canonical-snap-decisions", "true");
48- n.set_hint_string ("x-canonical-private-button-tint", "true");
49- n.set_hint_string ("x-canonical-non-shaped-icon", "true");
50+ n.set_hint ("x-canonical-snap-decisions", GLib.Variant.new_string("true"));
51+ n.set_hint ("x-canonical-snap-decisions-timeout", GLib.Variant.new_int32 (90000));
52+ n.set_hint ("x-canonical-private-button-tint", GLib.Variant.new_string("true"));
53+ n.set_hint ("x-canonical-non-shaped-icon", GLib.Variant.new_string("true"));
54
55 Gio.bus_own_name(Gio.BusType.SESSION, APPLICATION_ID, 0, bus_acquired, None, None)
56
57
58=== modified file 'include/notify-backend.h.in'
59--- include/notify-backend.h.in 2013-11-28 13:03:46 +0000
60+++ include/notify-backend.h.in 2014-05-07 15:39:33 +0000
61@@ -66,5 +66,6 @@
62 #define BUTTON_TINT_HINT "x-canonical-private-button-tint"
63 #define TRUNCATION_HINT "x-canonical-truncation"
64 #define APPEND_HINT "x-canonical-append"
65+#define TIMEOUT_HINT "x-canonical-snap-decisions-timeout"
66
67 #endif
68
69=== modified file 'src/NotificationServer.cpp'
70--- src/NotificationServer.cpp 2013-11-28 13:03:46 +0000
71+++ src/NotificationServer.cpp 2014-05-07 15:39:33 +0000
72@@ -56,6 +56,7 @@
73 capabilities.push_back(NON_SHAPED_ICON_HINT);
74 capabilities.push_back(MENU_MODEL_HINT);
75 capabilities.push_back(INTERACTIVE_HINT);
76+ capabilities.push_back(TIMEOUT_HINT);
77
78 return capabilities;
79 }
80@@ -77,7 +78,13 @@
81 expireTimeout = 3000;
82 ntype = Notification::Type::Confirmation;
83 } else if (hints.find(SNAP_HINT) != hints.end()) {
84- expireTimeout = 60000;
85+ QVariant u = hints[TIMEOUT_HINT].variant();
86+ if(!u.canConvert(QVariant::Int)) {
87+ expireTimeout = 60000;
88+ } else {
89+ expireTimeout = u.toInt();
90+ }
91+
92 ntype = Notification::Type::SnapDecision;
93 } else if(hints.find(INTERACTIVE_HINT) != hints.end()) {
94 ntype = Notification::Type::Interactive;

Subscribers

People subscribed via source and target branches

to all changes: