r15704 - gnucash/trunk - Add GOFFICE_WITH_CAIRO to enable build without GogRendererPixbuf.
Andreas Köhler
andi5 at cvs.gnucash.org
Fri Mar 9 17:44:36 EST 2007
Author: andi5
Date: 2007-03-09 17:44:33 -0500 (Fri, 09 Mar 2007)
New Revision: 15704
Trac: http://svn.gnucash.org/trac/changeset/15704
Modified:
gnucash/trunk/configure.in
gnucash/trunk/src/gnome-utils/gnc-html-graph-gog.c
Log:
Add GOFFICE_WITH_CAIRO to enable build without GogRendererPixbuf.
Check whether we find gog-renderer-cairo.h with the help of
GOFFICE_CFLAGS. If it is found, use GogRendererCairo instead of
GogRendererPixbuf. Newer goffice releases do not ship the latter any
more.
Modified: gnucash/trunk/configure.in
===================================================================
--- gnucash/trunk/configure.in 2007-03-09 20:16:36 UTC (rev 15703)
+++ gnucash/trunk/configure.in 2007-03-09 22:44:33 UTC (rev 15704)
@@ -1138,6 +1138,12 @@
AC_SUBST(GOFFICE_CFLAGS)
AC_SUBST(GOFFICE_LIBS)
+ saved_CPPFLAGS="${CPPFLAGS}"
+ CPPFLAGS="${GOFFICE_CFLAGS} ${CPPFLAGS}"
+ AC_CHECK_HEADER(goffice/graph/gog-renderer-cairo.h,
+ [AC_DEFINE(GOFFICE_WITH_CAIRO,1,[GOffice has been built with cairo support])])
+ CPPFLAGS="${saved_CPPFLAGS}"
+
##################################################
# regex needs its own linker flag on win32 platform
##################################################
Modified: gnucash/trunk/src/gnome-utils/gnc-html-graph-gog.c
===================================================================
--- gnucash/trunk/src/gnome-utils/gnc-html-graph-gog.c 2007-03-09 20:16:36 UTC (rev 15703)
+++ gnucash/trunk/src/gnome-utils/gnc-html-graph-gog.c 2007-03-09 22:44:33 UTC (rev 15704)
@@ -35,7 +35,11 @@
#include <goffice/goffice.h>
#include <goffice/graph/gog-graph.h>
#include <goffice/graph/gog-object.h>
-#include <goffice/graph/gog-renderer-pixbuf.h>
+#ifdef GOFFICE_WITH_CAIRO
+# include <goffice/graph/gog-renderer-cairo.h>
+#else
+# include <goffice/graph/gog-renderer-pixbuf.h>
+#endif
#include <goffice/graph/gog-renderer-gnome-print.h>
#include <goffice/graph/gog-style.h>
#include <goffice/graph/gog-styled-object.h>
@@ -158,7 +162,11 @@
add_pixbuf_graph_widget( GtkHTMLEmbedded *eb, GogObject *graph )
{
GtkWidget *widget;
+#ifdef GOFFICE_WITH_CAIRO
+ GogRendererCairo *cairo_renderer;
+#else
GogRendererPixbuf *pixbuf_renderer;
+#endif
GdkPixbuf *buf;
gboolean update_status;
@@ -168,12 +176,22 @@
// gnumeric uses. We probably _should_ do something like that, though.
gog_object_update (GOG_OBJECT (graph));
+#ifdef GOFFICE_WITH_CAIRO
+ cairo_renderer = GOG_RENDERER_CAIRO (g_object_new (GOG_RENDERER_CAIRO_TYPE,
+ "model", graph,
+ NULL));
+ update_status = gog_renderer_cairo_update (cairo_renderer,
+ eb->width, eb->height, 1.0);
+ buf = gog_renderer_cairo_get_pixbuf (cairo_renderer);
+#else
pixbuf_renderer = GOG_RENDERER_PIXBUF (g_object_new (GOG_RENDERER_PIXBUF_TYPE,
"model", graph,
NULL));
update_status = gog_renderer_pixbuf_update (pixbuf_renderer,
eb->width, eb->height, 1.0);
buf = gog_renderer_pixbuf_get (pixbuf_renderer);
+#endif /* GOFFICE_WITH_CAIRO */
+
widget = gtk_image_new_from_pixbuf (buf);
gtk_widget_set_size_request (widget, eb->width, eb->height);
gtk_widget_show_all (widget);
More information about the gnucash-changes
mailing list