Commit ab17ab5d authored by Colomban Wendling's avatar Colomban Wendling

OVCCGtk: use GResource to store our UI file

parent 8915f665
......@@ -20,13 +20,14 @@ AC_PROG_SED
AC_PROG_CC
AM_PROG_VALAC([0.7])
AC_CHECK_PROGS([GLIB_GENMARSHAL], [glib-genmarshal], [NONE])
AC_CHECK_PROGS([GLIB_COMPILE_RESOURCES], [glib-compile-resources], [NONE])
AC_CHECK_PROGS([GLIB_MKENUMS], [glib-mkenums], [NONE])
# check for gtk-doc
#GTK_DOC_CHECK(1.11)
# Checks for libraries.
GLIB_REQUIRE=2.12
GLIB_REQUIRE=2.32
GMODULE_REQUIRE=2.0
GTK_REQUIRE=3.0
OVCC_REQUIRE=0.0
......
......@@ -2,7 +2,7 @@
iconsdir = $(datadir)
nobase_dist_icons_DATA = icons/hicolor/scalable/apps/ovccgtk.svg
dist_pkgdata_DATA = ovccgtk-application.ui
dist_noinst_DATA = ovccgtk-application.ui
# we add directory $(pkgdatadir)/icons to our lookup path, so make sure it
# exists in case we aren't installed in a default prefix where icons are
......
......@@ -27,8 +27,10 @@ headers = ovccgtk-board.h \
tiles.h
autogen_sources = ovccgtk-marshal.c \
ovccgtk-resources.c \
ovccgtk-enum-types.c
autogen_headers = ovccgtk-marshal.h \
ovccgtk-resources.h \
ovccgtk-enum-types.h
CLEANFILES = $(autogen_sources) \
......@@ -36,7 +38,8 @@ CLEANFILES = $(autogen_sources) \
EXTRA_DIST = ovccgtk-marshal.list \
ovccgtk-enum-types.c.tpl \
ovccgtk-enum-types.h.tpl
ovccgtk-enum-types.h.tpl \
ovccgtk-resources.gresource.xml
ovcc_gtk_CFLAGS = $(OVCCGTK_CFLAGS) -DDATADIR='"$(ovccgtkdatadir)"'
......@@ -50,8 +53,11 @@ ovcc_gtk_SOURCES = $(autogen_sources) \
GLIB_GENMARSHAL_FLAGS = --prefix=ovccgtk_marshal
GLIB_COMPILE_RESOURCES_SOURCEDIR = $(top_srcdir)/data
GLIB_COMPILE_RESOURCES_FLAGS = --internal --manual-register --c-name=ovccgtk
SUFFIXES = .list .c.tpl .h.tpl .c .h
SUFFIXES = .list .c.tpl .h.tpl .gresource.xml .c .h
.list.h:
$(AM_V_GEN) $(GLIB_GENMARSHAL) $< --header $(GLIB_GENMARSHAL_FLAGS) > $@
......@@ -70,6 +76,21 @@ SUFFIXES = .list .c.tpl .h.tpl .c .h
$(SED) s%o_vcc_gtk_%ovccgtk_%g | \
$(SED) s%O_TYPE_VCC_GTK_%OVCCGTK_TYPE_%g > $@
.gresource.xml.h:
$(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) $< --target=$@ --generate-header \
$(GLIB_COMPILE_RESOURCES_FLAGS) \
--sourcedir=$(GLIB_COMPILE_RESOURCES_SOURCEDIR) && \
(echo $@: && $(GLIB_COMPILE_RESOURCES) $< \
--sourcedir=$(GLIB_COMPILE_RESOURCES_SOURCEDIR) \
--generate-dependencies) | $(SED) 's/$$/\\/' > .deps/$@.deps
.gresource.xml.c:
$(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) $< --target=$@ --generate-source \
$(GLIB_COMPILE_RESOURCES_FLAGS) \
--sourcedir=$(GLIB_COMPILE_RESOURCES_SOURCEDIR) && \
(echo $@: && $(GLIB_COMPILE_RESOURCES) $< \
--sourcedir=$(GLIB_COMPILE_RESOURCES_SOURCEDIR) \
--generate-dependencies) | $(SED) 's/$$/\\/' > .deps/$@.deps
# explicit dependencies of our generated files
......@@ -79,3 +100,8 @@ ovccgtk-marshal.c: ovccgtk-marshal.h
ovccgtk-enum-types.c: ovccgtk-enum-types.h $(headers)
ovccgtk-enum-types.h: $(headers)
-include .deps/ovccgtk-resources.h.deps
-include .deps/ovccgtk-resources.c.deps
ovccgtk-resources.c: ovccgtk-resources.h
......@@ -27,6 +27,7 @@
#include "utils.h"
#include "tiles.h"
#include "ovccgtk-resources.h"
#include "ovccgtk-board.h"
#include "ovccgtk-client.h"
#include "ovccgtk-connection-dialog.h"
......@@ -409,9 +410,9 @@ load_ui (GtkBuilder *builder,
{
GError *err = NULL;
gboolean loaded = FALSE;
gchar *path = data_get_path (filename);
gchar *path = g_build_filename ("/org/ovccgtk/widgets", filename, NULL);
loaded = gtk_builder_add_from_file (builder, path, &err) > 0;
loaded = gtk_builder_add_from_resource (builder, path, &err) > 0;
if (! loaded) {
show_message (NULL, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE,
err->message, _("Failed to load UI file \"%s\""), path);
......@@ -996,7 +997,9 @@ main (int argc,
int rv = 1;
gtk_init (&argc, &argv);
ovccgtk_register_resource ();
rv = ovcc_gtk (argc, argv) ? 0 : 1;
ovccgtk_unregister_resource ();
return rv;
}
......
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="/org/ovccgtk/widgets">
<file preprocess="xml-stripblanks">ovccgtk-application.ui</file>
</gresource>
</gresources>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment