Use GResource for sky.png
authorThomas White <taw@bitwiz.me.uk>
Sat, 31 Mar 2018 17:00:06 +0000 (19:00 +0200)
committerThomas White <taw@bitwiz.me.uk>
Sat, 31 Mar 2018 17:07:09 +0000 (19:07 +0200)
data/colloquium.gresource.xml [new file with mode: 0644]
meson.build
src/sc_editor.c

diff --git a/data/colloquium.gresource.xml b/data/colloquium.gresource.xml
new file mode 100644 (file)
index 0000000..5af8c0e
--- /dev/null
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<gresources>
+       <gresource prefix="/uk/me/bitwiz/Colloquium">
+               <file>sky.png</file>
+       </gresource>
+</gresources>
index 56fce4e..2433443 100644 (file)
@@ -4,6 +4,8 @@ project('colloquium', 'c',
         license : 'GPL3+',
         default_options : ['buildtype=debugoptimized'])
 
+gnome = import('gnome')
+
 datadir=join_paths(get_option('datadir'), 'colloquium')
 
 add_project_arguments('-DPACKAGE_VERSION="'+meson.project_version()+'"', language : 'c')
@@ -15,6 +17,10 @@ gtkdep = dependency('gtk+-3.0')
 cc = meson.get_compiler('c')
 mdep = cc.find_library('m', required : false)
 
+gresources = gnome.compile_resources('colloquium-resources',
+                                     'data/colloquium.gresource.xml',
+                                     source_dir: 'data', c_name: 'colloquium')
+
 # Main program
 executable('colloquium',
            ['src/colloquium.c',
@@ -33,12 +39,13 @@ executable('colloquium',
             'src/print.c',
             'src/sc_parse.c',
             'src/utils.c',
-          ],
+           ],
+           gresources,
            dependencies : [gtkdep, mdep],
            install : true)
 
 # Data files, icon, desktop file etc
-install_data(['data/demo.sc', 'data/sky.png', 'data/canvas.png',
+install_data(['data/demo.sc', 'data/canvas.png',
               'data/alpha_warning.svg'],
              install_dir : datadir)
 
index e087b55..bb22400 100644 (file)
@@ -2074,7 +2074,8 @@ SCEditor *sc_editor_new(SCBlock *scblocks, SCBlock **stylesheets,
        sceditor->bg_pixbuf = NULL;
 
        err = NULL;
-       sceditor->bg_pixbuf = gdk_pixbuf_new_from_file(DATADIR"/sky.png", &err);
+       sceditor->bg_pixbuf = gdk_pixbuf_new_from_resource("/uk/me/bitwiz/Colloquium/sky.png",
+                                                          &err);
        if ( sceditor->bg_pixbuf == NULL ) {
                fprintf(stderr, "Failed to load background: %s\n",
                        err->message);