[gnome-shell] extensions-app: Use Adw.Application's automatic style loading
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] extensions-app: Use Adw.Application's automatic style loading
- Date: Wed, 5 Jan 2022 15:12:42 +0000 (UTC)
commit f0754431bffca1c510965df011846372c7518926
Author: Florian Müllner <fmuellner gnome org>
Date: Wed Jan 5 14:51:53 2022 +0100
extensions-app: Use Adw.Application's automatic style loading
Now that we switched to AdwApplication, we can automate loading
the custom stylesheet by simply using the expected name and
resource prefix.
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1997>
.../extensions-app/data/css/{application.css => style.css} | 0
subprojects/extensions-app/data/meson.build | 6 +++++-
...urce.xml => org.gnome.Extensions.data.gresource.xml.in} | 6 ++++--
subprojects/extensions-app/js/main.js | 14 +-------------
4 files changed, 10 insertions(+), 16 deletions(-)
---
diff --git a/subprojects/extensions-app/data/css/application.css
b/subprojects/extensions-app/data/css/style.css
similarity index 100%
rename from subprojects/extensions-app/data/css/application.css
rename to subprojects/extensions-app/data/css/style.css
diff --git a/subprojects/extensions-app/data/meson.build b/subprojects/extensions-app/data/meson.build
index 4b601e8bd1..4f24267b04 100644
--- a/subprojects/extensions-app/data/meson.build
+++ b/subprojects/extensions-app/data/meson.build
@@ -1,6 +1,10 @@
gnome.compile_resources(
app_id + '.data',
- base_id + '.data.gresource.xml',
+ configure_file(
+ input: base_id + '.data.gresource.xml.in',
+ output: app_id + '.data.gresource.xml',
+ configuration: {'profile': '/'.join(profile.split('.')) },
+ ),
gresource_bundle: true,
install: true,
install_dir: pkgdatadir
diff --git a/subprojects/extensions-app/data/org.gnome.Extensions.data.gresource.xml
b/subprojects/extensions-app/data/org.gnome.Extensions.data.gresource.xml.in
similarity index 69%
rename from subprojects/extensions-app/data/org.gnome.Extensions.data.gresource.xml
rename to subprojects/extensions-app/data/org.gnome.Extensions.data.gresource.xml.in
index 659c03ffc8..ca04c08c12 100644
--- a/subprojects/extensions-app/data/org.gnome.Extensions.data.gresource.xml
+++ b/subprojects/extensions-app/data/org.gnome.Extensions.data.gresource.xml.in
@@ -1,8 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
- <gresource prefix="/org/gnome/Extensions">
- <file>css/application.css</file>
+ <gresource prefix="/org/gnome/Extensions@profile@">
+ <file alias="style.css">css/style.css</file>
+ </gresource>
+ <gresource prefix="/org/gnome/Extensions">
<file>dbus-interfaces/org.gnome.Shell.Extensions.xml</file>
<file>ui/extension-row.ui</file>
diff --git a/subprojects/extensions-app/js/main.js b/subprojects/extensions-app/js/main.js
index cbdac693f2..563cd7e456 100644
--- a/subprojects/extensions-app/js/main.js
+++ b/subprojects/extensions-app/js/main.js
@@ -1,10 +1,9 @@
/* exported main */
-imports.gi.versions.Gdk = '4.0';
imports.gi.versions.Gtk = '4.0';
const Gettext = imports.gettext;
const Package = imports.package;
-const { Adw, Gdk, GLib, Gio, GObject, Gtk, Shew } = imports.gi;
+const { Adw, GLib, Gio, GObject, Gtk, Shew } = imports.gi;
Package.initFormat();
@@ -58,17 +57,6 @@ class Application extends Adw.Application {
vfunc_startup() {
super.vfunc_startup();
- let provider = new Gtk.CssProvider();
- let uri = 'resource:///org/gnome/Extensions/css/application.css';
- try {
- provider.load_from_file(Gio.File.new_for_uri(uri));
- } catch (e) {
- logError(e, 'Failed to add application style');
- }
- Gtk.StyleContext.add_provider_for_display(Gdk.Display.get_default(),
- provider,
- Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
-
const action = new Gio.SimpleAction({ name: 'quit' });
action.connect('activate', () => this._window.close());
this.add_action(action);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]