|
4 | 4 | */ |
5 | 5 |
|
6 | 6 | public class Dock.Launcher : Gtk.Box { |
| 7 | + private static Settings settings; |
| 8 | + private static Settings? notify_settings; |
| 9 | + |
| 10 | + static construct { |
| 11 | + settings = new Settings ("io.elementary.dock"); |
| 12 | + |
| 13 | + if (SettingsSchemaSource.get_default ().lookup ("io.elementary.notifications", true) != null) { |
| 14 | + notify_settings = new Settings ("io.elementary.notifications"); |
| 15 | + } |
| 16 | + } |
| 17 | + |
7 | 18 | public signal void revealed_done (); |
8 | 19 |
|
9 | 20 | // Matches icon size and padding in Launcher.css |
@@ -40,8 +51,6 @@ public class Dock.Launcher : Gtk.Box { |
40 | 51 | } |
41 | 52 | } |
42 | 53 |
|
43 | | - private static Settings settings; |
44 | | - |
45 | 54 | private Gtk.Image image; |
46 | 55 | private Gtk.Revealer progress_revealer; |
47 | 56 | private Gtk.Revealer badge_revealer; |
@@ -70,10 +79,6 @@ public class Dock.Launcher : Gtk.Box { |
70 | 79 | set_css_name ("launcher"); |
71 | 80 | } |
72 | 81 |
|
73 | | - static construct { |
74 | | - settings = new Settings ("io.elementary.dock"); |
75 | | - } |
76 | | - |
77 | 82 | construct { |
78 | 83 | popover = new Gtk.PopoverMenu.from_model (app.menu_model) { |
79 | 84 | autohide = true, |
@@ -238,6 +243,10 @@ public class Dock.Launcher : Gtk.Box { |
238 | 243 | }, null |
239 | 244 | ); |
240 | 245 |
|
| 246 | + if (notify_settings != null) { |
| 247 | + notify_settings.changed["do-not-disturb"].connect (update_badge_revealer); |
| 248 | + } |
| 249 | + |
241 | 250 | app.notify["progress-visible"].connect (update_progress_revealer); |
242 | 251 | update_progress_revealer (); |
243 | 252 |
|
@@ -471,7 +480,8 @@ public class Dock.Launcher : Gtk.Box { |
471 | 480 | } |
472 | 481 |
|
473 | 482 | private void update_badge_revealer () { |
474 | | - badge_revealer.reveal_child = !moving && app.count_visible; |
| 483 | + badge_revealer.reveal_child = !moving && app.count_visible |
| 484 | + && (notify_settings == null || !notify_settings.get_boolean ("do-not-disturb")); |
475 | 485 | } |
476 | 486 |
|
477 | 487 | private void update_progress_revealer () { |
|
0 commit comments