[gnome-break-timer/dylanmccall/meson-build: 12/25] Move "helper" code to the BreakTimer.Helper namespace



commit 03b59bc09a5a36a5de77e4a5b6cbbbe86476bb13
Author: Dylan McCall <dylan dylanmccall com>
Date:   Mon Jan 7 22:13:36 2019 -0800

    Move "helper" code to the BreakTimer.Helper namespace
    
    This change fixes an regression where code from the common library (in
    the BreakTimer namespace) was no longer visible to helper code.

 helper/BreakManager.vala                     | 4 ++++
 helper/HelperApplication.vala                | 6 +++++-
 helper/ScreenOverlay.vala                    | 6 +++++-
 helper/SessionStatus.vala                    | 6 +++++-
 helper/UIManager.vala                        | 9 ++++++++-
 helper/activity-monitor/ActivityMonitor.vala | 4 ++++
 helper/break/BreakController.vala            | 6 +++++-
 helper/break/BreakType.vala                  | 6 +++++-
 helper/break/BreakView.vala                  | 6 +++++-
 helper/break/TimerBreakController.vala       | 6 +++++-
 helper/break/TimerBreakStatusWidget.vala     | 6 +++++-
 helper/break/TimerBreakType.vala             | 4 ++++
 helper/break/TimerBreakView.vala             | 6 +++++-
 helper/main.vala                             | 8 +++++++-
 helper/microbreak/MicroBreakController.vala  | 6 +++++-
 helper/microbreak/MicroBreakType.vala        | 6 +++++-
 helper/microbreak/MicroBreakView.vala        | 6 +++++-
 helper/restbreak/RestBreakController.vala    | 6 +++++-
 helper/restbreak/RestBreakType.vala          | 6 +++++-
 helper/restbreak/RestBreakView.vala          | 6 +++++-
 helper/util/Countdown.vala                   | 6 +++++-
 helper/util/PausableTimeout.vala             | 6 +++++-
 helper/util/SimpleFocusManager.vala          | 6 +++++-
 helper/util/StatefulTimer.vala               | 6 +++++-
 helper/util/Util.vala                        | 6 +++++-
 25 files changed, 127 insertions(+), 22 deletions(-)
---
diff --git a/helper/BreakManager.vala b/helper/BreakManager.vala
index 5440c13..ec18719 100644
--- a/helper/BreakManager.vala
+++ b/helper/BreakManager.vala
@@ -15,6 +15,8 @@
  * along with GNOME Break Timer.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+namespace BreakTimer.Helper {
+
 public class BreakManager : Object {
        private UIManager ui_manager;
 
@@ -142,3 +144,5 @@ public class BreakHelperServer : Object, IBreakHelper {
                if (break_type != null) break_type.break_controller.activate ();
        }
 }
+
+}
diff --git a/helper/HelperApplication.vala b/helper/HelperApplication.vala
index 1db261a..983bef0 100644
--- a/helper/HelperApplication.vala
+++ b/helper/HelperApplication.vala
@@ -15,6 +15,8 @@
  * along with GNOME Break Timer.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+namespace BreakTimer.Helper {
+
 public class HelperApplication : Gtk.Application {
        const string app_id = Config.HELPER_DESKTOP_ID;
        const string app_name = _("GNOME Break Timer");
@@ -98,7 +100,7 @@ public class HelperApplication : Gtk.Application {
                this.session_status = new SessionStatus (this);
 
                try {
-                       this.activity_monitor_backend = new X11ActivityMonitorBackend ();
+                       this.activity_monitor_backend = new GnomeShellActivityMonitorBackend ();
                } catch {
                        GLib.error ("Failed to initialize activity monitor backend");
                }
@@ -186,3 +188,5 @@ public class HelperApplication : Gtk.Application {
                }
        }
 }
+
+}
diff --git a/helper/ScreenOverlay.vala b/helper/ScreenOverlay.vala
index 73a60b6..9c90305 100644
--- a/helper/ScreenOverlay.vala
+++ b/helper/ScreenOverlay.vala
@@ -15,6 +15,8 @@
  * along with GNOME Break Timer.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+namespace BreakTimer.Helper {
+
 /* FIXME: Do another overlay widget and kill the set_format junk :) */
 
 public interface IScreenOverlayContent : Gtk.Widget {
@@ -253,4 +255,6 @@ public class ScreenOverlay : Gtk.Window {
                        return this.get_visible () && this.custom_content == widget;
                }
        }
-}
\ No newline at end of file
+}
+
+}
diff --git a/helper/SessionStatus.vala b/helper/SessionStatus.vala
index 153ebfa..ab4b69d 100644
--- a/helper/SessionStatus.vala
+++ b/helper/SessionStatus.vala
@@ -15,6 +15,8 @@
  * along with GNOME Break Timer.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+namespace BreakTimer.Helper {
+
 [DBus (name = "org.gnome.ScreenSaver")]
 public interface IScreenSaver : Object {
     public signal void active_changed (bool active);
@@ -107,4 +109,6 @@ public class SessionStatus : ISessionStatus, Object {
                        }
                }
        }
-}
\ No newline at end of file
+}
+
+}
diff --git a/helper/UIManager.vala b/helper/UIManager.vala
index d197e1f..fe350a3 100644
--- a/helper/UIManager.vala
+++ b/helper/UIManager.vala
@@ -15,6 +15,8 @@
  * along with GNOME Break Timer.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+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
@@ -51,12 +53,15 @@ public class UIManager : SimpleFocusManager {
                }
 
                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 () {
@@ -273,4 +278,6 @@ public class UIManager : SimpleFocusManager {
                this.release_focus (break_view);
                this.application.release ();
        }
-}
\ No newline at end of file
+}
+
+}
diff --git a/helper/activity-monitor/ActivityMonitor.vala b/helper/activity-monitor/ActivityMonitor.vala
index a8ea48f..df4d489 100644
--- a/helper/activity-monitor/ActivityMonitor.vala
+++ b/helper/activity-monitor/ActivityMonitor.vala
@@ -15,6 +15,8 @@
  * along with GNOME Break Timer.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+namespace BreakTimer.Helper {
+
 public class ActivityMonitor : Object {
        public enum ActivityType {
                SLEEP,
@@ -227,3 +229,5 @@ public abstract class ActivityMonitorBackend : Object {
                return sleep_time;
        }
 }
+
+}
diff --git a/helper/break/BreakController.vala b/helper/break/BreakController.vala
index 38136f1..9cca7e4 100644
--- a/helper/break/BreakController.vala
+++ b/helper/break/BreakController.vala
@@ -15,6 +15,8 @@
  * along with GNOME Break Timer.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+namespace BreakTimer.Helper {
+
 /**
  * Base class for a break's activity tracking functionality.
  * A break can be started or stopped, and once started it will be activated
@@ -182,4 +184,6 @@ public abstract class BreakController : Object {
                if (forget_start) this.activate_timestamp = null;
                this.finished (BreakController.FinishedReason.SKIPPED, was_active);
        }
-}
\ No newline at end of file
+}
+
+}
diff --git a/helper/break/BreakType.vala b/helper/break/BreakType.vala
index a6349f8..aff3505 100644
--- a/helper/break/BreakType.vala
+++ b/helper/break/BreakType.vala
@@ -15,6 +15,8 @@
  * along with GNOME Break Timer.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+namespace BreakTimer.Helper {
+
 public abstract class BreakType : Object {
        public string id;
        public BreakController break_controller;
@@ -34,4 +36,6 @@ public abstract class BreakType : Object {
 
        protected abstract BreakController get_break_controller ();
        protected abstract BreakView get_break_view (BreakController controller, UIManager ui_manager);
-}
\ No newline at end of file
+}
+
+}
diff --git a/helper/break/BreakView.vala b/helper/break/BreakView.vala
index 079d3dc..e86fcee 100644
--- a/helper/break/BreakView.vala
+++ b/helper/break/BreakView.vala
@@ -15,6 +15,8 @@
  * along with GNOME Break Timer.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+namespace BreakTimer.Helper {
+
 public abstract class BreakView : UIManager.UIFragment {
        protected weak BreakController break_controller;
 
@@ -131,4 +133,6 @@ public abstract class BreakView : UIManager.UIFragment {
                // We don't hide the current notification, because we might have a
                // "Finished" notification that outlasts the UIFragment
        }
-}
\ No newline at end of file
+}
+
+}
diff --git a/helper/break/TimerBreakController.vala b/helper/break/TimerBreakController.vala
index f7dec68..afb1c0a 100644
--- a/helper/break/TimerBreakController.vala
+++ b/helper/break/TimerBreakController.vala
@@ -15,6 +15,8 @@
  * along with GNOME Break Timer.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+namespace BreakTimer.Helper {
+
 /**
  * A type of break that times user activity. It activates after a particular
  * amount of uninterupted activity, and the break is finished after a
@@ -245,4 +247,6 @@ public abstract class TimerBreakController : BreakController {
                        this.active_changed ();
                }
        }
-}
\ No newline at end of file
+}
+
+}
diff --git a/helper/break/TimerBreakStatusWidget.vala b/helper/break/TimerBreakStatusWidget.vala
index 77a818a..585fd37 100644
--- a/helper/break/TimerBreakStatusWidget.vala
+++ b/helper/break/TimerBreakStatusWidget.vala
@@ -15,6 +15,8 @@
  * along with GNOME Break Timer.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+namespace BreakTimer.Helper {
+
 public class TimerBreakStatusWidget : Gtk.Grid, IScreenOverlayContent {
        private TimerBreakController timer_break;
 
@@ -88,4 +90,6 @@ public class TimerBreakStatusWidget : Gtk.Grid, IScreenOverlayContent {
        public void before_fade_out () {
                this.update_content ();
        }
-}
\ No newline at end of file
+}
+
+}
diff --git a/helper/break/TimerBreakType.vala b/helper/break/TimerBreakType.vala
index 46bb214..4669d03 100644
--- a/helper/break/TimerBreakType.vala
+++ b/helper/break/TimerBreakType.vala
@@ -15,6 +15,8 @@
  * along with GNOME Break Timer.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+namespace BreakTimer.Helper {
+
 public abstract class TimerBreakType : BreakType {
        private BreakHelper_TimerBreakServer break_type_server;
 
@@ -72,3 +74,5 @@ private class BreakHelper_TimerBreakServer : Object, IBreakHelper_TimerBreak {
                this.break_controller.activate ();
        }
 }
+
+}
diff --git a/helper/break/TimerBreakView.vala b/helper/break/TimerBreakView.vala
index a8663ea..f7b1eb0 100644
--- a/helper/break/TimerBreakView.vala
+++ b/helper/break/TimerBreakView.vala
@@ -15,6 +15,8 @@
  * along with GNOME Break Timer.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+namespace BreakTimer.Helper {
+
 public abstract class TimerBreakView : BreakView {
        protected TimerBreakController timer_break {
                get { return (TimerBreakController)this.break_controller; }
@@ -50,4 +52,6 @@ public abstract class TimerBreakView : BreakView {
                }
                return lead_in;
        }
-}
\ No newline at end of file
+}
+
+}
diff --git a/helper/main.vala b/helper/main.vala
index 6a69868..f2975f6 100644
--- a/helper/main.vala
+++ b/helper/main.vala
@@ -15,17 +15,23 @@
  * along with GNOME Break Timer.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+namespace BreakTimer.Helper {
+
 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);
+       */
        int status = application.run (args);
        return status;
 }
 
 void sigint_cb (int signal_number) {
        application.quit ();
-}
\ No newline at end of file
+}
+
+}
diff --git a/helper/microbreak/MicroBreakController.vala b/helper/microbreak/MicroBreakController.vala
index 8c625aa..8cb38c2 100644
--- a/helper/microbreak/MicroBreakController.vala
+++ b/helper/microbreak/MicroBreakController.vala
@@ -15,6 +15,8 @@
  * along with GNOME Break Timer.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+namespace BreakTimer.Helper {
+
 /**
  * A type of timer break that should activate frequently and for short
  * durations. Satisfied when the user is inactive for its entire duration,
@@ -31,4 +33,6 @@ public class MicroBreakController : TimerBreakController {
        private void delayed_cb (int lap_time, int total_time) {
                this.duration_countdown.reset ();
        }
-}
\ No newline at end of file
+}
+
+}
diff --git a/helper/microbreak/MicroBreakType.vala b/helper/microbreak/MicroBreakType.vala
index 7184262..938d2ee 100644
--- a/helper/microbreak/MicroBreakType.vala
+++ b/helper/microbreak/MicroBreakType.vala
@@ -15,6 +15,8 @@
  * along with GNOME Break Timer.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+namespace BreakTimer.Helper {
+
 public class MicroBreakType : TimerBreakType {
        private ActivityMonitor activity_monitor;
 
@@ -36,4 +38,6 @@ public class MicroBreakType : TimerBreakType {
                        ui_manager
                );
        }
-}
\ No newline at end of file
+}
+
+}
diff --git a/helper/microbreak/MicroBreakView.vala b/helper/microbreak/MicroBreakView.vala
index d7ff879..daca421 100644
--- a/helper/microbreak/MicroBreakView.vala
+++ b/helper/microbreak/MicroBreakView.vala
@@ -15,6 +15,8 @@
  * along with GNOME Break Timer.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+namespace BreakTimer.Helper {
+
 /* TODO: notification when user is away for rest duration */
 /* TODO: replace pause break if appropriate */
 
@@ -128,4 +130,6 @@ public class MicroBreakView : TimerBreakView {
        private void notification_action_skip_cb () {
                this.break_controller.skip (true);
        }
-}
\ No newline at end of file
+}
+
+}
diff --git a/helper/restbreak/RestBreakController.vala b/helper/restbreak/RestBreakController.vala
index acf63f8..d5dc0c7 100644
--- a/helper/restbreak/RestBreakController.vala
+++ b/helper/restbreak/RestBreakController.vala
@@ -15,6 +15,8 @@
  * along with GNOME Break Timer.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+namespace BreakTimer.Helper {
+
 /**
  * A type of timer break designed for longer durations. Satisfied when the user
  * is inactive for its entire duration, but allows the user to interact with
@@ -77,4 +79,6 @@ public class RestBreakController : TimerBreakController {
                        this.reminder_countdown.start ();
                }
        }
-}
\ No newline at end of file
+}
+
+}
diff --git a/helper/restbreak/RestBreakType.vala b/helper/restbreak/RestBreakType.vala
index 80395c8..0c52b66 100644
--- a/helper/restbreak/RestBreakType.vala
+++ b/helper/restbreak/RestBreakType.vala
@@ -15,6 +15,8 @@
  * along with GNOME Break Timer.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+namespace BreakTimer.Helper {
+
 public class RestBreakType : TimerBreakType {
        private ActivityMonitor activity_monitor;
 
@@ -36,4 +38,6 @@ public class RestBreakType : TimerBreakType {
                        ui_manager
                );
        }
-}
\ No newline at end of file
+}
+
+}
diff --git a/helper/restbreak/RestBreakView.vala b/helper/restbreak/RestBreakView.vala
index df96387..8ce1a9d 100644
--- a/helper/restbreak/RestBreakView.vala
+++ b/helper/restbreak/RestBreakView.vala
@@ -15,6 +15,8 @@
  * along with GNOME Break Timer.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+namespace BreakTimer.Helper {
+
 /* TODO: Use a single persistent notification throughout a given break */
 
 public class RestBreakView : TimerBreakView {
@@ -208,4 +210,6 @@ public class RestBreakView : TimerBreakView {
        private void notification_action_postpone_cb () {
                this.rest_break.postpone (60);
        }
-}
\ No newline at end of file
+}
+
+}
diff --git a/helper/util/Countdown.vala b/helper/util/Countdown.vala
index f160c84..e4d1894 100644
--- a/helper/util/Countdown.vala
+++ b/helper/util/Countdown.vala
@@ -15,6 +15,8 @@
  * along with GNOME Break Timer.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+namespace BreakTimer.Helper {
+
 /**
  * A countdown timer that counts seconds from a start time down to 0. Uses
  * "wall-clock" time instead of monotonic time, so it will count regardless
@@ -267,4 +269,6 @@ public class Countdown : Object {
        public bool is_finished () {
                return this.get_time_remaining () == 0;
        }
-}
\ No newline at end of file
+}
+
+}
diff --git a/helper/util/PausableTimeout.vala b/helper/util/PausableTimeout.vala
index 144939d..983c6bd 100644
--- a/helper/util/PausableTimeout.vala
+++ b/helper/util/PausableTimeout.vala
@@ -15,6 +15,8 @@
  * along with GNOME Break Timer.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+namespace BreakTimer.Helper {
+
 /**
  * Calls a function continuously with a particular interval, in seconds. An
  * instance of PausableTimout is attached to a particular TimeoutCB function,
@@ -89,4 +91,6 @@ public class PausableTimeout : Object {
        public bool is_running () {
                return this.source_id > 0;
        }
-}
\ No newline at end of file
+}
+
+}
diff --git a/helper/util/SimpleFocusManager.vala b/helper/util/SimpleFocusManager.vala
index fecb709..e057176 100644
--- a/helper/util/SimpleFocusManager.vala
+++ b/helper/util/SimpleFocusManager.vala
@@ -15,6 +15,8 @@
  * along with GNOME Break Timer.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+namespace BreakTimer.Helper {
+
 public interface IFocusable : Object {
        public abstract void focus_started ();
        public abstract void focus_stopped ();
@@ -108,4 +110,6 @@ public class SimpleFocusManager : Object {
        public bool is_focusing (IFocusable focusable) {
                return this.current_focus != null && this.current_focus.owner == focusable;
        }
-}
\ No newline at end of file
+}
+
+}
diff --git a/helper/util/StatefulTimer.vala b/helper/util/StatefulTimer.vala
index be5d9b6..995c9d9 100644
--- a/helper/util/StatefulTimer.vala
+++ b/helper/util/StatefulTimer.vala
@@ -15,6 +15,8 @@
  * along with GNOME Break Timer.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+namespace BreakTimer.Helper {
+
 /**
  * A simple GTimer lookalike that keeps track of its own state.
  * This is implemented using the GTimer API, internally, so it behaves
@@ -122,4 +124,6 @@ public class StatefulTimer : Object {
                        this.stop ();
                }
        }
-}
\ No newline at end of file
+}
+
+}
diff --git a/helper/util/Util.vala b/helper/util/Util.vala
index b1377ea..9addfe8 100644
--- a/helper/util/Util.vala
+++ b/helper/util/Util.vala
@@ -15,6 +15,8 @@
  * along with GNOME Break Timer.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+namespace BreakTimer.Helper {
+
 /**
  * A collection of handy little functions that can't really be categorized,
  * but end up being used throughout this application.
@@ -50,4 +52,6 @@ public class Util {
        public inline static int64 get_monotonic_time_seconds () {
                return get_monotonic_time () / MICROSECONDS_IN_SECONDS;
        }
-}
\ No newline at end of file
+}
+
+}


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