Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Application: use startup #363

Merged
merged 5 commits into from
Jun 13, 2023
Merged
Show file tree
Hide file tree
Changes from 3 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
4 changes: 3 additions & 1 deletion data/gresource.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="/io/elementary/tasks">
<file alias="location-marker.svg" compressed="true" preprocess="xml-stripblanks">LocationMarker.svg</file>
<file compressed="true">EditableLabel.css</file>
<file compressed="true">EntryPopover.css</file>
<file compressed="true">SourceRow.css</file>
<file compressed="true">TaskRow.css</file>
</gresource>
<gresource prefix="/io/elementary/tasks">
<file alias="location-marker.svg" compressed="true" preprocess="xml-stripblanks">LocationMarker.svg</file>
</gresource>
</gresources>
24 changes: 15 additions & 9 deletions src/Application.vala
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,21 @@ public class Tasks.Application : Gtk.Application {
GLib.Intl.textdomain (GETTEXT_PACKAGE);

add_main_option_entries (OPTIONS);
}

protected override void startup () {
base.startup ();

Hdy.init ();

var granite_settings = Granite.Settings.get_default ();
var gtk_settings = Gtk.Settings.get_default ();
danirabbit marked this conversation as resolved.
Show resolved Hide resolved

gtk_settings.gtk_application_prefer_dark_theme = granite_settings.prefers_color_scheme == Granite.Settings.ColorScheme.DARK;

granite_settings.notify["prefers-color-scheme"].connect (() => {
gtk_settings.gtk_application_prefer_dark_theme = granite_settings.prefers_color_scheme == Granite.Settings.ColorScheme.DARK;
});
danirabbit marked this conversation as resolved.
Show resolved Hide resolved

var quit_action = new SimpleAction ("quit", null);
quit_action.activate.connect (() => {
Expand Down Expand Up @@ -101,15 +116,6 @@ public class Tasks.Application : Gtk.Application {
main_window.maximize ();
}

var granite_settings = Granite.Settings.get_default ();
var gtk_settings = Gtk.Settings.get_default ();

gtk_settings.gtk_application_prefer_dark_theme = granite_settings.prefers_color_scheme == Granite.Settings.ColorScheme.DARK;

granite_settings.notify["prefers-color-scheme"].connect (() => {
gtk_settings.gtk_application_prefer_dark_theme = granite_settings.prefers_color_scheme == Granite.Settings.ColorScheme.DARK;
});

main_window.show_all ();
}

Expand Down
4 changes: 0 additions & 4 deletions src/MainWindow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,7 @@ public class Tasks.MainWindow : Hdy.ApplicationWindow {
}

static construct {
Hdy.init ();

action_accelerators[ACTION_DELETE_SELECTED_LIST] = "<Control>BackSpace";

Gtk.IconTheme.get_default ().add_resource_path ("/io/elementary/tasks");
}

construct {
Expand Down