Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions src/Application.vala
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
public class Badger.Application : Gtk.Application {
public bool headless = false;
public bool ask_autostart = false;
public Reminder[] reminders;

private Badger.MainWindow window;

Expand All @@ -40,7 +41,7 @@ public class Badger.Application : Gtk.Application {
var quit_action = new SimpleAction ("quit", null);
add_action (quit_action);
set_accels_for_action ("app.quit", {"<Control>q"});
quit_action.activate.connect (quit);
quit_action.activate.connect (tidy_up);
}

protected override void activate () {
Expand Down Expand Up @@ -76,7 +77,7 @@ public class Badger.Application : Gtk.Application {
}

if (window == null) {
var reminders = set_up_reminders ();
reminders = set_up_reminders ();
var main = new MainGrid (reminders);
window = new MainWindow (this, main);

Expand Down Expand Up @@ -214,4 +215,11 @@ public class Badger.Application : Gtk.Application {
);
return reminders;
}

public void tidy_up () {
foreach (var reminder in reminders) {
withdraw_notification (reminder.name);
};
quit ();
}
}
4 changes: 2 additions & 2 deletions src/MainWindow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ public class Badger.MainWindow : Gtk.Window {

if (!settings.get_boolean ("all")) {
debug ("All reminders are disabled, Badger will now go to sleep");
application.quit ();
};
((Badger.Application)this.application).tidy_up ();
}

return false;
}
Expand Down