[gnome-color-manager] Split out the X specific parts into a seporate GObject



commit 168dd48532e775215c8101bf31aca518f6c78767
Author: Richard Hughes <richard hughsie com>
Date:   Wed Nov 4 11:55:18 2009 +0000

    Split out the X specific parts into a seporate GObject

 src/Makefile.am   |    2 +
 src/gcm-inspect.c |    9 ++-
 src/gcm-utils.c   |  191 +------------------------------
 src/gcm-utils.h   |   11 --
 src/gcm-xserver.c |  321 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 src/gcm-xserver.h |   90 +++++++++++++++
 6 files changed, 428 insertions(+), 196 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index 2dac665..a81f2bc 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -28,6 +28,8 @@ libgcmshared_a_SOURCES =				\
 	gcm-clut.h					\
 	gcm-edid.c					\
 	gcm-edid.h					\
+	gcm-xserver.c					\
+	gcm-xserver.h					\
 	gcm-profile.c					\
 	gcm-profile.h
 
diff --git a/src/gcm-inspect.c b/src/gcm-inspect.c
index a47f559..33d2432 100644
--- a/src/gcm-inspect.c
+++ b/src/gcm-inspect.c
@@ -26,6 +26,7 @@
 
 #include "gcm-utils.h"
 #include "gcm-profile.h"
+#include "gcm-xserver.h"
 
 /**
  * main:
@@ -41,6 +42,7 @@ main (int argc, char **argv)
 	guint8 *data = NULL;
 	gsize length;
 	GcmProfile *profile = NULL;
+	GcmXserver *xserver = NULL;
 	gchar *description = NULL;
 	gchar *copyright = NULL;
 
@@ -59,8 +61,11 @@ main (int argc, char **argv)
 
 	egg_debug_init (verbose);
 
+	/* setup object to access X */
+	xserver = gcm_xserver_new ();
+
 	/* get profile from XServer */
-	ret = gcm_utils_get_x11_icc_profile_data (0, &data, &length, &error);
+	ret = gcm_xserver_get_root_window_profile_data (xserver, &data, &length, &error);
 	if (!ret) {
 		egg_warning ("failed to get XServer profile data: %s", error->message);
 		g_error_free (error);
@@ -93,6 +98,8 @@ out:
 	g_free (description);
 	if (profile != NULL)
 		g_object_unref (profile);
+	if (xserver != NULL)
+		g_object_unref (xserver);
 	return retval;
 }
 
diff --git a/src/gcm-utils.c b/src/gcm-utils.c
index 40e2ef5..65794ca 100644
--- a/src/gcm-utils.c
+++ b/src/gcm-utils.c
@@ -24,10 +24,11 @@
 #include <glib/gi18n.h>
 #include <gtk/gtk.h>
 #include <gdk/gdkx.h>
-#include <X11/Xatom.h>
 
 #include "gcm-utils.h"
 #include "gcm-edid.h"
+#include "gcm-xserver.h"
+
 #include "egg-debug.h"
 
 /**
@@ -269,6 +270,7 @@ gcm_utils_set_output_gamma (GnomeRROutput *output, GError **error)
 {
 	gboolean ret = FALSE;
 	GcmClut *clut = NULL;
+	GcmXserver *xserver = NULL;
 	GnomeRRCrtc *crtc;
 	gint x, y;
 	gchar *filename;
@@ -295,7 +297,8 @@ gcm_utils_set_output_gamma (GnomeRROutput *output, GError **error)
 	gnome_rr_output_get_position (output, &x, &y);
 	if (x == 0 && y == 0 && filename != NULL) {
 		egg_debug ("setting main ICC profile atom from %s", filename);
-		ret = gcm_utils_set_x11_icc_profile (0, filename, error);
+		xserver = gcm_xserver_new ();
+		ret = gcm_xserver_set_root_window_profile (xserver, filename, error);
 		if (!ret)
 			goto out;
 	}
@@ -303,6 +306,8 @@ out:
 	g_free (filename);
 	if (clut != NULL)
 		g_object_unref (clut);
+	if (xserver != NULL)
+		g_object_unref (xserver);
 	return ret;
 }
 
@@ -491,185 +496,3 @@ gcm_gnome_help (const gchar *link_id)
 	return ret;
 }
 
-/**
- * gcm_utils_get_x11_icc_profile_data:
- *
- * @id: the ID that is used according to ICC Profiles In X Specification
- * @data: the data that is returned from the XServer. Free with g_free()
- * @length: the size of the returned data, or %NULL if you don't care
- * @error: a %GError that is set in the result of an error, or %NULL
- * Return value: %TRUE for success.
- *
- * TODO: the ICC Profiles In X Specification is very vague about how the id
- * map to the RROutput name or ID. Seek clarification.
- *
- * Gets the ICC profile data from the XServer.
- **/
-gboolean
-gcm_utils_get_x11_icc_profile_data (guint id, guint8 **data, gsize *length, GError **error)
-{
-	gboolean ret = FALSE;
-	gchar *atom_name;
-	gchar *data_tmp = NULL;
-	gint format;
-	gint rc;
-	gulong bytes_after;
-	gulong nitems;
-	Atom atom = None;
-	Atom type;
-	Display	*display;
-	GdkDisplay *display_gdk;
-	GdkWindow *window_gdk;
-	Window window;
-
-	g_return_val_if_fail (data != NULL, FALSE);
-
-	/* get defaults for single screen */
-	display_gdk = gdk_display_get_default ();
-	window_gdk = gdk_get_default_root_window ();
-	display = GDK_DISPLAY_XDISPLAY (display_gdk);
-	window = GDK_WINDOW_XID (window_gdk);
-
-	/* get the atom name */
-	if (id == 0)
-		atom_name = g_strdup ("_ICC_PROFILE");
-	else
-		atom_name = g_strdup_printf ("_ICC_PROFILE_%i", id);
-
-	/* get the value */
-	gdk_error_trap_push ();
-	atom = gdk_x11_get_xatom_by_name_for_display (display_gdk, atom_name);
-	rc = XGetWindowProperty (display, window, atom, 0, G_MAXLONG, False, XA_CARDINAL,
-				 &type, &format, &nitems, &bytes_after, (void*) &data_tmp);
-	gdk_error_trap_pop ();
-
-	/* did the call fail */
-	if (rc != Success) {
-		if (error != NULL)
-			*error = g_error_new (1, 0, "failed to get %s atom with rc %i", atom_name, rc);
-		goto out;
-	}
-
-	/* was nothing found */
-	if (nitems == 0) {
-		if (error != NULL)
-			*error = g_error_new (1, 0, "%s atom has not been set", atom_name);
-		goto out;
-	}
-
-	/* allocate the data using Glib, rather than asking the user to use XFree */
-	*data = g_new0 (guint8, nitems);
-	memcpy (*data, data_tmp, nitems);
-
-	/* copy the length */
-	if (length != NULL)
-		*length = nitems;
-
-	/* success */
-	ret = TRUE;
-out:
-	g_free (atom_name);
-	if (data_tmp != NULL)
-		XFree (data_tmp);
-	return ret;
-}
-
-/**
- * gcm_utils_set_x11_icc_profile:
- * @id: the ID that is used according to ICC Profiles In X Specification
- * @filename: the filename of the ICC profile
- * @error: a %GError that is set in the result of an error, or %NULL
- * Return value: %TRUE for success.
- *
- * Sets the ICC profile data to the XServer.
- *
- * TODO: the ICC Profiles In X Specification is very vague about how the id
- * map to the RROutput name or ID. Seek clarification.
- **/
-gboolean
-gcm_utils_set_x11_icc_profile (guint id, const gchar *filename, GError **error)
-{
-	gboolean ret;
-	gchar *data = NULL;
-	gsize length;
-
-	g_return_val_if_fail (filename != NULL, FALSE);
-
-	/* get contents of file */
-	ret = g_file_get_contents (filename, &data, &length, error);
-	if (!ret)
-		goto out;
-
-	/* send to the XServer */
-	ret = gcm_utils_set_x11_icc_profile_data (id, (const guint8 *) data, length, error);
-	if (!ret)
-		goto out;
-out:
-	g_free (data);
-	return ret;
-}
-
-/**
- * gcm_utils_set_x11_icc_profile_data:
- * @id: the ID that is used according to ICC Profiles In X Specification
- * @data: the data that is to be set to the XServer
- * @length: the size of the data
- * @error: a %GError that is set in the result of an error, or %NULL
- * Return value: %TRUE for success.
- *
- * Sets the ICC profile data to the XServer.
- *
- * TODO: the ICC Profiles In X Specification is very vague about how the id
- * map to the RROutput name or ID. Seek clarification.
- **/
-gboolean
-gcm_utils_set_x11_icc_profile_data (guint id, const guint8 *data, gsize length, GError **error)
-{
-	gboolean ret = FALSE;
-	gchar *atom_name;
-	gint rc;
-	Atom atom = None;
-	Display	*display;
-	GdkDisplay *display_gdk;
-	GdkWindow *window_gdk;
-	Window window;
-
-	g_return_val_if_fail (data != NULL, FALSE);
-	g_return_val_if_fail (length != 0, FALSE);
-
-	/* get defaults for single screen */
-	display_gdk = gdk_display_get_default ();
-	window_gdk = gdk_get_default_root_window ();
-	display = GDK_DISPLAY_XDISPLAY (display_gdk);
-	window = GDK_WINDOW_XID (window_gdk);
-
-	/* get the atom name */
-	if (id == 0)
-		atom_name = g_strdup ("_ICC_PROFILE");
-	else
-		atom_name = g_strdup_printf ("_ICC_PROFILE_%i", id);
-
-	/* get the value */
-	gdk_error_trap_push ();
-	atom = gdk_x11_get_xatom_by_name_for_display (display_gdk, atom_name);
-	rc = XChangeProperty (display, window, atom, XA_CARDINAL, 8, PropModeReplace, (unsigned char*) data, length);
-	gdk_error_trap_pop ();
-
-	/* for some reason this fails with BadRequest, but actually sets the value */
-	if (rc == BadRequest)
-		rc = Success;
-
-	/* did the call fail */
-	if (rc != Success) {
-		if (error != NULL)
-			*error = g_error_new (1, 0, "failed to set %s atom with rc %i", atom_name, rc);
-		goto out;
-	}
-
-	/* success */
-	ret = TRUE;
-out:
-	g_free (atom_name);
-	return ret;
-}
-
diff --git a/src/gcm-utils.h b/src/gcm-utils.h
index 44e3625..87e727e 100644
--- a/src/gcm-utils.h
+++ b/src/gcm-utils.h
@@ -51,17 +51,6 @@ gboolean	 gcm_utils_mkdir_and_copy		(const gchar		*source,
 gchar		*gcm_utils_get_profile_destination	(const gchar		*filename);
 gchar		**gcm_utils_ptr_array_to_strv		(GPtrArray		*array);
 gboolean	 gcm_gnome_help				(const gchar		*link_id);
-gboolean	 gcm_utils_get_x11_icc_profile_data	(guint			 id,
-							 guint8			**data,
-							 gsize			*length,
-							 GError			**error);
-gboolean	 gcm_utils_set_x11_icc_profile_data	(guint			 id,
-							 const guint8		*data,
-							 gsize			 length,
-							 GError			**error);
-gboolean	 gcm_utils_set_x11_icc_profile		(guint			 id,
-							 const gchar		*filename,
-							 GError			**error);
 gboolean	 gcm_utils_output_is_lcd_internal	(const gchar		*output_name);
 gboolean	 gcm_utils_output_is_lcd		(const gchar		*output_name);
 
diff --git a/src/gcm-xserver.c b/src/gcm-xserver.c
new file mode 100644
index 0000000..b7e4d90
--- /dev/null
+++ b/src/gcm-xserver.c
@@ -0,0 +1,321 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2009 Richard Hughes <richard hughsie com>
+ *
+ * Licensed under the GNU General Public License Version 2
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more xserver.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+/**
+ * SECTION:gcm-xserver
+ * @short_description: Object to interact with the XServer
+ *
+ * This object talks to the currently running X Server.
+ */
+
+#include "config.h"
+
+#include <glib-object.h>
+#include <math.h>
+#include <string.h>
+#include <gio/gio.h>
+#include <stdlib.h>
+#include <gtk/gtk.h>
+#include <gdk/gdkx.h>
+#include <X11/Xatom.h>
+
+#include "gcm-xserver.h"
+
+#include "egg-debug.h"
+
+static void     gcm_xserver_finalize	(GObject     *object);
+
+#define GCM_XSERVER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GCM_TYPE_XSERVER, GcmXserverPrivate))
+
+/**
+ * GcmXserverPrivate:
+ *
+ * Private #GcmXserver data
+ **/
+struct _GcmXserverPrivate
+{
+	gchar				*display_name;
+	GdkDisplay			*display_gdk;
+	GdkWindow			*window_gdk;
+	Display				*display;
+	Window				 window;
+};
+
+enum {
+	PROP_0,
+	PROP_DISPLAY_NAME,
+	PROP_LAST
+};
+
+G_DEFINE_TYPE (GcmXserver, gcm_xserver, G_TYPE_OBJECT)
+
+/**
+ * gcm_xserver_get_root_window_profile_data:
+ *
+ * @data: the data that is returned from the XServer. Free with g_free()
+ * @length: the size of the returned data, or %NULL if you don't care
+ * @error: a %GError that is set in the result of an error, or %NULL
+ * Return value: %TRUE for success.
+ *
+ * Gets the ICC profile data from the XServer.
+ **/
+gboolean
+gcm_xserver_get_root_window_profile_data (GcmXserver *xserver, guint8 **data, gsize *length, GError **error)
+{
+	gboolean ret = FALSE;
+	const gchar *atom_name;
+	gchar *data_tmp = NULL;
+	gint format;
+	gint rc;
+	gulong bytes_after;
+	gulong nitems;
+	Atom atom = None;
+	Atom type;
+	GcmXserverPrivate *priv = xserver->priv;
+
+	g_return_val_if_fail (GCM_IS_XSERVER (xserver), FALSE);
+	g_return_val_if_fail (data != NULL, FALSE);
+
+	/* get the atom name */
+	atom_name = "_ICC_PROFILE";
+
+	/* get the value */
+	gdk_error_trap_push ();
+	atom = gdk_x11_get_xatom_by_name_for_display (priv->display_gdk, atom_name);
+	rc = XGetWindowProperty (priv->display, priv->window, atom, 0, G_MAXLONG, False, XA_CARDINAL,
+				 &type, &format, &nitems, &bytes_after, (void*) &data_tmp);
+	gdk_error_trap_pop ();
+
+	/* did the call fail */
+	if (rc != Success) {
+		if (error != NULL)
+			*error = g_error_new (1, 0, "failed to get %s atom with rc %i", atom_name, rc);
+		goto out;
+	}
+
+	/* was nothing found */
+	if (nitems == 0) {
+		if (error != NULL)
+			*error = g_error_new (1, 0, "%s atom has not been set", atom_name);
+		goto out;
+	}
+
+	/* allocate the data using Glib, rather than asking the user to use XFree */
+	*data = g_new0 (guint8, nitems);
+	memcpy (*data, data_tmp, nitems);
+
+	/* copy the length */
+	if (length != NULL)
+		*length = nitems;
+
+	/* success */
+	ret = TRUE;
+out:
+	if (data_tmp != NULL)
+		XFree (data_tmp);
+	return ret;
+}
+
+/**
+ * gcm_xserver_set_root_window_profile:
+ * @filename: the filename of the ICC profile
+ * @error: a %GError that is set in the result of an error, or %NULL
+ * Return value: %TRUE for success.
+ *
+ * Sets the ICC profile data to the XServer.
+ **/
+gboolean
+gcm_xserver_set_root_window_profile (GcmXserver *xserver, const gchar *filename, GError **error)
+{
+	gboolean ret;
+	gchar *data = NULL;
+	gsize length;
+
+	g_return_val_if_fail (GCM_IS_XSERVER (xserver), FALSE);
+	g_return_val_if_fail (filename != NULL, FALSE);
+
+	/* get contents of file */
+	ret = g_file_get_contents (filename, &data, &length, error);
+	if (!ret)
+		goto out;
+
+	/* send to the XServer */
+	ret = gcm_xserver_set_root_window_profile_data (xserver, (const guint8 *) data, length, error);
+	if (!ret)
+		goto out;
+out:
+	g_free (data);
+	return ret;
+}
+
+/**
+ * gcm_xserver_set_root_window_profile_data:
+ * @data: the data that is to be set to the XServer
+ * @length: the size of the data
+ * @error: a %GError that is set in the result of an error, or %NULL
+ * Return value: %TRUE for success.
+ *
+ * Sets the ICC profile data to the XServer.
+ **/
+gboolean
+gcm_xserver_set_root_window_profile_data (GcmXserver *xserver, const guint8 *data, gsize length, GError **error)
+{
+	gboolean ret = FALSE;
+	const gchar *atom_name;
+	gint rc;
+	Atom atom = None;
+	GcmXserverPrivate *priv = xserver->priv;
+
+	g_return_val_if_fail (GCM_IS_XSERVER (xserver), FALSE);
+	g_return_val_if_fail (data != NULL, FALSE);
+	g_return_val_if_fail (length != 0, FALSE);
+
+	/* get the atom name */
+	atom_name = "_ICC_PROFILE";
+
+	/* get the value */
+	gdk_error_trap_push ();
+	atom = gdk_x11_get_xatom_by_name_for_display (priv->display_gdk, atom_name);
+	rc = XChangeProperty (priv->display, priv->window, atom, XA_CARDINAL, 8, PropModeReplace, (unsigned char*) data, length);
+	gdk_error_trap_pop ();
+
+	/* for some reason this fails with BadRequest, but actually sets the value */
+	if (rc == BadRequest)
+		rc = Success;
+
+	/* did the call fail */
+	if (rc != Success) {
+		if (error != NULL)
+			*error = g_error_new (1, 0, "failed to set %s atom with rc %i", atom_name, rc);
+		goto out;
+	}
+
+	/* success */
+	ret = TRUE;
+out:
+	return ret;
+}
+
+/**
+ * gcm_xserver_get_property:
+ **/
+static void
+gcm_xserver_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
+{
+	GcmXserver *xserver = GCM_XSERVER (object);
+	GcmXserverPrivate *priv = xserver->priv;
+
+	switch (prop_id) {
+	case PROP_DISPLAY_NAME:
+		g_value_set_string (value, priv->display_name);
+		break;
+	default:
+		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+		break;
+	}
+}
+
+/**
+ * gcm_xserver_set_property:
+ **/
+static void
+gcm_xserver_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
+{
+	GcmXserver *xserver = GCM_XSERVER (object);
+	GcmXserverPrivate *priv = xserver->priv;
+
+	switch (prop_id) {
+	case PROP_DISPLAY_NAME:
+		g_free (priv->display_name);
+		priv->display_name = g_strdup (g_value_get_string (value));
+		break;
+	default:
+		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+		break;
+	}
+}
+
+/**
+ * gcm_xserver_class_init:
+ **/
+static void
+gcm_xserver_class_init (GcmXserverClass *klass)
+{
+	GParamSpec *pspec;
+	GObjectClass *object_class = G_OBJECT_CLASS (klass);
+	object_class->finalize = gcm_xserver_finalize;
+	object_class->get_property = gcm_xserver_get_property;
+	object_class->set_property = gcm_xserver_set_property;
+
+	/**
+	 * GcmXserver:display-name:
+	 */
+	pspec = g_param_spec_string ("display-name", NULL, NULL,
+				     NULL,
+				     G_PARAM_READWRITE);
+	g_object_class_install_property (object_class, PROP_DISPLAY_NAME, pspec);
+
+	g_type_class_add_private (klass, sizeof (GcmXserverPrivate));
+}
+
+/**
+ * gcm_xserver_init:
+ **/
+static void
+gcm_xserver_init (GcmXserver *xserver)
+{
+	xserver->priv = GCM_XSERVER_GET_PRIVATE (xserver);
+	xserver->priv->display_name = NULL;
+
+	/* get defaults for single screen */
+	xserver->priv->display_gdk = gdk_display_get_default ();
+	xserver->priv->window_gdk = gdk_get_default_root_window ();
+	xserver->priv->display = GDK_DISPLAY_XDISPLAY (xserver->priv->display_gdk);
+	xserver->priv->window = GDK_WINDOW_XID (xserver->priv->window_gdk);
+}
+
+/**
+ * gcm_xserver_finalize:
+ **/
+static void
+gcm_xserver_finalize (GObject *object)
+{
+	GcmXserver *xserver = GCM_XSERVER (object);
+	GcmXserverPrivate *priv = xserver->priv;
+
+	g_free (priv->display_name);
+
+	G_OBJECT_CLASS (gcm_xserver_parent_class)->finalize (object);
+}
+
+/**
+ * gcm_xserver_new:
+ *
+ * Return value: a new GcmXserver object.
+ **/
+GcmXserver *
+gcm_xserver_new (void)
+{
+	GcmXserver *xserver;
+	xserver = g_object_new (GCM_TYPE_XSERVER, NULL);
+	return GCM_XSERVER (xserver);
+}
+
diff --git a/src/gcm-xserver.h b/src/gcm-xserver.h
new file mode 100644
index 0000000..9f97472
--- /dev/null
+++ b/src/gcm-xserver.h
@@ -0,0 +1,90 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2009 Richard Hughes <richard hughsie com>
+ *
+ * Licensed under the GNU General Public License Version 2
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more xserver.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __GCM_XSERVER_H
+#define __GCM_XSERVER_H
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define GCM_TYPE_XSERVER		(gcm_xserver_get_type ())
+#define GCM_XSERVER(o)			(G_TYPE_CHECK_INSTANCE_CAST ((o), GCM_TYPE_XSERVER, GcmXserver))
+#define GCM_XSERVER_CLASS(k)		(G_TYPE_CHECK_CLASS_CAST((k), GCM_TYPE_XSERVER, GcmXserverClass))
+#define GCM_IS_XSERVER(o)		(G_TYPE_CHECK_INSTANCE_TYPE ((o), GCM_TYPE_XSERVER))
+#define GCM_IS_XSERVER_CLASS(k)		(G_TYPE_CHECK_CLASS_TYPE ((k), GCM_TYPE_XSERVER))
+#define GCM_XSERVER_GET_CLASS(o)	(G_TYPE_INSTANCE_GET_CLASS ((o), GCM_TYPE_XSERVER, GcmXserverClass))
+
+typedef struct _GcmXserverPrivate	GcmXserverPrivate;
+typedef struct _GcmXserver		GcmXserver;
+typedef struct _GcmXserverClass	GcmXserverClass;
+
+struct _GcmXserver
+{
+	 GObject		 parent;
+	 GcmXserverPrivate	*priv;
+};
+
+struct _GcmXserverClass
+{
+	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);
+};
+
+GType		 gcm_xserver_get_type		  		(void);
+GcmXserver	*gcm_xserver_new				(void);
+gboolean	 gcm_xserver_get_root_window_profile_data	(GcmXserver		*xserver,
+								 guint8			**data,
+								 gsize			*length,
+								 GError			**error);
+gboolean	 gcm_xserver_set_root_window_profile_data	(GcmXserver		*xserver,
+								 const guint8		*data,
+								 gsize			 length,
+								 GError			**error);
+gboolean	 gcm_xserver_set_root_window_profile		(GcmXserver		*xserver,
+								 const gchar		*filename,
+								 GError			**error);
+
+/* TODO: implement */
+gboolean	 gcm_xserver_get_output_profile_data		(GcmXserver		*xserver,
+								 const gchar		*output_name,
+								 guint8			**data,
+								 gsize			*length,
+								 GError			**error);
+gboolean	 gcm_xserver_set_output_profile_data		(GcmXserver		*xserver,
+								 const gchar		*output_name,
+								 const guint8		*data,
+								 gsize			 length,
+								 GError			**error);
+gboolean	 gcm_xserver_set_output_profile			(GcmXserver		*xserver,
+								 const gchar		*output_name,
+								 const gchar		*filename,
+								 GError			**error);
+
+G_END_DECLS
+
+#endif /* __GCM_XSERVER_H */
+



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