diff options
author | Niels De Graef <nielsdegraef@gmail.com> | 2023-02-23 19:20:39 +0100 |
---|---|---|
committer | Niels De Graef <nielsdegraef@gmail.com> | 2023-02-23 19:24:41 +0100 |
commit | 976897f6b81ec6757709f34e5cbfc870586925e4 (patch) | |
tree | c9c4558484f3f30790dc5ece760681fe46a9fc81 | |
parent | 5d00cee55d2af7df3eee9af54ef8d61924a9284d (diff) | |
download | gnome-contacts-976897f6b81ec6757709f34e5cbfc870586925e4.tar.gz |
Automatically load our CSS
Apparently `AdwApplication` automatically loads `style.css` from the
GResource base path [1]. By default, that base path in a `GApplication`
is the app ID (with some slight post processing). Let's use that so we
can remove our custom CSS loading code.
Basically, this commit moves `/org/gnome/Contacts/ui/style.css` to
`/org/gnome/Contacts/style.css` to automatically use that behavior.
[1]: https://gnome.pages.gitlab.gnome.org/libadwaita/doc/main/styles-and-appearance.html#custom-styles
-rw-r--r-- | data/contacts.gresource.xml | 2 | ||||
-rw-r--r-- | data/style.css (renamed from data/ui/style.css) | 0 | ||||
-rw-r--r-- | src/contacts-app.vala | 9 |
3 files changed, 1 insertions, 10 deletions
diff --git a/data/contacts.gresource.xml b/data/contacts.gresource.xml index e9158c1..e4ab82c 100644 --- a/data/contacts.gresource.xml +++ b/data/contacts.gresource.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <gresources> <gresource prefix="/org/gnome/Contacts"> - <file compressed="true">ui/style.css</file> + <file compressed="true">style.css</file> <file preprocess="xml-stripblanks">icons/scalable/actions/birthday-symbolic.svg</file> <file preprocess="xml-stripblanks">icons/scalable/actions/building-symbolic.svg</file> diff --git a/data/ui/style.css b/data/style.css index 6593344..6593344 100644 --- a/data/ui/style.css +++ b/data/style.css diff --git a/src/contacts-app.vala b/src/contacts-app.vala index 12d2dc5..7765e40 100644 --- a/src/contacts-app.vala +++ b/src/contacts-app.vala @@ -247,7 +247,6 @@ public class Contacts.App : Adw.Application { base.startup (); - load_styling (); create_actions (); } @@ -259,14 +258,6 @@ public class Contacts.App : Adw.Application { this.set_accels_for_action ("app.quit", {"<Control>q"}); } - public void load_styling () { - var provider = new Gtk.CssProvider (); - provider.load_from_resource ("/org/gnome/Contacts/ui/style.css"); - Gtk.StyleContext.add_provider_for_display (Gdk.Display.get_default (), - provider, - Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION); - } - public override void activate () { // Check if we've already done the setup process if (this.settings.did_initial_setup) |