Skip to content
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ matrix:
- env: DIST=juno

install:
- npm install @elementaryos/houston
- npm i -g @elementaryos/houston

script:
- houston ci
Expand Down
2 changes: 1 addition & 1 deletion post_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
schemadir = os.path.join(os.environ['MESON_INSTALL_PREFIX'], 'share', 'glib-2.0', 'schemas')

if not os.environ.get('DESTDIR'):
print('Compiling gsettings schemas...')
print('Compiling gsettings schemas')
subprocess.call(['glib-compile-schemas', schemadir], shell=False)
4 changes: 2 additions & 2 deletions src/Application.vala
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ namespace App {
/**
* Create the window of this application through the class {@code Window} and show it. If user clicks
* <quit> or press <control + q> the window will be destroyed.
*
*
* @return {@code void}
*/
public override void activate () {
Expand Down Expand Up @@ -81,7 +81,7 @@ namespace App {
if (x != -1 && y != -1) {
window.move (x, y);
}

window.get_focus ();
window.no_show_all = false;
window.show_all ();
Expand Down
8 changes: 4 additions & 4 deletions src/Window.vala
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ using App.Views;
namespace App {

/**
* Class responsible for creating the u window and will contain contain other widgets.
* Class responsible for creating the u window and will contain contain other widgets.
* allowing the user to manipulate the window (resize it, move it, close it, ...).
*
* @see Gtk.ApplicationWindow
* @since 1.0.0
*/
public class Window : Gtk.ApplicationWindow {

/**
* Constructs a new {@code Window} object.
*
Expand All @@ -57,13 +57,13 @@ namespace App {

var css_provider = new Gtk.CssProvider ();
css_provider.load_from_resource (Constants.URL_CSS);

Gtk.StyleContext.add_provider_for_screen (
Gdk.Screen.get_default (),
css_provider,
Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
);

new AppController (this, app);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/configs/Constants.vala
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
namespace App.Configs {

/**
* The {@code Constants} class is responsible for defining all
* The {@code Constants} class is responsible for defining all
* the constants used in the application.
*
* @since 1.0.0
Expand Down
2 changes: 1 addition & 1 deletion src/configs/Properties.vala
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
namespace App.Configs {

/**
* The {@code Properties} class is responsible for defining all
* The {@code Properties} class is responsible for defining all
* the texts that are displayed in the application and must be translated.
*
* @since 1.0.0
Expand Down
10 changes: 5 additions & 5 deletions src/configs/Settings.vala
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
namespace App.Configs {

/**
* The {@code Settings} class is responsible for defining all
* The {@code Settings} class is responsible for defining all
* the texts that are displayed in the application and must be translated.
*
* @see Granite.Services.Settings
Expand Down Expand Up @@ -52,11 +52,11 @@ namespace App.Configs {
* Should application start hidden
*/
public bool hide_on_start { get; set; }

/**
* Constructs a new {@code Settings} object
* Constructs a new {@code Settings} object
* and sets the default exit folder.
*
*
* @see webwatcher.Utils.StringUtil#is_empty(string)
* @see webwatcher.Constants
*/
Expand All @@ -66,7 +66,7 @@ namespace App.Configs {

/**
* Returns a single instance of this class.
*
*
* @return {@code Settings}
*/
public static unowned Settings get_instance () {
Expand Down
28 changes: 14 additions & 14 deletions src/controllers/AppController.vala
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ namespace App.Controllers {
*
* @since 1.0.0
*/
public class AppController {
public class AppController {

private Gtk.Application application;
private AppView appView;
Expand All @@ -47,7 +47,7 @@ namespace App.Controllers {
/**
* Constructs a new {@code AppController} object.
*/
public AppController (Gtk.ApplicationWindow window, Gtk.Application application) {
public AppController (Gtk.ApplicationWindow window, Gtk.Application application) {
this.settings = App.Configs.Settings.get_instance ();
this.window = window;

Expand Down Expand Up @@ -79,7 +79,7 @@ namespace App.Controllers {
this.indicator.set_status (AppIndicator.IndicatorStatus.ACTIVE);
this.indicatorView = new AppIndicatorView (indicator);
this.indicatorView.menu_event.connect (this.indicator_event);

// Initialize our database and get a list of active locations
this.database = DB.GetInstance ();
var statement = this.database.Prepare ("SELECT id FROM `sites` ORDER BY `order` ASC");
Expand Down Expand Up @@ -140,7 +140,7 @@ namespace App.Controllers {
return true;
});
}

private void site_changed (SiteModel site, SiteEvent event) {
switch (event) {
case SiteEvent.ADDED:
Expand Down Expand Up @@ -171,27 +171,27 @@ namespace App.Controllers {
if (!site.notify || !site.active) {
return;
}

var title = (event == SiteEvent.ONLINE) ? _("Website is up") : _("Website is down");
var body = (site.title != null) ? site.title + "\n" + site.url : site.url;

var notification = new Notification (title);
notification.set_body (body);
notification.set_priority (NotificationPriority.NORMAL);

if (site.icon != null && site.icon != "") {
notification.set_icon (site.get_icon_image ().gicon_async);
}

application.send_notification (Constants.ID, notification);

if (event == SiteEvent.ONLINE) {
this.offlineCount--;
}
else {
this.offlineCount++;
}

this.launcherEntry.count_visible = this.offlineCount > 0;
this.launcherEntry.count = this.offlineCount;
break;
Expand Down Expand Up @@ -229,9 +229,9 @@ namespace App.Controllers {

this.application.add_action (find_action);
this.application.add_action (quit_action);
this.application.add_accelerator ("<Control>f", "app.find", null);
this.application.add_accelerator ("<Control>q", "app.quit", null);

this.application.set_accels_for_action ("app.find", {"<Control>f"});
this.application.set_accels_for_action ("app.quit", {"<Control>q"});
}
}
}
}
38 changes: 19 additions & 19 deletions src/database/Database.vala
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
namespace App.Database {

/**
* The {@code Database} provides all of the basic functions
* The {@code Database} provides all of the basic functions
* needed to access and maintain the Sqlite database
*
* @see Sqlite.Database
Expand Down Expand Up @@ -73,21 +73,21 @@ namespace App.Database {

// Initial migration
if (1 > oldVersion) {
var settingsSQL = "
CREATE TABLE `settings` (
var settingsSQL = """
CREATE TABLE IF NOT EXISTS `settings` (
id INTEGER PRIMARY KEY AUTOINCREMENT,
key TEXT NOT NULL,
value TEXT NOT NULL
);

INSERT INTO `settings` (`key`, `value`) VALUES ('version', '1.0.0');
CREATE INDEX `key` ON `settings` (key);
";
CREATE INDEX IF NOT EXISTS `key` ON `settings` (key);
""";

this.Execute (settingsSQL);

var sitesSQL = "
CREATE TABLE `sites` (
var sitesSQL = """
CREATE TABLE IF NOT EXISTS `sites` (
id INTEGER PRIMARY KEY AUTOINCREMENT,
url TEXT NOT NULL,
description TEXT NULL,
Expand All @@ -102,16 +102,16 @@ namespace App.Database {
icon_updated_dt INTEGER NULL
);

CREATE INDEX `active` ON `sites` (active);
CREATE INDEX `title` ON `sites` (title);
CREATE INDEX `updated_dt` ON `sites` (updated_dt);
CREATE UNIQUE INDEX `url` ON `sites` (url);
";
CREATE INDEX IF NOT EXISTS `active` ON `sites` (active);
CREATE INDEX IF NOT EXISTS `title` ON `sites` (title);
CREATE INDEX IF NOT EXISTS `updated_dt` ON `sites` (updated_dt);
CREATE UNIQUE INDEX IF NOT EXISTS `url` ON `sites` (url);
""";

this.Execute (sitesSQL);

var siteResultSQL = "
CREATE TABLE `results` (
var siteResultSQL = """
CREATE TABLE IF NOT EXISTS `results` (
id INTEGER PRIMARY KEY AUTOINCREMENT,
site_id INTEGER NOT NULL,
response REAL NOT NULL,
Expand All @@ -121,10 +121,10 @@ namespace App.Database {
created_dt INTEGER NOT NULL
);

CREATE INDEX `site_id` ON `results` (site_id);
CREATE INDEX `status` ON `results` (status);
CREATE INDEX `created_dt` ON `results` (created_dt);
";
CREATE INDEX IF NOT EXISTS `site_id` ON `results` (site_id);
CREATE INDEX IF NOT EXISTS `status` ON `results` (status);
CREATE INDEX IF NOT EXISTS `created_dt` ON `results` (created_dt);
""";

this.Execute (siteResultSQL);
}
Expand Down Expand Up @@ -164,7 +164,7 @@ namespace App.Database {
Sqlite.Statement statement;
var result = this.db.prepare_v2 (query, query.length, out statement);
errorMsg = "";

if (result != Sqlite.OK) {
warning ("Error querying DB: %d - %s", this.db.errcode (), this.db.errmsg ());
errorMsg = this.db.errmsg ();
Expand Down
4 changes: 2 additions & 2 deletions src/models/BaseModel.vala
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ namespace App.Models {
*
* @since 1.0.0
*/
public abstract class BaseModel {
public abstract class BaseModel {

protected unowned App.Database.DB db { get { return App.Database.DB.GetInstance (); } }

public abstract bool get (int id);
public abstract bool load (Sqlite.Statement statement);
public abstract bool save ();
public abstract bool delete ();
}
}

}
18 changes: 9 additions & 9 deletions src/models/ResultModel.vala
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ namespace App.Models {
*
* @since 1.0.0
*/
public class ResultModel : BaseModel {
public class ResultModel : BaseModel {

public int id { get; set; }
public int site_id { get; set; }
Expand All @@ -39,7 +39,7 @@ namespace App.Models {
/**
* Constructs a new {@code ResultModel} object.
*/
public ResultModel () {}
public ResultModel () {}

public ResultModel.with_details (int site, double response, int code, string status) {
this.site_id = site;
Expand Down Expand Up @@ -95,15 +95,15 @@ namespace App.Models {

return loaded;
}

public override bool save () {
var sql = "";
var state = SiteEvent.ADDED;

// Update SQL
if (id > 0) {
state = SiteEvent.UPDATED;
sql = "
sql = """
UPDATE `results` SET
`site_id` = $SITE_ID,
`response` = $RESPONSE,
Expand All @@ -113,15 +113,15 @@ namespace App.Models {
`created_dt` = $CREATED_DT
WHERE
`id` = $ID
";
""";
}

// Insert SQL
else {
sql = "
sql = """
INSERT INTO `results` (`site_id`, `response`, `response_code`, `status`, `offline`, `created_dt`)
VALUES ($SITE_ID, $RESPONSE, $RESPONSE_CODE, $STATUS, $OFFLINE, $CREATED_DT)
";
""";

this.created_dt = (new DateTime.now_utc ()).to_unix ();
}
Expand All @@ -144,13 +144,13 @@ namespace App.Models {
if (state == SiteEvent.ADDED) {
this.id = (int)this.db.LastID ();
}

return true;
}

public override bool delete () {
return false;
}
}
}

}
Loading