Merge lp:~greggory-hz/noise/bug-1044347 into lp:~elementary-apps/noise/trunk

Proposed by greggory.hz
Status: Merged
Merge reported by: Victor Martinez
Merged at revision: not available
Proposed branch: lp:~greggory-hz/noise/bug-1044347
Merge into: lp:~elementary-apps/noise/trunk
Diff against target: 87 lines (+23/-0)
4 files modified
core/Settings.vala (+1/-0)
schemas/org.pantheon.noise.gschema.xml (+5/-0)
src/Dialogs/PreferencesWindow.vala (+14/-0)
src/LibraryWindow.vala (+3/-0)
To merge this branch: bzr merge lp:~greggory-hz/noise/bug-1044347
Reviewer Review Type Date Requested Status
Danielle Foré Needs Fixing
Victor Martinez (community) Approve
David Gomes (community) Approve
Review via email: mp+124764@code.launchpad.net

This proposal supersedes a proposal from 2012-09-17.

Description of the change

Added an option to disable desktop notifications

--updated to fix coding style

To post a comment you must log in.
Revision history for this message
David Gomes (davidgomes) wrote : Posted in a previous version of this proposal

disable_notifications_toggle.set_active(Settings.Main.instance.disable_notifications);

should be:

disable_notifications_toggle.set_active (Settings.Main.instance.disable_notifications);

Settings.Main.instance.disable_notifications = disable_notifications_toggle.get_active();

should be:

Settings.Main.instance.disable_notifications = disable_notifications_toggle.get_active ();

Regarding the code, you should fix those before merge.

review: Needs Fixing (code-style)
Revision history for this message
David Gomes (davidgomes) wrote :

Great job man, love this fix, ever since I reported the bug I've been waiting for it!

review: Approve
Revision history for this message
Victor Martinez (victored) wrote :

+1 to what David said. This looks perfect. I would have preferred to use "enabled" instead of "disabled" to avoid the implicit double negation, but that's a matter of preferences.

I approve the code, but we still need Daniel to approve the UI changes.

review: Approve
Revision history for this message
greggory.hz (greggory-hz) wrote :

Thanks guys!

Revision history for this message
Victor Martinez (victored) wrote :

Daniel, do you agree with adding this option to Noise's preferences?

Revision history for this message
Harvey Cabaguio (harveycabaguio) wrote :

I don't mind this, although I think the label should say "Enable Notifications".

Revision history for this message
Danielle Foré (danrabbit) wrote :

Fun fact: Noise doesn't compile with vala 0.17 haha.

I think it's a little confusing with the checkbox. Am I turning notifications on or off? Not really clear. I would personally use a switch instead and change the label to "Notification bubbles"

see: http://elementaryos.org/docs/human-interface-guidelines/ui-toolkit-elements/switches

review: Needs Fixing
Revision history for this message
Danielle Foré (danrabbit) wrote :

FWIW, I think in Luna +1 we should be doing this in a plug to configure all notifications centrally.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'core/Settings.vala'
2--- core/Settings.vala 2012-08-28 22:14:21 +0000
3+++ core/Settings.vala 2012-09-17 18:45:27 +0000
4@@ -69,6 +69,7 @@
5 public bool update_folder_hierarchy { get; set; }
6 public bool write_metadata_to_file { get; set; }
7 public bool copy_imported_music { get; set; }
8+ public bool disable_notifications { get; set; }
9 public bool download_new_podcasts { get; set; }
10 public int last_media_playing { get; set; }
11 public int last_media_position { get; set; }
12
13=== modified file 'schemas/org.pantheon.noise.gschema.xml'
14--- schemas/org.pantheon.noise.gschema.xml 2012-08-28 22:14:21 +0000
15+++ schemas/org.pantheon.noise.gschema.xml 2012-09-17 18:45:27 +0000
16@@ -31,6 +31,11 @@
17 <summary>Whether or not to copy imported files to music folder</summary>
18 <description>Whether or not to copy imported files to music folder</description>
19 </key>
20+ <key type="b" name="disable-notifications">
21+ <default>false</default>
22+ <summary>Whether or not to disable desktop notifications</summary>
23+ <description>Whether or not to disable desktop notifications</description>
24+ </key>
25 <key type="b" name="download-new-podcasts">
26 <default>false</default>
27 <summary>Whether or not to automatically download new podcasts</summary>
28
29=== modified file 'src/Dialogs/PreferencesWindow.vala'
30--- src/Dialogs/PreferencesWindow.vala 2012-09-15 07:14:46 +0000
31+++ src/Dialogs/PreferencesWindow.vala 2012-09-17 18:45:27 +0000
32@@ -190,6 +190,7 @@
33 private Gtk.CheckButton organize_folders_toggle;
34 private Gtk.CheckButton write_file_metadata_toggle;
35 private Gtk.CheckButton copy_imported_music_toggle;
36+ private Gtk.CheckButton disable_notifications_toggle;
37
38 #if ENABLE_EXPERIMENTAL
39 private Gtk.CheckButton is_default_application_toggle;
40@@ -205,6 +206,7 @@
41
42 add_library_folder_section ();
43 add_library_management_section ();
44+ add_notification_management_section ();
45 #if ENABLE_EXPERIMENTAL
46 add_default_application_section ();
47 #endif
48@@ -258,6 +260,17 @@
49 add_subsection (_("Library Management"), contents_grid);
50 }
51
52+ private void add_notification_management_section () {
53+ var contents_grid = new Gtk.Grid ();
54+
55+ disable_notifications_toggle = new Gtk.CheckButton.with_label (_("Disable desktop notifications"));
56+ disable_notifications_toggle.set_active (Settings.Main.instance.disable_notifications);
57+
58+ contents_grid.add (disable_notifications_toggle);
59+
60+ add_subsection (_("Notification Management"), contents_grid);
61+ }
62+
63 #if ENABLE_EXPERIMENTAL
64 private void add_default_application_section () {
65 var contents_grid = new Gtk.Grid ();
66@@ -281,6 +294,7 @@
67 Settings.Main.instance.update_folder_hierarchy = organize_folders_toggle.get_active();
68 Settings.Main.instance.write_metadata_to_file = write_file_metadata_toggle.get_active();
69 Settings.Main.instance.copy_imported_music = copy_imported_music_toggle.get_active();
70+ Settings.Main.instance.disable_notifications = disable_notifications_toggle.get_active ();
71
72 #if ENABLE_EXPERIMENTAL
73 Noise.App.instance.is_default_application = is_default_application_toggle.get_active ();
74
75=== modified file 'src/LibraryWindow.vala'
76--- src/LibraryWindow.vala 2012-09-15 23:52:40 +0000
77+++ src/LibraryWindow.vala 2012-09-17 18:45:27 +0000
78@@ -329,6 +329,9 @@
79 private Notify.Notification? notification = null;
80
81 public void show_notification (string primary_text, string secondary_text, Gdk.Pixbuf? pixbuf = null) {
82+ if (Settings.Main.instance.disable_notifications)
83+ return;
84+
85 // Don't show notifications if the window is active
86 if (this.is_active)
87 return;

Subscribers

People subscribed via source and target branches