[gnome-color-manager] trivial: move the sensor -> image mapping functions out of GcmCalibrateArgyll



commit 294a1f4f07f9bef64af501d4e38ab68d4a2a720a
Author: Richard Hughes <richard hughsie com>
Date:   Mon Nov 28 20:43:27 2011 +0000

    trivial: move the sensor -> image mapping functions out of GcmCalibrateArgyll

 src/gcm-calibrate-argyll.c |   65 +++-----------------------------------------
 src/gcm-calibrate.c        |   57 ++++++++++++++++++++++++++++++++++++++
 src/gcm-calibrate.h        |    3 ++
 3 files changed, 64 insertions(+), 61 deletions(-)
---
diff --git a/src/gcm-calibrate-argyll.c b/src/gcm-calibrate-argyll.c
index 64d120e..1943c9e 100644
--- a/src/gcm-calibrate-argyll.c
+++ b/src/gcm-calibrate-argyll.c
@@ -34,6 +34,7 @@
 #endif
 #include <canberra-gtk.h>
 
+#include "gcm-calibrate.h"
 #include "gcm-calibrate-argyll.h"
 #include "gcm-utils.h"
 #include "gcm-print.h"
@@ -109,64 +110,6 @@ gcm_calibrate_argyll_get_quality_arg (GcmCalibrateArgyll *calibrate_argyll)
 	return "-qm";
 }
 
-#ifdef HAVE_VTE
-/**
- * gcm_calibrate_argyll_get_sensor_image_attach:
- **/
-static const gchar *
-gcm_calibrate_argyll_get_sensor_image_attach (GcmCalibrateArgyll *calibrate_argyll)
-{
-	CdSensorKind sensor_kind;
-
-	g_object_get (calibrate_argyll, "sensor-kind", &sensor_kind, NULL);
-	if (sensor_kind == CD_SENSOR_KIND_HUEY)
-		return "huey-attach.svg";
-	if (sensor_kind == CD_SENSOR_KIND_COLOR_MUNKI)
-		return "munki-attach.svg";
-	if (sensor_kind == CD_SENSOR_KIND_SPYDER)
-		return "spyder-attach.svg";
-	if (sensor_kind == CD_SENSOR_KIND_COLORIMTRE_HCFR)
-		return "hcfr-attach.svg";
-	if (sensor_kind == CD_SENSOR_KIND_I1_PRO)
-		return "i1-pro-attach.svg";
-	if (sensor_kind == CD_SENSOR_KIND_DTP94)
-		return "dtp94-attach.svg";
-#if CD_CHECK_VERSION(0,1,14)
-	if (sensor_kind == CD_SENSOR_KIND_I1_DISPLAY3)
-		return "i1-display3-attach.svg";
-#endif
-	return NULL;
-}
-
-/**
- * gcm_calibrate_argyll_get_sensor_image_calibrate:
- **/
-static const gchar *
-gcm_calibrate_argyll_get_sensor_image_calibrate (GcmCalibrateArgyll *calibrate_argyll)
-{
-	CdSensorKind sensor_kind;
-
-	g_object_get (calibrate_argyll, "sensor-kind", &sensor_kind, NULL);
-	if (sensor_kind == CD_SENSOR_KIND_COLOR_MUNKI)
-		return "munki-calibrate.svg";
-	return NULL;
-}
-
-/**
- * gcm_calibrate_argyll_get_sensor_image_screen:
- **/
-static const gchar *
-gcm_calibrate_argyll_get_sensor_image_screen (GcmCalibrateArgyll *calibrate_argyll)
-{
-	CdSensorKind sensor_kind;
-
-	g_object_get (calibrate_argyll, "sensor-kind", &sensor_kind, NULL);
-	if (sensor_kind == CD_SENSOR_KIND_COLOR_MUNKI)
-		return "munki-screen.svg";
-	return NULL;
-}
-#endif
-
 /**
  * gcm_calibrate_argyll_get_display:
  **/
@@ -1977,7 +1920,7 @@ gcm_calibrate_argyll_interaction_attach (GcmCalibrateArgyll *calibrate_argyll)
 				 _("Please attach instrument"));
 
 	/* get the image, if we have one */
-	filename = gcm_calibrate_argyll_get_sensor_image_attach (calibrate_argyll);
+	filename = gcm_calibrate_get_sensor_image_attach (GCM_CALIBRATE (calibrate_argyll));
 	gcm_calibrate_set_image (GCM_CALIBRATE (calibrate_argyll), filename);
 
 	/* different messages with or without image */
@@ -2029,7 +1972,7 @@ gcm_calibrate_argyll_interaction_calibrate (GcmCalibrateArgyll *calibrate_argyll
 	g_debug ("blocking waiting for user input");
 
 	/* get the image, if we have one */
-	filename = gcm_calibrate_argyll_get_sensor_image_calibrate (calibrate_argyll);
+	filename = gcm_calibrate_get_sensor_image_calibrate (GCM_CALIBRATE (calibrate_argyll));
 	gcm_calibrate_set_image (GCM_CALIBRATE (calibrate_argyll), filename);
 
 	if (filename != NULL) {
@@ -2079,7 +2022,7 @@ gcm_calibrate_argyll_interaction_surface (GcmCalibrateArgyll *calibrate_argyll)
 	g_debug ("blocking waiting for user input");
 
 	/* get the image, if we have one */
-	filename = gcm_calibrate_argyll_get_sensor_image_screen (calibrate_argyll);
+	filename = gcm_calibrate_get_sensor_image_screen (GCM_CALIBRATE (calibrate_argyll));
 	gcm_calibrate_set_image (GCM_CALIBRATE (calibrate_argyll), filename);
 
 	if (filename != NULL) {
diff --git a/src/gcm-calibrate.c b/src/gcm-calibrate.c
index 1ce709c..bad30f7 100644
--- a/src/gcm-calibrate.c
+++ b/src/gcm-calibrate.c
@@ -346,6 +346,63 @@ gcm_calibrate_interaction (GcmCalibrate *calibrate, GtkResponseType response)
 }
 
 /**
+ * gcm_calibrate_get_sensor_image_attach:
+ **/
+const gchar *
+gcm_calibrate_get_sensor_image_attach (GcmCalibrate *calibrate)
+{
+	switch (cd_sensor_get_kind (calibrate->priv->sensor)) {
+	case CD_SENSOR_KIND_HUEY:
+		return "huey-attach.svg";
+	case CD_SENSOR_KIND_COLOR_MUNKI:
+		return "munki-attach.svg";
+	case CD_SENSOR_KIND_SPYDER:
+		return "spyder-attach.svg";
+	case CD_SENSOR_KIND_COLORIMTRE_HCFR:
+		return "hcfr-attach.svg";
+	case CD_SENSOR_KIND_I1_PRO:
+		return "i1-pro-attach.svg";
+	case CD_SENSOR_KIND_DTP94:
+		return "dtp94-attach.svg";
+#if CD_CHECK_VERSION(0,1,14)
+	case CD_SENSOR_KIND_I1_DISPLAY3:
+		return "i1-display3-attach.svg";
+#endif
+	default:
+		break;
+	}
+	return NULL;
+}
+
+/**
+ * gcm_calibrate_get_sensor_image_calibrate:
+ **/
+const gchar *
+gcm_calibrate_get_sensor_image_calibrate (GcmCalibrate *calibrate)
+{
+	CdSensorKind sensor_kind;
+
+	sensor_kind = cd_sensor_get_kind (calibrate->priv->sensor);
+	if (sensor_kind == CD_SENSOR_KIND_COLOR_MUNKI)
+		return "munki-calibrate.svg";
+	return NULL;
+}
+
+/**
+ * gcm_calibrate_get_sensor_image_screen:
+ **/
+const gchar *
+gcm_calibrate_get_sensor_image_screen (GcmCalibrate *calibrate)
+{
+	CdSensorKind sensor_kind;
+
+	sensor_kind = cd_sensor_get_kind (calibrate->priv->sensor);
+	if (sensor_kind == CD_SENSOR_KIND_COLOR_MUNKI)
+		return "munki-screen.svg";
+	return NULL;
+}
+
+/**
  * gcm_calibrate_copy_file:
  **/
 static gboolean
diff --git a/src/gcm-calibrate.h b/src/gcm-calibrate.h
index c5df8a0..ca1369e 100644
--- a/src/gcm-calibrate.h
+++ b/src/gcm-calibrate.h
@@ -153,6 +153,9 @@ void		 gcm_calibrate_pop			(GcmCalibrate	*calibrate);
 void		 gcm_calibrate_interaction_required	(GcmCalibrate	*calibrate,
 							 const gchar	*button_text);
 GtkWidget	*gcm_calibrate_get_content_widget	(GcmCalibrate	*calibrate);
+const gchar	*gcm_calibrate_get_sensor_image_attach	(GcmCalibrate	*calibrate);
+const gchar	*gcm_calibrate_get_sensor_image_calibrate (GcmCalibrate	*calibrate);
+const gchar	*gcm_calibrate_get_sensor_image_screen	(GcmCalibrate	*calibrate);
 
 /* JUNK */
 gboolean	 gcm_calibrate_set_from_exif		(GcmCalibrate	*calibrate,



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