[gnome-break-timer/dylanmccall/meson-build: 20/25] Remove ScreenOverlay and replace libcanberra-gtk



commit f3e332cdbaad3f30fa3e57e801ea023a8857ed56
Author: Dylan McCall <dylan dylanmccall com>
Date:   Fri Jan 18 23:51:07 2019 -0800

    Remove ScreenOverlay and replace libcanberra-gtk
    
    ScreenOverlay is currently dead code. It is a shame to see it go, but it
    will need to be significantly modified to work in newer desktops. In
    addition to removing ScreenOverlay, several blocks of code which
    referred to it in UIFragment and the BreakView classes have been
    removed.

 flatpak/org.gnome.BreakTimer.json        |  12 ++
 helper/BreakManager.vala                 |  10 +-
 helper/HelperApplication.vala            |  35 +---
 helper/ScreenOverlay.vala                | 260 -----------------------------
 helper/UIFragment.vala                   |  94 +++++++++++
 helper/UIManager.vala                    | 276 ++++++++-----------------------
 helper/break/BreakView.vala              |   5 +-
 helper/break/TimerBreakStatusWidget.vala |  95 -----------
 helper/break/TimerBreakType.vala         |   4 +-
 helper/main.vala                         |   6 +-
 helper/meson.build                       |   6 +-
 helper/microbreak/MicroBreakView.vala    |  12 +-
 helper/restbreak/RestBreakView.vala      |  44 +----
 meson.build                              |   3 +-
 14 files changed, 204 insertions(+), 658 deletions(-)
---
diff --git a/flatpak/org.gnome.BreakTimer.json b/flatpak/org.gnome.BreakTimer.json
index 5126de0..1363090 100644
--- a/flatpak/org.gnome.BreakTimer.json
+++ b/flatpak/org.gnome.BreakTimer.json
@@ -28,6 +28,18 @@
             "V" : "1"
         }
     },
+    "cleanup": [
+        "/include",
+        "/lib/pkgconfig",
+        "/share/pkgconfig",
+        "/share/aclocal",
+        "/man",
+        "/share/man",
+        "/share/gtk-doc",
+        "/share/vala",
+        "*.la",
+        "*.a"
+    ],
     "modules" : [
         {
             "name" : "libgee",
diff --git a/helper/BreakManager.vala b/helper/BreakManager.vala
index 2745ef4..43d714b 100644
--- a/helper/BreakManager.vala
+++ b/helper/BreakManager.vala
@@ -108,7 +108,7 @@ public class BreakHelperServer : Object, IBreakHelper {
         this.break_manager = break_manager;
     }
 
-    public string? get_current_active_break () {
+    public string? get_current_active_break () throws GLib.DBusError, GLib.IOError {
         /* Ask  for focused break */
         foreach (BreakType break_type in this.break_manager.all_breaks ()) {
             bool is_active = break_type.break_view.has_ui_focus () &&
@@ -118,7 +118,7 @@ public class BreakHelperServer : Object, IBreakHelper {
         return null;
     }
 
-    public bool is_active () {
+    public bool is_active () throws GLib.DBusError, GLib.IOError {
         bool active = false;
         foreach (BreakType break_type in this.break_manager.all_breaks ()) {
             active = active || break_type.break_controller.is_active ();
@@ -126,11 +126,11 @@ public class BreakHelperServer : Object, IBreakHelper {
         return active;
     }
 
-    public string[] get_break_ids () {
+    public string[] get_break_ids () throws GLib.DBusError, GLib.IOError {
         return this.break_manager.all_break_ids ().to_array ();
     }
 
-    public string[] get_status_messages () {
+    public string[] get_status_messages () throws GLib.DBusError, GLib.IOError {
         var messages = new Gee.ArrayList<string> ();
         foreach (BreakType break_type in break_manager.all_breaks ()) {
             string status_message = break_type.break_view.get_status_message ();
@@ -139,7 +139,7 @@ public class BreakHelperServer : Object, IBreakHelper {
         return messages.to_array ();
     }
 
-    public void activate_break (string break_name) {
+    public void activate_break (string break_name) throws GLib.DBusError, GLib.IOError {
         BreakType? break_type = this.break_manager.get_break_type_for_name (break_name);
         if (break_type != null) break_type.break_controller.activate ();
     }
diff --git a/helper/HelperApplication.vala b/helper/HelperApplication.vala
index 15f33a0..98db8ef 100644
--- a/helper/HelperApplication.vala
+++ b/helper/HelperApplication.vala
@@ -22,33 +22,6 @@ public class HelperApplication : Gtk.Application {
     const string app_name = _("GNOME Break Timer");
     const int DATA_VERSION = 0;
 
-    private static const string STYLE_DATA =
-        """
-        @define-color bg_top rgba(218, 236, 237, 0.80);
-        @define-color bg_middle rgba(226, 237, 236, 0.87);
-        @define-color bg_bottom rgba(179, 209, 183, 0.89);
-
-        GtkWindow._screen-overlay {
-            background-color: @bg_inner;
-            background-image:-gtk-gradient (linear,
-                   center top,
-                   center bottom,
-                   color-stop (0, @bg_top),
-                   color-stop (0.08, @bg_middle),
-                   color-stop (0.92, @bg_middle),
-                   color-stop (1, @bg_bottom));
-            font-size: 18px;
-            color: #999;
-        }
-
-        GtkLabel._timer-label {
-            font-weight: bold;
-            font-size: 36px;
-            color: #333;
-            text-shadow: 1px 1px 5px rgba (0, 0, 0, 0.5);
-        }
-        """;
-
     private BreakManager break_manager;
     private ISessionStatus session_status;
     private ActivityMonitorBackend activity_monitor_backend;
@@ -85,12 +58,6 @@ public class HelperApplication : Gtk.Application {
         Gdk.Screen screen = Gdk.Screen.get_default ();
         Gtk.CssProvider style_provider = new Gtk.CssProvider ();
 
-        try {
-            style_provider.load_from_data (STYLE_DATA, -1);
-        } catch (Error error) {
-            GLib.warning ("Error loading style data: %s", error.message);
-        }
-
         Gtk.StyleContext.add_provider_for_screen (
             screen,
             style_provider,
@@ -106,7 +73,7 @@ public class HelperApplication : Gtk.Application {
         }
         this.activity_monitor = new ActivityMonitor (session_status, activity_monitor_backend);
 
-        this.ui_manager = new UIManager (this, session_status, false);
+        this.ui_manager = new UIManager (this, session_status);
         this.break_manager = new BreakManager (ui_manager);
         this.break_manager.load_breaks (activity_monitor);
 
diff --git a/helper/UIFragment.vala b/helper/UIFragment.vala
new file mode 100644
index 0000000..94d4f0c
--- /dev/null
+++ b/helper/UIFragment.vala
@@ -0,0 +1,94 @@
+/*
+ * This file is part of GNOME Break Timer.
+ *
+ * GNOME Break Timer is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * GNOME Break Timer is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNOME Break Timer.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+namespace BreakTimer.Helper {
+
+public abstract class UIFragment : Object, IFocusable {
+    /**
+     * Provides a simple interface for UIManager to create notifications and
+     * overlays.
+     */
+
+    protected UIManager ui_manager;
+
+    protected Notify.Notification? notification;
+
+    protected FocusPriority focus_priority = FocusPriority.LOW;
+
+    public bool has_ui_focus () {
+        return this.ui_manager.is_focusing (this);
+    }
+
+    protected void request_ui_focus () {
+        if (this.has_ui_focus ()) {
+            // If we already have focus, UIManager will not call
+            // focus_started again. We need to call it ourselves.
+            this.focus_started ();
+        } else {
+            this.ui_manager.request_focus (this, this.focus_priority);
+        }
+    }
+
+    protected void release_ui_focus () {
+        this.ui_manager.release_focus (this);
+    }
+
+    protected void play_sound_from_id (string event_id) {
+        if (this.has_ui_focus ()) {
+            this.ui_manager.play_sound_from_id (event_id);
+        }
+    }
+
+    protected bool can_lock_screen () {
+        return this.ui_manager.can_lock_screen ();
+    }
+
+    protected void lock_screen () {
+        if (this.has_ui_focus ()) {
+            this.ui_manager.lock_screen ();
+        }
+    }
+
+    protected bool notifications_can_do (string action) {
+        return this.ui_manager.notifications_can_do (action);
+    }
+
+    protected void show_notification (Notify.Notification notification) {
+        if (this.has_ui_focus ()) {
+            this.ui_manager.show_notification (notification);
+            this.notification = notification;
+        }
+    }
+
+    protected void show_lock_notification (Notify.Notification notification) {
+        if (this.has_ui_focus ()) {
+            this.ui_manager.show_lock_notification (notification);
+            this.notification = notification;
+        }
+    }
+
+    protected void hide_notification () {
+        this.ui_manager.hide_notification (this.notification);
+    }
+
+    /* IFocusable interface */
+
+    protected abstract void focus_started ();
+    protected abstract void focus_stopped ();
+}
+
+}
diff --git a/helper/UIManager.vala b/helper/UIManager.vala
index ed5256f..2160b1f 100644
--- a/helper/UIManager.vala
+++ b/helper/UIManager.vala
@@ -17,243 +17,75 @@
 
 namespace BreakTimer.Helper {
 
-/**
- * Central place to manage UI throughout the application. We need this to
- * maintain a simple, modal structure. This uses SimpleFocusManager to make
- * sure only one break is affecting the UI at a time. This class also tries
- * to keep UI events nicely spaced so they don't turn into noise. Any object
- * which needs to provide a GUI implements UIFragment, which provides a simple
- * interface to create notifications and overlays.
- */
 public class UIManager : SimpleFocusManager {
-    public abstract class UIFragment : Object, IFocusable {
-        protected UIManager ui_manager;
-
-        protected IScreenOverlayContent? overlay_content;
-        protected Notify.Notification? notification;
-
-        protected FocusPriority focus_priority = FocusPriority.LOW;
-
-        public bool has_ui_focus () {
-            return this.ui_manager.is_focusing (this);
-        }
-
-        protected void request_ui_focus () {
-            if (this.has_ui_focus ()) {
-                // If we already have focus, UIManager will not call
-                // focus_started again. We need to call it ourselves.
-                this.focus_started ();
-            } else {
-                this.ui_manager.request_focus (this, this.focus_priority);
-            }
-        }
-
-        protected void release_ui_focus () {
-            this.ui_manager.release_focus (this);
-        }
-
-        protected void play_sound_from_id (string event_id) {
-            /* FIXME: Replace this with a modern equivalent? */
-            /*
-            if (this.has_ui_focus ()) {
-                unowned Canberra.Context canberra = CanberraGtk.context_get ();
-                canberra.play (0,
-                    Canberra.PROP_EVENT_ID, event_id
-                );
-            }
-            */
-        }
-
-        protected bool can_lock_screen () {
-            return ! this.ui_manager.application.is_inhibited (Gtk.ApplicationInhibitFlags.IDLE);
-        }
-
-        protected void lock_screen () {
-            if (this.has_ui_focus ()) {
-                if (! this.ui_manager.session_status.is_locked ()) {
-                    this.ui_manager.session_status.lock_screen ();
-                }
-            }
-        }
-
-        protected bool notifications_can_do (string capability) {
-            // For whatever reason notify_capabilities.index () isn't matching
-            // our capability strings, so we'll search the list ourselves
-            foreach (string server_capability in this.ui_manager.notify_capabilities) {
-                if (server_capability == capability) return true;
-            }
-            return false;
-        }
-
-        protected void show_notification (Notify.Notification notification) {
-            if (this.has_ui_focus ()) {
-                this.ui_manager.show_notification (notification);
-                this.notification = notification;
-            }
-        }
-
-        protected void show_lock_notification (Notify.Notification notification) {
-            if (this.has_ui_focus ()) {
-                this.ui_manager.show_lock_notification (notification);
-                this.notification = notification;
-            }
-        }
-
-        protected void hide_notification () {
-            this.ui_manager.hide_notification (this.notification);
-        }
-
-        protected void set_overlay (IScreenOverlayContent overlay_content) {
-            if (this.ui_manager.screen_overlay == null) return;
-
-            this.overlay_content = overlay_content;
-
-            if (this.has_ui_focus ()) {
-                this.ui_manager.screen_overlay.set_content (this.overlay_content);
-            }
-        }
-
-        protected void reveal_overlay () {
-            if (this.ui_manager.screen_overlay == null) return;
-
-            if (this.has_ui_focus ()) {
-                this.ui_manager.screen_overlay.reveal_content (this.overlay_content);
-            }
-        }
-
-        protected void shake_overlay () {
-            if (this.ui_manager.screen_overlay == null) return;
-
-            if (this.overlay_is_visible ()) {
-                this.ui_manager.screen_overlay.request_attention ();
-            }
-        }
-
-        protected bool overlay_is_visible () {
-            if (this.ui_manager.screen_overlay == null) {
-                return false;
-            } else {
-                return this.ui_manager.screen_overlay.is_showing_content (this.overlay_content);
-            }
-        }
-
-        protected void hide_overlay () {
-            if (this.ui_manager.screen_overlay == null) return;
-
-            this.ui_manager.screen_overlay.disappear_content (this.overlay_content);
-        }
-
-        /* IFocusable interface */
-
-        protected abstract void focus_started ();
-        protected abstract void focus_stopped ();
-    }
+    /**
+     * Central place to manage UI throughout the application. We need this to
+     * maintain a simple, modal structure. This uses SimpleFocusManager to
+     * make sure only one break is affecting the UI at a time. This class also
+     * tries to keep UI events nicely spaced so they don't turn into noise.
+     */
 
     private weak Gtk.Application application;
     private ISessionStatus session_status;
 
-    public bool quiet_mode { get; set; default=false; }
-    public int64 quiet_mode_expire_time { get; set; }
+    private Canberra.Context? canberra;
 
-    private PausableTimeout quiet_mode_timeout;
-
-    protected ScreenOverlay? screen_overlay;
-    protected Notify.Notification? notification;
-
-    protected List<string> notify_capabilities;
+    private Notify.Notification? notification;
+    private Notify.Notification? lock_notification;
 
-    // The desktop-entry notification hint wants our desktop ID without the
-    // ".desktop" part, so we need to trim it accordingly
-    private static string DESKTOP_ENTRY_BASENAME = Config.HELPER_DESKTOP_ID.slice (
-        0, Config.HELPER_DESKTOP_ID.last_index_of (".desktop")
-    );
+    private List<string> notify_capabilities;
 
-    public UIManager (Gtk.Application application, ISessionStatus session_status, bool with_overlay) {
+    public UIManager (Gtk.Application application, ISessionStatus session_status) {
         this.application = application;
         this.session_status = session_status;
 
-        if (with_overlay) {
-            this.screen_overlay = new ScreenOverlay ();
+        if (Canberra.Context.create (out this.canberra) != 0) {
+            this.canberra = null;
         }
 
-        Settings settings = new Settings ("org.gnome.BreakTimer");
-        settings.bind ("quiet-mode", this, "quiet-mode", SettingsBindFlags.DEFAULT);
-        settings.bind ("quiet-mode-expire-time", this, "quiet-mode-expire-time", SettingsBindFlags.DEFAULT);
-
-        this.quiet_mode_timeout = new PausableTimeout (this.quiet_mode_timeout_cb, 30);
-        this.notify["quiet-mode"].connect ( (s, p) => {
-            this.update_overlay_format ();
-        });
-        this.update_overlay_format ();
+        if (this.canberra != null) {
+            this.canberra.open();
+        }
 
         this.session_status.unlocked.connect (this.hide_lock_notification_cb);
         this.notify_capabilities = Notify.get_server_caps ();
     }
 
-    private void quiet_mode_timeout_cb (PausableTimeout timeout, int delta_millisecs) {
-        int64 now = Util.get_real_time_seconds ();
-        if (this.quiet_mode && now > this.quiet_mode_expire_time) {
-            this.quiet_mode = false;
-            this.quiet_mode_expire_time = 0;
-            GLib.debug ("Automatically expiring quiet mode");
+    public bool notifications_can_do (string capability) {
+        // For whatever reason notify_capabilities.index () isn't matching
+        // our capability strings, so we'll search the list ourselves
+        foreach (string server_capability in this.notify_capabilities) {
+            if (server_capability == capability) return true;
         }
+        return false;
     }
 
-    private void update_overlay_format () {
-        if (this.screen_overlay == null) return;
-
-        if (this.quiet_mode) {
-            this.screen_overlay.set_format (ScreenOverlay.Format.SILENT);
-            this.quiet_mode_timeout.start ();
-            this.quiet_mode_timeout.run_once ();
-            GLib.debug ("Quiet mode enabled");
-        } else {
-            this.screen_overlay.set_format (ScreenOverlay.Format.FULL);
-            this.quiet_mode_timeout.stop ();
-            GLib.debug ("Quiet mode disabled");
-        }
-    }
+    public void show_notification (Notify.Notification notification) {
+        /**
+         * Show a notification, ensuring that the application is only showing
+         * one notification at any time.
+         */
 
-    /**
-     * Show a notification, ensuring that the application is only showing one
-     * notification at any time.
-     */
-    protected void show_notification (Notify.Notification notification) {
         if (notification != this.notification) {
             this.hide_notification (this.notification);
         }
-        notification.set_hint ("desktop-entry", DESKTOP_ENTRY_BASENAME);
+
+        notification.set_hint ("desktop-entry", Config.HELPER_DESKTOP_ID);
+
         try {
             notification.show ();
         } catch (Error error) {
             GLib.warning ("Error showing notification: %s", error.message);
         }
-        this.notification = notification;
-    }
 
-    private Notify.Notification? lock_notification;
-    /**
-     * Show a notification that will only appear in the lock screen. The
-     * notification automatically hides when the screen is unlocked.
-     */
-    protected void show_lock_notification (Notify.Notification notification) {
-        if (this.session_status.is_locked ()) {
-            this.lock_notification = notification;
-        } else {
-            notification.set_hint ("transient", true);
-        }
-        this.show_notification (notification);
+        this.notification = notification;
     }
 
-    private void hide_lock_notification_cb () {
-        this.hide_notification (this.lock_notification, true);
-        this.lock_notification = null;
-    }
+    public void hide_notification (Notify.Notification? notification, bool immediate=true) {
+        /**
+         * Close a notification proactively, if it is still open.
+         */
 
-    /**
-     * Close a notification proactively, if it is still open.
-     */
-    protected void hide_notification (Notify.Notification? notification, bool immediate=true) {
         if (notification != null && this.notification == notification) {
             try {
                 if (immediate) {
@@ -270,6 +102,39 @@ public class UIManager : SimpleFocusManager {
         this.notification = null;
     }
 
+    public void show_lock_notification (Notify.Notification notification) {
+        /**
+         * Show a notification that will only appear in the lock screen. The
+         * notification automatically hides when the screen is unlocked.
+         */
+
+        if (this.session_status.is_locked ()) {
+            this.lock_notification = notification;
+        } else {
+            notification.set_hint ("transient", true);
+        }
+
+        this.show_notification (notification);
+    }
+
+    public void play_sound_from_id (string event_id) {
+        if (this.canberra != null) {
+            canberra.play (0,
+                Canberra.PROP_EVENT_ID, event_id
+            );
+        }
+    }
+
+    public bool can_lock_screen () {
+        return ! this.application.is_inhibited (Gtk.ApplicationInhibitFlags.IDLE);
+    }
+
+    public void lock_screen () {
+        if (! this.session_status.is_locked ()) {
+            this.session_status.lock_screen ();
+        }
+    }
+
     public void add_break (BreakView break_view) {
         this.application.hold ();
     }
@@ -278,6 +143,11 @@ public class UIManager : SimpleFocusManager {
         this.release_focus (break_view);
         this.application.release ();
     }
+
+    private void hide_lock_notification_cb () {
+        this.hide_notification (this.lock_notification, true);
+        this.lock_notification = null;
+    }
 }
 
 }
diff --git a/helper/break/BreakView.vala b/helper/break/BreakView.vala
index d0516b1..4769ee4 100644
--- a/helper/break/BreakView.vala
+++ b/helper/break/BreakView.vala
@@ -17,7 +17,7 @@
 
 namespace BreakTimer.Helper {
 
-public abstract class BreakView : UIManager.UIFragment {
+public abstract class BreakView : UIFragment {
     protected weak BreakController break_controller;
 
     private int64 last_break_notification_time = 0;
@@ -69,8 +69,6 @@ public abstract class BreakView : UIManager.UIFragment {
     }
 
     protected void show_break_notification (Notify.Notification notification) {
-        if (this.overlay_is_visible ()) return;
-
         if (this.notifications_can_do ("actions")) {
             /* Label for a notification action that shows information about the current break */
             notification.add_action ("info", _("What should I do?"), this.notification_action_info_cb);
@@ -128,7 +126,6 @@ public abstract class BreakView : UIManager.UIFragment {
     }
 
     protected override void focus_stopped () {
-        this.hide_overlay ();
         this.lost_ui_focus ();
         // We don't hide the current notification, because we might have a
         // "Finished" notification that outlasts the UIFragment
diff --git a/helper/break/TimerBreakType.vala b/helper/break/TimerBreakType.vala
index 6f9b9f2..6396379 100644
--- a/helper/break/TimerBreakType.vala
+++ b/helper/break/TimerBreakType.vala
@@ -59,7 +59,7 @@ private class BreakHelper_TimerBreakServer : Object, IBreakHelper_TimerBreak {
         this.break_view = break_view;
     }
 
-    public TimerBreakStatus get_status () {
+    public TimerBreakStatus get_status () throws GLib.DBusError, GLib.IOError {
         return TimerBreakStatus () {
             is_enabled = this.break_controller.is_enabled (),
             is_focused = this.break_view.has_ui_focus (),
@@ -70,7 +70,7 @@ private class BreakHelper_TimerBreakServer : Object, IBreakHelper_TimerBreak {
         };
     }
 
-    public void activate () {
+    public void activate () throws GLib.DBusError, GLib.IOError {
         this.break_controller.activate ();
     }
 }
diff --git a/helper/main.vala b/helper/main.vala
index 95fa01d..2b50eae 100644
--- a/helper/main.vala
+++ b/helper/main.vala
@@ -21,9 +21,9 @@ static HelperApplication application;
 
 public int main (string[] args) {
     application = new HelperApplication ();
-    Posix.signal (Posix.SIGINT, sigint_cb);
-    Posix.signal (Posix.SIGTERM, sigint_cb);
-    Posix.signal (Posix.SIGHUP, sigint_cb);
+    Posix.signal (Posix.Signal.INT, sigint_cb);
+    Posix.signal (Posix.Signal.TERM, sigint_cb);
+    Posix.signal (Posix.Signal.HUP, sigint_cb);
     int status = application.run (args);
     return status;
 }
diff --git a/helper/meson.build b/helper/meson.build
index bef2fce..4e0d9b7 100644
--- a/helper/meson.build
+++ b/helper/meson.build
@@ -11,7 +11,6 @@ helper_sources = [
     'break/BreakView.vala',
     'break/TimerBreakController.vala',
     'break/TimerBreakType.vala',
-    'break/TimerBreakStatusWidget.vala',
     'break/TimerBreakView.vala',
     'microbreak/MicroBreakController.vala',
     'microbreak/MicroBreakType.vala',
@@ -21,8 +20,8 @@ helper_sources = [
     'restbreak/RestBreakView.vala',
     'BreakManager.vala',
     'HelperApplication.vala',
-    'ScreenOverlay.vala',
     'SessionStatus.vala',
+    'UIFragment.vala',
     'UIManager.vala'
 ]
 
@@ -36,6 +35,7 @@ helper_dependencies = [
     gee_dep,
     json_glib_dep,
     libnotify_dep,
+    libcanberra_dep,
     posix_dep,
     m_dep
 ]
@@ -63,4 +63,4 @@ executable(
     dependencies : helper_lib_dep,
     install: true,
     install_dir: bindir
-)
+)
\ No newline at end of file
diff --git a/helper/microbreak/MicroBreakView.vala b/helper/microbreak/MicroBreakView.vala
index 3483608..ae4b81d 100644
--- a/helper/microbreak/MicroBreakView.vala
+++ b/helper/microbreak/MicroBreakView.vala
@@ -92,17 +92,7 @@ public class MicroBreakView : TimerBreakView {
     private void focused_and_activated_cb () {
         this.delay_time_notified = 0;
 
-        var status_widget = new TimerBreakStatusWidget (this.micro_break);
-        status_widget.set_message ( _("Take a moment to rest your eyes"));
-        this.set_overlay (status_widget);
-
-        if (! this.overlay_is_visible ()) {
-            this.show_start_notification ();
-            Timeout.add_seconds (this.get_lead_in_seconds (), () => {
-                this.reveal_overlay ();
-                return false;
-            });
-        }
+        this.show_start_notification ();
 
         this.micro_break.delayed.connect (this.delayed_cb);
     }
diff --git a/helper/restbreak/RestBreakView.vala b/helper/restbreak/RestBreakView.vala
index cd9046d..563d8fb 100644
--- a/helper/restbreak/RestBreakView.vala
+++ b/helper/restbreak/RestBreakView.vala
@@ -24,19 +24,6 @@ public class RestBreakView : TimerBreakView {
         get { return (RestBreakController)this.break_controller; }
     }
 
-    private string[] rest_quotes = {
-        /*
-        _("The quieter you become, the more you can hear."),
-        _("Knock on the sky and listen to the sound."),
-        _("So little time, so little to do."),
-        _("Sometimes the questions are complicated and the answers are simple."),
-        _("You cannot step into the same river twice."),
-        _("The obstacle is the path."),
-        _("No snowflake ever falls in the wrong place."),
-        _("The energy of the mind is the essence of life.")
-        */
-    };
-
     private int64 original_start_time = 0;
     private bool was_skipped = false;
     private bool proceeding_happily = false;
@@ -137,26 +124,11 @@ public class RestBreakView : TimerBreakView {
     private void focused_and_activated_cb () {
         this.proceeding_happily = false;
 
-        var status_widget = new TimerBreakStatusWidget (this.rest_break);
-        int quote_number = Random.int_range (0, this.rest_quotes.length);
-        string random_quote = this.rest_quotes[quote_number];
-        status_widget.set_message (random_quote);
-        this.set_overlay (status_widget);
-
-        if (! this.overlay_is_visible ()) {
-            // We only show notifications if the break overlay is not visible
-            if (! this.was_skipped) {
-                this.original_start_time = Util.get_real_time_seconds ();
-                this.show_start_notification ();
-            } else {
-                this.show_overdue_notification ();
-            }
-
-            // And we escalate to showing the overlay a little later
-            Timeout.add_seconds (this.get_lead_in_seconds (), () => {
-                this.reveal_overlay ();
-                return false;
-            });
+        if (! this.was_skipped) {
+            this.original_start_time = Util.get_real_time_seconds ();
+            this.show_start_notification ();
+        } else {
+            this.show_overdue_notification ();
         }
 
         this.rest_break.counting.connect (this.counting_cb);
@@ -183,9 +155,9 @@ public class RestBreakView : TimerBreakView {
     private void counting_cb (int lap_time, int total_time) {
         this.proceeding_happily = lap_time > 20;
 
-        if (this.proceeding_happily) {
+        if (this.proceeding_happily && this.can_lock_screen ()) {
             // TODO: Make a sound slightly before locking?
-            if (this.can_lock_screen ()) this.lock_screen ();
+            this.lock_screen ();
         }
     }
 
@@ -204,7 +176,7 @@ public class RestBreakView : TimerBreakView {
     }
 
     private void current_duration_changed_cb () {
-        this.shake_overlay ();
+        // TODO: Do something annoying?
     }
 
     private void notification_action_postpone_cb () {
diff --git a/meson.build b/meson.build
index c7b5403..cf8da6c 100644
--- a/meson.build
+++ b/meson.build
@@ -6,8 +6,6 @@ i18n = import('i18n')
 valac = meson.get_compiler('vala')
 cc = meson.get_compiler('c')
 
-env = environment()
-
 cairo_dep = dependency('cairo')
 gee_dep = dependency('gee-0.8')
 gio_dep = dependency('gio-2.0')
@@ -17,6 +15,7 @@ gobject_dep = dependency('gobject-2.0')
 gtk_dep = dependency('gtk+-3.0')
 json_glib_dep = dependency('json-glib-1.0')
 libnotify_dep = dependency('libnotify')
+libcanberra_dep = dependency('libcanberra')
 
 posix_dep = valac.find_library('posix')
 m_dep = cc.find_library('m', required : false)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]