[gnome-color-manager] Make libnotify an optional dependency as it relies on gtk-2.0
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-color-manager] Make libnotify an optional dependency as it relies on gtk-2.0
- Date: Fri, 18 Jun 2010 09:41:40 +0000 (UTC)
commit e14c8e6e68d5873b27e6610f3334e68d0e5ca0f1
Author: Richard Hughes <richard hughsie com>
Date: Fri Jun 18 10:41:31 2010 +0100
Make libnotify an optional dependency as it relies on gtk-2.0
configure.ac | 25 ++++++++++++++++---------
src/Makefile.am | 4 ++--
src/gcm-calibrate-argyll.c | 36 ++++++++++++++++++------------------
src/gcm-calibrate.c | 4 ++--
src/gcm-client.c | 22 +++++++++++-----------
src/gcm-exif.c | 4 ++--
src/gcm-prefs.c | 4 ++--
src/gcm-session.c | 5 ++++-
src/gcm-utils.c | 4 ++--
src/gcm-utils.h | 19 +++++++++++++++++++
10 files changed, 78 insertions(+), 49 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 161e960..3dbb4e1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -112,9 +112,16 @@ PKG_CHECK_MODULES(NOTIFY, libnotify)
dnl **** Check for VTE ****
PKG_CHECK_MODULES(VTE, vte3 >= 0.25.1, has_vte=yes, has_vte=no)
-AM_CONDITIONAL(GCM_USE_VTE, test x$has_vte = xyes)
+AM_CONDITIONAL(HAVE_VTE, test x$has_vte = xyes)
if test x$has_vte = xyes; then
- AC_DEFINE(GCM_USE_VTE,1,[Use VTE terminal widget])
+ AC_DEFINE(HAVE_VTE,1,[Use VTE terminal widget])
+fi
+
+dnl **** Check for LIBNOTIFY ****
+PKG_CHECK_MODULES(LIBNOTIFY, libnotify3 >= 0.4.3, has_libnotify=yes, has_libnotify=no)
+AM_CONDITIONAL(HAVE_LIBNOTIFY, test x$libnotify = xyes)
+if test x$has_libnotify = xyes; then
+ AC_DEFINE(HAVE_LIBNOTIFY,1,[Use session notifications])
fi
dnl **** Check for SANE ****
@@ -133,9 +140,9 @@ if test x$enable_sane != xno; then
AC_SUBST(SANE_LIBS)
fi
fi
-AM_CONDITIONAL(GCM_USE_SANE, test x$enable_sane = xyes)
+AM_CONDITIONAL(HAVE_SANE, test x$enable_sane = xyes)
if test x$enable_sane = xyes; then
- AC_DEFINE(GCM_USE_SANE,1,[Use SANE support for detecting scanners])
+ AC_DEFINE(HAVE_SANE,1,[Use SANE support for detecting scanners])
fi
AC_ARG_ENABLE(exiv, AS_HELP_STRING([--enable-exiv],[Enable EXIV support for RAW support]), enable_exiv=$enableval,
@@ -144,9 +151,9 @@ dnl **** Check for EXIV ****
if test x$enable_exiv != xno; then
PKG_CHECK_MODULES(EXIV, exiv2)
fi
-AM_CONDITIONAL(GCM_USE_EXIV, test x$enable_exiv = xyes)
+AM_CONDITIONAL(HAVE_EXIV, test x$enable_exiv = xyes)
if test x$enable_exiv = xyes; then
- AC_DEFINE(GCM_USE_EXIV,1,[Use EXIV support for detecting scanners])
+ AC_DEFINE(HAVE_EXIV,1,[Use EXIV support for detecting scanners])
fi
PKG_CHECK_MODULES(CANBERRA, libcanberra-gtk3 >= 0.10)
@@ -214,9 +221,9 @@ dnl - Use PackageKit to install missing tools
dnl ---------------------------------------------------------------------------
AC_ARG_ENABLE(packagekit, AS_HELP_STRING([--enable-packagekit],[enable PackageKit integration]),
enable_packagekit=$enableval,enable_packagekit=yes)
-AM_CONDITIONAL(GCM_USE_PACKAGEKIT, test x$enable_packagekit = xyes)
+AM_CONDITIONAL(HAVE_PACKAGEKIT, test x$enable_packagekit = xyes)
if test x$enable_packagekit = xyes; then
- AC_DEFINE(GCM_USE_PACKAGEKIT,1,[Use PackageKit for installing packages])
+ AC_DEFINE(HAVE_PACKAGEKIT,1,[Use PackageKit for installing packages])
fi
dnl ---------------------------------------------------------------------------
@@ -224,7 +231,7 @@ dnl - Build self tests
dnl ---------------------------------------------------------------------------
AC_ARG_ENABLE(tests, AS_HELP_STRING([--enable-tests],[enable unit test code]),
enable_tests=$enableval,enable_tests=yes)
-AM_CONDITIONAL(GCM_BUILD_TESTS, test x$enable_tests = xyes)
+AM_CONDITIONAL(HAVEmake, test x$enable_tests = xyes)
AC_SUBST(GCM_SYSTEM_PROFILES_DIR, "\$(localstatedir)/lib/color")
diff --git a/src/Makefile.am b/src/Makefile.am
index 3c06daf..6b93d6a 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -115,7 +115,7 @@ bin_PROGRAMS = \
gcm-picker \
gcm-import
-if GCM_USE_EXIV
+if HAVE_EXIV
libexec_PROGRAMS = gcm-helper-exiv
gcm_helper_exiv_SOURCES = gcm-helper-exiv.cpp
gcm_helper_exiv_LDADD = $(EXIV_LIBS)
@@ -311,7 +311,7 @@ gcm_session_LDADD = \
gcm_session_CFLAGS = \
$(WARNINGFLAGS_C)
-if GCM_BUILD_TESTS
+if HAVEmake
check_PROGRAMS = \
gcm-self-test
diff --git a/src/gcm-calibrate-argyll.c b/src/gcm-calibrate-argyll.c
index 8134e2d..10b19ce 100644
--- a/src/gcm-calibrate-argyll.c
+++ b/src/gcm-calibrate-argyll.c
@@ -35,7 +35,7 @@
#include <gio/gio.h>
#include <stdlib.h>
#include <gtk/gtk.h>
-#ifdef GCM_USE_VTE
+#ifdef HAVE_VTE
#include <vte/vte.h>
#endif
#include <canberra-gtk.h>
@@ -185,7 +185,7 @@ gcm_calibrate_argyll_printer_get_patches (GcmCalibrateArgyll *calibrate_argyll)
return patches;
}
-#ifdef GCM_USE_VTE
+#ifdef HAVE_VTE
/**
* gcm_calibrate_argyll_get_colorimeter_image_attach:
**/
@@ -369,7 +369,7 @@ static gboolean
gcm_calibrate_argyll_fork_command (GcmCalibrateArgyll *calibrate_argyll, gchar **argv, GError **error)
{
gboolean ret = FALSE;
-#ifdef GCM_USE_VTE
+#ifdef HAVE_VTE
const gchar *envp[] = { "ARGYLL_NOT_INTERACTIVE", NULL };
const gchar *working_directory;
GcmCalibrateArgyllPrivate *priv = calibrate_argyll->priv;
@@ -494,7 +494,7 @@ gcm_calibrate_argyll_display_neutralise (GcmCalibrateArgyll *calibrate_argyll, G
ret = FALSE;
goto out;
}
-#ifdef GCM_USE_VTE
+#ifdef HAVE_VTE
if (priv->response == GTK_RESPONSE_REJECT) {
gchar *vte_text;
vte_text = vte_terminal_get_text (VTE_TERMINAL(priv->terminal), NULL, NULL, NULL);
@@ -586,7 +586,7 @@ gcm_calibrate_argyll_display_read_chart (GcmCalibrateArgyll *calibrate_argyll, G
ret = FALSE;
goto out;
}
-#ifdef GCM_USE_VTE
+#ifdef HAVE_VTE
if (priv->response == GTK_RESPONSE_REJECT) {
gchar *vte_text;
vte_text = vte_terminal_get_text (VTE_TERMINAL(priv->terminal), NULL, NULL, NULL);
@@ -693,7 +693,7 @@ gcm_calibrate_argyll_display_generate_patches (GcmCalibrateArgyll *calibrate_arg
ret = FALSE;
goto out;
}
-#ifdef GCM_USE_VTE
+#ifdef HAVE_VTE
if (priv->response == GTK_RESPONSE_REJECT) {
gchar *vte_text;
vte_text = vte_terminal_get_text (VTE_TERMINAL(priv->terminal), NULL, NULL, NULL);
@@ -789,7 +789,7 @@ gcm_calibrate_argyll_display_draw_and_measure (GcmCalibrateArgyll *calibrate_arg
ret = FALSE;
goto out;
}
-#ifdef GCM_USE_VTE
+#ifdef HAVE_VTE
if (priv->response == GTK_RESPONSE_REJECT) {
gchar *vte_text;
vte_text = vte_terminal_get_text (VTE_TERMINAL(priv->terminal), NULL, NULL, NULL);
@@ -906,7 +906,7 @@ gcm_calibrate_argyll_display_generate_profile (GcmCalibrateArgyll *calibrate_arg
ret = FALSE;
goto out;
}
-#ifdef GCM_USE_VTE
+#ifdef HAVE_VTE
if (priv->response == GTK_RESPONSE_REJECT) {
gchar *vte_text;
vte_text = vte_terminal_get_text (VTE_TERMINAL(priv->terminal), NULL, NULL, NULL);
@@ -1128,7 +1128,7 @@ gcm_calibrate_argyll_device_measure (GcmCalibrateArgyll *calibrate_argyll, GErro
ret = FALSE;
goto out;
}
-#ifdef GCM_USE_VTE
+#ifdef HAVE_VTE
if (priv->response == GTK_RESPONSE_REJECT) {
gchar *vte_text;
vte_text = vte_terminal_get_text (VTE_TERMINAL(priv->terminal), NULL, NULL, NULL);
@@ -1253,7 +1253,7 @@ gcm_calibrate_argyll_device_generate_profile (GcmCalibrateArgyll *calibrate_argy
ret = FALSE;
goto out;
}
-#ifdef GCM_USE_VTE
+#ifdef HAVE_VTE
if (priv->response == GTK_RESPONSE_REJECT) {
gchar *vte_text;
vte_text = vte_terminal_get_text (VTE_TERMINAL(priv->terminal), NULL, NULL, NULL);
@@ -1504,7 +1504,7 @@ gcm_calibrate_argyll_spotread_read_chart (GcmCalibrateArgyll *calibrate_argyll,
ret = FALSE;
goto out;
}
-#ifdef GCM_USE_VTE
+#ifdef HAVE_VTE
if (priv->response == GTK_RESPONSE_REJECT) {
gchar *vte_text;
vte_text = vte_terminal_get_text (VTE_TERMINAL(priv->terminal), NULL, NULL, NULL);
@@ -1668,7 +1668,7 @@ gcm_calibrate_argyll_display_generate_targets (GcmCalibrateArgyll *calibrate_arg
ret = FALSE;
goto out;
}
-#ifdef GCM_USE_VTE
+#ifdef HAVE_VTE
if (priv->response == GTK_RESPONSE_REJECT) {
gchar *vte_text;
vte_text = vte_terminal_get_text (VTE_TERMINAL(priv->terminal), NULL, NULL, NULL);
@@ -2216,7 +2216,7 @@ out:
return ret;
}
-#ifdef GCM_USE_VTE
+#ifdef HAVE_VTE
/**
* gcm_calibrate_argyll_exit_cb:
**/
@@ -2726,7 +2726,7 @@ out:
}
#endif
-#ifdef GCM_USE_VTE
+#ifdef HAVE_VTE
/**
* gcm_calibrate_argyll_selection_func_cb:
**/
@@ -2796,7 +2796,7 @@ gcm_calibrate_argyll_response_cb (GtkWidget *widget, GtkResponseType response, G
/* send input if waiting */
if (priv->state == GCM_CALIBRATE_ARGYLL_STATE_WAITING_FOR_STDIN) {
egg_debug ("sending '%s' to argyll", priv->argyllcms_ok);
-#ifdef GCM_USE_VTE
+#ifdef HAVE_VTE
vte_terminal_feed_child (VTE_TERMINAL(priv->terminal), priv->argyllcms_ok, 1);
#endif
gcm_calibrate_dialog_pop (priv->calibrate_dialog);
@@ -2818,7 +2818,7 @@ gcm_calibrate_argyll_response_cb (GtkWidget *widget, GtkResponseType response, G
/* send input if waiting */
if (priv->state == GCM_CALIBRATE_ARGYLL_STATE_WAITING_FOR_STDIN) {
egg_debug ("sending 'Q' to argyll");
-#ifdef GCM_USE_VTE
+#ifdef HAVE_VTE
vte_terminal_feed_child (VTE_TERMINAL(priv->terminal), "Q", 1);
#endif
priv->state = GCM_CALIBRATE_ARGYLL_STATE_RUNNING;
@@ -2966,7 +2966,7 @@ gcm_calibrate_argyll_init (GcmCalibrateArgyll *calibrate_argyll)
calibrate_argyll->priv->screen = gcm_screen_new ();
/* add vte widget */
-#ifdef GCM_USE_VTE
+#ifdef HAVE_VTE
calibrate_argyll->priv->terminal = vte_terminal_new ();
vte_terminal_set_size (VTE_TERMINAL(calibrate_argyll->priv->terminal), 80, 10);
g_signal_connect (calibrate_argyll->priv->terminal, "child-exited",
@@ -2996,7 +2996,7 @@ gcm_calibrate_argyll_finalize (GObject *object)
g_main_loop_run (priv->loop);
}
-#ifdef GCM_USE_VTE
+#ifdef HAVE_VTE
/* we don't care if the VTE widget redraws now */
g_signal_handlers_disconnect_by_func (calibrate_argyll->priv->terminal,
G_CALLBACK (gcm_calibrate_argyll_exit_cb),
diff --git a/src/gcm-calibrate.c b/src/gcm-calibrate.c
index b94f8cb..90bfd32 100644
--- a/src/gcm-calibrate.c
+++ b/src/gcm-calibrate.c
@@ -1006,7 +1006,7 @@ gcm_calibrate_device (GcmCalibrate *calibrate, GtkWindow *window, GError **error
GtkResponseType response;
GtkWindow *window_tmp;
gchar *precision = NULL;
-#ifdef GCM_USE_PACKAGEKIT
+#ifdef HAVE_PACKAGEKIT
GtkWidget *dialog;
#endif
const gchar *title;
@@ -1018,7 +1018,7 @@ gcm_calibrate_device (GcmCalibrate *calibrate, GtkWindow *window, GError **error
/* install shared-color-targets package */
has_shared_targets = g_file_test ("/usr/share/shared-color-targets", G_FILE_TEST_IS_DIR);
if (!has_shared_targets) {
-#ifdef GCM_USE_PACKAGEKIT
+#ifdef HAVE_PACKAGEKIT
/* ask the user to confirm */
dialog = gtk_message_dialog_new (window, GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_QUESTION, GTK_BUTTONS_NONE,
/* TRANSLATORS: title, usually we can tell based on the EDID data or output name */
diff --git a/src/gcm-client.c b/src/gcm-client.c
index 5abbfd7..af9c92b 100644
--- a/src/gcm-client.c
+++ b/src/gcm-client.c
@@ -35,7 +35,7 @@
#include <libgnomeui/gnome-rr.h>
#include <cups/cups.h>
-#ifdef GCM_USE_SANE
+#ifdef HAVE_SANE
#include <sane/sane.h>
#endif
@@ -43,7 +43,7 @@
#include "gcm-device-xrandr.h"
#include "gcm-device-udev.h"
#include "gcm-device-cups.h"
-#ifdef GCM_USE_SANE
+#ifdef HAVE_SANE
#include "gcm-device-sane.h"
#endif
#include "gcm-device-virtual.h"
@@ -58,7 +58,7 @@ static void gcm_client_finalize (GObject *object);
static void gcm_client_xrandr_add (GcmClient *client, GnomeRROutput *output);
-#ifdef GCM_USE_SANE
+#ifdef HAVE_SANE
static gboolean gcm_client_coldplug_devices_sane (GcmClient *client, GError **error);
static gpointer gcm_client_coldplug_devices_sane_thrd (GcmClient *client);
#endif
@@ -382,7 +382,7 @@ out:
return ret;
}
-#ifdef GCM_USE_SANE
+#ifdef HAVE_SANE
/**
* gcm_client_sane_refresh_cb:
**/
@@ -426,7 +426,7 @@ static void
gcm_client_uevent_cb (GUdevClient *gudev_client, const gchar *action, GUdevDevice *udev_device, GcmClient *client)
{
gboolean ret;
-#ifdef GCM_USE_SANE
+#ifdef HAVE_SANE
const gchar *value;
GcmDevice *device_tmp;
guint i;
@@ -439,7 +439,7 @@ gcm_client_uevent_cb (GUdevClient *gudev_client, const gchar *action, GUdevDevic
if (ret)
egg_debug ("removed %s", g_udev_device_get_sysfs_path (udev_device));
-#ifdef GCM_USE_SANE
+#ifdef HAVE_SANE
/* we need to remove scanner devices */
value = g_udev_device_get_property (udev_device, "GCM_RESCAN");
if (g_strcmp0 (value, "scanner") == 0) {
@@ -473,7 +473,7 @@ gcm_client_uevent_cb (GUdevClient *gudev_client, const gchar *action, GUdevDevic
if (ret)
egg_debug ("added %s", g_udev_device_get_sysfs_path (udev_device));
-#ifdef GCM_USE_SANE
+#ifdef HAVE_SANE
/* we need to rescan scanner devices */
value = g_udev_device_get_property (udev_device, "GCM_RESCAN");
if (g_strcmp0 (value, "scanner") == 0) {
@@ -793,7 +793,7 @@ gcm_client_coldplug_devices_cups_thrd (GcmClient *client)
return NULL;
}
-#ifdef GCM_USE_SANE
+#ifdef HAVE_SANE
/**
* gcm_client_sane_add:
**/
@@ -928,7 +928,7 @@ gcm_client_add_unconnected_device (GcmClient *client, GKeyFile *keyfile, const g
} else if (kind == GCM_DEVICE_KIND_CAMERA) {
/* FIXME: use GPhoto? */
device = gcm_device_udev_new ();
-#ifdef GCM_USE_SANE
+#ifdef HAVE_SANE
} else if (kind == GCM_DEVICE_KIND_SCANNER) {
device = gcm_device_sane_new ();
#endif
@@ -1164,7 +1164,7 @@ gcm_client_coldplug (GcmClient *client, GcmClientColdplug coldplug, GError **err
}
}
-#ifdef GCM_USE_SANE
+#ifdef HAVE_SANE
/* SANE */
enable = g_settings_get_boolean (client->priv->settings, GCM_SETTINGS_ENABLE_SANE);
if (enable && (!coldplug || coldplug & GCM_CLIENT_COLDPLUG_SANE)) {
@@ -1541,7 +1541,7 @@ gcm_client_finalize (GObject *object)
g_object_unref (priv->settings);
if (client->priv->init_cups)
httpClose (priv->http);
-#ifdef GCM_USE_SANE
+#ifdef HAVE_SANE
if (client->priv->init_sane)
sane_exit ();
#endif
diff --git a/src/gcm-exif.c b/src/gcm-exif.c
index 8383c8e..a72619f 100644
--- a/src/gcm-exif.c
+++ b/src/gcm-exif.c
@@ -199,7 +199,7 @@ out:
return ret;
}
-#ifdef GCM_USE_EXIV
+#ifdef HAVE_EXIV
/**
* gcm_exif_parse_exiv:
**/
@@ -296,7 +296,7 @@ gcm_exif_parse (GcmExif *exif, GFile *file, GError **error)
goto out;
}
-#ifdef GCM_USE_EXIV
+#ifdef HAVE_EXIV
if (g_strcmp0 (content_type, "image/x-adobe-dng") == 0 ||
g_strcmp0 (content_type, "image/x-canon-crw") == 0 ||
g_strcmp0 (content_type, "image/x-fuji-raf") == 0 ||
diff --git a/src/gcm-prefs.c b/src/gcm-prefs.c
index 5ead7bc..b822d17 100644
--- a/src/gcm-prefs.c
+++ b/src/gcm-prefs.c
@@ -838,7 +838,7 @@ gcm_prefs_ensure_argyllcms_installed (void)
if (ret)
goto out;
-#ifndef GCM_USE_PACKAGEKIT
+#ifndef HAVE_PACKAGEKIT
egg_warning ("cannot install: this package was not compiled with --enable-packagekit");
goto out;
#endif
@@ -1587,7 +1587,7 @@ gcm_prefs_set_calibrate_button_sensitivity (void)
goto out;
}
-#ifndef GCM_USE_VTE
+#ifndef HAVE_VTE
has_vte = FALSE;
#endif
diff --git a/src/gcm-session.c b/src/gcm-session.c
index 9115ca2..78bd0ca 100644
--- a/src/gcm-session.c
+++ b/src/gcm-session.c
@@ -24,8 +24,9 @@
#include <glib/gi18n.h>
#include <gtk/gtk.h>
#include <locale.h>
+#ifdef HAVE_LIBNOTIFY
#include <libnotify/notify.h>
-
+#endif
#include "egg-debug.h"
#include "gcm-client.h"
@@ -67,6 +68,7 @@ gcm_session_check_idle_cb (gpointer user_data)
return TRUE;
}
+#ifdef HAVE_LIBNOTIFY
/**
* gcm_session_notify_cb:
**/
@@ -88,6 +90,7 @@ gcm_session_notify_cb (NotifyNotification *notification, gchar *action, gpointer
}
}
}
+#endif
/**
* gcm_session_notify_recalibrate:
diff --git a/src/gcm-utils.c b/src/gcm-utils.c
index 5c69246..e159369 100644
--- a/src/gcm-utils.c
+++ b/src/gcm-utils.c
@@ -145,7 +145,7 @@ gcm_utils_install_package (const gchar *package_name, GtkWindow *window)
g_return_val_if_fail (package_name != NULL, FALSE);
-#ifndef GCM_USE_PACKAGEKIT
+#ifndef HAVE_PACKAGEKIT
egg_warning ("cannot install %s: this package was not compiled with --enable-packagekit", package_name);
goto out;
#endif
@@ -217,7 +217,7 @@ gcm_utils_is_package_installed (const gchar *package_name)
g_return_val_if_fail (package_name != NULL, FALSE);
-#ifndef GCM_USE_PACKAGEKIT
+#ifndef HAVE_PACKAGEKIT
egg_warning ("cannot query %s: this package was not compiled with --enable-packagekit", package_name);
return TRUE;
#endif
diff --git a/src/gcm-utils.h b/src/gcm-utils.h
index b867406..ec35b9f 100644
--- a/src/gcm-utils.h
+++ b/src/gcm-utils.h
@@ -62,6 +62,25 @@
#define GCM_PREFS_PACKAGE_NAME_COLOR_PROFILES "shared-color-profiles"
#define GCM_PREFS_PACKAGE_NAME_COLOR_PROFILES_EXTRA "shared-color-profiles-extra"
+/* libnotify dummy code */
+#ifndef HAVE_LIBNOTIFY
+#define notify_init(f1) /* nothing */
+#define notify_is_initted(f1) FALSE
+#define notify_notification_close(f1,f2) TRUE
+#define notify_notification_show(f1,f2) TRUE
+#define notify_notification_set_timeout(f1,f2) /* nothing */
+#define notify_notification_set_urgency(f1,f2) /* nothing */
+#define notify_notification_add_action(f1,f2,f3,f4,f5,f6) /* nothing */
+#define NotifyNotification GtkWidget
+#define NotifyUrgency guint
+#define notify_notification_new(f1,f2,f3,f4) gtk_fixed_new()
+#define notify_notification_new_with_status_icon(f1,f2,f3,f4) gtk_fixed_new()
+#define NOTIFY_URGENCY_LOW 0
+#define NOTIFY_URGENCY_NORMAL 1
+#define NOTIFY_URGENCY_CRITICAL 2
+#define NOTIFY_EXPIRES_NEVER 0
+#endif
+
gboolean gcm_utils_mkdir_for_filename (const gchar *filename,
GError **error);
gboolean gcm_utils_mkdir_with_parents (const gchar *filename,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]