[gnome-color-manager/colord] Remove SANE support, it's moved to colord



commit 5ebac9459e0308f94d6a1385c1743cd9da1eb326
Author: Richard Hughes <richard hughsie com>
Date:   Mon Jan 17 13:51:15 2011 +0000

    Remove SANE support, it's moved to colord

 configure.ac                        |   22 ----
 contrib/gnome-color-manager.spec.in |    1 -
 src/Makefile.am                     |   12 --
 src/gcm-client.c                    |  163 -----------------------------
 src/gcm-device-sane.c               |  197 -----------------------------------
 src/gcm-device-sane.h               |   60 -----------
 6 files changed, 0 insertions(+), 455 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 6380e4b..2dfb1ec 100644
--- a/configure.ac
+++ b/configure.ac
@@ -137,27 +137,6 @@ fi
 dnl **** Check for libnotify ****
 PKG_CHECK_MODULES(NOTIFY, libnotify >= 0.7.0)
 
-dnl **** Check for SANE ****
-AC_ARG_ENABLE(sane, AS_HELP_STRING([--enable-sane],[Enable SANE support for scanner support]), enable_sane=$enableval,
-				   enable_sane=yes)
-if test x$enable_sane != xno; then
-	PKG_CHECK_MODULES(SANE, sane-backends, has_sane=yes, has_sane=no)
-	if test $has_sane = "no"; then
-		AC_CHECK_HEADER(sane/sane.h, has_sane=yes, has_sane=no)
-		if test $has_sane = "no"; then
-			AC_MSG_ERROR([Cannot fine SANE])
-		fi
-		SANE_CFLAGS=""
-		SANE_LIBS="-lsane"
-		AC_SUBST(SANE_CFLAGS)
-		AC_SUBST(SANE_LIBS)
-	fi
-fi
-AM_CONDITIONAL(HAVE_SANE, test x$enable_sane = xyes)
-if test x$enable_sane = xyes; then
-	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,
 				   enable_exiv=yes)
 dnl **** Check for EXIV ****
@@ -285,7 +264,6 @@ echo "
         cflags:                    ${CFLAGS}
         cppflags:                  ${CPPFLAGS}
         PackageKit integration:    ${enable_packagekit}
-        SANE support:              ${enable_sane}
         RAW support:               ${enable_exiv}
         VTE support:               ${has_vte}
         New LIBUSB:                ${has_new_libusb}
diff --git a/contrib/gnome-color-manager.spec.in b/contrib/gnome-color-manager.spec.in
index b88402f..1959417 100644
--- a/contrib/gnome-color-manager.spec.in
+++ b/contrib/gnome-color-manager.spec.in
@@ -30,7 +30,6 @@ BuildRequires: intltool
 BuildRequires: libgudev1-devel
 BuildRequires: libXrandr-devel
 BuildRequires: lcms2-devel
-BuildRequires: sane-backends-devel
 BuildRequires: libtiff-devel
 BuildRequires: libexif-devel
 BuildRequires: exiv2-devel
diff --git a/src/Makefile.am b/src/Makefile.am
index b0450e4..5f0aca5 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -4,7 +4,6 @@ INCLUDES =						\
 	$(GTK_CFLAGS)					\
 	$(VTE_CFLAGS)					\
 	$(XORG_CFLAGS)					\
-	$(SANE_CFLAGS)					\
 	$(TIFF_CFLAGS)					\
 	$(EXIF_CFLAGS)					\
 	$(EXIV_CFLAGS)					\
@@ -115,10 +114,6 @@ libgcmshared_a_SOURCES =				\
 	gcm-calibrate-dialog.c				\
 	gcm-calibrate-dialog.h
 
-libgcmshared_a_SOURCES +=				\
-	gcm-device-sane.c				\
-	gcm-device-sane.h
-
 libgcmshared_a_CFLAGS =					\
 	$(WARNINGFLAGS_C)
 
@@ -147,7 +142,6 @@ gcm_inspect_LDADD =					\
 	$(XORG_LIBS)					\
 	$(GTK_LIBS)					\
 	$(LCMS_LIBS)					\
-	$(SANE_LIBS)					\
 	$(COLORD_LIBS)					\
 	-lm
 
@@ -165,7 +159,6 @@ gcm_import_LDADD =					\
 	$(XORG_LIBS)					\
 	$(GTK_LIBS)					\
 	$(LCMS_LIBS)					\
-	$(SANE_LIBS)					\
 	$(COLORD_LIBS)					\
 	-lm
 
@@ -185,7 +178,6 @@ gcm_viewer_LDADD =					\
 	$(GUDEV_LIBS)					\
 	$(XORG_LIBS)					\
 	$(GTK_LIBS)					\
-	$(SANE_LIBS)					\
 	$(TIFF_LIBS)					\
 	$(LCMS_LIBS)					\
 	$(EXIF_LIBS)					\
@@ -206,7 +198,6 @@ gcm_picker_LDADD =					\
 	$(GUDEV_LIBS)					\
 	$(XORG_LIBS)					\
 	$(GTK_LIBS)					\
-	$(SANE_LIBS)					\
 	$(TIFF_LIBS)					\
 	$(USB_LIBS)					\
 	$(LCMS_LIBS)					\
@@ -230,7 +221,6 @@ gcm_session_LDADD =					\
 	$(GTK_LIBS)					\
 	$(TIFF_LIBS)					\
 	$(EXIF_LIBS)					\
-	$(SANE_LIBS)					\
 	$(NOTIFY_LIBS)					\
 	$(LCMS_LIBS)					\
 	$(COLORD_LIBS)					\
@@ -261,7 +251,6 @@ libcolor_la_LIBADD =					\
 	$(TIFF_LIBS)					\
 	$(EXIF_LIBS)					\
 	$(LCMS_LIBS)					\
-	$(SANE_LIBS)					\
 	$(NOTIFY_LIBS)					\
 	$(CANBERRA_LIBS)				\
 	$(CONTROL_CENTER_LIBS)				\
@@ -287,7 +276,6 @@ gcm_self_test_LDADD =					\
 	$(LCMS_LIBS)					\
 	$(XORG_LIBS)					\
 	$(GTK_LIBS)					\
-	$(SANE_LIBS)					\
 	$(USB_LIBS)					\
 	$(TIFF_LIBS)					\
 	$(EXIF_LIBS)					\
diff --git a/src/gcm-client.c b/src/gcm-client.c
index daf33a6..f5f6b3f 100644
--- a/src/gcm-client.c
+++ b/src/gcm-client.c
@@ -33,14 +33,7 @@
 #include <glib-object.h>
 #include <gudev/gudev.h>
 
-#ifdef HAVE_SANE
- #include <sane/sane.h>
-#endif
-
 #include "gcm-client.h"
-#ifdef HAVE_SANE
- #include "gcm-device-sane.h"
-#endif
 #include "gcm-x11-screen.h"
 #include "gcm-utils.h"
 
@@ -48,10 +41,6 @@ static void     gcm_client_finalize	(GObject     *object);
 
 #define GCM_CLIENT_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GCM_TYPE_CLIENT, GcmClientPrivate))
 
-#ifdef HAVE_SANE
-static gboolean gcm_client_coldplug_devices_sane (GcmClient *client, GError **error);
-#endif
-
 /**
  * GcmClientPrivate:
  *
@@ -65,7 +54,6 @@ struct _GcmClientPrivate
 	GSettings			*settings;
 	gboolean			 loading;
 	guint				 loading_refcount;
-	gboolean			 init_sane;
 	guint				 refresh_id;
 	guint				 emit_added_id;
 };
@@ -92,49 +80,6 @@ G_DEFINE_TYPE (GcmClient, gcm_client, G_TYPE_OBJECT)
 #define	GCM_CLIENT_SANE_REMOVED_TIMEOUT		200	/* ms */
 
 /**
- * gcm_client_set_loading:
- **/
-static void
-gcm_client_set_loading (GcmClient *client, gboolean ret)
-{
-	client->priv->loading = ret;
-	g_object_notify (G_OBJECT (client), "loading");
-	g_debug ("loading: %i", ret);
-}
-
-/**
- * gcm_client_done_loading:
- **/
-static void
-gcm_client_done_loading (GcmClient *client)
-{
-	static GStaticMutex mutex = G_STATIC_MUTEX_INIT;
-
-	/* decrement refcount, with a lock */
-	g_static_mutex_lock (&mutex);
-	client->priv->loading_refcount--;
-	if (client->priv->loading_refcount == 0)
-		gcm_client_set_loading (client, FALSE);
-	g_static_mutex_unlock (&mutex);
-}
-
-/**
- * gcm_client_add_loading:
- **/
-static void
-gcm_client_add_loading (GcmClient *client)
-{
-	static GStaticMutex mutex = G_STATIC_MUTEX_INIT;
-
-	/* decrement refcount, with a lock */
-	g_static_mutex_lock (&mutex);
-	client->priv->loading_refcount++;
-	if (client->priv->loading_refcount > 0)
-		gcm_client_set_loading (client, TRUE);
-	g_static_mutex_unlock (&mutex);
-}
-
-/**
  * gcm_client_get_devices:
  *
  * @client: a valid %GcmClient instance
@@ -347,33 +292,6 @@ out:
 	return ret;
 }
 
-#ifdef HAVE_SANE
-/**
- * gcm_client_sane_refresh_cb:
- **/
-static gboolean
-gcm_client_sane_refresh_cb (GcmClient *client)
-{
-	gboolean ret;
-	GError *error = NULL;
-
-	/* inform UI if we are loading devices still */
-	client->priv->loading_refcount = 1;
-	gcm_client_set_loading (client, TRUE);
-
-	/* rescan */
-	g_debug ("rescanning sane");
-	ret = gcm_client_coldplug_devices_sane (client, &error);
-	if (!ret) {
-		g_debug ("failed to rescan sane devices: %s", error->message);
-		g_error_free (error);
-		goto out;
-	}
-out:
-	return FALSE;
-}
-#endif
-
 /**
  * gcm_client_uevent_cb:
  **/
@@ -599,84 +517,8 @@ out:
 		g_object_unref (device);
 }
 
-/**
- * gcm_client_coldplug_devices_sane:
- **/
-static gboolean
-gcm_client_coldplug_devices_sane (GcmClient *client, GError **error)
-{
-	gint i;
-	gboolean ret = TRUE;
-	SANE_Status status;
-	const SANE_Device **device_list;
-
-	/* force sane to drop it's cache of devices -- yes, it is that crap */
-	if (client->priv->init_sane) {
-		sane_exit ();
-		client->priv->init_sane = FALSE;
-	}
-	status = sane_init (NULL, NULL);
-	if (status != SANE_STATUS_GOOD) {
-		ret = FALSE;
-		g_set_error (error, 1, 0, "failed to init SANE: %s", sane_strstatus (status));
-		goto out;
-	}
-	client->priv->init_sane = TRUE;
-
-	/* get scanners on the local server */
-	status = sane_get_devices (&device_list, FALSE);
-	if (status != SANE_STATUS_GOOD) {
-		ret = FALSE;
-		g_set_error (error, 1, 0, "failed to get devices from SANE: %s", sane_strstatus (status));
-		goto out;
-	}
-
-	/* nothing */
-	if (device_list == NULL || device_list[0] == NULL) {
-		g_debug ("no devices to add");
-		goto out;
-	}
-
-	/* add them */
-	for (i=0; device_list[i] != NULL; i++)
-		gcm_client_sane_add (client, device_list[i]);
-out:
-	/* inform the UI */
-	gcm_client_done_loading (client);
-	return ret;
-}
-
 #endif
 
-/**
- * gcm_client_coldplug:
- **/
-gboolean
-gcm_client_coldplug (GcmClient *client, GcmClientColdplug coldplug, GError **error)
-{
-	gboolean ret = TRUE;
-	gboolean enable;
-
-	g_return_val_if_fail (GCM_IS_CLIENT (client), FALSE);
-
-	/* reset */
-	client->priv->loading_refcount = 0;
-
-#ifdef HAVE_SANE
-	/* SANE */
-	enable = g_settings_get_boolean (client->priv->settings, GCM_SETTINGS_ENABLE_SANE);
-	if (enable && (!coldplug || coldplug & GCM_CLIENT_COLDPLUG_SANE)) {
-		gcm_client_add_loading (client);
-		g_debug ("adding devices of type SANE");
-		ret = gcm_client_coldplug_devices_sane (client, error);
-		if (!ret)
-			goto out;
-	}
-#endif
-out:
-	return ret;
-}
-
 typedef struct {
 	GcmClient *client;
 	GcmDevice *device;
@@ -957,7 +799,6 @@ gcm_client_init (GcmClient *client)
 	client->priv = GCM_CLIENT_GET_PRIVATE (client);
 	client->priv->display_name = NULL;
 	client->priv->loading_refcount = 0;
-	client->priv->init_sane = FALSE;
 	client->priv->settings = g_settings_new (GCM_SETTINGS_SCHEMA);
 	client->priv->array = g_ptr_array_new_with_free_func ((GDestroyNotify) g_object_unref);
 
@@ -994,10 +835,6 @@ gcm_client_finalize (GObject *object)
 	g_ptr_array_unref (priv->array);
 	g_object_unref (priv->gudev_client);
 	g_object_unref (priv->settings);
-#ifdef HAVE_SANE
-	if (client->priv->init_sane)
-		sane_exit ();
-#endif
 
 	G_OBJECT_CLASS (gcm_client_parent_class)->finalize (object);
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]