[gnome-color-manager] Remove the device registration functionality, it's been moved to gnome-settings-daemon



commit 88c73df3186fa857517a4251e21fe11210bb8186
Author: Richard Hughes <richard hughsie com>
Date:   Wed Jun 1 14:50:08 2011 +0100

    Remove the device registration functionality, it's been moved to gnome-settings-daemon

 data/tests/LG-L225W-External.bin   |  Bin 128 -> 0 bytes
 data/tests/Lenovo-T61-Internal.bin |  Bin 128 -> 0 bytes
 data/tests/Makefile.am             |    4 +-
 src/Makefile.am                    |   12 +-
 src/gcm-calibrate-argyll.c         |   15 -
 src/gcm-clut.c                     |  115 +-----
 src/gcm-clut.h                     |    6 -
 src/gcm-dmi.c                      |  220 ---------
 src/gcm-dmi.h                      |   66 ---
 src/gcm-edid.c                     |  633 -------------------------
 src/gcm-edid.h                     |   82 ----
 src/gcm-inspect.c                  |  127 +++++-
 src/gcm-self-test.c                |  258 ----------
 src/gcm-session.c                  |  907 ------------------------------------
 src/gcm-tables.c                   |  202 --------
 src/gcm-tables.h                   |   66 ---
 src/gcm-x11-output.c               |  499 --------------------
 src/gcm-x11-output.h               |  109 -----
 src/gcm-x11-screen.c               |  812 --------------------------------
 src/gcm-x11-screen.h               |  107 -----
 src/org.gnome.ColorManager.xml     |   32 --
 21 files changed, 117 insertions(+), 4155 deletions(-)
---
diff --git a/data/tests/Makefile.am b/data/tests/Makefile.am
index 2858ea9..5cbcc54 100644
--- a/data/tests/Makefile.am
+++ b/data/tests/Makefile.am
@@ -12,9 +12,7 @@ TEST_FILES =						\
 	image-widget-nonembed.png			\
 	image-widget-output.png				\
 	image-widget.png				\
-	trc-widget.png					\
-	Lenovo-T61-Internal.bin				\
-	LG-L225W-External.bin
+	trc-widget.png
 
 EXTRA_DIST =						\
 	$(TEST_FILES)
diff --git a/src/Makefile.am b/src/Makefile.am
index 0913751..174e921 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -35,10 +35,6 @@ libgcmshared_a_SOURCES =				\
 	gcm-clut.h					\
 	gcm-debug.c					\
 	gcm-debug.h					\
-	gcm-dmi.c					\
-	gcm-dmi.h					\
-	gcm-edid.c					\
-	gcm-edid.h					\
 	gcm-exif.c					\
 	gcm-exif.h					\
 	gcm-image.c					\
@@ -49,16 +45,10 @@ libgcmshared_a_SOURCES =				\
 	gcm-profile.h					\
 	gcm-named-color.c				\
 	gcm-named-color.h				\
-	gcm-tables.c					\
-	gcm-tables.h					\
 	gcm-trc-widget.c				\
 	gcm-trc-widget.h				\
 	gcm-utils.c					\
-	gcm-utils.h					\
-	gcm-x11-output.c				\
-	gcm-x11-output.h				\
-	gcm-x11-screen.c				\
-	gcm-x11-screen.h
+	gcm-utils.h
 
 if HAVE_CLUTTER
 libgcmshared_a_SOURCES +=				\
diff --git a/src/gcm-calibrate-argyll.c b/src/gcm-calibrate-argyll.c
index 4e1caaa..f97d188 100644
--- a/src/gcm-calibrate-argyll.c
+++ b/src/gcm-calibrate-argyll.c
@@ -36,7 +36,6 @@
 
 #include "gcm-calibrate-argyll.h"
 #include "gcm-utils.h"
-#include "gcm-x11-screen.h"
 #include "gcm-print.h"
 
 #define FIXED_ARGYLL
@@ -66,7 +65,6 @@ struct _GcmCalibrateArgyllPrivate
 	GtkWidget			*terminal;
 	pid_t				 child_pid;
 	GtkResponseType			 response;
-	GcmX11Screen			*screen;
 	glong				 vte_previous_row;
 	glong				 vte_previous_col;
 	gboolean			 already_on_window;
@@ -402,7 +400,6 @@ gcm_calibrate_argyll_display_neutralise (GcmCalibrateArgyll *calibrate_argyll, G
 	gchar kind;
 	gchar *command = NULL;
 	gchar **argv = NULL;
-	GcmX11Output *output;
 	GPtrArray *array = NULL;
 	gchar *basename = NULL;
 	const gchar *output_name;
@@ -429,13 +426,6 @@ gcm_calibrate_argyll_display_neutralise (GcmCalibrateArgyll *calibrate_argyll, G
 		goto out;
 	}
 
-	/* get the device */
-	output = gcm_x11_screen_get_output_by_name (priv->screen, output_name, error);
-	if (output == NULL) {
-		ret = FALSE;
-		goto out;
-	}
-
 	/* get l-cd or c-rt */
 	kind = gcm_calibrate_argyll_get_display_kind (calibrate_argyll);
 
@@ -2738,10 +2728,6 @@ gcm_calibrate_argyll_init (GcmCalibrateArgyll *calibrate_argyll)
 	g_signal_connect (calibrate_argyll->priv->print, "status-changed",
 			  G_CALLBACK (gcm_calibrate_argyll_status_changed_cb), calibrate_argyll);
 
-	/* get screen */
-	calibrate_argyll->priv->screen = gcm_x11_screen_new ();
-	gcm_x11_screen_assign (calibrate_argyll->priv->screen, NULL, NULL);
-
 	/* add vte widget */
 #ifdef HAVE_VTE
 	calibrate_argyll->priv->terminal = vte_terminal_new ();
@@ -2785,7 +2771,6 @@ gcm_calibrate_argyll_finalize (GObject *object)
 		g_source_remove (priv->keypress_id);
 
 	g_main_loop_unref (priv->loop);
-	g_object_unref (priv->screen);
 	g_object_unref (priv->print);
 
 	G_OBJECT_CLASS (gcm_calibrate_argyll_parent_class)->finalize (object);
diff --git a/src/gcm-clut.c b/src/gcm-clut.c
index 4d8f36c..25f2c66 100644
--- a/src/gcm-clut.c
+++ b/src/gcm-clut.c
@@ -40,51 +40,16 @@ struct _GcmClutPrivate
 {
 	GPtrArray 			*array;
 	guint				 size;
-	gdouble				 gamma;
-	gdouble				 brightness;
-	gdouble				 contrast;
 };
 
 enum {
 	PROP_0,
 	PROP_SIZE,
-	PROP_ID,
-	PROP_GAMMA,
-	PROP_BRIGHTNESS,
-	PROP_CONTRAST,
-	PROP_COPYRIGHT,
-	PROP_DESCRIPTION,
 	PROP_LAST
 };
 
 G_DEFINE_TYPE (GcmClut, gcm_clut, G_TYPE_OBJECT)
 
-#if 0
-/**
- * gcm_clut_set_source_data:
- **/
-static gboolean
-gcm_clut_set_source_data (GcmClut *clut, const GcmClutData *data, guint size)
-{
-	guint i;
-	GcmClutData *tmp;
-
-	g_return_val_if_fail (GCM_IS_CLUT (clut), FALSE);
-	g_return_val_if_fail (data != NULL, FALSE);
-
-	/* copy each element into the array */
-	for (i=0; i<size; i++) {
-		tmp = g_new0 (GcmClutData, 1);
-		tmp->red = data[i].red;
-		tmp->green = data[i].green;
-		tmp->blue = data[i].blue;
-		g_ptr_array_add (clut->priv->array, tmp);
-	}
-
-	return TRUE;
-}
-#endif
-
 /**
  * gcm_clut_set_source_array:
  **/
@@ -120,21 +85,6 @@ gcm_clut_reset (GcmClut *clut)
 }
 
 /**
- * gcm_clut_get_adjusted_value:
- **/
-static guint
-gcm_clut_get_adjusted_value (guint value, gdouble min, gdouble max, gdouble custom_gamma)
-{
-	guint retval;
-
-	/* optimise for the common case */
-	if (min < 0.01f && max > 0.99f && custom_gamma > 0.99 && custom_gamma < 1.01)
-		return value;
-	retval = 65536.0f * ((powf (((gdouble)value/65536.0f), custom_gamma) * (max - min)) + min);
-	return retval;
-}
-
-/**
  * gcm_clut_get_size:
  **/
 guint
@@ -154,16 +104,8 @@ gcm_clut_get_array (GcmClut *clut)
 	guint value;
 	const GcmClutData *tmp;
 	GcmClutData *data;
-	gdouble min;
-	gdouble max;
-	gdouble custom_gamma;
 
 	g_return_val_if_fail (GCM_IS_CLUT (clut), FALSE);
-	g_return_val_if_fail (clut->priv->gamma != 0, FALSE);
-
-	min = clut->priv->brightness / 100.0f;
-	max = (1.0f - min) * (clut->priv->contrast / 100.0f) + min;
-	custom_gamma = clut->priv->gamma;
 
 	array = g_ptr_array_new_with_free_func (g_free);
 	if (clut->priv->array->len == 0) {
@@ -172,9 +114,9 @@ gcm_clut_get_array (GcmClut *clut)
 		for (i=0; i<clut->priv->size; i++) {
 			value = (i * 0xffff) / (clut->priv->size - 1);
 			data = g_new0 (GcmClutData, 1);
-			data->red = gcm_clut_get_adjusted_value (value, min, max, custom_gamma);
-			data->green = gcm_clut_get_adjusted_value (value, min, max, custom_gamma);
-			data->blue = gcm_clut_get_adjusted_value (value, min, max, custom_gamma);
+			data->red = value;
+			data->green = value;
+			data->blue = value;
 			g_ptr_array_add (array, data);
 		}
 	} else {
@@ -182,9 +124,9 @@ gcm_clut_get_array (GcmClut *clut)
 		for (i=0; i<clut->priv->size; i++) {
 			tmp = g_ptr_array_index (clut->priv->array, i);
 			data = g_new0 (GcmClutData, 1);
-			data->red = gcm_clut_get_adjusted_value (tmp->red, min, max, custom_gamma);
-			data->green = gcm_clut_get_adjusted_value (tmp->green, min, max, custom_gamma);
-			data->blue = gcm_clut_get_adjusted_value (tmp->blue, min, max, custom_gamma);
+			data->red = tmp->red;
+			data->green = tmp->green;
+			data->blue = tmp->blue;
 			g_ptr_array_add (array, data);
 		}
 	}
@@ -222,15 +164,6 @@ gcm_clut_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec
 	case PROP_SIZE:
 		g_value_set_uint (value, priv->size);
 		break;
-	case PROP_GAMMA:
-		g_value_set_double (value, priv->gamma);
-		break;
-	case PROP_BRIGHTNESS:
-		g_value_set_double (value, priv->brightness);
-		break;
-	case PROP_CONTRAST:
-		g_value_set_double (value, priv->contrast);
-		break;
 	default:
 		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
 		break;
@@ -250,15 +183,6 @@ gcm_clut_set_property (GObject *object, guint prop_id, const GValue *value, GPar
 	case PROP_SIZE:
 		priv->size = g_value_get_uint (value);
 		break;
-	case PROP_GAMMA:
-		priv->gamma = g_value_get_double (value);
-		break;
-	case PROP_BRIGHTNESS:
-		priv->brightness = g_value_get_double (value);
-		break;
-	case PROP_CONTRAST:
-		priv->contrast = g_value_get_double (value);
-		break;
 	default:
 		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
 		break;
@@ -285,30 +209,6 @@ gcm_clut_class_init (GcmClutClass *klass)
 				   G_PARAM_READWRITE);
 	g_object_class_install_property (object_class, PROP_SIZE, pspec);
 
-	/**
-	 * GcmClut:gamma:
-	 */
-	pspec = g_param_spec_double ("gamma", NULL, NULL,
-				     0.0, G_MAXDOUBLE, 1.01,
-				     G_PARAM_READWRITE);
-	g_object_class_install_property (object_class, PROP_GAMMA, pspec);
-
-	/**
-	 * GcmClut:brightness:
-	 */
-	pspec = g_param_spec_double ("brightness", NULL, NULL,
-				     0.0, G_MAXDOUBLE, 1.02,
-				     G_PARAM_READWRITE);
-	g_object_class_install_property (object_class, PROP_BRIGHTNESS, pspec);
-
-	/**
-	 * GcmClut:contrast:
-	 */
-	pspec = g_param_spec_double ("contrast", NULL, NULL,
-				     0.0, G_MAXDOUBLE, 1.03,
-				     G_PARAM_READWRITE);
-	g_object_class_install_property (object_class, PROP_CONTRAST, pspec);
-
 	g_type_class_add_private (klass, sizeof (GcmClutPrivate));
 }
 
@@ -320,9 +220,6 @@ gcm_clut_init (GcmClut *clut)
 {
 	clut->priv = GCM_CLUT_GET_PRIVATE (clut);
 	clut->priv->array = g_ptr_array_new_with_free_func (g_free);
-	clut->priv->gamma = 1.0;
-	clut->priv->brightness = 0.0f;
-	clut->priv->contrast = 100.f;
 }
 
 /**
diff --git a/src/gcm-clut.h b/src/gcm-clut.h
index e589735..1c81199 100644
--- a/src/gcm-clut.h
+++ b/src/gcm-clut.h
@@ -46,12 +46,6 @@ struct _GcmClut
 struct _GcmClutClass
 {
 	GObjectClass	parent_class;
-	/* padding for future expansion */
-	void (*_gcm_reserved1) (void);
-	void (*_gcm_reserved2) (void);
-	void (*_gcm_reserved3) (void);
-	void (*_gcm_reserved4) (void);
-	void (*_gcm_reserved5) (void);
 };
 
 typedef struct {
diff --git a/src/gcm-inspect.c b/src/gcm-inspect.c
index 0ae0315..b7975f8 100644
--- a/src/gcm-inspect.c
+++ b/src/gcm-inspect.c
@@ -27,8 +27,6 @@
 
 #include "gcm-utils.h"
 #include "gcm-profile.h"
-#include "gcm-x11-output.h"
-#include "gcm-x11-screen.h"
 #include "gcm-debug.h"
 
 /**
@@ -64,6 +62,108 @@ out:
 	return ret;
 }
 
+static gboolean
+gcm_inspect_get_screen_protocol_version (GdkWindow *gdk_window,
+					 guint *major,
+					 guint *minor,
+					 GError **error)
+{
+	gboolean ret;
+	gint length;
+	gint rc;
+	guchar *data_tmp = NULL;
+
+	/* get the value */
+	gdk_error_trap_push ();
+	ret = gdk_property_get (gdk_window,
+				gdk_atom_intern_static_string ("_ICC_PROFILE_IN_X_VERSION"),
+				gdk_atom_intern_static_string ("CARDINAL"),
+				0,
+				G_MAXLONG,
+				FALSE,
+				NULL,
+				NULL,
+				&length,
+				&data_tmp);
+	if (!ret) {
+		g_set_error_literal (error, 1, 0, "failed to get property");
+		goto out;
+	}
+	rc = gdk_error_trap_pop ();
+	if (rc != 0) {
+		ret = FALSE;
+		g_set_error (error, 1, 0, "failed to get atom: %i", rc);
+		goto out;
+	}
+
+	/* was nothing found */
+	if (length == 0) {
+		ret = FALSE;
+		g_set_error (error, 1, 0, "icc profile atom has not been set");
+		goto out;
+	}
+
+	/* set total */
+	*major = (guint) data_tmp[0] / 100;
+	*minor = (guint) data_tmp[0] % 100;
+
+	/* success */
+	ret = TRUE;
+out:
+	if (data_tmp != NULL)
+		g_free (data_tmp);
+	return ret;
+}
+
+static gboolean
+gcm_inspect_get_screen_profile_data (GdkWindow *gdk_window,
+				     guint8 **data,
+				     gsize *length,
+				     GError **error)
+{
+	gboolean ret;
+	gint rc;
+	gint length_tmp;
+
+	/* get the value */
+	gdk_error_trap_push ();
+	ret = gdk_property_get (gdk_window,
+				gdk_atom_intern_static_string ("_ICC_PROFILE"),
+				gdk_atom_intern_static_string ("CARDINAL"),
+				0,
+				G_MAXLONG,
+				FALSE,
+				NULL,
+				NULL,
+				&length_tmp,
+				(guchar **) data);
+	if (!ret) {
+		g_set_error_literal (error, 1, 0, "failed to get property");
+		goto out;
+	}
+	rc = gdk_error_trap_pop ();
+	if (rc != 0) {
+		ret = FALSE;
+		g_set_error (error, 1, 0, "failed to get icc profile atom: %i", rc);
+		goto out;
+	}
+
+	/* was nothing found */
+	if (length_tmp == 0) {
+		ret = FALSE;
+		g_set_error (error, 1, 0, "icc profile atom has not been set");
+		goto out;
+	}
+
+	/* proxy size */
+	*length = length_tmp;
+
+	/* success */
+	ret = TRUE;
+out:
+	return ret;
+}
+
 /**
  * gcm_inspect_show_x11_atoms:
  **/
@@ -72,23 +172,17 @@ gcm_inspect_show_x11_atoms (void)
 {
 	gboolean ret;
 	guint8 *data = NULL;
-	gsize length;
-	GcmX11Screen *screen = NULL;
+	gsize length = 0;
 	GError *error = NULL;
-	guint major;
-	guint minor;
+	guint major = -1;
+	guint minor = -1;
+	GdkWindow *gdk_window;
 
 	/* setup object to access X */
-	screen = gcm_x11_screen_new ();
-	ret = gcm_x11_screen_assign (screen, NULL, &error);
-	if (!ret) {
-		g_warning ("failed to get outputs: %s", error->message);
-		g_error_free (error);
-		goto out;
-	}
+	gdk_window = gdk_screen_get_root_window (gdk_screen_get_default ());
 
 	/* get profile from XServer */
-	ret = gcm_x11_screen_get_profile_data (screen, &data, &length, &error);
+	ret = gcm_inspect_get_screen_profile_data (gdk_window, &data, &length, &error);
 	if (!ret) {
 		g_warning ("failed to get XServer profile data: %s", error->message);
 		g_error_free (error);
@@ -100,7 +194,7 @@ gcm_inspect_show_x11_atoms (void)
 	}
 
 	/* get profile from XServer */
-	ret = gcm_x11_screen_get_protocol_version (screen, &major, &minor, &error);
+	ret = gcm_inspect_get_screen_protocol_version (gdk_window, &major, &minor, &error);
 	if (!ret) {
 		g_warning ("failed to get XServer protocol version: %s", error->message);
 		g_error_free (error);
@@ -110,10 +204,7 @@ gcm_inspect_show_x11_atoms (void)
 		/* TRANSLATORS: the root window of all the screens */
 		g_print ("%s %i.%i\n", _("Root window protocol version:"), major, minor);
 	}
-out:
 	g_free (data);
-	if (screen != NULL)
-		g_object_unref (screen);
 	return ret;
 }
 
diff --git a/src/gcm-self-test.c b/src/gcm-self-test.c
index 29a2fba..308995e 100644
--- a/src/gcm-self-test.c
+++ b/src/gcm-self-test.c
@@ -32,8 +32,6 @@
 #include "gcm-cie-widget.h"
 #include "gcm-clut.h"
 #include "gcm-debug.h"
-#include "gcm-dmi.h"
-#include "gcm-edid.h"
 #include "gcm-exif.h"
 #include "gcm-gamma-widget.h"
 #include "gcm-hull.h"
@@ -42,123 +40,8 @@
 #include "gcm-print.h"
 #include "gcm-profile.h"
 #include "gcm-sample-window.h"
-#include "gcm-tables.h"
 #include "gcm-trc-widget.h"
 #include "gcm-utils.h"
-#include "gcm-x11-output.h"
-#include "gcm-x11-screen.h"
-
-#define TEST_MAIN_OUTPUT	"LVDS1"
-
-typedef struct {
-	const gchar *monitor_name;
-	const gchar *vendor_name;
-	const gchar *serial_number;
-	const gchar *eisa_id;
-	const gchar *checksum;
-	const gchar *pnp_id;
-	guint width;
-	guint height;
-	gfloat gamma;
-} GcmEdidTestData;
-
-static void
-gcm_test_edid_test_parse_edid_file (GcmEdid *edid, const gchar *filename, GcmEdidTestData *test_data)
-{
-	gchar *data;
-	gfloat mygamma;
-	gboolean ret;
-	GError *error = NULL;
-	gsize length = 0;
-
-	ret = g_file_get_contents (filename, &data, &length, &error);
-	g_assert_no_error (error);
-	g_assert (ret);
-
-	ret = gcm_edid_parse (edid, (const guint8 *) data, length, &error);
-	g_assert_no_error (error);
-	g_assert (ret);
-
-	g_assert_cmpstr (gcm_edid_get_monitor_name (edid), ==, test_data->monitor_name);
-	g_assert_cmpstr (gcm_edid_get_vendor_name (edid), ==, test_data->vendor_name);
-	g_assert_cmpstr (gcm_edid_get_serial_number (edid), ==, test_data->serial_number);
-	g_assert_cmpstr (gcm_edid_get_eisa_id (edid), ==, test_data->eisa_id);
-	g_assert_cmpstr (gcm_edid_get_checksum (edid), ==, test_data->checksum);
-	g_assert_cmpstr (gcm_edid_get_pnp_id (edid), ==, test_data->pnp_id);
-	g_assert_cmpint (gcm_edid_get_height (edid), ==, test_data->height);
-	g_assert_cmpint (gcm_edid_get_width (edid), ==, test_data->width);
-	mygamma = gcm_edid_get_gamma (edid);
-	g_assert_cmpfloat (mygamma, >=, test_data->gamma - 0.01);
-	g_assert_cmpfloat (mygamma, <, test_data->gamma + 0.01);
-
-	g_free (data);
-}
-
-static void
-gcm_test_edid_func (void)
-{
-	GcmEdid *edid;
-	GcmEdidTestData test_data;
-
-	edid = gcm_edid_new ();
-	g_assert (edid != NULL);
-
-	/* LG 21" LCD panel */
-	test_data.monitor_name = "L225W";
-	test_data.vendor_name = "Goldstar Company Ltd";
-	test_data.serial_number = "34398";
-	test_data.eisa_id = NULL;
-	test_data.checksum = "80b7dda4c74b06366abb8fa23e71d645";
-	test_data.pnp_id = "GSM";
-	test_data.height = 30;
-	test_data.width = 47;
-	test_data.gamma = 2.2f;
-	gcm_test_edid_test_parse_edid_file (edid, TESTDATADIR "/LG-L225W-External.bin", &test_data);
-
-	/* Lenovo T61 Intel Panel */
-	test_data.monitor_name = NULL;
-	test_data.vendor_name = "IBM France";
-	test_data.serial_number = NULL;
-	test_data.eisa_id = "LTN154P2-L05";
-	test_data.checksum = "c585d9e80adc65c54f0a52597e850f83";
-	test_data.pnp_id = "IBM";
-	test_data.height = 21;
-	test_data.width = 33;
-	test_data.gamma = 2.2f;
-	gcm_test_edid_test_parse_edid_file (edid, TESTDATADIR "/Lenovo-T61-Internal.bin", &test_data);
-
-	g_object_unref (edid);
-}
-
-static void
-gcm_test_tables_func (void)
-{
-	GcmTables *tables;
-	GError *error = NULL;
-	gchar *vendor;
-
-	tables = gcm_tables_new ();
-	g_assert (tables != NULL);
-
-	vendor = gcm_tables_get_pnp_id (tables, "IBM", &error);
-	g_assert_no_error (error);
-	g_assert (vendor != NULL);
-	g_assert_cmpstr (vendor, ==, "IBM France");
-	g_free (vendor);
-
-	vendor = gcm_tables_get_pnp_id (tables, "MIL", &error);
-	g_assert_no_error (error);
-	g_assert (vendor != NULL);
-	g_assert_cmpstr (vendor, ==, "Marconi Instruments Ltd");
-	g_free (vendor);
-
-	vendor = gcm_tables_get_pnp_id (tables, "XXX", &error);
-	g_assert_error (error, 1, 0);
-	g_assert_cmpstr (vendor, ==, NULL);
-	g_free (vendor);
-
-	g_object_unref (tables);
-}
 
 static void
 gcm_test_hull_func (void)
@@ -372,8 +255,6 @@ gcm_test_clut_func (void)
 	/* set some initial properties */
 	g_object_set (clut,
 		      "size", 3,
-		      "contrast", 100.0f,
-		      "brightness", 0.0f,
 		      NULL);
 
 	array = gcm_clut_get_array (clut);
@@ -396,71 +277,10 @@ gcm_test_clut_func (void)
 
 	g_ptr_array_unref (array);
 
-	/* set some initial properties */
-	g_object_set (clut,
-		      "contrast", 99.0f,
-		      "brightness", 0.0f,
-		      NULL);
-
-	array = gcm_clut_get_array (clut);
-	g_assert_cmpint (array->len, ==, 3);
-
-	data = g_ptr_array_index (array, 0);
-	g_assert_cmpint (data->red, ==, 0);
-	g_assert_cmpint (data->green, ==, 0);
-	g_assert_cmpint (data->blue, ==, 0);
-	data = g_ptr_array_index (array, 1);
-	g_assert_cmpint (data->red, ==, 32439);
-	g_assert_cmpint (data->green, ==, 32439);
-	g_assert_cmpint (data->blue, ==, 32439);
-	data = g_ptr_array_index (array, 2);
-	g_assert_cmpint (data->red, ==, 64879);
-	g_assert_cmpint (data->green, ==, 64879);
-	g_assert_cmpint (data->blue, ==, 64879);
-
-	g_ptr_array_unref (array);
-
-	/* set some initial properties */
-	g_object_set (clut,
-		      "contrast", 100.0f,
-		      "brightness", 1.0f,
-		      NULL);
-
-	array = gcm_clut_get_array (clut);
-	g_assert_cmpint (array->len, ==, 3);
-
-	data = g_ptr_array_index (array, 0);
-	g_assert_cmpint (data->red, ==, 655);
-	g_assert_cmpint (data->green, ==, 655);
-	g_assert_cmpint (data->blue, ==, 655);
-	data = g_ptr_array_index (array, 1);
-	g_assert_cmpint (data->red, ==, 33094);
-	g_assert_cmpint (data->green, ==, 33094);
-	g_assert_cmpint (data->blue, ==, 33094);
-	data = g_ptr_array_index (array, 2);
-	g_assert_cmpint (data->red, ==, 65535);
-	g_assert_cmpint (data->green, ==, 65535);
-	g_assert_cmpint (data->blue, ==, 65535);
-
-	g_ptr_array_unref (array);
-
 	g_object_unref (clut);
 }
 
 static void
-gcm_test_dmi_func (void)
-{
-	GcmDmi *dmi;
-
-	dmi = gcm_dmi_new ();
-	g_assert (dmi != NULL);
-	g_assert (gcm_dmi_get_name (dmi) != NULL);
-//	g_assert (gcm_dmi_get_version (dmi) != NULL);
-	g_assert (gcm_dmi_get_vendor (dmi) != NULL);
-	g_object_unref (dmi);
-}
-
-static void
 gcm_test_brightness_func (void)
 {
 	GcmBrightness *brightness;
@@ -557,40 +377,6 @@ gcm_test_image_func (void)
 	gtk_widget_destroy (dialog);
 }
 
-static void
-gcm_test_x11_func (void)
-{
-	GcmX11Screen *screen;
-	GcmX11Output *output;
-	guint x, y;
-	guint width, height;
-	GError *error = NULL;
-	gboolean ret;
-
-	/* new object */
-	screen = gcm_x11_screen_new ();
-	ret = gcm_x11_screen_assign (screen, NULL, &error);
-	g_assert_no_error (error);
-	g_assert (ret);
-
-	/* get object */
-	output = gcm_x11_screen_get_output_by_name (screen, TEST_MAIN_OUTPUT, &error);
-	g_assert_no_error (error);
-	g_assert (output != NULL);
-
-	/* check parameters */
-	gcm_x11_output_get_position (output, &x, &y);
-//	g_assert_cmpint (x, ==, 0);
-//	g_assert_cmpint (y, ==, 0);
-	gcm_x11_output_get_size (output, &width, &height);
-	g_assert_cmpint (width, >, 0);
-	g_assert_cmpint (height, >, 0);
-	g_assert (gcm_x11_output_get_connected (output));
-
-	g_object_unref (output);
-	g_object_unref (screen);
-}
-
 static gboolean
 gcm_test_sample_window_loop_cb (GMainLoop *loop)
 {
@@ -599,45 +385,6 @@ gcm_test_sample_window_loop_cb (GMainLoop *loop)
 }
 
 static void
-gcm_test_sample_window_move_window (GtkWindow *window, const gchar *output_name)
-{
-	GcmX11Screen *screen;
-	GcmX11Output *output = NULL;
-	guint x, y;
-	guint width, height;
-	gint window_width, window_height;
-	GError *error = NULL;
-	gboolean ret;
-
-	/* get new screen */
-	screen = gcm_x11_screen_new ();
-	ret = gcm_x11_screen_assign (screen, NULL, &error);
-	if (!ret) {
-		g_warning ("failed to assign screen: %s", error->message);
-		g_error_free (error);
-		goto out;
-	}
-
-	/* get output */
-	output = gcm_x11_screen_get_output_by_name (screen, output_name, &error);
-	if (output == NULL) {
-		g_warning ("failed to get output: %s", error->message);
-		g_error_free (error);
-		goto out;
-	}
-
-	/* center the window on this output */
-	gcm_x11_output_get_position (output, &x, &y);
-	gcm_x11_output_get_size (output, &width, &height);
-	gtk_window_get_size (window, &window_width, &window_height);
-	gtk_window_move (window, x + ((width - window_width) / 2), y + ((height - window_height) / 2));
-out:
-	if (output != NULL)
-		g_object_unref (output);
-	g_object_unref (screen);
-}
-
-static void
 gcm_test_sample_window_func (void)
 {
 	GtkWindow *window;
@@ -653,7 +400,6 @@ gcm_test_sample_window_func (void)
 	gcm_sample_window_set_percentage (GCM_SAMPLE_WINDOW (window), GCM_SAMPLE_WINDOW_PERCENTAGE_PULSE);
 
 	/* move to the center of device lvds1 */
-	gcm_test_sample_window_move_window (window, TEST_MAIN_OUTPUT);
 	gtk_window_present (window);
 
 	loop = g_main_loop_new (NULL, FALSE);
@@ -1039,12 +785,8 @@ main (int argc, char **argv)
 	g_test_add_func ("/color/exif", gcm_test_exif_func);
 	g_test_add_func ("/color/utils", gcm_test_utils_func);
 	g_test_add_func ("/color/hull", gcm_test_hull_func);
-	g_test_add_func ("/color/edid", gcm_test_edid_func);
-	g_test_add_func ("/color/tables", gcm_test_tables_func);
 	g_test_add_func ("/color/profile", gcm_test_profile_func);
 	g_test_add_func ("/color/clut", gcm_test_clut_func);
-	g_test_add_func ("/color/dmi", gcm_test_dmi_func);
-	g_test_add_func ("/color/x11", gcm_test_x11_func);
 	g_test_add_func ("/color/sample-window", gcm_test_sample_window_func);
 	if (g_test_thorough ()) {
 		g_test_add_func ("/color/brightness", gcm_test_brightness_func);
diff --git a/src/gcm-session.c b/src/gcm-session.c
index 3d3e8e3..26bce60 100644
--- a/src/gcm-session.c
+++ b/src/gcm-session.c
@@ -29,670 +29,16 @@
 #include <lcms2.h>
 
 #include "gcm-debug.h"
-#include "gcm-dmi.h"
 #include "gcm-exif.h"
 #include "gcm-utils.h"
-#include "gcm-x11-output.h"
-#include "gcm-x11-screen.h"
 
 typedef struct {
 	CdClient	*client;
-	GcmDmi		*dmi;
-	GcmX11Screen	*x11_screen;
 	GDBusConnection	*connection;
 	GDBusNodeInfo	*introspection;
 	GMainLoop	*loop;
 } GcmSessionPrivate;
 
-#define GCM_ICC_PROFILE_IN_X_VERSION_MAJOR	0
-#define GCM_ICC_PROFILE_IN_X_VERSION_MINOR	3
-
-/**
- * gcm_session_get_output_id:
- **/
-static gchar *
-gcm_session_get_output_id (GcmX11Output *output)
-{
-	const gchar *name;
-	const gchar *serial;
-	const gchar *vendor;
-	GcmEdid *edid = NULL;
-	GString *device_id;
-	GError *error = NULL;
-
-	/* all output devices are prefixed with this */
-	device_id = g_string_new ("xrandr");
-
-	/* get the output EDID if possible */
-	edid = gcm_x11_output_get_edid (output, &error);
-	if (edid == NULL) {
-		g_debug ("no edid for %s [%s], falling back to connection name",
-			 gcm_x11_output_get_name (output),
-			 error->message);
-		g_error_free (error);
-		g_string_append_printf (device_id,
-					"_%s",
-					gcm_x11_output_get_name (output));
-		goto out;
-	}
-
-	/* get EDID data */
-	vendor = gcm_edid_get_vendor_name (edid);
-	if (vendor != NULL)
-		g_string_append_printf (device_id, "-%s", vendor);
-	name = gcm_edid_get_monitor_name (edid);
-	if (name != NULL)
-		g_string_append_printf (device_id, "-%s", name);
-	serial = gcm_edid_get_serial_number (edid);
-	if (serial != NULL)
-		g_string_append_printf (device_id, "-%s", serial);
-out:
-	if (edid != NULL)
-		g_object_unref (edid);
-	return g_string_free (device_id, FALSE);
-}
-
-/**
- * gcm_session_profile_added_notify_cb:
- **/
-static void
-gcm_session_profile_added_notify_cb (CdClient *client,
-				     CdProfile *profile,
-				     GcmSessionPrivate *priv)
-{
-	GHashTable *metadata = NULL;
-	const gchar *edid_md5;
-	GcmX11Output *output = NULL;
-	GError *error = NULL;
-	CdDevice *device = NULL;
-	gchar *device_id = NULL;
-	gboolean ret;
-
-	/* get properties */
-	ret = cd_profile_connect_sync (profile, NULL, &error);
-	if (!ret) {
-		g_warning ("cannot connect to profile: %s",
-			   error->message);
-		g_error_free (error);
-		goto out;
-	}
-
-	/* does the profile have EDID metadata? */
-	metadata = cd_profile_get_metadata (profile);
-	edid_md5 = g_hash_table_lookup (metadata, "EDID_md5");
-	if (edid_md5 == NULL)
-		goto out;
-
-	/* get the GcmX11Output for the edid */
-	output = gcm_x11_screen_get_output_by_edid (priv->x11_screen,
-						    edid_md5,
-						    &error);
-	if (output == NULL) {
-		g_debug ("edid hash %s ignored: %s",
-			 edid_md5,
-			 error->message);
-		g_error_free (error);
-		goto out;
-	}
-
-	/* get the CdDevice for this ID */
-	device_id = gcm_session_get_output_id (output);
-	device = cd_client_find_device_sync (priv->client,
-					     device_id,
-					     NULL,
-					     &error);
-	if (device == NULL) {
-		g_warning ("not found device %s which should have been added: %s",
-			   device_id,
-			   error->message);
-		g_error_free (error);
-		goto out;
-	}
-
-	/* get properties */
-	ret = cd_device_connect_sync (device, NULL, &error);
-	if (!ret) {
-		g_warning ("cannot connect to device: %s",
-			   error->message);
-		g_error_free (error);
-		goto out;
-	}
-
-	/* add the profile to the device */
-	ret = cd_device_add_profile_sync (device,
-					  CD_DEVICE_RELATION_SOFT,
-					  profile,
-					  NULL,
-					  &error);
-	if (!ret) {
-		/* this will fail if the profile is already added */
-		g_debug ("failed to assign auto-edid profile to device %s: %s",
-			 gcm_x11_output_get_name (output),
-			 error->message);
-		g_error_free (error);
-		goto out;
-	}
-
-	/* phew! */
-	g_debug ("successfully assigned %s to %s",
-		 cd_profile_get_object_path (profile),
-		 cd_device_get_object_path (device));
-out:
-	g_free (device_id);
-	if (metadata != NULL)
-		g_hash_table_unref (metadata);
-	if (output != NULL)
-		g_object_unref (output);
-	if (device != NULL)
-		g_object_unref (device);
-}
-
-/**
- * gcm_apply_create_icc_profile_for_edid:
- **/
-static gboolean
-gcm_apply_create_icc_profile_for_edid (GcmSessionPrivate *priv,
-				       GcmEdid *edid,
-				       const gchar *filename,
-				       GError **error)
-{
-	const gchar *data;
-	gboolean ret;
-	gchar *title = NULL;
-	GcmProfile *profile = NULL;
-
-	/* ensure the per-user directory exists */
-	ret = gcm_utils_mkdir_for_filename (filename, error);
-	if (!ret)
-		goto out;
-
-	/* create new profile */
-	profile = gcm_profile_new ();
-	gcm_profile_set_colorspace (profile, CD_COLORSPACE_RGB);
-	gcm_profile_set_copyright (profile, "No copyright");
-	gcm_profile_set_kind (profile, CD_PROFILE_KIND_DISPLAY_DEVICE);
-
-	/* get manufacturer */
-	data = gcm_edid_get_vendor_name (edid);
-	if (data == NULL)
-		data = gcm_dmi_get_vendor (priv->dmi);
-	if (data == NULL)
-		data = "Unknown vendor";
-	gcm_profile_set_manufacturer (profile, data);
-
-	/* get model */
-	data = gcm_edid_get_monitor_name (edid);
-	if (data == NULL)
-		data = gcm_dmi_get_name (priv->dmi);
-	if (data == NULL)
-		data = "Unknown monitor";
-	gcm_profile_set_model (profile, data);
-
-	/* TRANSLATORS: this is prepended to the device title to let the use know it was generated by us automatically */
-	title = g_strdup_printf ("%s, %s",
-				 _("Automatic"),
-				 data);
-	gcm_profile_set_description (profile, title);
-
-	/* generate a profile from the chroma data */
-	ret = gcm_profile_create_from_chroma (profile,
-					      gcm_edid_get_gamma (edid),
-					      gcm_edid_get_red (edid),
-					      gcm_edid_get_green (edid),
-					      gcm_edid_get_blue (edid),
-					      gcm_edid_get_white (edid),
-					      error);
-	if (!ret)
-		goto out;
-
-	/* set 'ICC meta Tag for Monitor Profiles' data */
-	gcm_profile_set_data (profile,
-			      "EDID_md5",
-			      gcm_edid_get_checksum (edid));
-	data = gcm_edid_get_monitor_name (edid);
-	if (data != NULL) {
-		gcm_profile_set_data (profile,
-				      "EDID_model",
-				      data);
-	}
-	data = gcm_edid_get_serial_number (edid);
-	if (data != NULL) {
-		gcm_profile_set_data (profile,
-				      "EDID_serial",
-				      data);
-	}
-	data = gcm_edid_get_pnp_id (edid);
-	if (data != NULL) {
-		gcm_profile_set_data (profile,
-				      "EDID_mnft",
-				      data);
-	}
-	data = gcm_edid_get_vendor_name (edid);
-	if (data != NULL) {
-		gcm_profile_set_data (profile,
-				      "EDID_manufacturer",
-				      data);
-	}
-
-	/* save this */
-	ret = gcm_profile_save (profile, filename, error);
-	if (!ret)
-		goto out;
-out:
-	g_object_unref (profile);
-	g_free (title);
-	return ret;
-}
-
-/**
- * gcm_session_device_set_gamma:
- **/
-static gboolean
-gcm_session_device_set_gamma (GcmX11Output *output,
-			      CdProfile *profile,
-			      GError **error)
-{
-	const gchar *filename;
-	gboolean ret;
-	GcmClut *clut = NULL;
-	GcmProfile *gcm_profile = NULL;
-	GFile *file = NULL;
-
-	/* parse locally so we can access the VCGT data */
-	gcm_profile = gcm_profile_new ();
-	filename = cd_profile_get_filename (profile);
-	file = g_file_new_for_path (filename);
-	ret = gcm_profile_parse (gcm_profile, file, error);
-	if (!ret)
-		goto out;
-
-	/* create a lookup table */
-	clut = gcm_profile_generate_vcgt (gcm_profile,
-					  gcm_x11_output_get_gamma_size (output));
-
-	/* apply the vcgt to this output */
-	ret = gcm_x11_output_set_gamma_from_clut (output, clut, error);
-	if (!ret)
-		goto out;
-out:
-	if (clut != NULL)
-		g_object_unref (clut);
-	if (gcm_profile != NULL)
-		g_object_unref (gcm_profile);
-	if (file != NULL)
-		g_object_unref (file);
-	return ret;
-}
-
-/**
- * gcm_session_device_reset_gamma:
- **/
-static gboolean
-gcm_session_device_reset_gamma (GcmX11Output *output,
-			        GError **error)
-{
-	gboolean ret;
-	GcmClut *clut;
-
-	/* create a linear ramp */
-	clut = gcm_clut_new ();
-	g_object_set (clut,
-		      "size", gcm_x11_output_get_gamma_size (output),
-		      NULL);
-
-	/* apply the vcgt to this output */
-	ret = gcm_x11_output_set_gamma_from_clut (output, clut, error);
-	if (!ret)
-		goto out;
-out:
-	g_object_unref (clut);
-	return ret;
-}
-
-/**
- * gcm_session_get_x11_output_by_id:
- **/
-static GcmX11Output *
-gcm_session_get_x11_output_by_id (GcmSessionPrivate *priv,
-				  const gchar *device_id,
-				  GError **error)
-{
-	gchar *output_id;
-	GcmX11Output *output = NULL;
-	GcmX11Output *output_tmp;
-	GPtrArray *outputs = NULL;
-	guint i;
-
-	/* search all X11 outputs for the device id */
-	outputs = gcm_x11_screen_get_outputs (priv->x11_screen, error);
-	if (outputs == NULL)
-		goto out;
-	for (i=0; i<outputs->len && output == NULL; i++) {
-		output_tmp = g_ptr_array_index (outputs, i);
-		output_id = gcm_session_get_output_id (output_tmp);
-		if (g_strcmp0 (output_id, device_id) == 0) {
-			output = g_object_ref (output_tmp);
-		}
-		g_free (output_id);
-	}
-	if (output == NULL) {
-		g_set_error (error, 1, 0,
-			     "Failed to find output %s",
-			     device_id);
-	}
-out:
-	if (outputs != NULL)
-		g_ptr_array_unref (outputs);
-	return output;
-}
-
-/**
- * gcm_session_device_assign:
- **/
-static void
-gcm_session_device_assign (GcmSessionPrivate *priv, CdDevice *device)
-{
-	CdDeviceKind kind;
-	CdProfile *profile = NULL;
-	const gchar *filename;
-	gboolean ret;
-	gchar *autogen_filename = NULL;
-	gchar *autogen_path = NULL;
-	GcmEdid *edid = NULL;
-	GcmX11Output *output = NULL;
-	GError *error = NULL;
-	const gchar *qualifier_default[] = { "*", NULL};
-	const gchar *xrandr_id;
-
-	/* get properties */
-	ret = cd_device_connect_sync (device, NULL, &error);
-	if (!ret) {
-		g_warning ("failed to connect to device: %s",
-			   error->message);
-		g_error_free (error);
-		goto out;
-	}
-
-	/* check we care */
-	kind = cd_device_get_kind (device);
-	if (kind != CD_DEVICE_KIND_DISPLAY)
-		return;
-
-	g_debug ("need to assign display device %s",
-		 cd_device_get_id (device));
-
-	/* get the GcmX11Output for the device id */
-	xrandr_id = cd_device_get_id (device);
-	output = gcm_session_get_x11_output_by_id (priv,
-						   xrandr_id,
-						   &error);
-	if (output == NULL) {
-		g_warning ("no %s device found: %s",
-			   cd_device_get_id (device),
-			   error->message);
-		g_error_free (error);
-		goto out;
-	}
-
-	/* get the output EDID */
-	edid = gcm_x11_output_get_edid (output, &error);
-	if (edid == NULL) {
-		g_warning ("unable to get EDID for %s: %s",
-			   cd_device_get_id (device),
-			   error->message);
-		g_error_free (error);
-		goto out;
-	}
-
-	/* create profile from device edid if it does not exist */
-	autogen_filename = g_strdup_printf ("edid-%s.icc",
-					    gcm_edid_get_checksum (edid));
-	autogen_path = g_build_filename (g_get_user_data_dir (),
-					 "icc", autogen_filename, NULL);
-
-	if (g_file_test (autogen_path, G_FILE_TEST_EXISTS)) {
-		g_debug ("auto-profile edid %s exists", autogen_path);
-	} else {
-		g_debug ("auto-profile edid does not exist, creating as %s",
-			 autogen_path);
-		ret = gcm_apply_create_icc_profile_for_edid (priv,
-							     edid,
-							     autogen_path,
-							     &error);
-		if (!ret) {
-			g_warning ("failed to create profile from EDID data: %s",
-				     error->message);
-			g_clear_error (&error);
-		}
-	}
-
-	/* get the default profile for the device */
-	profile = cd_device_get_profile_for_qualifiers_sync (device,
-							     qualifier_default,
-							     NULL,
-							     &error);
-	if (profile == NULL) {
-		g_debug ("%s has no default profile to set: %s",
-			 cd_device_get_id (device),
-			 error->message);
-		g_clear_error (&error);
-
-		/* the default output? */
-		if (gcm_x11_output_get_primary (output)) {
-			ret = gcm_x11_screen_remove_profile (priv->x11_screen,
-							     &error);
-			if (!ret) {
-				g_warning ("failed to clear output _ICC_PROFILE: %s",
-					   error->message);
-				g_clear_error (&error);
-			}
-			ret = gcm_x11_screen_remove_protocol_version (priv->x11_screen,
-								      &error);
-			if (!ret) {
-				g_warning ("failed to clear output _ICC_PROFILE version: %s",
-					   error->message);
-				g_clear_error (&error);
-			}
-		}
-
-		/* reset, as we want linear profiles for profiling */
-		ret = gcm_session_device_reset_gamma (output,
-						      &error);
-		if (!ret) {
-			g_warning ("failed to reset %s gamma tables: %s",
-				   cd_device_get_id (device),
-				   error->message);
-			g_error_free (error);
-			goto out;
-		}
-		goto out;
-	}
-
-	/* get properties */
-	ret = cd_profile_connect_sync (profile, NULL, &error);
-	if (!ret) {
-		g_warning ("failed to connect to profile: %s",
-			   error->message);
-		g_error_free (error);
-		goto out;
-	}
-
-	/* get the filename */
-	filename = cd_profile_get_filename (profile);
-	g_assert (filename != NULL);
-
-	/* set the _ICC_PROFILE atom */
-	if (gcm_x11_output_get_primary (output)) {
-		ret = gcm_x11_screen_set_profile (priv->x11_screen,
-						  filename,
-						  &error);
-		if (!ret) {
-			g_warning ("failed to set screen _ICC_PROFILE: %s",
-				   error->message);
-			g_clear_error (&error);
-		}
-		ret = gcm_x11_screen_set_protocol_version (priv->x11_screen,
-							   GCM_ICC_PROFILE_IN_X_VERSION_MAJOR,
-							   GCM_ICC_PROFILE_IN_X_VERSION_MINOR,
-							   &error);
-		if (!ret) {
-			g_warning ("failed to set screen _ICC_PROFILE: %s",
-				   error->message);
-			g_clear_error (&error);
-		}
-	}
-
-	/* create a vcgt for this icc file */
-	ret = cd_profile_get_has_vcgt (profile);
-	if (ret) {
-		ret = gcm_session_device_set_gamma (output,
-						    profile,
-						    &error);
-		if (!ret) {
-			g_warning ("failed to set %s gamma tables: %s",
-				   cd_device_get_id (device),
-				   error->message);
-			g_error_free (error);
-			goto out;
-		}
-	} else {
-		ret = gcm_session_device_reset_gamma (output,
-						      &error);
-		if (!ret) {
-			g_warning ("failed to reset %s gamma tables: %s",
-				   cd_device_get_id (device),
-				   error->message);
-			g_error_free (error);
-			goto out;
-		}
-	}
-out:
-	g_free (autogen_filename);
-	g_free (autogen_path);
-	if (edid != NULL)
-		g_object_unref (edid);
-	if (output != NULL)
-		g_object_unref (output);
-	if (profile != NULL)
-		g_object_unref (profile);
-}
-
-/**
- * gcm_session_device_added_assign_cb:
- **/
-static void
-gcm_session_device_added_assign_cb (CdClient *client,
-				    CdDevice *device,
-				    GcmSessionPrivate *priv)
-{
-	gcm_session_device_assign (priv, device);
-}
-
-/**
- * gcm_session_device_changed_assign_cb:
- **/
-static void
-gcm_session_device_changed_assign_cb (CdClient *client,
-				      CdDevice *device,
-				      GcmSessionPrivate *priv)
-{
-	g_debug ("%s changed", cd_device_get_object_path (device));
-	gcm_session_device_assign (priv, device);
-}
-
-/**
- * gcm_session_get_profile_for_window:
- **/
-static const gchar *
-gcm_session_get_profile_for_window (GcmSessionPrivate *priv,
-				    guint xid,
-				    GError **error)
-{
-	CdDevice *device = NULL;
-	CdProfile *profile = NULL;
-	const gchar *filename = NULL;
-	gchar *device_id = NULL;
-	GcmX11Output *output = NULL;
-	GdkWindow *window;
-	GError *error_local = NULL;
-	gboolean ret;
-
-	g_debug ("getting profile for %i", xid);
-
-	/* get window for xid */
-	window = gdk_x11_window_foreign_new_for_display (gdk_display_get_default (), xid);
-	if (window == NULL) {
-		g_set_error (error, 1, 0,
-			     "failed to create window for xid %i",
-			     xid);
-		goto out;
-	}
-
-	/* get output for this window */
-	output = cd_x11_screen_get_output_by_window (priv->x11_screen,
-						     window);
-	if (output == NULL) {
-		g_set_error (error, 1, 0,
-			     "no output found for xid %i",
-			     xid);
-		goto out;
-	}
-
-	/* get device for this output */
-	device_id = gcm_session_get_output_id (output);
-	device = cd_client_find_device_sync (priv->client,
-					     device_id,
-					     NULL,
-					     &error_local);
-
-	if (device == NULL) {
-		g_set_error (error, 1, 0,
-			     "no device found for xid %i: %s",
-			     xid, error_local->message);
-		g_error_free (error_local);
-		goto out;
-	}
-
-	/* get properties */
-	ret = cd_device_connect_sync (device, NULL, error);
-	if (!ret)
-		goto out;
-
-	/* get the default profile for the device */
-	profile = cd_device_get_default_profile (device);
-	if (filename == NULL) {
-		g_set_error (error, 1, 0,
-			     "no profiles found for device %s",
-			     device_id);
-		goto out;
-	}
-
-	/* get properties */
-	ret = cd_profile_connect_sync (profile, NULL, error);
-	if (!ret)
-		goto out;
-
-	/* get the filename */
-	filename = cd_profile_get_filename (profile);
-	if (filename == NULL) {
-		g_set_error (error, 1, 0,
-			     "no filname found for profile %s",
-			     cd_profile_get_id (profile));
-		goto out;
-	}
-out:
-	g_free (device_id);
-	if (window != NULL)
-		g_object_unref (window);
-	if (profile != NULL)
-		g_object_unref (profile);
-	if (device != NULL)
-		g_object_unref (device);
-	if (output != NULL)
-		g_object_unref (output);
-	return filename;
-}
-
 /**
  * gcm_session_variant_from_profile_array:
  **/
@@ -822,7 +168,6 @@ gcm_session_handle_method_call (GDBusConnection *connection_, const gchar *sende
 {
 	GVariant *tuple = NULL;
 	GVariant *value = NULL;
-	guint xid;
 	gchar *device_id = NULL;
 	gchar *filename = NULL;
 	gchar *hints = NULL;
@@ -830,32 +175,8 @@ gcm_session_handle_method_call (GDBusConnection *connection_, const gchar *sende
 	GPtrArray *array = NULL;
 	gchar **devices = NULL;
 	GError *error = NULL;
-	const gchar *profile_filename;
 	GcmSessionPrivate *priv = (GcmSessionPrivate *) user_data;
 
-	/* return 's' */
-	if (g_strcmp0 (method_name, "GetProfileForWindow") == 0) {
-		g_variant_get (parameters, "(u)", &xid);
-
-		/* get the profile for a window */
-		profile_filename = gcm_session_get_profile_for_window (priv,
-								       xid,
-								       &error);
-		if (profile_filename == NULL) {
-			g_dbus_method_invocation_return_dbus_error (invocation,
-								    "org.gnome.ColorManager.Failed",
-								    error->message);
-			g_error_free (error);
-			goto out;
-		}
-
-		/* format the value */
-		value = g_variant_new_string (profile_filename);
-		tuple = g_variant_new_tuple (&value, 1);
-		g_dbus_method_invocation_return_value (invocation, tuple);
-		goto out;
-	}
-
 	/* return 'a(ss)' */
 	if (g_strcmp0 (method_name, "GetProfilesForDevice") == 0) {
 		g_variant_get (parameters, "(ss)", &device_id, &hints);
@@ -968,173 +289,6 @@ gcm_session_on_name_lost (GDBusConnection *connection,
 	g_main_loop_quit (priv->loop);
 }
 
-static void
-gcm_session_create_device_cb (GObject *object,
-			      GAsyncResult *res,
-			      gpointer user_data)
-{
-	CdDevice *device;
-	GError *error = NULL;
-
-	device = cd_client_create_device_finish (CD_CLIENT (object),
-						 res,
-						 &error);
-	if (device == NULL) {
-		g_warning ("failed to create device: %s",
-			   error->message);
-		g_error_free (error);
-		return;
-	}
-	g_object_unref (device);
-}
-
-static void
-gcm_session_add_x11_output (GcmSessionPrivate *priv, GcmX11Output *output)
-{
-	const gchar *model;
-	const gchar *serial;
-	const gchar *vendor;
-	gboolean ret;
-	gchar *device_id = NULL;
-	GcmEdid *edid;
-	GError *error = NULL;
-	GHashTable *device_props = NULL;
-
-	/* get edid */
-	edid = gcm_x11_output_get_edid (output, &error);
-	if (edid == NULL) {
-		g_warning ("failed to get edid: %s",
-			   error->message);
-		g_error_free (error);
-		goto out;
-	}
-
-	/* is this an internal device? */
-	ret = gcm_utils_output_is_lcd_internal (gcm_x11_output_get_name (output));
-	if (ret) {
-		model = gcm_dmi_get_name (priv->dmi);
-		vendor = gcm_dmi_get_vendor (priv->dmi);
-	} else {
-		model = gcm_edid_get_monitor_name (edid);
-		if (model == NULL)
-			model = gcm_x11_output_get_name (output);
-		vendor = gcm_edid_get_vendor_name (edid);
-	}
-
-	/* get a serial number if one exists */
-	serial = gcm_edid_get_serial_number (edid);
-	if (serial == NULL)
-		serial = "unknown";
-
-	device_id = gcm_session_get_output_id (output);
-	g_debug ("output %s added", device_id);
-	device_props = g_hash_table_new_full (g_str_hash, g_str_equal,
-					      NULL, NULL);
-	g_hash_table_insert (device_props,
-			     (gpointer) CD_DEVICE_PROPERTY_KIND,
-			     (gpointer) cd_device_kind_to_string (CD_DEVICE_KIND_DISPLAY));
-	g_hash_table_insert (device_props,
-			     (gpointer) CD_DEVICE_PROPERTY_MODE,
-			     (gpointer) cd_device_mode_to_string (CD_DEVICE_MODE_PHYSICAL));
-	g_hash_table_insert (device_props,
-			     (gpointer) CD_DEVICE_PROPERTY_COLORSPACE,
-			     (gpointer) cd_colorspace_to_string (CD_COLORSPACE_RGB));
-	g_hash_table_insert (device_props,
-			     (gpointer) CD_DEVICE_PROPERTY_VENDOR,
-			     (gpointer) vendor);
-	g_hash_table_insert (device_props,
-			     (gpointer) CD_DEVICE_PROPERTY_MODEL,
-			     (gpointer) model);
-	g_hash_table_insert (device_props,
-			     (gpointer) CD_DEVICE_PROPERTY_SERIAL,
-			     (gpointer) serial);
-	g_hash_table_insert (device_props,
-			     (gpointer) CD_DEVICE_METADATA_XRANDR_NAME,
-			     (gpointer) gcm_x11_output_get_name (output));
-	cd_client_create_device (priv->client,
-				 device_id,
-				 CD_OBJECT_SCOPE_TEMP,
-				 device_props,
-				 NULL,
-				 gcm_session_create_device_cb,
-				 priv);
-out:
-	g_free (device_id);
-	if (device_props != NULL)
-		g_hash_table_unref (device_props);
-	if (edid != NULL)
-		g_object_unref (edid);
-}
-
-
-/**
- * gcm_x11_screen_output_added_cb:
- **/
-static void
-gcm_x11_screen_output_added_cb (GcmX11Screen *screen_,
-				GcmX11Output *output,
-				GcmSessionPrivate *priv)
-{
-	gcm_session_add_x11_output (priv, output);
-}
-
-/**
- * gcm_x11_screen_output_removed_cb:
- **/
-static void
-gcm_x11_screen_output_removed_cb (GcmX11Screen *screen_,
-				  GcmX11Output *output,
-				  GcmSessionPrivate *priv)
-{
-	gboolean ret;
-	GError *error = NULL;
-	CdDevice *device;
-
-	g_debug ("output %s removed",
-		 gcm_x11_output_get_name (output));
-	device = cd_client_find_device_sync (priv->client,
-					     gcm_x11_output_get_name (output),
-					     NULL,
-					     &error);
-	ret = cd_client_delete_device_sync (priv->client,
-					    device,
-					    NULL,
-					    &error);
-	if (!ret) {
-		g_warning ("failed to delete device: %s",
-			   error->message);
-		g_error_free (error);
-		goto out;
-	}
-out:
-	g_object_unref (device);
-}
-
-static void
-gcm_session_get_devices_cb (GObject *object, GAsyncResult *res, gpointer user_data)
-{
-	CdDevice *device;
-	GError *error = NULL;
-	GPtrArray *array;
-	guint i;
-	GcmSessionPrivate *priv = (GcmSessionPrivate *) user_data;
-
-	array = cd_client_get_devices_sync (CD_CLIENT (object), NULL, &error);
-	if (array == NULL) {
-		g_warning ("failed to get devices: %s",
-			   error->message);
-		g_error_free (error);
-		goto out;
-	}
-	for (i=0; i<array->len; i++) {
-		device = g_ptr_array_index (array, i);
-		gcm_session_device_assign (priv, device);
-	}
-out:
-	if (array != NULL)
-		g_ptr_array_unref (array);
-}
-
 /**
  * gcm_session_client_connect_cb:
  **/
@@ -1145,9 +299,6 @@ gcm_session_client_connect_cb (GObject *source_object,
 {
 	gboolean ret;
 	GError *error = NULL;
-	GPtrArray *outputs = NULL;
-	guint i;
-	GcmX11Output *output;
 	GcmSessionPrivate *priv = (GcmSessionPrivate *) user_data;
 
 	/* connected */
@@ -1158,39 +309,6 @@ gcm_session_client_connect_cb (GObject *source_object,
 		g_error_free (error);
 		goto out;
 	}
-
-	/* add screens */
-	ret = gcm_x11_screen_refresh (priv->x11_screen, &error);
-	if (!ret) {
-		g_warning ("failed to refresh: %s", error->message);
-		g_error_free (error);
-		goto out;
-	}
-
-	/* get X11 outputs */
-	outputs = gcm_x11_screen_get_outputs (priv->x11_screen, &error);
-	if (outputs == NULL) {
-		g_warning ("failed to get outputs: %s", error->message);
-		g_error_free (error);
-		goto out;
-	}
-	for (i=0; i<outputs->len; i++) {
-		output = g_ptr_array_index (outputs, i);
-		gcm_session_add_x11_output (priv, output);
-	}
-
-	/* only connect when colord is awake */
-	g_signal_connect (priv->x11_screen, "added",
-			  G_CALLBACK (gcm_x11_screen_output_added_cb),
-			  priv);
-	g_signal_connect (priv->x11_screen, "removed",
-			  G_CALLBACK (gcm_x11_screen_output_removed_cb),
-			  priv);
-
-	/* set for each device that already exist */
-	cd_client_get_devices (priv->client, NULL,
-			       gcm_session_get_devices_cb,
-			       priv);
 out:
 	return;
 }
@@ -1273,34 +391,13 @@ main (int argc, char *argv[])
 
 	priv = g_new0 (GcmSessionPrivate, 1);
 
-	/* use DMI data for internal panels */
-	priv->dmi = gcm_dmi_new ();
-
 	/* monitor daemon */
 	priv->client = cd_client_new ();
-	g_signal_connect (priv->client, "profile-added",
-			  G_CALLBACK (gcm_session_profile_added_notify_cb),
-			  priv);
-	g_signal_connect (priv->client, "device-added",
-			  G_CALLBACK (gcm_session_device_added_assign_cb),
-			  priv);
-	g_signal_connect (priv->client, "device-changed",
-			  G_CALLBACK (gcm_session_device_changed_assign_cb),
-			  priv);
 	cd_client_connect (priv->client,
 			   NULL,
 			   gcm_session_client_connect_cb,
 			   priv);
 
-	/* monitor displays */
-	priv->x11_screen = gcm_x11_screen_new ();
-	ret = gcm_x11_screen_assign (priv->x11_screen, NULL, &error);
-	if (!ret) {
-		g_warning ("failed to assign: %s", error->message);
-		g_error_free (error);
-		goto out;
-	}
-
 	/* create new objects */
 	g_debug ("spinning loop");
 	priv->loop = g_main_loop_new (NULL, FALSE);
@@ -1333,12 +430,8 @@ out:
 	if (owner_id > 0)
 		g_bus_unown_name (owner_id);
 	if (priv != NULL) {
-		if (priv->dmi != NULL)
-			g_object_unref (priv->dmi);
 		if (priv->connection != NULL)
 			g_object_unref (priv->connection);
-		if (priv->x11_screen != NULL)
-			g_object_unref (priv->x11_screen);
 		g_dbus_node_info_unref (priv->introspection);
 		g_object_unref (priv->client);
 		g_main_loop_unref (priv->loop);
diff --git a/src/org.gnome.ColorManager.xml b/src/org.gnome.ColorManager.xml
index 68c6994..eac9b7e 100644
--- a/src/org.gnome.ColorManager.xml
+++ b/src/org.gnome.ColorManager.xml
@@ -90,38 +90,6 @@
       </arg>
     </method>
 
-    <!--*****************************************************************************************-->
-    <method name='GetProfileForWindow'>
-      <annotation name='org.freedesktop.DBus.GLib.Async' value=''/>
-      <doc:doc>
-        <doc:description>
-          <doc:para>
-            Gets the profile for a window. In the case where the window overlaps
-            two different outputs, then the profile with the greatest percentage
-            area is used.
-          </doc:para>
-        </doc:description>
-      </doc:doc>
-      <arg type='u' name='xid' direction='in'>
-        <doc:doc>
-          <doc:summary>
-            <doc:para>
-              A window XID.
-            </doc:para>
-          </doc:summary>
-        </doc:doc>
-      </arg>
-      <arg type='s' name='profile' direction='out'>
-        <doc:doc>
-          <doc:summary>
-            <doc:para>
-              A profile filename that is should be used for the display.
-            </doc:para>
-          </doc:summary>
-        </doc:doc>
-      </arg>
-    </method>
-
   </interface>
 </node>
 



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