[gnome-sound-recorder/wip/cdavis/gtk4: 2/2] data: Fix icon loading
- From: Christopher Davis <christopherdavis src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-sound-recorder/wip/cdavis/gtk4: 2/2] data: Fix icon loading
- Date: Tue, 21 Sep 2021 10:33:18 +0000 (UTC)
commit 7cabd20be70ac155727b020c0250e6a8b5f41503
Author: Christopher Davis <christopherdavis gnome org>
Date: Tue Sep 21 03:27:02 2021 -0700
data: Fix icon loading
Icon loading in GTK4 is tied to the hicolor theme's paths.
data/org.gnome.SoundRecorder.data.gresource.xml | 6 ++++--
src/application.js | 6 +++++-
2 files changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/data/org.gnome.SoundRecorder.data.gresource.xml b/data/org.gnome.SoundRecorder.data.gresource.xml
index f446c3d..7438fe7 100644
--- a/data/org.gnome.SoundRecorder.data.gresource.xml
+++ b/data/org.gnome.SoundRecorder.data.gresource.xml
@@ -6,7 +6,9 @@
<file>ui/row.ui</file>
<file>ui/window.ui</file>
<file alias="gtk/help-overlay.ui">ui/help-overlay.ui</file>
- <file compressed="true" preprocess="xml-stripblanks">icons/skip-back-symbolic.svg</file>
- <file compressed="true" preprocess="xml-stripblanks">icons/skip-forward-symbolic.svg</file>
+ </gresource>
+ <gresource prefix="/org/gnome/SoundRecorder/icons/16x16/actions/">
+ <file compressed="true" preprocess="xml-stripblanks"
alias="skip-back-symbolic.svg">icons/skip-back-symbolic.svg</file>
+ <file compressed="true" preprocess="xml-stripblanks"
alias="skip-forward-symbolic.svg">icons/skip-forward-symbolic.svg</file>
</gresource>
</gresources>
diff --git a/src/application.js b/src/application.js
index 9e07093..b1012fa 100644
--- a/src/application.js
+++ b/src/application.js
@@ -91,10 +91,14 @@ var Application = GObject.registerClass(class Application extends Gtk.Applicatio
let provider = new Gtk.CssProvider();
provider.load_from_resource('/org/gnome/SoundRecorder/application.css');
- Gtk.StyleContext.add_provider_for_display(Gdk.Display.get_default(),
+
+ let display = Gdk.Display.get_default();
+ Gtk.StyleContext.add_provider_for_display(display,
provider,
Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
+ Gtk.IconTheme.get_for_display(display).add_resource_path('/org/gnome/SoundRecorder/icons/');
+
this.set_resource_base_path('/org/gnome/SoundRecorder/');
Handy.init();
Gst.init(null);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]