[gnome-color-manager] Use the CIE widget in the profile import dialog too



commit ac88a458d781a1bd7e1b2df870b08c126345ac80
Author: Richard Hughes <richard hughsie com>
Date:   Wed Dec 2 09:31:46 2009 +0000

    Use the CIE widget in the profile import dialog too

 src/Makefile.am  |    4 ++--
 src/gcm-import.c |   38 ++++++++++++++++++++++++++++++++++++++
 src/gcm-xyz.c    |    6 +++---
 3 files changed, 43 insertions(+), 5 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index d2b36be..6440611 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -38,6 +38,8 @@ libgcmshared_a_SOURCES =				\
 	gcm-client.h					\
 	gcm-device.c					\
 	gcm-device.h					\
+	gcm-cie-widget.c				\
+	gcm-cie-widget.h				\
 	gcm-profile.c					\
 	gcm-profile.h
 
@@ -122,8 +124,6 @@ gcm_prefs_SOURCES =					\
 	gcm-calibrate.h					\
 	gcm-brightness.c				\
 	gcm-brightness.h				\
-	gcm-cie-widget.c				\
-	gcm-cie-widget.h				\
 	gcm-prefs.c
 
 gcm_prefs_LDADD =					\
diff --git a/src/gcm-import.c b/src/gcm-import.c
index 7edc15f..6cdc1ef 100644
--- a/src/gcm-import.c
+++ b/src/gcm-import.c
@@ -30,6 +30,8 @@
 
 #include "gcm-profile.h"
 #include "gcm-utils.h"
+#include "gcm-xyz.h"
+#include "gcm-cie-widget.h"
 
 /**
  * main:
@@ -49,6 +51,12 @@ main (int argc, char **argv)
 	GString *string = NULL;
 	GtkWidget *dialog;
 	GtkResponseType response;
+	GtkWidget *vbox;
+	GtkWidget *cie_widget = NULL;
+	GcmXyz *white = NULL;
+	GcmXyz *red = NULL;
+	GcmXyz *green = NULL;
+	GcmXyz *blue = NULL;
 
 	const GOptionEntry options[] = {
 		{ G_OPTION_REMAINING, '\0', 0, G_OPTION_ARG_FILENAME_ARRAY, &files,
@@ -101,8 +109,16 @@ main (int argc, char **argv)
 	g_object_get (profile,
 		      "description", &description,
 		      "copyright", &copyright,
+		      "white-point", &white,
+		      "luminance-red", &red,
+		      "luminance-green", &green,
+		      "luminance-blue", &blue,
 		      NULL);
 
+	/* use CIE widget */
+	cie_widget = gcm_cie_widget_new ();
+	gtk_widget_set_size_request (cie_widget, 200, 200);
+
 	/* check file does't already exist */
 	destination = gcm_utils_get_profile_destination (files[0]);
 	ret = g_file_test (destination, G_FILE_TEST_EXISTS);
@@ -111,6 +127,13 @@ main (int argc, char **argv)
 		dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_INFO, GTK_BUTTONS_CLOSE, _("ICC profile already installed"));
 		gtk_window_set_icon_name (GTK_WINDOW (dialog), GCM_STOCK_ICON);
 		gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog), "%s\n%s", description, copyright);
+
+		/* add cie widget */
+		vbox = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
+		gtk_box_pack_end (GTK_BOX(vbox), cie_widget, TRUE, TRUE, 12);
+		gtk_widget_show (cie_widget);
+
+		gtk_window_set_resizable (GTK_WINDOW (dialog), TRUE);
 		gtk_dialog_run (GTK_DIALOG (dialog));
 		gtk_widget_destroy (dialog);
 		goto out;
@@ -136,6 +159,13 @@ main (int argc, char **argv)
 	gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog), "%s", string->str);
 	/* TRANSLATORS: button text */
 	gtk_dialog_add_button (GTK_DIALOG (dialog), _("Install"), GTK_RESPONSE_OK);
+
+	/* add cie widget */
+	vbox = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
+	gtk_box_pack_end (GTK_BOX(vbox), cie_widget, TRUE, TRUE, 12);
+	gtk_widget_show (cie_widget);
+
+	gtk_window_set_resizable (GTK_WINDOW (dialog), TRUE);
 	response = gtk_dialog_run (GTK_DIALOG (dialog));
 	gtk_widget_destroy (dialog);
 
@@ -164,6 +194,14 @@ main (int argc, char **argv)
 		goto out;
 	}
 out:
+	if (white != NULL)
+		g_object_unref (white);
+	if (red != NULL)
+		g_object_unref (red);
+	if (green != NULL)
+		g_object_unref (green);
+	if (blue != NULL)
+		g_object_unref (blue);
 	if (string != NULL)
 		g_string_free (string, TRUE);
 	if (profile != NULL)
diff --git a/src/gcm-xyz.c b/src/gcm-xyz.c
index 0572adc..e02c8d0 100644
--- a/src/gcm-xyz.c
+++ b/src/gcm-xyz.c
@@ -185,7 +185,7 @@ gcm_xyz_class_init (GcmXyzClass *klass)
 	 * GcmXyz:cie-x:
 	 */
 	pspec = g_param_spec_float ("cie-x", NULL, NULL,
-				    0.0f, G_MAXFLOAT, 0.0f,
+				    -G_MAXFLOAT, G_MAXFLOAT, 0.0f,
 				    G_PARAM_READWRITE);
 	g_object_class_install_property (object_class, PROP_CIE_X, pspec);
 
@@ -193,7 +193,7 @@ gcm_xyz_class_init (GcmXyzClass *klass)
 	 * GcmXyz:cie-y:
 	 */
 	pspec = g_param_spec_float ("cie-y", NULL, NULL,
-				    0.0f, G_MAXFLOAT, 0.0f,
+				    -G_MAXFLOAT, G_MAXFLOAT, 0.0f,
 				    G_PARAM_READWRITE);
 	g_object_class_install_property (object_class, PROP_CIE_Y, pspec);
 
@@ -201,7 +201,7 @@ gcm_xyz_class_init (GcmXyzClass *klass)
 	 * GcmXyz:cie-z:
 	 */
 	pspec = g_param_spec_float ("cie-z", NULL, NULL,
-				    0.0f, G_MAXFLOAT, 0.0f,
+				    -G_MAXFLOAT, G_MAXFLOAT, 0.0f,
 				    G_PARAM_READWRITE);
 	g_object_class_install_property (object_class, PROP_CIE_Z, pspec);
 



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