[drwright] Use GResource for the stripes background image
- From: Christian Persch <chpe src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [drwright] Use GResource for the stripes background image
- Date: Thu, 29 Mar 2012 16:25:09 +0000 (UTC)
commit fa7070830accfff95ba035861966c567fc9d9967
Author: Christian Persch <chpe gnome org>
Date: Thu Mar 29 18:23:34 2012 +0200
Use GResource for the stripes background image
configure.in | 14 +++++++++++---
src/Makefile.am | 23 +++++++++++++++++++----
src/drw-utils.c | 2 +-
src/drwright.gresource.xml | 22 ++++++++++++++++++++++
4 files changed, 53 insertions(+), 8 deletions(-)
---
diff --git a/configure.in b/configure.in
index 528c94d..1eaea8d 100644
--- a/configure.in
+++ b/configure.in
@@ -20,7 +20,7 @@ AC_INIT([Typing Break],
AC_CONFIG_SRCDIR([src/main.c])
AC_CONFIG_HEADERS([config.h])
-AM_INIT_AUTOMAKE([1.9 foreign no-dist-gzip dist-bzip2])
+AM_INIT_AUTOMAKE([1.9 foreign no-dist-gzip dist-bzip2 -Wno-portability])
m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
@@ -42,8 +42,9 @@ LT_LIB_M
# Requirements
# ************
-GLIB_REQUIRED=2.26.0
-GIO_REQUIRED=2.26.0
+GLIB_REQUIRED=2.31.13
+GIO_REQUIRED=2.31.13
+GDK_PIXBUF_REQUIRED=2.25.3
GTK_REQUIRED=3.0.0
LIBCANBERRA_REQUIRED=0
LIBNOTIFY_REQUIRED=0.7
@@ -56,6 +57,7 @@ GSD_REQUIRED=2.91.8
PKG_CHECK_MODULES([TYPING],[
glib-2.0 >= $GLIB_REQUIRED
gio-2.0 >= $GIO_REQUIRED
+ gdk-pixbuf-2.0 >= $GDK_PIXBUF_REQUIRED
gtk+-3.0 >= $GTK_REQUIRED
libcanberra-gtk3 >= $LIBCANBERRA_REQUIRED
libnotify >= $LIBNOTIFY_REQUIRED
@@ -107,6 +109,12 @@ if test "$GTK_BUILDER_CONVERT" = "false"; then
AC_MSG_ERROR([gtk-builder-convert not found])
fi
+AC_ARG_VAR([GLIB_COMPILE_RESOURCES],[the glib-compile-resources programme])
+AC_PATH_PROG([GLIB_COMPILE_RESOURCES],[glib-compile-resources],[])
+if test -z "$GLIB_COMPILE_RESOURCES"; then
+ AC_MSG_ERROR([glib-compile-resources not found])
+fi
+
# *********
# GSettings
# *********
diff --git a/src/Makefile.am b/src/Makefile.am
index 6fe4f4d..1ca6a78 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,9 +1,16 @@
NULL =
+EXTRA_DIST =
+
# Typing break
pkglibexec_PROGRAMS = gnome-typing-monitor
+BUILT_SOURCES = \
+ drw-resources.c \
+ drw-resources.h \
+ $(NULL)
+
gnome_typing_monitor_SOURCES = \
main.c \
drwright.c \
@@ -17,7 +24,9 @@ gnome_typing_monitor_SOURCES = \
drw-selection.c \
drw-selection.h \
drw-timer.c \
- drw-timer.h
+ drw-timer.h \
+ $(BUILT_SOURCES) \
+ $(NULL)
gnome_typing_monitor_CPPFLAGS = \
-DGNOMELOCALEDIR="\"$(datadir)/locale\"" \
@@ -33,8 +42,7 @@ gnome_typing_monitor_LDADD = \
$(LIBM) \
$(INTLLIBS)
-imagedir = $(pkgdatadir)/pixmaps
-dist_image_DATA = ocean-stripes.png
+EXTRA_DIST += ocean-stripes.png
# Themeable application icon
icondir = $(datadir)/icons/hicolor/48x48/apps
@@ -136,6 +144,11 @@ desktop_DATA = $(desktop_in_files:.desktop.in=.desktop)
@INTLTOOL_DESKTOP_RULE@
+# Resources
+
+drw-resources.h drw-resources.c: drwright.gresource.xml Makefile $(shell $(GLIB_COMPILE_RESOURCES) --generate-dependencies --sourcedir $(srcdir) $(srcdir)/drwright.gresource.xml)
+ $(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) --target $@ --sourcedir $(srcdir) --generate --c-name drw $<
+
# GSettings
gsettings_schemas_in_files = org.gnome.settings-daemon.plugins.typing-break.gschema.xml.in
@@ -149,7 +162,7 @@ gsettings_SCHEMAS = $(gsettings_schemas_in_files:.gschema.xml.in=.gschema.xml)
# Clean
-EXTRA_DIST = \
+EXTRA_DIST += \
$(builder_in_files) \
$(gsd_plugin_in_files) \
$(gsettings_schemas_in_files) \
@@ -160,12 +173,14 @@ CLEANFILES = \
$(desktop_DATA) \
$(gsettings_SCHEMAS) \
$(gsd_plugin_DATA) \
+ $(BUILT_SOURCES) \
$(NULL)
DISTCLEANFILES = \
$(builder_DATA) \
$(desktop_DATA) \
$(gsd_plugin_DATA) \
+ $(BUILT_SOURCES) \
$(NULL)
# includes
diff --git a/src/drw-utils.c b/src/drw-utils.c
index f27bcdd..6010820 100644
--- a/src/drw-utils.c
+++ b/src/drw-utils.c
@@ -158,7 +158,7 @@ set_surface_background (GtkWidget *window)
width = gdk_screen_get_width (screen);
height = gdk_screen_get_height (screen);
- pixbuf = gdk_pixbuf_new_from_file (IMAGEDIR "/ocean-stripes.png", NULL);
+ pixbuf = gdk_pixbuf_new_from_resource ("/org/gnome/drwright/ocean-stripes.png", NULL);
rect.x = 0;
rect.y = 0;
diff --git a/src/drwright.gresource.xml b/src/drwright.gresource.xml
new file mode 100644
index 0000000..cbfae6d
--- /dev/null
+++ b/src/drwright.gresource.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright  2012 Christian Persch
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This program is distributed in the hope conf it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+-->
+<gresources>
+ <gresource prefix="/org/gnome/drwright">
+ <file preprocess="to-pixdata">ocean-stripes.png</file>
+ </gresource>
+</gresources>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]