[gnome-clocks: 1/2] images: Move to GResource



commit 1acfc6cb3053eb9d9a80ab3759c5cab4854db605
Author: Zander Brown <zbrown gnome org>
Date:   Sun Jul 28 19:32:33 2019 +0100

    images: Move to GResource

 data/gnome-clocks.gresource.xml | 2 ++
 data/meson.build                | 2 --
 src/utils.vala                  | 3 +--
 3 files changed, 3 insertions(+), 4 deletions(-)
---
diff --git a/data/gnome-clocks.gresource.xml b/data/gnome-clocks.gresource.xml
index 4c1aac3..ccaa9a9 100644
--- a/data/gnome-clocks.gresource.xml
+++ b/data/gnome-clocks.gresource.xml
@@ -3,6 +3,8 @@
   <gresource prefix="/org/gnome/clocks">
     <file>css/gnome-clocks.css</file>
     <file>css/gnome-clocks.highcontrast.css</file>
+    <file>images/day.png</file>
+    <file>images/night.png</file>
     <file preprocess="xml-stripblanks">gtk/menus.ui</file>
     <file preprocess="xml-stripblanks">gtk/help-overlay.ui</file>
     <file preprocess="xml-stripblanks">ui/window.ui</file>
diff --git a/data/meson.build b/data/meson.build
index 748e017..edd4f85 100644
--- a/data/meson.build
+++ b/data/meson.build
@@ -12,8 +12,6 @@ install_data(
   rename: '@0 -symbolic svg'.format(app_id)
 )
 
-install_subdir('images/', install_dir: join_paths(get_option('datadir'), meson.project_name()))
-
 resource_files = files('gnome-clocks.gresource.xml')
 resources = gnome.compile_resources('org.gnome.clocks', resource_files,
   c_name: 'resources'
diff --git a/src/utils.vala b/src/utils.vala
index d8db419..394e0b8 100644
--- a/src/utils.vala
+++ b/src/utils.vala
@@ -49,8 +49,7 @@ public void load_theme_css (string theme_name) {
 
 public Gdk.Pixbuf? load_image (string image) {
     try {
-        var path = Path.build_filename (Config.DATADIR, "gnome-clocks", "images", image);
-        return new Gdk.Pixbuf.from_file (path);
+        return new Gdk.Pixbuf.from_resource ("/org/gnome/clocks/images/" + image);
     } catch (Error e) {
         warning ("loading image file: %s", e.message);
     }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]