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
=== modified file 'examples/example.py'
--- examples/example.py 2014-05-07 15:32:40 +0000
+++ examples/example.py 2014-06-16 10:11:21 +0000
@@ -42,6 +42,8 @@
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,
46 'suppress-sound': False,
45 'image/svg+xml': False,47 'image/svg+xml': False,
46 'urgency': False,48 'urgency': False,
47 'x-canonical-private-synchronous': False,49 'x-canonical-private-synchronous': False,
@@ -94,6 +96,10 @@
94 print "\ticon-static"96 print "\ticon-static"
95 if capabilities['sound']:97 if capabilities['sound']:
96 print "\tsound"98 print "\tsound"
99 if capabilities['sound-file']:
100 print "\tsound-file"
101 if capabilities['suppress-sound']:
102 print "\tsuppress-sound"
97 if capabilities['urgency']:103 if capabilities['urgency']:
98 print "\turgency"104 print "\turgency"
99 if capabilities['image/svg+xml']:105 if capabilities['image/svg+xml']:
100106
=== added file 'examples/sound.py'
--- examples/sound.py 1970-01-01 00:00:00 +0000
+++ examples/sound.py 2014-06-16 10:11:21 +0000
@@ -0,0 +1,53 @@
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 sound.py
12## ./sound.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 pynotify
36import example
37
38if __name__ == '__main__':
39 if not pynotify.init ("sound"):
40 sys.exit (1)
41
42 # call this so we can savely use capabilities dictionary later
43 example.initCaps ()
44
45 # show what's supported
46 example.printCaps ()
47
48 # try the sound support
49 n = pynotify.Notification ("Lotsof N. Oise",
50 "With the popping up of this notification, you should hear a sound being played.",
51 os.getcwd() + "/assets/avatar2.jpg")
52 n.set_hint_string ("sound-file", "/usr/share/sounds/ubuntu/stereo/desktop-login.ogg")
53 n.show ()
054
=== added file 'examples/suppress-sound.py'
--- examples/suppress-sound.py 1970-01-01 00:00:00 +0000
+++ examples/suppress-sound.py 2014-06-16 10:11:21 +0000
@@ -0,0 +1,54 @@
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 suppress-sound.py
12## ./suppress-sound.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 pynotify
36import example
37
38if __name__ == '__main__':
39 if not pynotify.init ("suppress-sound"):
40 sys.exit (1)
41
42 # call this so we can savely use capabilities dictionary later
43 example.initCaps ()
44
45 # show what's supported
46 example.printCaps ()
47
48 # try suppress-sound support
49 n = pynotify.Notification ("Lotsof N. Oise",
50 "With the popping up of this notification, you should NOT hear a sound being played.",
51 os.getcwd() + "/assets/avatar2.jpg")
52 n.set_hint_string ("sound-file", "/usr/share/sounds/ubuntu/stereo/desktop-login.ogg")
53 n.set_hint_string ("suppress-sound", "true")
54 n.show ()
055
=== modified file 'include/notify-backend.h.in'
--- include/notify-backend.h.in 2014-05-07 15:32:40 +0000
+++ include/notify-backend.h.in 2014-06-16 10:11:21 +0000
@@ -56,6 +56,8 @@
56#endif56#endif
5757
58#define URGENCY_HINT "urgency"58#define URGENCY_HINT "urgency"
59#define SOUND_HINT "sound-file"
60#define SUPPRESS_SOUND_HINT "suppress-sound"
59#define SYNCH_HINT "x-canonical-private-synchronous"61#define SYNCH_HINT "x-canonical-private-synchronous"
60#define SNAP_HINT "x-canonical-snap-decisions"62#define SNAP_HINT "x-canonical-snap-decisions"
61#define MENU_MODEL_HINT "x-canonical-private-menu-model"63#define MENU_MODEL_HINT "x-canonical-private-menu-model"
6264
=== modified file 'src/NotificationServer.cpp'
--- src/NotificationServer.cpp 2014-06-02 10:58:21 +0000
+++ src/NotificationServer.cpp 2014-06-16 10:11:21 +0000
@@ -47,6 +47,8 @@
47 capabilities.push_back("icon-static");47 capabilities.push_back("icon-static");
48 capabilities.push_back("image/svg+xml");48 capabilities.push_back("image/svg+xml");
49 capabilities.push_back(URGENCY_HINT);49 capabilities.push_back(URGENCY_HINT);
50 capabilities.push_back(SOUND_HINT);
51 capabilities.push_back(SUPPRESS_SOUND_HINT);
50 capabilities.push_back(SYNCH_HINT);52 capabilities.push_back(SYNCH_HINT);
51 capabilities.push_back(APPEND_HINT);53 capabilities.push_back(APPEND_HINT);
52 capabilities.push_back(ICON_ONLY_HINT);54 capabilities.push_back(ICON_ONLY_HINT);

Subscribers

People subscribed via source and target branches

to all changes: