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

Proposed by Mirco Müller
Status: Merged
Approved by: Daniel d'Andrada
Approved revision: 220
Merged at revision: 215
Proposed branch: lp:~macslow/unity-notifications/fix-1348092
Merge into: lp:unity-notifications
Diff against target: 570 lines (+186/-107)
20 files modified
examples/example.py (+27/-27)
examples/icon-summary-body.py (+1/-1)
examples/icon-summary.py (+3/-2)
examples/interactive-notification.py (+1/-1)
examples/non-shaped-icon-summary-body.py (+1/-1)
examples/sd-example-event-reminder.py (+94/-0)
examples/sd-example-incoming-call-canceled.py (+7/-6)
examples/sd-example-incoming-call.py (+6/-5)
examples/sd-example-incoming-file.py (+2/-0)
examples/sd-example-morning-alarm.py (+2/-1)
examples/sd-example-much-body-text.py (+16/-5)
examples/sd-example-password-entry.py (+2/-1)
examples/sd-example-user-auth.py (+2/-1)
examples/sd-example-using-button-tint-hint.py (+6/-6)
examples/update-notifications.py (+1/-1)
include/NotificationClient.h (+0/-1)
include/notify-backend.h.in (+2/-2)
src/Notification.cpp (+11/-1)
src/NotificationClient.cpp (+0/-17)
src/NotificationServer.cpp (+2/-28)
To merge this branch: bzr merge lp:~macslow/unity-notifications/fix-1348092
Reviewer Review Type Date Requested Status
Daniel d'Andrada (community) Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+228252@code.launchpad.net

Commit message

Renamed and added hints to expose the new button-tint hints for snap-decisions, which are needed to comply with the visual changes coming from Design (for RTM). Updated examples to reflect these changes.

Description of the change

Renamed and added hints to expose the new button-tint hints for snap-decisions, which are needed to comply with the visual changes coming from Design (for RTM). Updated examples to reflect these changes.

* Are there any related MPs required for this MP to build/function as expected? Please list.
Yes. This goes hand in hand with lp:~macslow/unity8/fix-1348092

* Did you perform an exploratory manual test run of your code change and any related functionality?
Yes.

* 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?
Not applicable.

* If you changed the UI, has there been a design review?
Not applicable.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Daniel d'Andrada (dandrader) wrote :

Some coding style nitpicks in the diff.

Revision history for this message
Daniel d'Andrada (dandrader) wrote :

But otherwise it looks ok to me.

review: Needs Fixing
220. By Mirco Müller

Fixed some formatting issues.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Daniel d'Andrada (dandrader) wrote :

Looks ok.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'examples/example.py'
--- examples/example.py 2014-06-23 09:31:56 +0000
+++ examples/example.py 2014-08-19 14:04:59 +0000
@@ -34,29 +34,29 @@
34import pynotify34import pynotify
3535
36# even in Python this is globally nasty :), do something nicer in your own code36# even in Python this is globally nasty :), do something nicer in your own code
37capabilities = {'actions': False,37capabilities = {'actions': False,
38 'body': False,38 'body': False,
39 'body-hyperlinks': False,39 'body-hyperlinks': False,
40 'body-images': False,40 'body-images': False,
41 'body-markup': False,41 'body-markup': False,
42 'icon-multi': False,42 'icon-multi': False,
43 'icon-static': False,43 'icon-static': False,
44 'sound': False,44 'sound': False,
45 'sound-file': False,45 'sound-file': False,
46 'suppress-sound': False,46 'suppress-sound': False,
47 'image/svg+xml': False,47 'image/svg+xml': False,
48 'urgency': False,48 'urgency': False,
49 'x-canonical-private-synchronous': False,49 'x-canonical-private-synchronous': False,
50 'x-canonical-append': False,50 'x-canonical-private-icon-only': False,
51 'x-canonical-private-icon-only': False,51 'x-canonical-truncation': False,
52 'x-canonical-truncation': False,52 'x-canonical-snap-decisions': False,
53 'x-canonical-snap-decisions': False,53 'x-canonical-snap-decisions-timeout': False,
54 'x-canonical-snap-decisions-timeout':False,54 'x-canonical-switch-to-application': False,
55 'x-canonical-switch-to-application': False,55 'x-canonical-secondary-icon': False,
56 'x-canonical-secondary-icon': False,56 'x-canonical-private-affirmative-tint': False,
57 'x-canonical-private-button-tint': False,57 'x-canonical-private-rejection-tint': False,
58 'x-canonical-private-menu-model': False,58 'x-canonical-private-menu-model': False,
59 'x-canonical-non-shaped-icon': False}59 'x-canonical-non-shaped-icon': False}
6060
61def initCaps ():61def initCaps ():
62 caps = pynotify.get_server_caps ()62 caps = pynotify.get_server_caps ()
@@ -106,8 +106,6 @@
106 print "\timage/svg+xml"106 print "\timage/svg+xml"
107 if capabilities['x-canonical-private-synchronous']:107 if capabilities['x-canonical-private-synchronous']:
108 print "\tx-canonical-private-synchronous"108 print "\tx-canonical-private-synchronous"
109 if capabilities['x-canonical-append']:
110 print "\tx-canonical-append"
111 if capabilities['x-canonical-private-icon-only']:109 if capabilities['x-canonical-private-icon-only']:
112 print "\tx-canonical-private-icon-only"110 print "\tx-canonical-private-icon-only"
113 if capabilities['x-canonical-truncation']:111 if capabilities['x-canonical-truncation']:
@@ -120,8 +118,10 @@
120 print "\tx-canonical-switch-to-application"118 print "\tx-canonical-switch-to-application"
121 if capabilities['x-canonical-secondary-icon']:119 if capabilities['x-canonical-secondary-icon']:
122 print "\tx-canonical-secondary-icon"120 print "\tx-canonical-secondary-icon"
123 if capabilities['x-canonical-private-button-tint']:121 if capabilities['x-canonical-private-affirmative-tint']:
124 print "\tx-canonical-private-button-tint"122 print "\tx-canonical-private-affirmative-tint"
123 if capabilities['x-canonical-private-rejection-tint']:
124 print "\tx-canonical-private-rejection-tint"
125 if capabilities['x-canonical-private-menu-model']:125 if capabilities['x-canonical-private-menu-model']:
126 print "\tx-canonical-private-menu-model"126 print "\tx-canonical-private-menu-model"
127 if capabilities['x-canonical-non-shaped-icon']:127 if capabilities['x-canonical-non-shaped-icon']:
128128
=== modified file 'examples/icon-summary-body.py'
--- examples/icon-summary-body.py 2013-05-17 14:57:48 +0000
+++ examples/icon-summary-body.py 2014-08-19 14:04:59 +0000
@@ -51,5 +51,5 @@
51 "next weekend? Will you join me "51 "next weekend? Will you join me "
52 "and Anna?",52 "and Anna?",
53 os.getcwd() + "/assets/avatar2.jpg")53 os.getcwd() + "/assets/avatar2.jpg")
54 n.set_hint_string ("x-canonical-secondary-icon", os.getcwd() + "/assets/icon_message.png")54 n.set_hint_string ("x-canonical-secondary-icon", "message")
55 n.show ()55 n.show ()
5656
=== modified file 'examples/icon-summary.py'
--- examples/icon-summary.py 2013-05-17 14:57:48 +0000
+++ examples/icon-summary.py 2014-08-19 14:04:59 +0000
@@ -48,6 +48,7 @@
48 # try the icon-summary case48 # try the icon-summary case
49 n = pynotify.Notification ("Upload of image completed",49 n = pynotify.Notification ("Upload of image completed",
50 "",50 "",
51 "")51 os.getcwd() + "/assets/icon_facebook.png")
52 n.set_hint_string ("x-canonical-secondary-icon", os.getcwd() + "/assets/icon_facebook.png")52 n.set_hint_string ("x-canonical-non-shaped-icon", "true")
53
53 n.show ()54 n.show ()
5455
=== modified file 'examples/interactive-notification.py'
--- examples/interactive-notification.py 2013-05-17 14:57:48 +0000
+++ examples/interactive-notification.py 2014-08-19 14:04:59 +0000
@@ -47,7 +47,7 @@
47 "Click this notification to trigger the attached action.",47 "Click this notification to trigger the attached action.",
48 icon);48 icon);
49 n.set_hint_string ("x-canonical-switch-to-application", value);49 n.set_hint_string ("x-canonical-switch-to-application", value);
50 n.set_hint_string ("x-canonical-secondary-icon", os.getcwd() + "/assets/icon_message.png");50 n.set_hint_string ("x-canonical-secondary-icon", "message");
51 n.add_action ("action_id", "dummy", action_callback);51 n.add_action ("action_id", "dummy", action_callback);
52 return n52 return n
5353
5454
=== modified file 'examples/non-shaped-icon-summary-body.py'
--- examples/non-shaped-icon-summary-body.py 2013-10-31 12:55:18 +0000
+++ examples/non-shaped-icon-summary-body.py 2014-08-19 14:04:59 +0000
@@ -51,6 +51,6 @@
51 "next weekend? Will you join me "51 "next weekend? Will you join me "
52 "and Anna?",52 "and Anna?",
53 os.getcwd() + "/assets/avatar2-with-alpha.png")53 os.getcwd() + "/assets/avatar2-with-alpha.png")
54 n.set_hint_string ("x-canonical-secondary-icon", os.getcwd() + "/assets/icon_message.png")54 n.set_hint_string ("x-canonical-secondary-icon", "message")
55 n.set_hint_string ("x-canonical-non-shaped-icon", "true")55 n.set_hint_string ("x-canonical-non-shaped-icon", "true")
56 n.show ()56 n.show ()
5757
=== added file 'examples/sd-example-event-reminder.py'
--- examples/sd-example-event-reminder.py 1970-01-01 00:00:00 +0000
+++ examples/sd-example-event-reminder.py 2014-08-19 14:04:59 +0000
@@ -0,0 +1,94 @@
1#!/usr/bin/python
2
3################################################################################
4##3456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789
5## 10 20 30 40 50 60 70 80
6##
7## Info:
8## Example of how to use libnotify correctly
9##
10## Run:
11## chmod +x sd-example-event-reminder.py
12## ./sd-example-event-reminder.py
13##
14## Copyright 2014 Canonical Ltd.
15##
16## Author:
17## Mirco "MacSlow" Mueller <mirco.mueller@canonical.com>
18##
19## This program is free software: you can redistribute it and/or modify it
20## under the terms of the GNU General Public License version 3, as published
21## by the Free Software Foundation.
22##
23## This program is distributed in the hope that it will be useful, but
24## WITHOUT ANY WARRANTY; without even the implied warranties of
25## MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
26## PURPOSE. See the GNU General Public License for more details.
27##
28## You should have received a copy of the GNU General Public License along
29## with this program. If not, see <http://www.gnu.org/licenses/>.
30##
31################################################################################
32
33import os
34import sys
35import time
36import pynotify
37import gobject
38import example
39
40def action_view (notification, action):
41 if action == "view":
42 print "Viewing the thing."
43 else:
44 print "That should not have happened (action_view)!"
45
46def action_snooze (notification, action):
47 if action == "snooze":
48 print "You want to snooze some more you lazy bastard!"
49 else:
50 print "That should not have happened (action_snooze)!"
51
52def action_ok (notification, action):
53 if action == "ok":
54 print "Getting up is the right thing to do... good for you!"
55 else:
56 print "That should not have happened (action_ok)!"
57
58def pushNotification (title, body, icon):
59 n = pynotify.Notification (title, body, icon);
60
61 # NOTE: the order in which actions are added is important... positive
62 # always comes first!
63 n.add_action ("ok", "Ok", action_ok);
64 n.add_action ("snooze", "Snooze", action_snooze);
65 n.add_action ("view", "View", action_view);
66
67 # indicate to the notification-daemon, that we want to use snap-decisions
68 n.set_hint_string ("x-canonical-snap-decisions", "true");
69 n.set_hint_string ("x-canonical-non-shaped-icon", "true");
70 n.set_hint_string ("x-canonical-private-affirmative-tint", "true");
71
72 n.show ()
73 return n
74
75if __name__ == '__main__':
76 if not pynotify.init ("sd-example-event-reminder"):
77 sys.exit (1)
78
79 # call this so we can savely use capabilities dictionary later
80 example.initCaps ()
81
82 # show what's supported
83 example.printCaps ()
84
85 # be nice and check for required capabilities
86 if not example.capabilities['x-canonical-snap-decisions'] \
87 and example.capabilities['x-canonical-non-shaped-icon'] \
88 and example.capabilities['x-canonical-private-affirmative-tint']:
89 sys.exit (2)
90
91 loop = gobject.MainLoop ()
92 n = pushNotification ("Theatre at Ferria Stadium", "at Ferria Stadium in Bilbao, Spain\n07578545317", "")
93 n.connect ("closed", example.closedHandler, loop)
94 loop.run ()
095
=== modified file 'examples/sd-example-incoming-call-canceled.py'
--- examples/sd-example-incoming-call-canceled.py 2014-05-29 08:59:34 +0000
+++ examples/sd-example-incoming-call-canceled.py 2014-08-19 14:04:59 +0000
@@ -87,18 +87,19 @@
87 n.add_action ("action_accept", "Pick up", action_accept);87 n.add_action ("action_accept", "Pick up", action_accept);
88 n.add_action ("action_decline_1", "Hang up", action_decline_1);88 n.add_action ("action_decline_1", "Hang up", action_decline_1);
89 n.add_action ("action_decline_2", "Reject with SMS", action_decline_2);89 n.add_action ("action_decline_2", "Reject with SMS", action_decline_2);
90 n.add_action ("action_decline_3", "messages:Dude, my wife is here!", action_decline_3);90 n.add_action ("action_decline_3", "message:Dude, my wife is here!", action_decline_3);
91 n.add_action ("action_decline_4", "messages:I'm sleeping.", action_decline_4);91 n.add_action ("action_decline_4", "message:I'm sleeping.", action_decline_4);
92 n.add_action ("action_decline_5", "messages:No time... I'm riding!", action_decline_5);92 n.add_action ("action_decline_5", "message:No time... I'm riding!", action_decline_5);
93 n.add_action ("action_decline_6", "edit:Send SMS...", action_decline_6);93 n.add_action ("action_decline_6", "edit:Send SMS...", action_decline_6);
9494
95 # indicate to the notification-daemon, that we want to use snap-decisions95 # indicate to the notification-daemon, that we want to use snap-decisions
96 n.set_hint_string ("x-canonical-snap-decisions", "true");96 n.set_hint_string ("x-canonical-snap-decisions", "true");
97 n.set_hint_string ("x-canonical-secondary-icon", os.getcwd() + "/assets/icon_phone.png");97 n.set_hint_string ("x-canonical-secondary-icon", "incoming-call");
9898
99 # set the button-tint hint so that the right/positive button is tinted and99 # set the button-tint hint so that the right/positive button is tinted and
100 # not using the stock clear-color100 # not using the stock clear-color
101 n.set_hint_string ("x-canonical-private-button-tint", "true");101 n.set_hint_string ("x-canonical-private-affirmative-tint", "true");
102 n.set_hint_string ("x-canonical-private-rejection-tint", "true");
102 n.set_urgency (pynotify.URGENCY_CRITICAL)103 n.set_urgency (pynotify.URGENCY_CRITICAL)
103104
104 n.show ()105 n.show ()
@@ -119,7 +120,7 @@
119 example.printCaps ()120 example.printCaps ()
120121
121 # be nice and check for required capabilities122 # be nice and check for required capabilities
122 if not example.capabilities['x-canonical-private-button-tint'] and not example.capabilities['x-canonical-snap-decisions']:123 if not example.capabilities['x-canonical-private-affirmative-tint'] and not example.capabilities['x-canonical-private-rejection-tint'] and not example.capabilities['x-canonical-snap-decisions']:
123 sys.exit (2)124 sys.exit (2)
124125
125 loop = gobject.MainLoop ()126 loop = gobject.MainLoop ()
126127
=== modified file 'examples/sd-example-incoming-call.py'
--- examples/sd-example-incoming-call.py 2014-05-29 08:59:34 +0000
+++ examples/sd-example-incoming-call.py 2014-08-19 14:04:59 +0000
@@ -87,15 +87,16 @@
87 n.add_action ("action_accept", "Hold + Answer", action_accept);87 n.add_action ("action_accept", "Hold + Answer", action_accept);
88 n.add_action ("action_decline_1", "End + Answer", action_decline_1);88 n.add_action ("action_decline_1", "End + Answer", action_decline_1);
89 n.add_action ("action_decline_2", "Decline", action_decline_2);89 n.add_action ("action_decline_2", "Decline", action_decline_2);
90 n.add_action ("action_decline_3", "messages:I missed your call - can you call me now?", action_decline_3);90 n.add_action ("action_decline_3", "message:I missed your call - can you call me now?", action_decline_3);
91 n.add_action ("action_decline_4", "messages:I'm running late. I'm on my way.", action_decline_4);91 n.add_action ("action_decline_4", "message:I'm running late. I'm on my way.", action_decline_4);
92 n.add_action ("action_decline_5", "messages:I'm busy at the moment. I'll call later.", action_decline_5);92 n.add_action ("action_decline_5", "message:I'm busy at the moment. I'll call later.", action_decline_5);
93 n.add_action ("action_decline_6", "edit:Custom", action_decline_6);93 n.add_action ("action_decline_6", "edit:Custom", action_decline_6);
9494
95 # indicate to the notification-daemon, that we want to use snap-decisions95 # indicate to the notification-daemon, that we want to use snap-decisions
96 n.set_hint_string ("x-canonical-snap-decisions", "true");96 n.set_hint_string ("x-canonical-snap-decisions", "true");
97 n.set_hint_string ("x-canonical-private-button-tint", "true");97 n.set_hint_string ("x-canonical-private-affirmative-tint", "true");
98 n.set_hint_string ("x-canonical-secondary-icon", os.getcwd() + "/assets/icon_phone.png");98 n.set_hint_string ("x-canonical-private-rejection-tint", "true");
99 n.set_hint_string ("x-canonical-secondary-icon", "incoming-call");
99 n.set_urgency (pynotify.URGENCY_CRITICAL)100 n.set_urgency (pynotify.URGENCY_CRITICAL)
100101
101 n.show ()102 n.show ()
102103
=== modified file 'examples/sd-example-incoming-file.py'
--- examples/sd-example-incoming-file.py 2014-02-18 14:48:55 +0000
+++ examples/sd-example-incoming-file.py 2014-08-19 14:04:59 +0000
@@ -60,6 +60,8 @@
60 # indicate to the notification-daemon, that we want to use snap-decisions60 # indicate to the notification-daemon, that we want to use snap-decisions
61 n.set_hint_string ("x-canonical-snap-decisions", "true");61 n.set_hint_string ("x-canonical-snap-decisions", "true");
62 n.set_hint_string ("x-canonical-non-shaped-icon", "true");62 n.set_hint_string ("x-canonical-non-shaped-icon", "true");
63 n.set_hint_string ("x-canonical-private-affirmative-tint", "true");
64 n.set_hint_string ("x-canonical-private-rejection-tint", "true");
6365
64 n.show ()66 n.show ()
65 return n67 return n
6668
=== modified file 'examples/sd-example-morning-alarm.py'
--- examples/sd-example-morning-alarm.py 2013-10-31 12:55:18 +0000
+++ examples/sd-example-morning-alarm.py 2014-08-19 14:04:59 +0000
@@ -60,6 +60,7 @@
60 # indicate to the notification-daemon, that we want to use snap-decisions60 # indicate to the notification-daemon, that we want to use snap-decisions
61 n.set_hint_string ("x-canonical-snap-decisions", "true");61 n.set_hint_string ("x-canonical-snap-decisions", "true");
62 n.set_hint_string ("x-canonical-non-shaped-icon", "true");62 n.set_hint_string ("x-canonical-non-shaped-icon", "true");
63 n.set_hint_string ("x-canonical-private-affirmative-tint", "true");
6364
64 n.show ()65 n.show ()
65 return n66 return n
@@ -81,7 +82,7 @@
81 loop = gobject.MainLoop ()82 loop = gobject.MainLoop ()
82 n = pushNotification ("Morning alarm",83 n = pushNotification ("Morning alarm",
83 "It's 6:30... time to get up!",84 "It's 6:30... time to get up!",
84 os.getcwd() + "/assets/notification-weekday-alarm.svg")85 "alarm-clock")
85 n.connect ("closed", example.closedHandler, loop)86 n.connect ("closed", example.closedHandler, loop)
86 87
87 loop.run ()88 loop.run ()
8889
=== modified file 'examples/sd-example-much-body-text.py'
--- examples/sd-example-much-body-text.py 2014-02-18 14:48:55 +0000
+++ examples/sd-example-much-body-text.py 2014-08-19 14:04:59 +0000
@@ -62,7 +62,8 @@
6262
63 # set the button-tint hint so that the right/positive button is tinted and63 # set the button-tint hint so that the right/positive button is tinted and
64 # not using the stock clear-color64 # not using the stock clear-color
65 n.set_hint_string ("x-canonical-private-button-tint", "true");65 n.set_hint_string ("x-canonical-private-affirmative-tint", "true");
66 n.set_hint_string ("x-canonical-private-rejection-tint", "true");
66 n.set_hint_string ("x-canonical-non-shaped-icon", "true");67 n.set_hint_string ("x-canonical-non-shaped-icon", "true");
6768
68 n.show ()69 n.show ()
@@ -79,13 +80,23 @@
79 example.printCaps ()80 example.printCaps ()
8081
81 # be nice and check for required capabilities82 # be nice and check for required capabilities
82 if not example.capabilities['x-canonical-private-button-tint'] and not example.capabilities['x-canonical-snap-decisions']:83 if not example.capabilities['x-canonical-private-affirmative-tint'] \
84 and not example.capabilities['x-canonical-private-rejection-tint'] \
85 and not example.capabilities['x-canonical-snap-decisions']:
83 sys.exit (2)86 sys.exit (2)
8487
85 loop = gobject.MainLoop ()88 loop = gobject.MainLoop ()
86 n = pushNotification ("Uses much text",89 n = pushNotification ("Uses much text",
87 "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.",90 "Lorem ipsum dolor sit amet,"
88 "messages")91 " consetetur sadipscing elitr,"
92 " sed diam nonumy eirmod tempor"
93 " invidunt ut labore et dolore"
94 " magna aliquyam erat, sed diam"
95 " voluptua. At vero eos et accusam"
96 " et justo duo dolores et ea rebum."
97 " Stet clita kasd gubergren, no sea"
98 " takimata sanctus est Lorem ipsum"
99 " dolor sit amet.",
100 "message")
89 n.connect ("closed", example.closedHandler, loop)101 n.connect ("closed", example.closedHandler, loop)
90
91 loop.run ()102 loop.run ()
92103
=== modified file 'examples/sd-example-password-entry.py'
--- examples/sd-example-password-entry.py 2014-05-07 15:32:40 +0000
+++ examples/sd-example-password-entry.py 2014-08-19 14:04:59 +0000
@@ -120,7 +120,8 @@
120 # indicate to the notification-daemon, that we want to use snap-decisions120 # indicate to the notification-daemon, that we want to use snap-decisions
121 n.set_hint ("x-canonical-snap-decisions", GLib.Variant.new_string("true"));121 n.set_hint ("x-canonical-snap-decisions", GLib.Variant.new_string("true"));
122 n.set_hint ("x-canonical-snap-decisions-timeout", GLib.Variant.new_int32(90000));122 n.set_hint ("x-canonical-snap-decisions-timeout", GLib.Variant.new_int32(90000));
123 n.set_hint ("x-canonical-private-button-tint", GLib.Variant.new_string("true"));123 n.set_hint ("x-canonical-private-affirmative-tint", GLib.Variant.new_string("true"));
124 n.set_hint ("x-canonical-private-rejection-tint", GLib.Variant.new_string("true"));
124 n.set_hint ("x-canonical-non-shaped-icon", GLib.Variant.new_string("true"));125 n.set_hint ("x-canonical-non-shaped-icon", GLib.Variant.new_string("true"));
125126
126 Gio.bus_own_name(Gio.BusType.SESSION, APPLICATION_ID, 0, bus_acquired, None, None)127 Gio.bus_own_name(Gio.BusType.SESSION, APPLICATION_ID, 0, bus_acquired, None, None)
127128
=== modified file 'examples/sd-example-user-auth.py'
--- examples/sd-example-user-auth.py 2014-05-07 15:32:40 +0000
+++ examples/sd-example-user-auth.py 2014-08-19 14:04:59 +0000
@@ -134,7 +134,8 @@
134 # indicate to the notification-daemon, that we want to use snap-decisions134 # indicate to the notification-daemon, that we want to use snap-decisions
135 n.set_hint ("x-canonical-snap-decisions", GLib.Variant.new_string("true"));135 n.set_hint ("x-canonical-snap-decisions", GLib.Variant.new_string("true"));
136 n.set_hint ("x-canonical-snap-decisions-timeout", GLib.Variant.new_int32 (90000));136 n.set_hint ("x-canonical-snap-decisions-timeout", GLib.Variant.new_int32 (90000));
137 n.set_hint ("x-canonical-private-button-tint", GLib.Variant.new_string("true"));137 n.set_hint ("x-canonical-private-affirmative-tint", GLib.Variant.new_string("true"));
138 n.set_hint ("x-canonical-private-rejection-tint", GLib.Variant.new_string("true"));
138 n.set_hint ("x-canonical-non-shaped-icon", GLib.Variant.new_string("true")); 139 n.set_hint ("x-canonical-non-shaped-icon", GLib.Variant.new_string("true"));
139140
140 Gio.bus_own_name(Gio.BusType.SESSION, APPLICATION_ID, 0, bus_acquired, None, None)141 Gio.bus_own_name(Gio.BusType.SESSION, APPLICATION_ID, 0, bus_acquired, None, None)
141142
=== modified file 'examples/sd-example-using-button-tint-hint.py'
--- examples/sd-example-using-button-tint-hint.py 2014-02-18 14:48:55 +0000
+++ examples/sd-example-using-button-tint-hint.py 2014-08-19 14:04:59 +0000
@@ -62,7 +62,8 @@
6262
63 # set the button-tint hint so that the right/positive button is tinted and63 # set the button-tint hint so that the right/positive button is tinted and
64 # not using the stock clear-color64 # not using the stock clear-color
65 n.set_hint_string ("x-canonical-private-button-tint", "true");65 n.set_hint_string ("x-canonical-private-affirmative-tint", "true");
66 n.set_hint_string ("x-canonical-private-rejection-tint", "true");
66 n.set_hint_string ("x-canonical-non-shaped-icon", "true");67 n.set_hint_string ("x-canonical-non-shaped-icon", "true");
6768
68 n.show ()69 n.show ()
@@ -79,13 +80,12 @@
79 example.printCaps ()80 example.printCaps ()
8081
81 # be nice and check for required capabilities82 # be nice and check for required capabilities
82 if not example.capabilities['x-canonical-private-button-tint'] and not example.capabilities['x-canonical-snap-decisions']:83 if not example.capabilities['x-canonical-private-affirmative-tint'] \
84 and not example.capabilities['x-canonical-private-rejection-tint'] \
85 and not example.capabilities['x-canonical-snap-decisions']:
83 sys.exit (2)86 sys.exit (2)
8487
85 loop = gobject.MainLoop ()88 loop = gobject.MainLoop ()
86 n = pushNotification ("Question",89 n = pushNotification ("Question", "Would you say Ok or Cancel?", "search")
87 "Would you say Ok or Cancel?",
88 "search")
89 n.connect ("closed", example.closedHandler, loop)90 n.connect ("closed", example.closedHandler, loop)
90
91 loop.run ()91 loop.run ()
9292
=== renamed file 'examples/append-hint-example.py' => 'examples/unsupported/append-hint-example.py'
=== modified file 'examples/update-notifications.py'
--- examples/update-notifications.py 2013-05-17 14:57:48 +0000
+++ examples/update-notifications.py 2014-08-19 14:04:59 +0000
@@ -66,7 +66,7 @@
66 "Initial layout (2. notification)",66 "Initial layout (2. notification)",
67 "This bubble uses the icon-title-body layout with a secondary icon.",67 "This bubble uses the icon-title-body layout with a secondary icon.",
68 os.getcwd() + "/assets/avatar3.jpg")68 os.getcwd() + "/assets/avatar3.jpg")
69 n.set_hint_string ("x-canonical-secondary-icon", os.getcwd() + "/assets/icon_message.png");69 n.set_hint_string ("x-canonical-secondary-icon", "message");
70 n.show ()70 n.show ()
71 time.sleep (2); # simulate app activity71 time.sleep (2); # simulate app activity
7272
7373
=== modified file 'include/NotificationClient.h'
--- include/NotificationClient.h 2013-10-18 08:19:39 +0000
+++ include/NotificationClient.h 2014-08-19 14:04:59 +0000
@@ -34,7 +34,6 @@
34 NotificationClient(QObject *parent=nullptr);34 NotificationClient(QObject *parent=nullptr);
35 ~NotificationClient();35 ~NotificationClient();
36 NotificationID sendNotification(Notification::Type ntype, Notification::Urgency urg, const QString &summary, const QString &body);36 NotificationID sendNotification(Notification::Type ntype, Notification::Urgency urg, const QString &summary, const QString &body);
37 NotificationID appendText(NotificationID id, const QString &text);
3837
39public Q_SLOTS:38public Q_SLOTS:
40 /* These slots are needed to catch the incoming DBus messages. */39 /* These slots are needed to catch the incoming DBus messages. */
4140
=== modified file 'include/notify-backend.h.in'
--- include/notify-backend.h.in 2014-06-23 09:31:56 +0000
+++ include/notify-backend.h.in 2014-08-19 14:04:59 +0000
@@ -65,9 +65,9 @@
65#define SECONDARY_ICON_HINT "x-canonical-secondary-icon"65#define SECONDARY_ICON_HINT "x-canonical-secondary-icon"
66#define NON_SHAPED_ICON_HINT "x-canonical-non-shaped-icon"66#define NON_SHAPED_ICON_HINT "x-canonical-non-shaped-icon"
67#define ICON_ONLY_HINT "x-canonical-private-icon-only"67#define ICON_ONLY_HINT "x-canonical-private-icon-only"
68#define BUTTON_TINT_HINT "x-canonical-private-button-tint"68#define AFFIRMATIVE_TINT_HINT "x-canonical-private-affirmative-tint"
69#define REJECTION_TINT_HINT "x-canonical-private-rejection-tint"
69#define TRUNCATION_HINT "x-canonical-truncation"70#define TRUNCATION_HINT "x-canonical-truncation"
70#define APPEND_HINT "x-canonical-append"
71#define TIMEOUT_HINT "x-canonical-snap-decisions-timeout"71#define TIMEOUT_HINT "x-canonical-snap-decisions-timeout"
7272
73#endif73#endif
7474
=== modified file 'src/Notification.cpp'
--- src/Notification.cpp 2014-07-14 13:54:41 +0000
+++ src/Notification.cpp 2014-08-19 14:04:59 +0000
@@ -133,7 +133,17 @@
133}133}
134134
135void Notification::setSecondaryIcon(const QString &secondaryIcon) {135void Notification::setSecondaryIcon(const QString &secondaryIcon) {
136 p->secondaryIcon = secondaryIcon;136 if (secondaryIcon.startsWith(" ") || secondaryIcon.size() == 0) {
137 p->secondaryIcon = nullptr;
138 }
139 else {
140 p->secondaryIcon = secondaryIcon;
141
142 if (secondaryIcon.indexOf("/") == -1) {
143 p->secondaryIcon.prepend("image://theme/");
144 }
145 }
146
137 Q_EMIT secondaryIconChanged(p->secondaryIcon);147 Q_EMIT secondaryIconChanged(p->secondaryIcon);
138 Q_EMIT dataChanged(p->id);148 Q_EMIT dataChanged(p->id);
139}149}
140150
=== modified file 'src/NotificationClient.cpp'
--- src/NotificationClient.cpp 2013-10-18 08:19:39 +0000
+++ src/NotificationClient.cpp 2014-08-19 14:04:59 +0000
@@ -62,23 +62,6 @@
62 return result.value();62 return result.value();
63}63}
6464
65NotificationID NotificationClient::appendText(NotificationID id, const QString &text) {
66 QString app_name("append");
67 QString app_icon;
68 QString summary;
69 QStringList actions;
70 QMap<QString, QVariant> hints;
71 hints[APPEND_HINT] = QVariant(true);
72 int timeout = 5000;
73 QDBusReply<unsigned int> result = service.call("Notify",
74 app_name, id, app_icon, summary, text, actions, hints, timeout);
75 if(!result.isValid()) {
76 return (NotificationID) -1;
77 }
78 return result.value();
79
80}
81
82void NotificationClient::NotificationClosed(NotificationID id, unsigned int reason) {65void NotificationClient::NotificationClosed(NotificationID id, unsigned int reason) {
83 Q_EMIT closed(id, reason);66 Q_EMIT closed(id, reason);
84 QString msg("Got NotificationClosed signal for notification ");67 QString msg("Got NotificationClosed signal for notification ");
8568
=== modified file 'src/NotificationServer.cpp'
--- src/NotificationServer.cpp 2014-06-23 09:32:04 +0000
+++ src/NotificationServer.cpp 2014-08-19 14:04:59 +0000
@@ -50,9 +50,9 @@
50 capabilities.push_back(SOUND_HINT);50 capabilities.push_back(SOUND_HINT);
51 capabilities.push_back(SUPPRESS_SOUND_HINT);51 capabilities.push_back(SUPPRESS_SOUND_HINT);
52 capabilities.push_back(SYNCH_HINT);52 capabilities.push_back(SYNCH_HINT);
53 capabilities.push_back(APPEND_HINT);
54 capabilities.push_back(ICON_ONLY_HINT);53 capabilities.push_back(ICON_ONLY_HINT);
55 capabilities.push_back(BUTTON_TINT_HINT);54 capabilities.push_back(AFFIRMATIVE_TINT_HINT);
55 capabilities.push_back(REJECTION_TINT_HINT);
56 capabilities.push_back(TRUNCATION_HINT);56 capabilities.push_back(TRUNCATION_HINT);
57 capabilities.push_back(SNAP_HINT);57 capabilities.push_back(SNAP_HINT);
58 capabilities.push_back(SECONDARY_ICON_HINT);58 capabilities.push_back(SECONDARY_ICON_HINT);
@@ -117,33 +117,7 @@
117 }117 }
118 currentId = replaces_id;118 currentId = replaces_id;
119 notification = model.getNotification(replaces_id);119 notification = model.getNotification(replaces_id);
120 // Appending text is a special case. This is the new update-behaviour
121 // for the append-hint and expects the client-app to use libnotify's
122 // call notify_notification_update()
123 if (hints.find(APPEND_HINT) != hints.end()) {
124 QString newBody = QString(notification->getBody() + "\n" + body);
125 notification->setBody(newBody);
126 model.notificationUpdated(currentId);
127 return notification->getID();
128 }
129 // Otherwise we let the code below update the fields.
130 } else {120 } else {
131
132 // support append-hint also for a new notification using just the
133 // summary-text as "identifier"... this is legacy behaviour and
134 // only kept for compatibility-reasons... developer-docs have to
135 // be updated and extended with a remark that this will be dropped
136 // by the next cycle
137 if (hints.find(APPEND_HINT) != hints.end()) {
138 notification = model.getNotification(summary);
139 if (notification) {
140 QString newBody = QString(notification->getBody() + "\n" + body);
141 notification->setBody(newBody);
142 model.notificationUpdated(notification->getID());
143 return notification->getID();
144 }
145 }
146
147 Notification *n = buildNotification(currentId, hints);121 Notification *n = buildNotification(currentId, hints);
148 if(!n) {122 if(!n) {
149 fprintf(stderr, "Could not build notification object.\n");123 fprintf(stderr, "Could not build notification object.\n");

Subscribers

People subscribed via source and target branches

to all changes: