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>
This commit is contained in:
parent
891978b4eb
commit
f0754431bf
@ -1,6 +1,10 @@
|
|||||||
gnome.compile_resources(
|
gnome.compile_resources(
|
||||||
app_id + '.data',
|
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,
|
gresource_bundle: true,
|
||||||
install: true,
|
install: true,
|
||||||
install_dir: pkgdatadir
|
install_dir: pkgdatadir
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<gresources>
|
<gresources>
|
||||||
<gresource prefix="/org/gnome/Extensions">
|
<gresource prefix="/org/gnome/Extensions@profile@">
|
||||||
<file>css/application.css</file>
|
<file alias="style.css">css/style.css</file>
|
||||||
|
</gresource>
|
||||||
|
|
||||||
|
<gresource prefix="/org/gnome/Extensions">
|
||||||
<file>dbus-interfaces/org.gnome.Shell.Extensions.xml</file>
|
<file>dbus-interfaces/org.gnome.Shell.Extensions.xml</file>
|
||||||
|
|
||||||
<file>ui/extension-row.ui</file>
|
<file>ui/extension-row.ui</file>
|
@ -1,10 +1,9 @@
|
|||||||
/* exported main */
|
/* exported main */
|
||||||
imports.gi.versions.Gdk = '4.0';
|
|
||||||
imports.gi.versions.Gtk = '4.0';
|
imports.gi.versions.Gtk = '4.0';
|
||||||
|
|
||||||
const Gettext = imports.gettext;
|
const Gettext = imports.gettext;
|
||||||
const Package = imports.package;
|
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();
|
Package.initFormat();
|
||||||
|
|
||||||
@ -58,17 +57,6 @@ class Application extends Adw.Application {
|
|||||||
vfunc_startup() {
|
vfunc_startup() {
|
||||||
super.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' });
|
const action = new Gio.SimpleAction({ name: 'quit' });
|
||||||
action.connect('activate', () => this._window.close());
|
action.connect('activate', () => this._window.close());
|
||||||
this.add_action(action);
|
this.add_action(action);
|
||||||
|
Loading…
Reference in New Issue
Block a user