Merge lp:~macslow/unity-notifications/sound-hint-support into lp:unity-notifications

Proposed by Mirco Müller
Status: Merged
Approved by: Michał Sawicz
Approved revision: 204
Merged at revision: 210
Proposed branch: lp:~macslow/unity-notifications/sound-hint-support
Merge into: lp:unity-notifications
Diff against target: 166 lines (+117/-0)
5 files modified
examples/example.py (+6/-0)
examples/sound.py (+53/-0)
examples/suppress-sound.py (+54/-0)
include/notify-backend.h.in (+2/-0)
src/NotificationServer.cpp (+2/-0)
To merge this branch: bzr merge lp:~macslow/unity-notifications/sound-hint-support
Reviewer Review Type Date Requested Status
Michał Sawicz Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+218961@code.launchpad.net

Commit message

Added the backend-part of sound-hint support with two additional examples demonstrating its use.

Description of the change

Added the backend-part of sound-hint support with two additional examples demonstrating its use.

* Are there any related MPs required for this MP to build/function as expected?
Not applicable.

* 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: Approve (continuous-integration)
Revision history for this message
Michał Sawicz (saviq) wrote :

Minor comments inline.

review: Needs Fixing
204. By Mirco Müller

Fixed identation.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Michał Sawicz (saviq) wrote :

Yes.

review: Approve

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 2014-05-07 15:32:40 +0000
3+++ examples/example.py 2014-06-16 10:11:21 +0000
4@@ -42,6 +42,8 @@
5 'icon-multi': False,
6 'icon-static': False,
7 'sound': False,
8+ 'sound-file': False,
9+ 'suppress-sound': False,
10 'image/svg+xml': False,
11 'urgency': False,
12 'x-canonical-private-synchronous': False,
13@@ -94,6 +96,10 @@
14 print "\ticon-static"
15 if capabilities['sound']:
16 print "\tsound"
17+ if capabilities['sound-file']:
18+ print "\tsound-file"
19+ if capabilities['suppress-sound']:
20+ print "\tsuppress-sound"
21 if capabilities['urgency']:
22 print "\turgency"
23 if capabilities['image/svg+xml']:
24
25=== added file 'examples/sound.py'
26--- examples/sound.py 1970-01-01 00:00:00 +0000
27+++ examples/sound.py 2014-06-16 10:11:21 +0000
28@@ -0,0 +1,53 @@
29+#!/usr/bin/python
30+
31+################################################################################
32+##3456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789
33+## 10 20 30 40 50 60 70 80
34+##
35+## Info:
36+## Example of how to use libnotify correctly
37+##
38+## Run:
39+## chmod +x sound.py
40+## ./sound.py
41+##
42+## Copyright 2014 Canonical Ltd.
43+##
44+## Author:
45+## Mirco "MacSlow" Mueller <mirco.mueller@canonical.com>
46+##
47+## This program is free software: you can redistribute it and/or modify it
48+## under the terms of the GNU General Public License version 3, as published
49+## by the Free Software Foundation.
50+##
51+## This program is distributed in the hope that it will be useful, but
52+## WITHOUT ANY WARRANTY; without even the implied warranties of
53+## MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
54+## PURPOSE. See the GNU General Public License for more details.
55+##
56+## You should have received a copy of the GNU General Public License along
57+## with this program. If not, see <http://www.gnu.org/licenses/>.
58+##
59+################################################################################
60+
61+import os
62+import sys
63+import pynotify
64+import example
65+
66+if __name__ == '__main__':
67+ if not pynotify.init ("sound"):
68+ sys.exit (1)
69+
70+ # call this so we can savely use capabilities dictionary later
71+ example.initCaps ()
72+
73+ # show what's supported
74+ example.printCaps ()
75+
76+ # try the sound support
77+ n = pynotify.Notification ("Lotsof N. Oise",
78+ "With the popping up of this notification, you should hear a sound being played.",
79+ os.getcwd() + "/assets/avatar2.jpg")
80+ n.set_hint_string ("sound-file", "/usr/share/sounds/ubuntu/stereo/desktop-login.ogg")
81+ n.show ()
82
83=== added file 'examples/suppress-sound.py'
84--- examples/suppress-sound.py 1970-01-01 00:00:00 +0000
85+++ examples/suppress-sound.py 2014-06-16 10:11:21 +0000
86@@ -0,0 +1,54 @@
87+#!/usr/bin/python
88+
89+################################################################################
90+##3456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789
91+## 10 20 30 40 50 60 70 80
92+##
93+## Info:
94+## Example of how to use libnotify correctly
95+##
96+## Run:
97+## chmod +x suppress-sound.py
98+## ./suppress-sound.py
99+##
100+## Copyright 2014 Canonical Ltd.
101+##
102+## Author:
103+## Mirco "MacSlow" Mueller <mirco.mueller@canonical.com>
104+##
105+## This program is free software: you can redistribute it and/or modify it
106+## under the terms of the GNU General Public License version 3, as published
107+## by the Free Software Foundation.
108+##
109+## This program is distributed in the hope that it will be useful, but
110+## WITHOUT ANY WARRANTY; without even the implied warranties of
111+## MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
112+## PURPOSE. See the GNU General Public License for more details.
113+##
114+## You should have received a copy of the GNU General Public License along
115+## with this program. If not, see <http://www.gnu.org/licenses/>.
116+##
117+################################################################################
118+
119+import os
120+import sys
121+import pynotify
122+import example
123+
124+if __name__ == '__main__':
125+ if not pynotify.init ("suppress-sound"):
126+ sys.exit (1)
127+
128+ # call this so we can savely use capabilities dictionary later
129+ example.initCaps ()
130+
131+ # show what's supported
132+ example.printCaps ()
133+
134+ # try suppress-sound support
135+ n = pynotify.Notification ("Lotsof N. Oise",
136+ "With the popping up of this notification, you should NOT hear a sound being played.",
137+ os.getcwd() + "/assets/avatar2.jpg")
138+ n.set_hint_string ("sound-file", "/usr/share/sounds/ubuntu/stereo/desktop-login.ogg")
139+ n.set_hint_string ("suppress-sound", "true")
140+ n.show ()
141
142=== modified file 'include/notify-backend.h.in'
143--- include/notify-backend.h.in 2014-05-07 15:32:40 +0000
144+++ include/notify-backend.h.in 2014-06-16 10:11:21 +0000
145@@ -56,6 +56,8 @@
146 #endif
147
148 #define URGENCY_HINT "urgency"
149+#define SOUND_HINT "sound-file"
150+#define SUPPRESS_SOUND_HINT "suppress-sound"
151 #define SYNCH_HINT "x-canonical-private-synchronous"
152 #define SNAP_HINT "x-canonical-snap-decisions"
153 #define MENU_MODEL_HINT "x-canonical-private-menu-model"
154
155=== modified file 'src/NotificationServer.cpp'
156--- src/NotificationServer.cpp 2014-06-02 10:58:21 +0000
157+++ src/NotificationServer.cpp 2014-06-16 10:11:21 +0000
158@@ -47,6 +47,8 @@
159 capabilities.push_back("icon-static");
160 capabilities.push_back("image/svg+xml");
161 capabilities.push_back(URGENCY_HINT);
162+ capabilities.push_back(SOUND_HINT);
163+ capabilities.push_back(SUPPRESS_SOUND_HINT);
164 capabilities.push_back(SYNCH_HINT);
165 capabilities.push_back(APPEND_HINT);
166 capabilities.push_back(ICON_ONLY_HINT);

Subscribers

People subscribed via source and target branches

to all changes: