[gnome-color-manager] Use CdSampleWindow from libcolord-gtk rather than our own copy



commit ed5c076e97a2b51919445bcd2533f694ac43422a
Author: Richard Hughes <richard hughsie com>
Date:   Wed May 9 09:49:07 2012 +0100

    Use CdSampleWindow from libcolord-gtk rather than our own copy

 configure.ac            |    2 +-
 src/Makefile.am         |    6 -
 src/gcm-calibrate.c     |   15 ++--
 src/gcm-sample-window.c |  262 -----------------------------------------------
 src/gcm-sample-window.h |   62 -----------
 src/gcm-self-test.c     |   35 ------
 6 files changed, 8 insertions(+), 374 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index ab4ca76..33760bc 100644
--- a/configure.ac
+++ b/configure.ac
@@ -94,7 +94,7 @@ PKG_CHECK_MODULES(GTK, gtk+-3.0 >= 2.91.0)
 PKG_CHECK_MODULES(LCMS, lcms2 >= 2.2)
 PKG_CHECK_MODULES(X11, x11)
 PKG_CHECK_MODULES(GNOME_DESKTOP, gnome-desktop-3.0)
-PKG_CHECK_MODULES(COLORD, colord >= 0.1.12)
+PKG_CHECK_MODULES(COLORD, colord-gtk >= 0.1.20)
 
 dnl **** Check for clutter ****
 AC_ARG_ENABLE(clutter, AS_HELP_STRING([--enable-clutter],[Enable clutter for 3D support]), enable_clutter=$enableval, enable_clutter=yes)
diff --git a/src/Makefile.am b/src/Makefile.am
index 94eb9ab..ce5ad25 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -87,8 +87,6 @@ gcm_calibrate_SOURCES =					\
 	gcm-gamma-widget.h				\
 	gcm-list-store-profiles.c			\
 	gcm-list-store-profiles.h			\
-	gcm-sample-window.c				\
-	gcm-sample-window.h				\
 	gcm-calibrate-main.c
 
 gcm_calibrate_LDADD =					\
@@ -136,8 +134,6 @@ gcm_calibrate_helper_SOURCES =				\
 	gcm-brightness.h				\
 	gcm-calibrate.c					\
 	gcm-calibrate.h					\
-	gcm-sample-window.c				\
-	gcm-sample-window.h				\
 	gcm-calibrate-helper.c
 
 gcm_calibrate_helper_LDADD =				\
@@ -234,8 +230,6 @@ gcm_self_test_SOURCES =					\
 	gcm-gamma-widget.h				\
 	gcm-named-color.c				\
 	gcm-named-color.h				\
-	gcm-sample-window.c				\
-	gcm-sample-window.h				\
 	gcm-self-test.c
 
 gcm_self_test_LDADD =					\
diff --git a/src/gcm-calibrate.c b/src/gcm-calibrate.c
index fe7a5e3..6f4e4b7 100644
--- a/src/gcm-calibrate.c
+++ b/src/gcm-calibrate.c
@@ -24,7 +24,7 @@
 #include <glib/gi18n.h>
 #include <gtk/gtk.h>
 #include <math.h>
-#include <colord.h>
+#include <colord-gtk.h>
 #include <lcms2.h>
 #include <canberra-gtk.h>
 
@@ -35,7 +35,6 @@
 #include "gcm-utils.h"
 #include "gcm-brightness.h"
 #include "gcm-exif.h"
-#include "gcm-sample-window.h"
 
 static void     gcm_calibrate_finalize	(GObject     *object);
 
@@ -652,8 +651,8 @@ gcm_calibrate_get_samples (GcmCalibrate *calibrate,
 
 	/* setup the measure window */
 	cd_color_set_rgb (&rgb_tmp, 1.0f, 1.0f, 1.0f);
-	gcm_sample_window_set_color (GCM_SAMPLE_WINDOW (priv->sample_window), &rgb_tmp);
-	gcm_sample_window_set_percentage (GCM_SAMPLE_WINDOW (priv->sample_window), 0);
+	cd_sample_window_set_color (CD_SAMPLE_WINDOW (priv->sample_window), &rgb_tmp);
+	cd_sample_window_set_fraction (CD_SAMPLE_WINDOW (priv->sample_window), 0.0f);
 	gtk_window_set_modal (priv->sample_window, TRUE);
 	gtk_window_stick (priv->sample_window);
 	gtk_window_present (priv->sample_window);
@@ -676,9 +675,9 @@ gcm_calibrate_get_samples (GcmCalibrate *calibrate,
 			 rgb->R, rgb->G, rgb->B);
 
 		/* set the window color */
-		gcm_sample_window_set_color (GCM_SAMPLE_WINDOW (priv->sample_window), rgb);
-		gcm_sample_window_set_percentage (GCM_SAMPLE_WINDOW (priv->sample_window),
-						  100 * i / samples_rgb->len);
+		cd_sample_window_set_color (CD_SAMPLE_WINDOW (priv->sample_window), rgb);
+		cd_sample_window_set_fraction (CD_SAMPLE_WINDOW (priv->sample_window),
+					       i / samples_rgb->len);
 
 		/* wait for the refresh to set the new color */
 		if (i == 0 && !priv->sensor_on_screen) {
@@ -2486,7 +2485,7 @@ gcm_calibrate_init (GcmCalibrate *calibrate)
 	calibrate->priv->print_kind = GCM_CALIBRATE_PRINT_KIND_UNKNOWN;
 	calibrate->priv->reference_kind = GCM_CALIBRATE_REFERENCE_KIND_UNKNOWN;
 	calibrate->priv->precision = GCM_CALIBRATE_PRECISION_UNKNOWN;
-	calibrate->priv->sample_window = gcm_sample_window_new ();
+	calibrate->priv->sample_window = cd_sample_window_new ();
 	calibrate->priv->old_brightness = G_MAXUINT;
 	calibrate->priv->brightness = gcm_brightness_new ();
 
diff --git a/src/gcm-self-test.c b/src/gcm-self-test.c
index 5d08dc6..d35b918 100644
--- a/src/gcm-self-test.c
+++ b/src/gcm-self-test.c
@@ -38,7 +38,6 @@
 #include "gcm-named-color.h"
 #include "gcm-print.h"
 #include "gcm-profile.h"
-#include "gcm-sample-window.h"
 #include "gcm-trc-widget.h"
 #include "gcm-utils.h"
 
@@ -376,39 +375,6 @@ gcm_test_image_func (void)
 	gtk_widget_destroy (dialog);
 }
 
-static gboolean
-gcm_test_sample_window_loop_cb (GMainLoop *loop)
-{
-	g_main_loop_quit (loop);
-	return FALSE;
-}
-
-static void
-gcm_test_sample_window_func (void)
-{
-	GtkWindow *window;
-	GMainLoop *loop;
-	CdColorRGB source;
-
-	window = gcm_sample_window_new ();
-	g_assert (window != NULL);
-	source.R = 1.0f;
-	source.G = 1.0f;
-	source.B = 0.0f;
-	gcm_sample_window_set_color (GCM_SAMPLE_WINDOW (window), &source);
-	gcm_sample_window_set_percentage (GCM_SAMPLE_WINDOW (window), GCM_SAMPLE_WINDOW_PERCENTAGE_PULSE);
-
-	/* move to the center of device lvds1 */
-	gtk_window_present (window);
-
-	loop = g_main_loop_new (NULL, FALSE);
-	g_timeout_add_seconds (2, (GSourceFunc) gcm_test_sample_window_loop_cb, loop);
-	g_main_loop_run (loop);
-
-	g_main_loop_unref (loop);
-	gtk_widget_destroy (GTK_WIDGET (window));
-}
-
 static void
 gcm_test_calibrate_func (void)
 {
@@ -780,7 +746,6 @@ main (int argc, char **argv)
 	g_test_add_func ("/color/hull", gcm_test_hull_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/sample-window", gcm_test_sample_window_func);
 	if (g_test_thorough ()) {
 		g_test_add_func ("/color/brightness", gcm_test_brightness_func);
 		g_test_add_func ("/color/image", gcm_test_image_func);



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