[gnome-break-timer/dylanmccall/meson-build: 4/25] Vala compatibility fixes for settings and common modules
- From: Dylan McCall <dylanmccall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-break-timer/dylanmccall/meson-build: 4/25] Vala compatibility fixes for settings and common modules
- Date: Wed, 23 Jan 2019 04:03:20 +0000 (UTC)
commit 0d48d6a8b197eddd0223a1f0486639620ce3f2da
Author: Dylan McCall <dylan dylanmccall com>
Date: Fri Jun 8 23:14:41 2018 -0700
Vala compatibility fixes for settings and common modules
common/IBreakHelper.vala | 6 +++++-
common/ISessionStatus.vala | 6 +++++-
common/NaturalTime.vala | 6 +++++-
settings/BreakManager.vala | 19 +++++++++++++------
settings/BreakSettingsDialog.vala | 11 +++++++++--
settings/BreakType.vala | 13 ++++++++++---
settings/CircleCounter.vala | 9 +++++++--
settings/MainWindow.vala | 7 +++++++
settings/MicroBreakType.vala | 11 +++++++++--
settings/OverlayArrow.vala | 9 ++++++++-
settings/RestBreakType.vala | 11 +++++++++--
settings/SettingsApplication.vala | 11 +++++++++--
settings/TimeChooser.vala | 7 +++++++
settings/TimerBreakType.vala | 11 +++++++++--
settings/main.vala | 6 +++++-
15 files changed, 117 insertions(+), 26 deletions(-)
---
diff --git a/common/IBreakHelper.vala b/common/IBreakHelper.vala
index 39ce480..fce367b 100644
--- a/common/IBreakHelper.vala
+++ b/common/IBreakHelper.vala
@@ -15,6 +15,8 @@
* along with GNOME Break Timer. If not, see <http://www.gnu.org/licenses/>.
*/
+namespace BreakTimer {
+
public const string HELPER_BUS_NAME = "org.gnome.BreakTimer";
public const string HELPER_OBJECT_PATH = "/org/gnome/BreakTimer";
public const string HELPER_BREAK_OBJECT_BASE_PATH = "/org/gnome/BreakTimer/";
@@ -61,4 +63,6 @@ public struct TimerBreakStatus {
int starts_in;
int time_remaining;
int current_duration;
-}
\ No newline at end of file
+}
+
+}
diff --git a/common/ISessionStatus.vala b/common/ISessionStatus.vala
index 01c7043..037a5fa 100644
--- a/common/ISessionStatus.vala
+++ b/common/ISessionStatus.vala
@@ -15,6 +15,8 @@
* along with GNOME Break Timer. If not, see <http://www.gnu.org/licenses/>.
*/
+namespace BreakTimer {
+
public interface ISessionStatus : Object {
public signal void locked ();
public signal void unlocked ();
@@ -23,4 +25,6 @@ public interface ISessionStatus : Object {
public abstract void lock_screen ();
public abstract void blank_screen ();
public abstract void unblank_screen ();
-}
\ No newline at end of file
+}
+
+}
diff --git a/common/NaturalTime.vala b/common/NaturalTime.vala
index 66f432f..31ca9c2 100644
--- a/common/NaturalTime.vala
+++ b/common/NaturalTime.vala
@@ -15,6 +15,8 @@
* along with GNOME Break Timer. If not, see <http://www.gnu.org/licenses/>.
*/
+namespace BreakTimer {
+
public class NaturalTime : Object {
public delegate string FormatTimeCb (int seconds);
@@ -145,4 +147,6 @@ public class NaturalTime : Object {
int time_softened = ( (seconds-1) / interval) + 1;
return time_softened * interval;
}
-}
\ No newline at end of file
+}
+
+}
diff --git a/settings/BreakManager.vala b/settings/BreakManager.vala
index e3ce918..64ea70b 100644
--- a/settings/BreakManager.vala
+++ b/settings/BreakManager.vala
@@ -18,15 +18,20 @@
// TODO: This intentionally resembles BreakManager from the helper
// application. Ideally, it should be common code in the future.
+using Gee;
+using GLib;
+
+namespace BreakTimer.Settings {
+
public class BreakManager : Object {
private SettingsApplication application;
private IBreakHelper break_helper;
private Gee.Map<string, BreakType> breaks;
- private List<BreakType> breaks_ordered;
+ private GLib.List<BreakType> breaks_ordered;
- private Settings settings;
+ private GLib.Settings settings;
public bool master_enabled { get; set; }
public string[] selected_break_ids { get; set; }
public BreakType? foreground_break { get; private set; }
@@ -34,9 +39,9 @@ public class BreakManager : Object {
public BreakManager (SettingsApplication application) {
this.application = application;
this.breaks = new Gee.HashMap<string, BreakType> ();
- this.breaks_ordered = new List<BreakType> ();
+ this.breaks_ordered = new GLib.List<BreakType> ();
- this.settings = new Settings ("org.gnome.break-timer");
+ this.settings = new GLib.Settings ("org.gnome.break-timer");
this.settings.bind ("enabled", this, "master-enabled", SettingsBindFlags.DEFAULT);
this.settings.bind ("selected-breaks", this, "selected-break-ids", SettingsBindFlags.DEFAULT);
@@ -70,7 +75,7 @@ public class BreakManager : Object {
return this.breaks.keys;
}
- public unowned List<BreakType> all_breaks () {
+ public unowned GLib.List<BreakType> all_breaks () {
return this.breaks_ordered;
}
@@ -146,4 +151,6 @@ public class BreakManager : Object {
GLib.warning ("Error launching helper application: %s", error.message);
}
}
-}
\ No newline at end of file
+}
+
+}
diff --git a/settings/BreakSettingsDialog.vala b/settings/BreakSettingsDialog.vala
index 5467cfd..2655afd 100644
--- a/settings/BreakSettingsDialog.vala
+++ b/settings/BreakSettingsDialog.vala
@@ -15,19 +15,24 @@
* along with GNOME Break Timer. If not, see <http://www.gnu.org/licenses/>.
*/
+using Gtk;
+using GLib;
+
+namespace BreakTimer.Settings {
+
public class BreakSettingsDialog : Gtk.Dialog {
private BreakManager break_manager;
private BreakConfigurationChooser configuration_chooser;
private Gtk.Grid breaks_grid;
- private static const int ABOUT_BUTTON_RESPONSE = 5;
+ private const int ABOUT_BUTTON_RESPONSE = 5;
public BreakSettingsDialog (BreakManager break_manager) {
Object ();
this.break_manager = break_manager;
- Settings settings = new Settings ("org.gnome.break-timer");
+ GLib.Settings settings = new GLib.Settings ("org.gnome.break-timer");
this.set_title ( _("Choose Your Break Schedule"));
this.set_resizable (false);
@@ -214,3 +219,5 @@ class FixedSizeGrid : Gtk.Grid {
return hidden_children;
}
}
+
+}
diff --git a/settings/BreakType.vala b/settings/BreakType.vala
index d0c14a3..de255c9 100644
--- a/settings/BreakType.vala
+++ b/settings/BreakType.vala
@@ -15,6 +15,11 @@
* along with GNOME Break Timer. If not, see <http://www.gnu.org/licenses/>.
*/
+using Gtk;
+using GLib;
+
+namespace BreakTimer.Settings {
+
public abstract class BreakType : Object {
public string id { get; private set; }
public BreakStatus? status;
@@ -23,9 +28,9 @@ public abstract class BreakType : Object {
public BreakStatusPanel status_panel;
public BreakSettingsPanel settings_panel;
- public Settings settings;
+ public GLib.Settings settings;
- public BreakType (string id, Settings settings) {
+ public BreakType (string id, GLib.Settings settings) {
this.id = id;
this.settings = settings;
}
@@ -163,4 +168,6 @@ public abstract class BreakSettingsPanel : Gtk.Grid {
protected void set_details (Gtk.Widget content) {
this.details.add (content);
}
-}
\ No newline at end of file
+}
+
+}
diff --git a/settings/CircleCounter.vala b/settings/CircleCounter.vala
index c8001a9..016e219 100644
--- a/settings/CircleCounter.vala
+++ b/settings/CircleCounter.vala
@@ -15,7 +15,10 @@
* along with GNOME Break Timer. If not, see <http://www.gnu.org/licenses/>.
*/
-// TODO: Share code with gnome-clocks, instead of duplicating effort
+using Gtk;
+using GLib;
+
+namespace BreakTimer.Settings {
/**
* Displays a countdown using a circle, reminiscent of a countdown timer.
@@ -121,4 +124,6 @@ public class CircleCounter : Gtk.Widget {
private int calculate_diameter () {
return 2 * DEFAULT_RADIUS;
}
-}
\ No newline at end of file
+}
+
+}
diff --git a/settings/MainWindow.vala b/settings/MainWindow.vala
index a135f2b..daed07a 100644
--- a/settings/MainWindow.vala
+++ b/settings/MainWindow.vala
@@ -15,6 +15,11 @@
* along with GNOME Break Timer. If not, see <http://www.gnu.org/licenses/>.
*/
+using Gtk;
+using GLib;
+
+namespace BreakTimer.Settings {
+
public class MainWindow : Gtk.ApplicationWindow {
private BreakManager break_manager;
@@ -355,3 +360,5 @@ private class StatusPanel : Gtk.Stack {
}
}
}
+
+}
diff --git a/settings/MicroBreakType.vala b/settings/MicroBreakType.vala
index 66b2e57..d1fdaad 100644
--- a/settings/MicroBreakType.vala
+++ b/settings/MicroBreakType.vala
@@ -15,9 +15,14 @@
* along with GNOME Break Timer. If not, see <http://www.gnu.org/licenses/>.
*/
+using Gtk;
+using GLib;
+
+namespace BreakTimer.Settings {
+
public class MicroBreakType : TimerBreakType {
public MicroBreakType () {
- Settings settings = new Settings ("org.gnome.break-timer.microbreak");
+ GLib.Settings settings = new GLib.Settings ("org.gnome.break-timer.microbreak");
base ("microbreak", settings);
this.interval_options = { 240, 300, 360, 480, 600 };
@@ -92,4 +97,6 @@ class MicroBreakSettingsPanel : TimerBreakSettingsPanel {
_("Pause frequently to relax your eyes")
);
}
-}
\ No newline at end of file
+}
+
+}
diff --git a/settings/OverlayArrow.vala b/settings/OverlayArrow.vala
index 1377336..1b7e162 100644
--- a/settings/OverlayArrow.vala
+++ b/settings/OverlayArrow.vala
@@ -15,6 +15,11 @@
* along with GNOME Break Timer. If not, see <http://www.gnu.org/licenses/>.
*/
+using Gtk;
+using GLib;
+
+namespace BreakTimer.Settings {
+
/* FIXME: This widget is stealing clicks when it is used in an overlay */
public class OverlayArrow : Gtk.Widget {
private Gtk.Widget from_widget;
@@ -115,4 +120,6 @@ public class OverlayArrow : Gtk.Widget {
}
this.to_widget.translate_coordinates (this, to_local_x, to_local_y, out to_x, out to_y);
}
-}
\ No newline at end of file
+}
+
+}
diff --git a/settings/RestBreakType.vala b/settings/RestBreakType.vala
index 228b267..b547e0d 100644
--- a/settings/RestBreakType.vala
+++ b/settings/RestBreakType.vala
@@ -15,9 +15,14 @@
* along with GNOME Break Timer. If not, see <http://www.gnu.org/licenses/>.
*/
+using Gtk;
+using GLib;
+
+namespace BreakTimer.Settings {
+
public class RestBreakType : TimerBreakType {
public RestBreakType () {
- Settings settings = new Settings ("org.gnome.break-timer.restbreak");
+ GLib.Settings settings = new GLib.Settings ("org.gnome.break-timer.restbreak");
base ("restbreak", settings);
this.interval_options = { 1800, 2400, 3000, 3600 };
@@ -93,4 +98,6 @@ class RestBreakSettingsPanel : TimerBreakSettingsPanel {
_("And take some longer breaks to stretch your legs")
);
}
-}
\ No newline at end of file
+}
+
+}
diff --git a/settings/SettingsApplication.vala b/settings/SettingsApplication.vala
index 13332bf..b47c3ca 100644
--- a/settings/SettingsApplication.vala
+++ b/settings/SettingsApplication.vala
@@ -15,10 +15,15 @@
* along with GNOME Break Timer. If not, see <http://www.gnu.org/licenses/>.
*/
+using Gtk;
+using GLib;
+
+namespace BreakTimer.Settings {
+
public class SettingsApplication : Gtk.Application {
const string app_id = HELPER_BUS_NAME+".Settings";
- private static const string STYLE_DATA =
+ private const string STYLE_DATA =
"""
._settings-title {
font-weight:bold;
@@ -98,7 +103,7 @@ public class SettingsApplication : Gtk.Application {
this.add_action (quit_action);
quit_action.activate.connect (this.quit);
- Menu app_menu = new Menu ();
+ GLib.Menu app_menu = new GLib.Menu ();
app_menu.append ( _("About"), "app.about");
app_menu.append ( _("Quit"), "app.quit");
this.set_app_menu (app_menu);
@@ -125,3 +130,5 @@ public class SettingsApplication : Gtk.Application {
this.main_window.show_about_dialog ();
}
}
+
+}
diff --git a/settings/TimeChooser.vala b/settings/TimeChooser.vala
index c21defd..256171c 100644
--- a/settings/TimeChooser.vala
+++ b/settings/TimeChooser.vala
@@ -15,6 +15,11 @@
* along with GNOME Break Timer. If not, see <http://www.gnu.org/licenses/>.
*/
+using Gtk;
+using GLib;
+
+namespace BreakTimer.Settings {
+
public class TimeChooser : Gtk.ComboBox {
private Gtk.ListStore list_store;
@@ -119,3 +124,5 @@ public class TimeChooser : Gtk.ComboBox {
GLib.warning("Custom time input is not implemented");
}
}
+
+}
diff --git a/settings/TimerBreakType.vala b/settings/TimerBreakType.vala
index e0123a1..e617e94 100644
--- a/settings/TimerBreakType.vala
+++ b/settings/TimerBreakType.vala
@@ -15,6 +15,11 @@
* along with GNOME Break Timer. If not, see <http://www.gnu.org/licenses/>.
*/
+using Gtk;
+using GLib;
+
+namespace BreakTimer.Settings {
+
public abstract class TimerBreakType : BreakType {
public int interval { get; protected set; }
public int duration { get; protected set; }
@@ -24,7 +29,7 @@ public abstract class TimerBreakType : BreakType {
public IBreakHelper_TimerBreak? break_server;
- public TimerBreakType (string name, Settings settings) {
+ public TimerBreakType (string name, GLib.Settings settings) {
base (name, settings);
settings.bind ("interval-seconds", this, "interval", SettingsBindFlags.GET);
settings.bind ("duration-seconds", this, "duration", SettingsBindFlags.GET);
@@ -191,4 +196,6 @@ public abstract class TimerBreakSettingsPanel : BreakSettingsPanel {
details_grid.show_all ();
}
-}
\ No newline at end of file
+}
+
+}
diff --git a/settings/main.vala b/settings/main.vala
index fff96e4..c5414ea 100644
--- a/settings/main.vala
+++ b/settings/main.vala
@@ -15,8 +15,12 @@
* along with GNOME Break Timer. If not, see <http://www.gnu.org/licenses/>.
*/
+namespace BreakTimer.Settings {
+
public int main (string[] args) {
SettingsApplication application = new SettingsApplication ();
int status = application.run (args);
return status;
-}
\ No newline at end of file
+}
+
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]