[gdm/wip/initial-setup2] initial-setup: Use resources



commit e471ceddfb5970ba07e41af801285293c2700414
Author: Matthias Clasen <mclasen redhat com>
Date:   Mon Apr 16 00:27:38 2012 -0400

    initial-setup: Use resources

 configure.ac                          |    1 +
 gui/initial-setup/Makefile.am         |   17 ++++++++++-------
 gui/initial-setup/gdm-initial-setup.c |    7 +------
 gui/initial-setup/setup.gresource.xml |   10 ++++++++++
 gui/initial-setup/setup.ui            |    2 +-
 5 files changed, 23 insertions(+), 14 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 976b393..4c90893 100644
--- a/configure.ac
+++ b/configure.ac
@@ -169,6 +169,7 @@ PLUGIN_LIBTOOL_FLAGS="-export_dynamic -module -avoid-version"
 AC_SUBST(PLUGIN_LIBTOOL_FLAGS)
 
 AC_PATH_PROG(GLIB_GENMARSHAL, glib-genmarshal)
+AC_PATH_PROG(GLIB_COMPILE_RESOURCES, glib-compile-resources)
 AC_PATH_XTRA
 
 NETWORK_MANAGER_REQUIRED_VERSION=0.8.992
diff --git a/gui/initial-setup/Makefile.am b/gui/initial-setup/Makefile.am
index 58b8397..d964057 100644
--- a/gui/initial-setup/Makefile.am
+++ b/gui/initial-setup/Makefile.am
@@ -23,6 +23,9 @@ timedated.h: Makefile.am timedated1-interface.xml
 		--generate-c-code timedated \
 		$(srcdir)/timedated1-interface.xml
 
+setup_resources.c: setup.gresource.xml setup.ui welcome-image.jpg
+	$(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=$(srcdir) --generate-source $(srcdir)/setup.gresource.xml
+
 gdm_initial_setup_SOURCES =	\
 	gdm-initial-setup.c \
 	panel-cell-renderer-signal.c panel-cell-renderer-signal.h \
@@ -32,17 +35,17 @@ gdm_initial_setup_SOURCES =	\
 	um-utils.c um-utils.h \
 	tz.c tz.h \
 	../libgdmgreeter/gdm-greeter-client.c ../libgdmgreeter/gdm-greeter-client.h \
-	$(dbus_built_sources)
+	$(dbus_built_sources) \
+	setup_resources.c
 
-ui_DATA = \
-	setup.ui \
-	welcome-image.jpg
 
 EXTRA_DIST = \
+	$(sys_DATA) \
 	timedated1-interface.xml \
-	$(ui_DATA) \
-	$(sys_DATA)
+	setup.ui \
+	welcome-image.jpg \
+	application.gresource.xml
 
-BUILT_SOURCES = $(dbus_built_sources)
+BUILT_SOURCES = $(dbus_built_sources) setup_resources.c
 
 -include $(top_srcdir)/git.mk
diff --git a/gui/initial-setup/gdm-initial-setup.c b/gui/initial-setup/gdm-initial-setup.c
index d2fa9b3..381d031 100644
--- a/gui/initial-setup/gdm-initial-setup.c
+++ b/gui/initial-setup/gdm-initial-setup.c
@@ -1835,7 +1835,6 @@ main (int argc, char *argv[])
 {
         SetupData *setup;
         GError *error;
-        const gchar *filename;
 
         setup = g_new0 (SetupData, 1);
 
@@ -1847,12 +1846,8 @@ main (int argc, char *argv[])
                 exit (1);
         };
 
-        filename = UIDIR "/setup.ui";
-        if (!g_file_test (filename, G_FILE_TEST_EXISTS))
-                filename = "setup.ui";
-
         setup->builder = gtk_builder_new ();
-        if (!gtk_builder_add_from_file (setup->builder, filename, &error)) {
+        if (!gtk_builder_add_from_resource (setup->builder, "/ui/setup.ui", &error)) {
                 g_error ("%s", error->message);
                 g_error_free (error);
                 exit (1);
diff --git a/gui/initial-setup/setup.gresource.xml b/gui/initial-setup/setup.gresource.xml
new file mode 100644
index 0000000..d9e697d
--- /dev/null
+++ b/gui/initial-setup/setup.gresource.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<gresources>
+  <gresource prefix="/image">
+    <file preprocess="to-pixdata">welcome-image.jpg</file>
+  </gresource>
+  <gresource prefix="/ui">
+    <file preprocess="xml-stripblanks">setup.ui</file>
+  </gresource>
+</gresources>
+
diff --git a/gui/initial-setup/setup.ui b/gui/initial-setup/setup.ui
index d3ef5b5..28027a0 100644
--- a/gui/initial-setup/setup.ui
+++ b/gui/initial-setup/setup.ui
@@ -65,7 +65,7 @@
             <property name="visible">True</property>
             <property name="halign">start</property>
             <property name="valign">start</property>
-            <property name="file">welcome-image.jpg</property>
+            <property name="file">resource:///image/welcome-image.jpg</property>
           </object>
           <packing>
             <property name="left_attach">0</property>



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