Skip to content

Commit 9589cc0

Browse files
authored
Merge pull request #68 from ellie-commons/main
Main
2 parents 89f78ca + a2b5c4b commit 9589cc0

File tree

10 files changed

+416
-381
lines changed

10 files changed

+416
-381
lines changed

data/io.github.ellie_commons.reminduck.gresource.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<gresources>
33
<gresource prefix="/io/github/ellie_commons/reminduck">
4-
<file alias="AppIcon.png">icons/io.github.ellie_commons.reminduck.png</file>
4+
<file alias="AppIcon.png">icons/hicolor/io.github.ellie_commons.reminduck.png</file>
55
<file alias="stylesheet.css">stylesheet.css</file>
66
<file alias="quack.mp3">quack.mp3</file>
77
</gresource>

data/io.github.ellie_commons.reminduck.gschema.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,10 @@
1414
<summary>The saved height of the window.</summary>
1515
<description>The saved height of the window.</description>
1616
</key>
17+
<key name="first-run" type="b">
18+
<default>true</default>
19+
<summary>Whether this is the first time that Reminduck has opened</summary>
20+
<description>Used to determine whether or not to perform initial install steps</description>
21+
</key>
1722
</schema>
1823
</schemalist>

data/meson.build

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,25 @@
11

22

3+
34
install_data(
45
'icons' / 'scalable.svg',
56
install_dir: get_option('datadir') / 'icons' / 'scalable' / 'apps',
67
rename: meson.project_name() + '.svg'
78
)
89

10+
# Install our icons in all the required sizes
11+
icon_sizes = ['16', '24', '32', '48', '64', '128']
12+
13+
foreach i : icon_sizes
14+
install_data(
15+
'icons' / 'hicolor' / 'io.github.ellie_commons.reminduck.png',
16+
install_dir: get_option('datadir') / 'icons' / 'hicolor' / i + 'x' + i / 'apps',
17+
rename: meson.project_name() + '.png'
18+
)
19+
endforeach
20+
21+
22+
923
i18n.merge_file(
1024
input: meson.project_name() + '.desktop.in',
1125
output: meson.project_name() + '.desktop',

po/ca.po

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ msgstr ""
1414
"Language-Team: none\n"
1515
"Language: ca\n"
1616
"MIME-Version: 1.0\n"
17-
"Content-Type: text/plain; charset=CHARSET\n"
17+
"Content-Type: text/plain; charset=UTF-8\n"
1818
"Content-Transfer-Encoding: 8bit\n"
1919
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
2020

src/Application.vala

Lines changed: 55 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ namespace Reminduck {
2323
public class ReminduckApp : Gtk.Application {
2424

2525

26-
public static ArrayList<Reminder> reminders;
26+
public static Gee.ArrayList<Reminduck.Reminder> reminders;
2727
public bool headless = false;
2828
private uint timeout_id = 0;
2929

@@ -72,65 +72,65 @@ namespace Reminduck {
7272
}
7373

7474
public static int main(string[] args) {
75-
var app = new ReminduckApp();
75+
var app = new ReminduckApp ();
7676

7777
if (args.length > 1 && args[1] == "--headless") {
7878
app.headless = true;
7979
}
8080

81-
return app.run(args);
81+
return app.run (args);
8282
}
8383

84-
protected override void activate() {
85-
stdout.printf("\n✔️ Activated");
86-
database.verify_database();
84+
protected override void activate () {
85+
stdout.printf ("\n✔️ Activated");
86+
database.verify_database ();
8787

88-
this.settings = new GLib.Settings("io.github.ellie_commons.reminduck.state");
88+
this.settings = new GLib.Settings ("io.github.ellie_commons.reminduck.state");
8989

90-
var first_run = this.settings.get_boolean("first-run");
90+
var first_run = this.settings.get_boolean ("first-run");
9191
// Set autostart here
9292

93-
reload_reminders();
93+
reload_reminders ();
9494

9595
if (this.main_window == null) {
96-
this.main_window = new MainWindow();
97-
this.main_window.set_application(this);
96+
this.main_window = new MainWindow ();
97+
this.main_window.set_application (this);
9898

99-
var provider = new Gtk.CssProvider();
100-
Gtk.StyleContext.add_provider_for_display(
101-
Gdk.Display.get_default(),
99+
var provider = new Gtk.CssProvider ();
100+
Gtk.StyleContext.add_provider_for_display (
101+
Gdk.Display.get_default (),
102102
provider,
103103
Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
104104
);
105105

106106
if (!this.headless) {
107-
this.main_window.show();
108-
this.main_window.show_welcome_view(Gtk.StackTransitionType.NONE);
109-
this.main_window.present();
107+
this.main_window.show ();
108+
this.main_window.show_welcome_view (Gtk.StackTransitionType.NONE);
109+
this.main_window.present ();
110110
}
111111
}
112112

113113
if (this.main_window != null && !this.headless) {
114-
this.main_window.show();
115-
this.main_window.show_welcome_view(Gtk.StackTransitionType.NONE);
116-
this.main_window.present();
114+
this.main_window.show ();
115+
this.main_window.show_welcome_view (Gtk.StackTransitionType.NONE);
116+
this.main_window.present ();
117117
}
118118

119119
if (timeout_id == 0) {
120-
set_reminder_interval();
120+
set_reminder_interval ();
121121
}
122122
}
123123

124-
private void load_stylesheet(Gtk.Settings gtk_settings, Gtk.CssProvider provider) {
124+
private void load_stylesheet (Gtk.Settings gtk_settings, Gtk.CssProvider provider) {
125125
if (gtk_settings.gtk_application_prefer_dark_theme) {
126-
provider.load_from_resource("/io/github/ellie_commons/reminduck/stylesheet-dark.css");
126+
provider.load_from_resource ("/io/github/ellie_commons/reminduck/stylesheet-dark.css");
127127
} else {
128-
provider.load_from_resource("/io/github/ellie_commons/reminduck/stylesheet.css");
128+
provider.load_from_resource ("/io/github/ellie_commons/reminduck/stylesheet.css");
129129
}
130130
}
131131

132-
public override int command_line(ApplicationCommandLine command_line) {
133-
stdout.printf("\n💲️ Command line mode started");
132+
public override int command_line (ApplicationCommandLine command_line) {
133+
stdout.printf ("\n💲️ Command line mode started");
134134

135135
bool headless_mode = false;
136136
OptionEntry[] options = new OptionEntry[1];
@@ -141,34 +141,34 @@ namespace Reminduck {
141141

142142
// We have to make an extra copy of the array, since .parse assumes
143143
// that it can remove strings from the array without freeing them.
144-
string[] args = command_line.get_arguments();
144+
string[] args = command_line.get_arguments ();
145145
string[] _args = new string[args.length];
146-
for(int i = 0; i < args.length; i++) {
146+
for (int i = 0; i < args.length; i++) {
147147
_args[i] = args[i];
148148
}
149149

150150
try {
151-
var ctx = new OptionContext();
152-
ctx.set_help_enabled(true);
153-
ctx.add_main_entries(options, null);
151+
var ctx = new OptionContext ();
152+
ctx.set_help_enabled (true);
153+
ctx.add_main_entries (options, null);
154154
unowned string[] tmp = _args;
155155
ctx.parse(ref tmp);
156-
} catch(OptionError e) {
157-
command_line.print("error: %s\n", e.message);
156+
} catch (OptionError e) {
157+
command_line.print ("error: %s\n", e.message);
158158
return 0;
159159
}
160160

161161
this.headless = headless_mode;
162162

163163
stdout.printf(this.headless ? "\n✔️ Headless" : "\n️️️️ ✔️ Interface");
164164

165-
hold();
166-
activate();
165+
hold ();
166+
activate ();
167167
return 0;
168168
}
169169

170-
public static void reload_reminders() {
171-
reminders = database.fetch_reminders();
170+
public static void reload_reminders () {
171+
reminders = database.fetch_reminders ();
172172
}
173173

174174
public void set_reminder_interval() {
@@ -177,20 +177,20 @@ namespace Reminduck {
177177
Source.remove(timeout_id);
178178
}
179179

180-
timeout_id = Timeout.add_seconds(1 * 60, remind);
180+
timeout_id = Timeout.add_seconds (1 * 60, remind);
181181
}
182182

183-
public bool remind() {
184-
reload_reminders();
183+
public bool remind () {
184+
reload_reminders ();
185185

186-
var reminders_to_delete = new ArrayList<string>();
186+
Gee.ArrayList<string> reminders_to_delete = new Gee.ArrayList<string> ();
187187
foreach(var reminder in reminders) {
188188
//If reminder date < current date
189-
if (reminder.time.compare(new GLib.DateTime.now()) <= 0) {
190-
var notification = new Notification("QUACK!");
191-
notification.set_body(reminder.description);
192-
notification.set_priority(GLib.NotificationPriority.URGENT);
193-
this.send_notification("notify.app", notification);
189+
if (reminder.time.compare (new GLib.DateTime.now ()) <= 0) {
190+
var notification = new Notification ("QUACK!");
191+
notification.set_body (reminder.description);
192+
notification.set_priority (GLib.NotificationPriority.URGENT);
193+
this.send_notification ("notify.app", notification);
194194

195195
if (reminder.recurrency_type != RecurrencyType.NONE) {
196196
GLib.DateTime new_time = reminder.time;
@@ -203,44 +203,44 @@ namespace Reminduck {
203203
for (var i = 0; i < 30; i++) {
204204
switch (reminder.recurrency_type) {
205205
case RecurrencyType.EVERY_X_MINUTES:
206-
new_time = reminder.time.add_minutes(reminder.recurrency_interval);
206+
new_time = reminder.time.add_minutes (reminder.recurrency_interval);
207207
break;
208208
case RecurrencyType.EVERY_DAY:
209-
new_time = reminder.time.add_days(1);
209+
new_time = reminder.time.add_days (1);
210210
break;
211211
case RecurrencyType.EVERY_WEEK:
212-
new_time = reminder.time.add_weeks(1);
212+
new_time = reminder.time.add_weeks (1);
213213
break;
214214
case RecurrencyType.EVERY_MONTH:
215-
new_time = reminder.time.add_months(1);
215+
new_time = reminder.time.add_months (1);
216216
break;
217217
default:
218218
break;
219219
}
220220

221221
//if new_time > current time
222-
if (new_time.compare(new GLib.DateTime.now()) > 0) {
222+
if (new_time.compare (new GLib.DateTime.now ()) > 0) {
223223
var new_reminder = new Reminder();
224224
new_reminder.time = new_time;
225225
new_reminder.description = reminder.description;
226226
new_reminder.recurrency_type = reminder.recurrency_type;
227227

228-
database.upsert_reminder(new_reminder);
228+
database.upsert_reminder (new_reminder);
229229
break;
230230
}
231231
//else, keep looping
232232
}
233233
}
234234

235-
reminders_to_delete.add(reminder.rowid);
235+
reminders_to_delete.add (reminder.rowid);
236236
}
237237
}
238238

239239
if (reminders_to_delete.size > 0) {
240240
foreach(var reminder in reminders_to_delete) {
241-
database.delete_reminder(reminder);
241+
database.delete_reminder (reminder);
242242
}
243-
reload_reminders();
243+
reload_reminders ();
244244
}
245245

246246
return true;

0 commit comments

Comments
 (0)