Skip to content
Browse files

Use GResource to bundle the style data and images with the application

  • Loading branch information...
1 parent c129f4a commit 402d2a89746505908d523485c3dc2707ddbf003a @thos thos committed
Showing with 39 additions and 19 deletions.
  1. +17 −13 data/Makefile.am
  2. +2 −0 mex/.gitignore
  3. +13 −1 mex/Makefile.am
  4. +1 −2 mex/mex-scroll-view.c
  5. +6 −3 mex/mex-utils.c
View
30 data/Makefile.am
@@ -15,8 +15,24 @@ extradir = $(pkgdatadir)
dist_extra_DATA = mex-lircrc
endif
+
styledir = $(pkgdatadir)/style
dist_style_DATA = \
+ style/folder-tile-up.png \
+ style/folder-tile.png \
+ style/thumb-app.png \
+ style/thumb-bg.png \
+ style/thumb-call-avatar-small.png \
+ style/thumb-call-avatar.png \
+ style/thumb-call-pip-off.png \
+ style/thumb-disc.png \
+ style/thumb-image.png \
+ style/thumb-music.png \
+ style/thumb-tv.png \
+ style/thumb-video.png
+
+EXTRA_DIST = \
+ media-explorer.gresource.xml \
style/bg-gradient.png \
style/button-bg-highlight.png \
style/button-bg.png \
@@ -25,8 +41,6 @@ dist_style_DATA = \
style/controls-container.png \
style/details-actions-separator.png \
style/details-bg.png \
- style/folder-tile-up.png \
- style/folder-tile.png \
style/footer.png \
style/frame-bg.png \
style/graphic-network.png \
@@ -66,17 +80,7 @@ dist_style_DATA = \
style/spinner.png \
style/style.css \
style/text-input-bg.png \
- style/thumb-app.png \
- style/thumb-bg.png \
- style/thumb-call-avatar.png \
- style/thumb-call-avatar-small.png \
- style/thumb-call-pip-off.png \
- style/thumb-disc.png \
- style/thumb-image.png \
- style/thumb-music.png \
style/thumb-no-content.png \
- style/thumb-tv.png \
- style/thumb-video.png \
style/timeline-bg.png \
style/timeline-buffer.png \
style/timeline-highlight-white.png \
@@ -98,7 +102,7 @@ dist_style_DATA = \
if ENABLE_IDLE_VIDEO
-dist_style_DATA +=style/background-loop.mkv
+EXTRA_DIST +=style/background-loop.mkv
endif
icondir = $(pkgdatadir)/icons/mex
View
2 mex/.gitignore
@@ -2,4 +2,6 @@ mex-enum-types.c
mex-enum-types.h
mex-marshal.c
mex-marshal.h
+mex-resource.c
+mex-resource.h
mex-test-internal
View
14 mex/Makefile.am
@@ -9,6 +9,15 @@ DISTCLEANFILES =
EXTRA_DIST =
BUILT_SOURCES =
+
+mex-resource.c: $(top_srcdir)/data/media-explorer.gresource.xml
@tarigo
tarigo added a note

...
make[2]: *** No rule to make target ../data/media-explorer.gresource.xml', needed bymex-resource.c'. Stop.
make[2]: Leaving directory /home/tarigo/src/media-explorer/mex'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory
/home/tarigo/src/media-explorer'
make: *** [all] Error 2
...

@thos Media Explorer member
thos added a note
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+ glib-compile-resources --target=$@ --sourcedir=$(top_srcdir)/data \
+ --generate-source --c-name mex $(top_srcdir)/data/media-explorer.gresource.xml
+
+mex-resource.h: $(top_srcdir)/data/media-explorer.gresource.xml
+ glib-compile-resources --target=$@ --sourcedir=$(top_srcdir)/data \
+ --generate-header --c-name mex $(top_srcdir)/data/media-explorer.gresource.xml
+
glib_marshal_list = mex-marshal.list
glib_marshal_prefix = mex_marshal
include $(top_srcdir)/build/Makefile.am.marshal
@@ -21,7 +30,7 @@ glib_enum_c = mex-enum-types.c
glib_enum_headers = $(filter-out gbinding.h, $(mex_headers))
include $(top_srcdir)/build/Makefile.am.enums
-BUILT_SOURCES += $(MARSHAL_SOURCES)
+BUILT_SOURCES += $(MARSHAL_SOURCES) mex-resource.c mex-resource.h
mex_headers = \
$(top_srcdir)/mex/mex.h \
@@ -243,6 +252,9 @@ libmex_@MEX_API_VERSION@_la_SOURCES = \
$(mex_private_headers) \
$(NULL)
+nodist_libmex_@MEX_API_VERSION@_la_SOURCES = \
+ mex-resource.c mex-resouce.h
+
common_includes = \
-I$(top_srcdir) \
-I$(top_builddir) \
View
3 mex/mex-scroll-view.c
@@ -1048,8 +1048,7 @@ mex_scroll_view_style_changed_cb (MexScrollView *self,
NULL);
if (priv->scroll_shadow && priv->scroll_shadow->uri)
- priv->scroll_shadow_texture = cogl_texture_new_from_file (priv->scroll_shadow->uri,
- 0, 0, NULL);
+ priv->scroll_shadow_texture = mx_texture_cache_get_cogl_texture (mx_texture_cache_get_default (), priv->scroll_shadow->uri);
else if (priv->scroll_shadow)
{
g_boxed_free (MX_TYPE_BORDER_IMAGE, priv->scroll_shadow);
View
9 mex/mex-utils.c
@@ -56,6 +56,8 @@
#include <mex/mex-program.h>
#include <mex/mex-settings.h>
+#include "mex-resource.h"
+
#ifdef HAVE_COGL_GLES2
#define GLES2_VARS \
@@ -143,9 +145,10 @@ mex_style_load_default (void)
mx_icon_theme_set_theme_name (theme, "mex");
/* Load the style */
- tmp = g_build_filename (mex_get_data_dir (), "style", "style.css", NULL);
- mx_style_load_from_file (mx_style_get_default (), tmp, &error);
- g_free (tmp);
+ mx_style_load_from_resource (mx_style_get_default (),
+ mex_get_resource (),
+ "/org/media-explorer/MediaExplorer/style/style.css",
+ &error);
if (error)
{

0 comments on commit 402d2a8

Please sign in to comment.
Something went wrong with that request. Please try again.