[gnome-mines] Add missing resources changes...



commit b7df6aa2a7d855748bd952da80af9989754b9b21
Author: Robert Ancell <robert ancell canonical com>
Date:   Tue May 23 11:05:57 2017 +1200

    Add missing resources changes...

 configure.ac                  |    1 +
 data/Makefile.am              |    6 ------
 data/meson.build              |    5 -----
 po/POTFILES.in                |    2 +-
 src/Makefile.am               |   11 ++++++++++-
 src/gnome-mines.gresource.xml |    7 +++----
 src/gnome-mines.vala          |   12 ++----------
 src/meson.build               |    6 +++++-
 8 files changed, 22 insertions(+), 28 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 45eecef..f0965c1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -11,6 +11,7 @@ AM_PROG_VALAC([0.24])
 AM_PROG_CC_C_O
 
 GLIB_GSETTINGS
+AC_PATH_PROG(GLIB_COMPILE_RESOURCES, glib-compile-resources)
 
 APPSTREAM_XML
 
diff --git a/data/Makefile.am b/data/Makefile.am
index bb1a14c..b3d4ceb 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -8,12 +8,6 @@ man_MANS = gnome-mines.6
 icon_symbolicdir=$(datadir)/icons/hicolor/16x16/actions
 icon_symbolic_DATA=flag-symbolic.svg
 
-cssdir = $(pkgdatadir)
-css_DATA = gnome-mines.css
-
-uidir = $(pkgdatadir)
-ui_DATA = interface.ui
-
 desktopdir = $(datadir)/applications
 desktop_in_files = gnome-mines.desktop.in
 desktop_DATA = $(desktop_in_files:.desktop.in=.desktop)
diff --git a/data/meson.build b/data/meson.build
index 98b599e..239ffe6 100644
--- a/data/meson.build
+++ b/data/meson.build
@@ -11,11 +11,6 @@ install_data ('org.gnome.mines.gschema.xml',
               install_dir: join_paths (datadir, 'glib-2.0', 'schemas'))
 meson.add_install_script ('meson_compile_gschema.py')
 
-install_data ('gnome-mines.css',
-              install_dir: pkgdatadir)
-install_data ('interface.ui',
-              install_dir: pkgdatadir)
-
 foreach theme: [ 'default', 'bgcolors', 'classic' ]
     foreach file: [ 'theme.css',
                     '1mines.svg', '2mines.svg', '3mines.svg', '4mines.svg', '5mines.svg', '6mines.svg', 
'7mines.svg', '8mines.svg',
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 1efce3f..8b44902 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -4,7 +4,7 @@
 data/gnome-mines.appdata.xml.in
 data/gnome-mines.desktop.in
 data/org.gnome.mines.gschema.xml
-[type: gettext/glade]data/interface.ui
+[type: gettext/glade]src/interface.ui
 src/gnome-mines.vala
 src/minefield.vala
 src/minefield-view.vala
diff --git a/src/Makefile.am b/src/Makefile.am
index f6d3dd7..0bea843 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,12 +1,16 @@
 bin_PROGRAMS = gnome-mines
 
+resources.c: gnome-mines.gresource.xml $(shell $(GLIB_COMPILE_RESOURCES) --generate-dependencies 
$(srcdir)/gnome-mines.gresource.xml)
+       $(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) --target=$@ --generate-source $<
+
 gnome_mines_SOURCES =  \
        config.vapi     \
        gnome-mines.vala \
        minefield.vala \
        minefield-view.vala \
        tile.vala \
-       theme-selector-dialog.vala
+       theme-selector-dialog.vala \
+       resources.c
 
 gnome_mines_CFLAGS = \
        -DVERSION=\"$(VERSION)\" \
@@ -24,6 +28,7 @@ gnome_mines_VALAFLAGS = \
        --pkg pangocairo \
        --pkg libgnome-games-support-1 \
        --pkg gee-0.8 \
+       --gresources=gnome-mines.gresource.xml \
        --target-glib $(GLIB_REQUIRED)
 
 gnome_mines_LDADD = \
@@ -33,4 +38,8 @@ CLEANFILES = \
        $(patsubst %.vala,%.c,$(filter %.vala, $(SOURCES))) \
        *_vala.stamp
 
+EXTRA_DIST = interface.ui \
+             gnome-mines.css \
+             gnome-mines.gresource.xml
+
 -include $(top_srcdir)/git.mk
diff --git a/src/gnome-mines.gresource.xml b/src/gnome-mines.gresource.xml
index 4100994..fbd44a1 100644
--- a/src/gnome-mines.gresource.xml
+++ b/src/gnome-mines.gresource.xml
@@ -1,8 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <gresources>
-  <gresource prefix="/org/gnome/SimpleScan">
-    <file preprocess="xml-stripblanks">app-window.ui</file>
-    <file preprocess="xml-stripblanks">preferences-dialog.ui</file>
-    <file preprocess="xml-stripblanks">authorize-dialog.ui</file>
+  <gresource prefix="/org/gnome/Mines">
+    <file preprocess="xml-stripblanks">interface.ui</file>
+    <file>gnome-mines.css</file>
   </gresource>
 </gresources>
diff --git a/src/gnome-mines.vala b/src/gnome-mines.vala
index 1cf3f92..f727bcf 100644
--- a/src/gnome-mines.vala
+++ b/src/gnome-mines.vala
@@ -176,21 +176,13 @@ public class Mines : Gtk.Application
         Gtk.Window.set_default_icon_name ("gnome-mines");
 
         var css_provider = new Gtk.CssProvider ();
-        var css_path = Path.build_filename (DATA_DIRECTORY, "gnome-mines.css");
-        try
-        {
-            css_provider.load_from_path (css_path);
-        }
-        catch (GLib.Error e)
-        {
-            warning ("Error loading css styles from %s: %s", css_path, e.message);
-        }
+        css_provider.load_from_resource ("/org/gnome/Mines/gnome-mines.css");
 
         Gtk.StyleContext.add_provider_for_screen (Gdk.Screen.get_default (), css_provider, 
Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
         var ui_builder = new Gtk.Builder ();
         try
         {
-            ui_builder.add_from_file (Path.build_filename (DATA_DIRECTORY, "interface.ui", null));
+            ui_builder.add_from_resource ("/org/gnome/Mines/interface.ui");
         }
         catch (Error e)
         {
diff --git a/src/meson.build b/src/meson.build
index ad6403e..541487f 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -1,10 +1,14 @@
+resources = gnome.compile_resources ('resources', 'gnome-mines.gresource.xml',
+                                     source_dir: '.',
+                                     c_name: 'resources')
+
 gnome_mines = executable ('gnome-mines',
                           [ 'config.vapi',
                             'gnome-mines.vala',
                             'minefield.vala',
                             'minefield-view.vala',
                             'tile.vala',
-                            'theme-selector-dialog.vala'],
+                            'theme-selector-dialog.vala'] + resources,
                           dependencies: [ glib_dep,
                                           gee_dep,
                                           gtk_dep,


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