[almanah: 1/6] resources: Combined resources into app binary
- From: Álvaro Peña <alvaropg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [almanah: 1/6] resources: Combined resources into app binary
- Date: Sat, 14 Feb 2015 13:53:05 +0000 (UTC)
commit 376b49c96bcc8229186fc070a33de7dd2d0020b8
Author: Álvaro Peña <alvaropg gmail com>
Date: Sat Feb 7 12:19:24 2015 +0100
resources: Combined resources into app binary
Now the resources are combined into the application binary generating
the c file resources.c with the glib-compile-resources tool.
The required GIO has been updated to 2.32 due GResources.
https://bugzilla.gnome.org/show_bug.cgi?id=743086
configure.ac | 4 +++-
data/Makefile.am | 14 --------------
src/Makefile.am | 14 ++++++++++++++
{data => src}/almanah.gresource.xml | 0
src/application.c | 15 ---------------
{data => src}/gtk/menus.ui | 0
src/interface.c | 9 ---------
src/interface.h | 1 -
8 files changed, 17 insertions(+), 40 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 26aba67..1614de6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -66,12 +66,14 @@ dnl ***************************************************************************
dnl Dependencies
dnl ***************************************************************************
+GIO_MIN_VERSION=2.32
+
dnl Required dependencies
PKG_CHECK_MODULES(STANDARD, glib-2.0
gtk+-3.0 >= 3.6
gmodule-2.0
gthread-2.0
- gio-2.0 >= 2.28.0
+ gio-2.0 >= $GIO_MIN_VERSION
sqlite3
cairo
atk
diff --git a/data/Makefile.am b/data/Makefile.am
index d3086c2..ab1f924 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -4,20 +4,6 @@ EXTRA_DIST =
CLEANFILES =
###############################################################################
-# GResource
-###############################################################################
-
-resource_files = $(shell $(GLIB_COMPILE_RESOURCES) --sourcedir=$(srcdir) --generate-dependencies
$(srcdir)/almanah.gresource.xml)
-almanah.gresource: almanah.gresource.xml $(resource_files)
- $(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=$(srcdir) $<
-
-resourcedir = $(pkgdatadir)
-resource_DATA = almanah.gresource
-
-EXTRA_DIST += $(resource_files)
-CLEANFILES += almanah.gresource
-
-###############################################################################
# Icons
###############################################################################
diff --git a/src/Makefile.am b/src/Makefile.am
index 363c2e5..b79204d 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,5 +1,8 @@
bin_PROGRAMS = almanah
+EXTRA_DIST =
+CLEANFILES =
+
almanah_SOURCES = \
$(ALMANAH_MARSHAL_FILES) \
$(ALMANAH_ENUM_FILES) \
@@ -99,6 +102,17 @@ almanah_LDADD = \
$(SPELL_CHECKING_LIBS) \
$(AM_LDADD)
+# GResource
+
+almanah_SOURCES += resources.c
+
+resource_files = $(shell $(GLIB_COMPILE_RESOURCES) --sourcedir=$(srcdir) --generate-dependencies
$(srcdir)/almanah.gresource.xml)
+resources.c: almanah.gresource.xml $(resource_files)
+ $(AM_V_GEN)$(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=$(srcdir) --generate-source --c-name
almanah $(srcdir)/almanah.gresource.xml
+
+EXTRA_DIST += almanah.gresource.xml
+CLEANFILES += resources.c
+
# Marshalling
ALMANAH_MARSHAL_FILES = \
almanah-marshal.c \
diff --git a/data/almanah.gresource.xml b/src/almanah.gresource.xml
similarity index 100%
rename from data/almanah.gresource.xml
rename to src/almanah.gresource.xml
diff --git a/src/application.c b/src/application.c
index 87344f7..b977389 100644
--- a/src/application.c
+++ b/src/application.c
@@ -55,7 +55,6 @@ static void action_quit_cb (GSimpleAction *action, GVariant *parameter, gpointer
struct _AlmanahApplicationPrivate {
gboolean debug;
- GResource *resource;
GSettings *settings;
AlmanahStorageManager *storage_manager;
AlmanahEventManager *event_manager;
@@ -112,16 +111,8 @@ almanah_application_class_init (AlmanahApplicationClass *klass)
static void
almanah_application_init (AlmanahApplication *self)
{
- GError *error = NULL;
-
self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, ALMANAH_TYPE_APPLICATION, AlmanahApplicationPrivate);
self->priv->debug = FALSE;
- self->priv->resource = g_resource_load (almanah_get_resource_filename (), &error);
- if (error == NULL) {
- g_resources_register (self->priv->resource);
- } else {
- g_error (_("Error loading resources file: %s"), error->message);
- }
}
static void
@@ -172,12 +163,6 @@ dispose (GObject *object)
g_object_unref (priv->print_settings);
priv->print_settings = NULL;
- if (priv->resource) {
- g_resources_unregister (priv->resource);
- g_resource_unref (priv->resource);
- }
- priv->resource = NULL;
-
/* Chain up to the parent class */
G_OBJECT_CLASS (almanah_application_parent_class)->dispose (object);
}
diff --git a/data/gtk/menus.ui b/src/gtk/menus.ui
similarity index 100%
rename from data/gtk/menus.ui
rename to src/gtk/menus.ui
diff --git a/src/interface.c b/src/interface.c
index f86b31e..ea93784 100644
--- a/src/interface.c
+++ b/src/interface.c
@@ -52,15 +52,6 @@ almanah_get_css_path (void)
return PACKAGE_DATA_DIR"/almanah";
}
-const gchar *
-almanah_get_resource_filename(void)
-{
- if (g_file_test ("./data/almanah.gresource", G_FILE_TEST_EXISTS) == TRUE)
- return "./data/almanah.gresource";
- else
- return PACKAGE_DATA_DIR"/almanah/almanah.gresource";
-}
-
void
almanah_interface_create_text_tags (GtkTextBuffer *text_buffer, gboolean connect_events)
{
diff --git a/src/interface.h b/src/interface.h
index 603290f..e4e4f6f 100644
--- a/src/interface.h
+++ b/src/interface.h
@@ -27,7 +27,6 @@ G_BEGIN_DECLS
const gchar *almanah_get_interface_filename (void);
const gchar *almanah_get_interface_app_menu_filename (void);
const gchar *almanah_get_css_path (void);
-const gchar *almanah_get_resource_filename(void);
void almanah_interface_create_text_tags (GtkTextBuffer *text_buffer, gboolean connect_events);
void almanah_calendar_month_changed_cb (GtkCalendar *calendar, gpointer user_data);
gboolean almanah_run_on_screen (GdkScreen *screen, const gchar *command_line, GError **error);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]