[gnome-color-manager] trivial: Move the calibration dialogs down into the baseclass
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-color-manager] trivial: Move the calibration dialogs down into the baseclass
- Date: Mon, 12 Dec 2011 18:18:12 +0000 (UTC)
commit 502840a8b1a3dd8a89bdb5c8ff85c903eb586403
Author: Richard Hughes <richard hughsie com>
Date: Mon Dec 12 16:34:38 2011 +0000
trivial: Move the calibration dialogs down into the baseclass
src/Makefile.am | 1 +
src/gcm-calibrate-argyll.c | 91 +++-----------------------------------
src/gcm-calibrate.c | 107 ++++++++++++++++++++++++++++++++++++++-----
src/gcm-calibrate.h | 6 +-
4 files changed, 104 insertions(+), 101 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index 8ac9d1e..c177c32 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -148,6 +148,7 @@ gcm_calibrate_helper_LDADD = \
$(TIFF_LIBS) \
$(COLORD_LIBS) \
$(GNOME_DESKTOP_LIBS) \
+ $(CANBERRA_LIBS) \
-lm
gcm_calibrate_helper_CFLAGS = \
diff --git a/src/gcm-calibrate-argyll.c b/src/gcm-calibrate-argyll.c
index 1943c9e..21f6de4 100644
--- a/src/gcm-calibrate-argyll.c
+++ b/src/gcm-calibrate-argyll.c
@@ -1902,7 +1902,6 @@ gcm_calibrate_argyll_timeout_cb (GcmCalibrateArgyll *calibrate_argyll)
static void
gcm_calibrate_argyll_interaction_attach (GcmCalibrateArgyll *calibrate_argyll)
{
- const gchar *filename;
GcmCalibrateArgyllPrivate *priv = calibrate_argyll->priv;
/* different tools assume the device is not on the screen */
@@ -1915,40 +1914,14 @@ gcm_calibrate_argyll_interaction_attach (GcmCalibrateArgyll *calibrate_argyll)
goto out;
}
- /* TRANSLATORS: title, instrument is a hardware color calibration sensor */
- gcm_calibrate_set_title (GCM_CALIBRATE (calibrate_argyll),
- _("Please attach instrument"));
-
- /* get the image, if we have one */
- 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 */
- if (filename != NULL) {
- /* TRANSLATORS: dialog message, ask user to attach device, and there's an example image */
- gcm_calibrate_set_message (GCM_CALIBRATE (calibrate_argyll),
- _("Please attach the measuring instrument to the center of the screen on the gray square like the image below."));
- } else {
- /* TRANSLATORS: dialog message, ask user to attach device */
- gcm_calibrate_set_message (GCM_CALIBRATE (calibrate_argyll),
- _("Please attach the measuring instrument to the center of the screen on the gray square."));
- }
+ /* tell the user to attach the sensor */
+ gcm_calibrate_interaction_attach (GCM_CALIBRATE (calibrate_argyll));
/* block for a response */
g_debug ("blocking waiting for user input");
- gcm_calibrate_interaction_required (GCM_CALIBRATE (calibrate_argyll), _("Continue"));
-
- /* set state */
priv->argyllcms_ok = "\n";
priv->state = GCM_CALIBRATE_ARGYLL_STATE_WAITING_FOR_STDIN,
- /* play sound from the naming spec */
- ca_context_play (ca_gtk_context_get (), 0,
- CA_PROP_EVENT_ID, "dialog-information",
- /* TRANSLATORS: this is the application name for libcanberra */
- CA_PROP_APPLICATION_NAME, _("GNOME Color Manager"),
- CA_PROP_EVENT_DESCRIPTION, "interaction required", NULL);
-
/* save as we know the device is on the screen now */
priv->already_on_window = TRUE;
out:
@@ -1961,48 +1934,21 @@ out:
static void
gcm_calibrate_argyll_interaction_calibrate (GcmCalibrateArgyll *calibrate_argyll)
{
- const gchar *filename;
GcmCalibrateArgyllPrivate *priv = calibrate_argyll->priv;
- /* TRANSLATORS: title, instrument is a hardware color calibration sensor */
- gcm_calibrate_set_title (GCM_CALIBRATE (calibrate_argyll),
- _("Please configure instrument"));
+ /* standard dialog */
+ gcm_calibrate_interaction_calibrate (GCM_CALIBRATE (calibrate_argyll));
/* block for a response */
g_debug ("blocking waiting for user input");
- /* get the image, if we have one */
- filename = gcm_calibrate_get_sensor_image_calibrate (GCM_CALIBRATE (calibrate_argyll));
- gcm_calibrate_set_image (GCM_CALIBRATE (calibrate_argyll), filename);
-
- if (filename != NULL) {
- /* TRANSLATORS: this is when the user has to change a setting on the sensor, and we're showing a picture */
- gcm_calibrate_set_message (GCM_CALIBRATE (calibrate_argyll),
- _("Please set the measuring instrument to calibration mode like the image below."));
- } else {
- /* TRANSLATORS: this is when the user has to change a setting on the sensor */
- gcm_calibrate_set_message (GCM_CALIBRATE (calibrate_argyll),
- _("Please set the measuring instrument to calibration mode."));
- }
-
-
- /* play sound from the naming spec */
- ca_context_play (ca_gtk_context_get (), 0,
- CA_PROP_EVENT_ID, "dialog-information",
- /* TRANSLATORS: this is the application name for libcanberra */
- CA_PROP_APPLICATION_NAME, _("GNOME Color Manager"),
- CA_PROP_EVENT_DESCRIPTION, "setup calibration tool", NULL);
-
/* assume it's no longer on the window */
priv->already_on_window = FALSE;
/* assume it was done correctly */
priv->done_calibrate = TRUE;
-
- /* set state */
priv->argyllcms_ok = "\n";
priv->state = GCM_CALIBRATE_ARGYLL_STATE_WAITING_FOR_STDIN;
- gcm_calibrate_interaction_required (GCM_CALIBRATE (calibrate_argyll), _("Continue"));
}
/**
@@ -2011,45 +1957,20 @@ gcm_calibrate_argyll_interaction_calibrate (GcmCalibrateArgyll *calibrate_argyll
static void
gcm_calibrate_argyll_interaction_surface (GcmCalibrateArgyll *calibrate_argyll)
{
- const gchar *filename;
GcmCalibrateArgyllPrivate *priv = calibrate_argyll->priv;
- /* TRANSLATORS: title, instrument is a hardware color calibration sensor */
- gcm_calibrate_set_title (GCM_CALIBRATE (calibrate_argyll),
- _("Please configure instrument"));
+ /* standard dialog */
+ gcm_calibrate_interaction_screen (GCM_CALIBRATE (calibrate_argyll));
/* block for a response */
g_debug ("blocking waiting for user input");
- /* get the image, if we have one */
- filename = gcm_calibrate_get_sensor_image_screen (GCM_CALIBRATE (calibrate_argyll));
- gcm_calibrate_set_image (GCM_CALIBRATE (calibrate_argyll), filename);
-
- if (filename != NULL) {
- /* TRANSLATORS: this is when the user has to change a setting on the sensor, and we're showing a picture */
- gcm_calibrate_set_message (GCM_CALIBRATE (calibrate_argyll),
- _("Please set the measuring instrument to screen mode like the image below."));
- } else {
- /* TRANSLATORS: this is when the user has to change a setting on the sensor */
- gcm_calibrate_set_message (GCM_CALIBRATE (calibrate_argyll),
- _("Please set the measuring instrument to screen mode."));
- }
-
-
- /* play sound from the naming spec */
- ca_context_play (ca_gtk_context_get (), 0,
- CA_PROP_EVENT_ID, "dialog-information",
- /* TRANSLATORS: this is the application name for libcanberra */
- CA_PROP_APPLICATION_NAME, _("GNOME Color Manager"),
- CA_PROP_EVENT_DESCRIPTION, "correct hardware state", NULL);
-
/* assume it's no longer on the window */
priv->already_on_window = FALSE;
/* set state */
priv->argyllcms_ok = "\n";
priv->state = GCM_CALIBRATE_ARGYLL_STATE_WAITING_FOR_STDIN;
- gcm_calibrate_interaction_required (GCM_CALIBRATE (calibrate_argyll), _("Continue"));
}
/**
diff --git a/src/gcm-calibrate.c b/src/gcm-calibrate.c
index 43aa619..c7f453b 100644
--- a/src/gcm-calibrate.c
+++ b/src/gcm-calibrate.c
@@ -26,6 +26,7 @@
#include <math.h>
#include <colord.h>
#include <lcms2.h>
+#include <canberra-gtk.h>
#define GNOME_DESKTOP_USE_UNSTABLE_API
#include <libgnome-desktop/gnome-rr.h>
@@ -349,7 +350,7 @@ gcm_calibrate_interaction (GcmCalibrate *calibrate, GtkResponseType response)
/**
* gcm_calibrate_get_sensor_image_attach:
**/
-const gchar *
+static const gchar *
gcm_calibrate_get_sensor_image_attach (GcmCalibrate *calibrate)
{
switch (cd_sensor_get_kind (calibrate->priv->sensor)) {
@@ -384,7 +385,7 @@ gcm_calibrate_get_sensor_image_attach (GcmCalibrate *calibrate)
/**
* gcm_calibrate_get_sensor_image_calibrate:
**/
-const gchar *
+static const gchar *
gcm_calibrate_get_sensor_image_calibrate (GcmCalibrate *calibrate)
{
CdSensorKind sensor_kind;
@@ -398,7 +399,7 @@ gcm_calibrate_get_sensor_image_calibrate (GcmCalibrate *calibrate)
/**
* gcm_calibrate_get_sensor_image_screen:
**/
-const gchar *
+static const gchar *
gcm_calibrate_get_sensor_image_screen (GcmCalibrate *calibrate)
{
CdSensorKind sensor_kind;
@@ -472,32 +473,110 @@ gcm_calibrate_delay (guint ms)
}
/**
- * gcm_calibrate_interaction_attach_sensor:
+ * gcm_calibrate_interaction_attach:
**/
-static void
-gcm_calibrate_interaction_attach_sensor (GcmCalibrate *calibrate)
+void
+gcm_calibrate_interaction_attach (GcmCalibrate *calibrate)
{
const gchar *filename;
- const gchar *message;
+ GString *message;
/* TRANSLATORS: title, instrument is a hardware color calibration sensor */
gcm_calibrate_set_title (calibrate, _("Please attach instrument"));
/* different messages with or without image */
+ message = g_string_new ("");
filename = gcm_calibrate_get_sensor_image_attach (calibrate);
if (filename != NULL) {
/* TRANSLATORS: dialog message, ask user to attach device, and there's an example image */
- message = _("Please attach the measuring instrument to the center of the screen on the gray square like the image below.");
+ g_string_append (message, _("Please attach the measuring instrument to the center of the screen on the gray square like the image below."));
} else {
/* TRANSLATORS: dialog message, ask user to attach device */
- message = _("Please attach the measuring instrument to the center of the screen on the gray square.");
+ g_string_append (message, _("Please attach the measuring instrument to the center of the screen on the gray square."));
}
- gcm_calibrate_set_message (calibrate, message);
+ gcm_calibrate_set_message (calibrate, message->str);
+ gcm_calibrate_set_image (calibrate, filename);
+ gcm_calibrate_interaction_required (calibrate, _("Continue"));
+
+ /* play sound from the naming spec */
+ ca_context_play (ca_gtk_context_get (), 0,
+ CA_PROP_EVENT_ID, "dialog-information",
+ /* TRANSLATORS: this is the application name for libcanberra */
+ CA_PROP_APPLICATION_NAME, _("GNOME Color Manager"),
+ CA_PROP_EVENT_DESCRIPTION, "interaction required", NULL);
+
+ g_string_free (message, TRUE);
+}
+
+/**
+ * gcm_calibrate_interaction_screen:
+ **/
+void
+gcm_calibrate_interaction_screen (GcmCalibrate *calibrate)
+{
+ const gchar *filename;
+
+ /* TRANSLATORS: title, instrument is a hardware color calibration sensor */
+ gcm_calibrate_set_title (calibrate,
+ _("Please configure instrument"));
+
+ /* get the image, if we have one */
+ filename = gcm_calibrate_get_sensor_image_screen (calibrate);
gcm_calibrate_set_image (calibrate, filename);
gcm_calibrate_interaction_required (calibrate, _("Continue"));
+ if (filename != NULL) {
+ /* TRANSLATORS: this is when the user has to change a setting on the sensor, and we're showing a picture */
+ gcm_calibrate_set_message (calibrate,
+ _("Please set the measuring instrument to screen mode like the image below."));
+ } else {
+ /* TRANSLATORS: this is when the user has to change a setting on the sensor */
+ gcm_calibrate_set_message (calibrate,
+ _("Please set the measuring instrument to screen mode."));
+ }
+
+ /* play sound from the naming spec */
+ ca_context_play (ca_gtk_context_get (), 0,
+ CA_PROP_EVENT_ID, "dialog-information",
+ /* TRANSLATORS: this is the application name for libcanberra */
+ CA_PROP_APPLICATION_NAME, _("GNOME Color Manager"),
+ CA_PROP_EVENT_DESCRIPTION, "correct hardware state", NULL);
+}
+
+/**
+ * gcm_calibrate_interaction_calibrate:
+ **/
+void
+gcm_calibrate_interaction_calibrate (GcmCalibrate *calibrate)
+{
+ const gchar *filename;
+
+ /* TRANSLATORS: title, instrument is a hardware color calibration sensor */
+ gcm_calibrate_set_title (calibrate,
+ _("Please configure instrument"));
+
+ /* block for a response */
+ g_debug ("blocking waiting for user input");
+
+ /* get the image, if we have one */
+ filename = gcm_calibrate_get_sensor_image_calibrate (calibrate);
+ gcm_calibrate_set_image (calibrate, filename);
+ gcm_calibrate_interaction_required (calibrate, _("Continue"));
+ if (filename != NULL) {
+ /* TRANSLATORS: this is when the user has to change a setting on the sensor, and we're showing a picture */
+ gcm_calibrate_set_message (calibrate,
+ _("Please set the measuring instrument to calibration mode like the image below."));
+ } else {
+ /* TRANSLATORS: this is when the user has to change a setting on the sensor */
+ gcm_calibrate_set_message (calibrate,
+ _("Please set the measuring instrument to calibration mode."));
+ }
- //FIXME
- gcm_calibrate_delay (3000);
+ /* play sound from the naming spec */
+ ca_context_play (ca_gtk_context_get (), 0,
+ CA_PROP_EVENT_ID, "dialog-information",
+ /* TRANSLATORS: this is the application name for libcanberra */
+ CA_PROP_APPLICATION_NAME, _("GNOME Color Manager"),
+ CA_PROP_EVENT_DESCRIPTION, "setup calibration tool", NULL);
}
/**
@@ -548,7 +627,9 @@ gcm_calibrate_get_samples (GcmCalibrate *calibrate,
/* wait for the refresh to set the new color */
if (i == 0 && !priv->sensor_on_screen) {
- gcm_calibrate_interaction_attach_sensor (calibrate);
+ gcm_calibrate_interaction_attach (calibrate);
+ //FIXME
+ gcm_calibrate_delay (3000);
priv->sensor_on_screen = TRUE;
}
gcm_calibrate_delay (100);
diff --git a/src/gcm-calibrate.h b/src/gcm-calibrate.h
index ca1369e..fb3ab7a 100644
--- a/src/gcm-calibrate.h
+++ b/src/gcm-calibrate.h
@@ -153,9 +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);
+void gcm_calibrate_interaction_attach (GcmCalibrate *calibrate);
+void gcm_calibrate_interaction_calibrate (GcmCalibrate *calibrate);
+void gcm_calibrate_interaction_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]