Skip to content

Commit

Permalink
Embedded daemon in one unified binary (#702)
Browse files Browse the repository at this point in the history
* Moved Daemon to src folder

* Renamed Daemon to TodayEventMonitor

* Use modern namespacing

* Removed no longer needed activate method

* Removed daemon subdir

* Adding --background flag

* Use dedicated EventStore instance for background task

* Lint' Me Happy

* Adressed feedback of @mcclurgm

Co-authored-by: Michael McClurg <michael.mcclurg@outlook.com>
  • Loading branch information
marbetschar and mcclurgm committed Sep 13, 2021
1 parent ac53fff commit 558716e
Show file tree
Hide file tree
Showing 8 changed files with 193 additions and 239 deletions.
4 changes: 2 additions & 2 deletions core/Services/Calendar/EventStore.vala
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public class Calendar.EventStore : Object {
}
}

protected EventStore () {
public EventStore () {
this.week_starts_on = get_week_start ();
this.month_start = Calendar.Util.datetime_get_start_of_month (get_page ());
compute_ranges ();
Expand Down Expand Up @@ -368,7 +368,7 @@ public class Calendar.EventStore : Object {
int wso = (int) week_starts_on;
int offset = 0;

// offset corresponds number of days from the start of the week to
// offset corresponds number of days from the start of the week to
// month_start, as seen on a displayed calendar.
if (wso < dow) {
offset = dow - wso;
Expand Down
217 changes: 0 additions & 217 deletions daemon/Daemon.vala

This file was deleted.

18 changes: 0 additions & 18 deletions daemon/meson.build

This file was deleted.

2 changes: 1 addition & 1 deletion data/io.elementary.calendar-daemon.desktop.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Name=Calendar Daemon
Comment=View Event Reminders
Icon=io.elementary.calendar
Exec=@EXEC_PATH@
Exec=@EXEC_PATH@ --background
Terminal=false
Type=Application
Categories=System;
Expand Down
1 change: 0 additions & 1 deletion meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ gresource_calendar = gnome.compile_resources(

subdir('data')
subdir('core')
subdir('daemon')
subdir('src')
subdir('plugins')
subdir('po')
Expand Down
9 changes: 9 additions & 0 deletions src/Application.vala
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ namespace Maya {
public MainWindow window;
public static GLib.Settings? saved_state = null;
public static GLib.Settings? wingpanel_settings = null;
public static bool run_in_background = false;

static construct {
if (SettingsSchemaSource.get_default ().lookup ("io.elementary.calendar.savedstate", true) != null) {
Expand Down Expand Up @@ -58,10 +59,18 @@ namespace Maya {
public const OptionEntry[] APP_OPTIONS = {
{ "add-event", 'a', 0, OptionArg.NONE, out Option.add_event, N_("Create an event"), null },
{ "show-day", 's', 0, OptionArg.STRING, out Option.show_day, N_("Focus the given day"), N_("date") },
{ "background", 'b', 0, OptionArg.NONE, out run_in_background, "Run the Application in background", null},
{ null }
};

protected override void activate () {
if (run_in_background) {
run_in_background = false;
new Calendar.TodayEventMonitor ();
hold ();
return;
}

if (get_windows () != null) {
get_windows ().data.present (); // present window if app is already running
return;
Expand Down
Loading

0 comments on commit 558716e

Please sign in to comment.