aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@bitwiz.me.uk>2018-03-31 19:00:06 +0200
committerThomas White <taw@bitwiz.me.uk>2018-03-31 19:07:09 +0200
commit2e5cf1278d8976a1d714c5fe2b0b58fd9175d975 (patch)
tree7cd59a2fbd0122122b307240f101c1b3eb8e71a3
parentd8ab381ea63e90053c958a7658d421f6843a8783 (diff)
Use GResource for sky.png
-rw-r--r--data/colloquium.gresource.xml6
-rw-r--r--meson.build11
-rw-r--r--src/sc_editor.c3
3 files changed, 17 insertions, 3 deletions
diff --git a/data/colloquium.gresource.xml b/data/colloquium.gresource.xml
new file mode 100644
index 0000000..5af8c0e
--- /dev/null
+++ b/data/colloquium.gresource.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<gresources>
+ <gresource prefix="/uk/me/bitwiz/Colloquium">
+ <file>sky.png</file>
+ </gresource>
+</gresources>
diff --git a/meson.build b/meson.build
index 56fce4e..2433443 100644
--- a/meson.build
+++ b/meson.build
@@ -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)
diff --git a/src/sc_editor.c b/src/sc_editor.c
index e087b55..bb22400 100644
--- a/src/sc_editor.c
+++ b/src/sc_editor.c
@@ -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);