[gnome-color-manager] Allow building against gtk-2.0 rather than gtk-3.0
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-color-manager] Allow building against gtk-2.0 rather than gtk-3.0
- Date: Fri, 6 Aug 2010 09:11:27 +0000 (UTC)
commit 34b2a311e37618f902b54fdb5b67be1e3a2c05f9
Author: Richard Hughes <richard hughsie com>
Date: Thu Aug 5 16:34:05 2010 +0100
Allow building against gtk-2.0 rather than gtk-3.0
configure.ac | 32 +++++++++++++++++++++++++++-----
libcolor-glib/gcm-compat.h | 10 ++++++++++
src/gcm-picker.c | 1 +
src/gcm-viewer.c | 1 +
4 files changed, 39 insertions(+), 5 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index e78c05b..747a7eb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -131,12 +131,37 @@ AC_DEFINE(GETTEXT_PACKAGE, "AC_PACKAGE_NAME", [foo])
AM_GLIB_GNU_GETTEXT
GLIB_GSETTINGS
+dnl **** We can compile against GTK2 or GTK3 ****
+AC_MSG_CHECKING([which gtk+ version to compile against])
+AC_ARG_WITH([gtk],
+ [AS_HELP_STRING([--with-gtk=2.0|3.0],[which gtk+ version to compile against (default: 3.0)])],
+ [case "$with_gtk" in
+ 2.0|3.0) ;;
+ *) AC_MSG_ERROR([invalid gtk version specified]) ;;
+ esac],
+ [with_gtk=3.0])
+AC_MSG_RESULT([$with_gtk])
+
+case "$with_gtk" in
+2.0)
+ PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.21.5)
+ PKG_CHECK_MODULES(VTE, vte >= 0.25.1, has_vte=yes, has_vte=no)
+ PKG_CHECK_MODULES(NOTIFY, libnotify >= 0.4.0, has_libnotify=yes, has_libnotify=no)
+ PKG_CHECK_MODULES(CANBERRA, libcanberra-gtk >= 0.10)
+ ;;
+3.0)
+ PKG_CHECK_MODULES(GTK, gtk+-3.0 >= 2.90.3)
+ PKG_CHECK_MODULES(VTE, vte-2.90 >= 0.25.1, has_vte=yes, has_vte=no)
+ PKG_CHECK_MODULES(NOTIFY, libnotify >= 0.5.0, has_libnotify=yes, has_libnotify=no)
+ PKG_CHECK_MODULES(CANBERRA, libcanberra-gtk3 >= 0.10)
+ ;;
+esac
+
dnl ---------------------------------------------------------------------------
dnl - Check library dependencies
dnl ---------------------------------------------------------------------------
PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.14.0 gobject-2.0 gthread-2.0 gio-2.0 >= 2.25.9)
PKG_CHECK_MODULES(XORG, xrandr)
-PKG_CHECK_MODULES(GTK, gtk+-3.0 >= 2.90.3)
PKG_CHECK_MODULES(GUDEV, gudev-1.0)
PKG_CHECK_MODULES(LCMS, lcms2)
PKG_CHECK_MODULES(X11, x11)
@@ -155,14 +180,12 @@ PANELS_DIR="${libdir}/control-center-1/panels"
AC_SUBST(PANELS_DIR)
dnl **** Check for VTE ****
-PKG_CHECK_MODULES(VTE, vte-2.90 >= 0.25.1, has_vte=yes, has_vte=no)
AM_CONDITIONAL(HAVE_VTE, test x$has_vte = xyes)
if test x$has_vte = xyes; then
AC_DEFINE(HAVE_VTE,1,[Use VTE terminal widget])
fi
dnl **** Check for NOTIFY ****
-PKG_CHECK_MODULES(NOTIFY, libnotify >= 0.5.0, has_libnotify=yes, has_libnotify=no)
AM_CONDITIONAL(HAVE_NOTIFY, test x$libnotify = xyes)
if test x$has_libnotify = xyes; then
AC_DEFINE(HAVE_NOTIFY,1,[Use session notifications])
@@ -200,8 +223,6 @@ if test x$enable_exiv = xyes; then
AC_DEFINE(HAVE_EXIV,1,[Use EXIV support for detecting scanners])
fi
-PKG_CHECK_MODULES(CANBERRA, libcanberra-gtk3 >= 0.10)
-
PKG_CHECK_MODULES(EXIF, libexif)
AC_CHECK_LIB(tiff, TIFFReadRGBAImageOriented,
TIFF_CFLAGS=""
@@ -341,6 +362,7 @@ echo "
compiler: ${CC}
cflags: ${CFLAGS}
cppflags: ${CPPFLAGS}
+ GTK version: ${with_gtk}
PackageKit integration: ${enable_packagekit}
SANE support: ${enable_sane}
RAW support: ${enable_exiv}
diff --git a/libcolor-glib/gcm-compat.h b/libcolor-glib/gcm-compat.h
index 3e30993..0e11979 100644
--- a/libcolor-glib/gcm-compat.h
+++ b/libcolor-glib/gcm-compat.h
@@ -26,6 +26,7 @@
#ifndef __GCM_COMPAT_H__
#define __GCM_COMPAT_H__
+#include <gtk/gtk.h>
#include "config.h"
/* only libusb 1.0.8 has libusb_strerror */
@@ -33,5 +34,14 @@
#define libusb_strerror(f1) "unknown"
#endif
+/* GtkApplication is missing */
+#if (!GTK_CHECK_VERSION(2,21,6))
+#define GtkApplication GObject
+#define gtk_application_quit(f1) g_assert(f1!=NULL)
+#define gtk_application_run(f1) g_assert(f1!=NULL)
+#define gtk_application_add_window(f1,f2) g_assert(f1!=NULL)
+#define gtk_application_new(f1,f2,f3) g_object_new(G_TYPE_OBJECT, NULL)
+#endif
+
#endif /* __GCM_COMPAT_H__ */
diff --git a/src/gcm-picker.c b/src/gcm-picker.c
index b223c29..e56b62c 100644
--- a/src/gcm-picker.c
+++ b/src/gcm-picker.c
@@ -29,6 +29,7 @@
#include <locale.h>
#include <gtk/gtk.h>
#include <lcms2.h>
+#include <libcolor-glib.h>
#include "egg-debug.h"
diff --git a/src/gcm-viewer.c b/src/gcm-viewer.c
index 8496adb..3fa26de 100644
--- a/src/gcm-viewer.c
+++ b/src/gcm-viewer.c
@@ -26,6 +26,7 @@
#include <glib/gstdio.h>
#include <locale.h>
#include <canberra-gtk.h>
+#include <libcolor-glib.h>
#include "egg-debug.h"
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]