[gnome-color-manager] Add support for sending calibration images to print shops, rather than just using the local printer
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-color-manager] Add support for sending calibration images to print shops, rather than just using the local printer
- Date: Tue, 23 Feb 2010 12:43:30 +0000 (UTC)
commit 25b5acacb76d6661e013a3072f7f2ee96d2a336b
Author: Richard Hughes <richard hughsie com>
Date: Tue Feb 23 12:42:57 2010 +0000
Add support for sending calibration images to print shops, rather than just using the local printer
data/gcm-calibrate.ui | 149 ++++++++++++++++++++++++++++++++++++++++++++
src/gcm-calibrate-argyll.c | 72 +++++++++++++++------
src/gcm-calibrate-dialog.c | 56 ++++++++++++++++
src/gcm-calibrate-dialog.h | 1 +
src/gcm-calibrate.c | 42 ++++++++++++
src/gcm-calibrate.h | 7 ++
6 files changed, 306 insertions(+), 21 deletions(-)
---
diff --git a/data/gcm-calibrate.ui b/data/gcm-calibrate.ui
index d4e0c73..486cd9f 100644
--- a/data/gcm-calibrate.ui
+++ b/data/gcm-calibrate.ui
@@ -564,6 +564,155 @@
<property name="tab_fill">False</property>
</packing>
</child>
+ <child>
+ <object class="GtkVBox" id="vbox_print_mode">
+ <property name="visible">True</property>
+ <property name="border_width">9</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <object class="GtkHBox" id="hbox2">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <property name="homogeneous">True</property>
+ <child>
+ <object class="GtkButton" id="button_print_local">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <child>
+ <object class="GtkVBox" id="vbox1">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkImage" id="image4">
+ <property name="visible">True</property>
+ <property name="pixel_size">150</property>
+ <property name="icon_name">document-print</property>
+ </object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label17">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Profile Attached Printer</property>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="button_print_generate">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <child>
+ <object class="GtkVBox" id="vbox2">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkImage" id="image5">
+ <property name="visible">True</property>
+ <property name="pixel_size">150</property>
+ <property name="icon_name">document-save</property>
+ </object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label18">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Create Images For Print Shop</property>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="button_print_analyse">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <child>
+ <object class="GtkVBox" id="vbox3">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkImage" id="image6">
+ <property name="visible">True</property>
+ <property name="pixel_size">150</property>
+ <property name="icon_name">emblem-photos</property>
+ </object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label19">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Analyse Print Shop Images</property>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label20">
+ <property name="visible">True</property>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="position">4</property>
+ </packing>
+ </child>
+ <child type="tab">
+ <object class="GtkLabel" id="label16">
+ <property name="visible">True</property>
+ <property name="label">print-mode</property>
+ </object>
+ <packing>
+ <property name="position">4</property>
+ <property name="tab_fill">False</property>
+ </packing>
+ </child>
</object>
<packing>
<property name="expand">False</property>
diff --git a/src/gcm-calibrate-argyll.c b/src/gcm-calibrate-argyll.c
index 5a61b38..df72e3c 100644
--- a/src/gcm-calibrate-argyll.c
+++ b/src/gcm-calibrate-argyll.c
@@ -1494,48 +1494,78 @@ gcm_calibrate_argyll_printer (GcmCalibrate *calibrate, GtkWindow *window, GError
const gchar *title;
const gchar *message;
GtkResponseType response;
+ GcmCalibratePrintKind print_kind;
GcmCalibrateArgyll *calibrate_argyll = GCM_CALIBRATE_ARGYLL(calibrate);
GcmCalibrateArgyllPrivate *priv = calibrate_argyll->priv;
/* need to ask if we are printing now, or using old data */
+ g_object_get (calibrate,
+ "print-kind", &print_kind,
+ NULL);
/* set modal windows up correctly */
gcm_calibrate_dialog_set_move_window (priv->calibrate_dialog, FALSE);
gcm_calibrate_dialog_set_window (priv->calibrate_dialog, window);
/* step 1 */
- ret = gcm_calibrate_argyll_display_generate_patches (calibrate_argyll, error);
- if (!ret)
- goto out;
+ if (print_kind == GCM_CALIBRATE_PRINT_KIND_LOCAL ||
+ print_kind == GCM_CALIBRATE_PRINT_KIND_GENERATE) {
+ ret = gcm_calibrate_argyll_display_generate_patches (calibrate_argyll, error);
+ if (!ret)
+ goto out;
+ }
/* print */
- window = gcm_calibrate_dialog_get_window (priv->calibrate_dialog);
- ret = gcm_print_with_render_callback (priv->print, window, (GcmPrintRenderCb) gcm_calibrate_argyll_render_cb, calibrate, error);
- if (!ret)
- goto out;
-
- /* TRANSLATORS: title, patches are specific colours used in calibration */
- title = _("Wait for the ink to dry");
+ if (print_kind == GCM_CALIBRATE_PRINT_KIND_LOCAL ||
+ print_kind == GCM_CALIBRATE_PRINT_KIND_GENERATE) {
+ window = gcm_calibrate_dialog_get_window (priv->calibrate_dialog);
+ //TODO: we need to send a temp directory
+ ret = gcm_print_with_render_callback (priv->print, window, (GcmPrintRenderCb) gcm_calibrate_argyll_render_cb, calibrate, error);
+ if (!ret)
+ goto out;
+ }
- /* TRANSLATORS: dialog message */
- message = _("Please wait a few minutes for the ink to dry. Profiling damp ink will produce a poor profile and may damage your calibration device.");
+ /* we're done */
+ if (print_kind == GCM_CALIBRATE_PRINT_KIND_GENERATE) {
+ egg_warning ("we need to open the directory we're using");
+ goto out;
+ }
- /* push new messages into the UI */
- gcm_calibrate_dialog_show (priv->calibrate_dialog, GCM_CALIBRATE_DIALOG_TAB_GENERIC, title, message);
- gcm_calibrate_dialog_set_show_button_ok (priv->calibrate_dialog, TRUE);
- gcm_calibrate_dialog_set_show_expander (priv->calibrate_dialog, FALSE);
- gcm_calibrate_dialog_set_image_filename (priv->calibrate_dialog, "clock.svg");
- response = gcm_calibrate_dialog_run (priv->calibrate_dialog);
- if (response != GTK_RESPONSE_OK) {
- gcm_calibrate_dialog_hide (priv->calibrate_dialog);
+ /* we're done */
+ if (print_kind == GCM_CALIBRATE_PRINT_KIND_ANALYSE) {
g_set_error_literal (error,
GCM_CALIBRATE_ERROR,
GCM_CALIBRATE_ERROR_USER_ABORT,
- "user did not wait for ink to dry");
+ "FIXME: need to show file chooser");
ret = FALSE;
goto out;
}
+ /* wait */
+ if (print_kind == GCM_CALIBRATE_PRINT_KIND_LOCAL) {
+ /* TRANSLATORS: title, patches are specific colours used in calibration */
+ title = _("Wait for the ink to dry");
+
+ /* TRANSLATORS: dialog message */
+ message = _("Please wait a few minutes for the ink to dry. Profiling damp ink will produce a poor profile and may damage your calibration device.");
+
+ /* push new messages into the UI */
+ gcm_calibrate_dialog_show (priv->calibrate_dialog, GCM_CALIBRATE_DIALOG_TAB_GENERIC, title, message);
+ gcm_calibrate_dialog_set_show_button_ok (priv->calibrate_dialog, TRUE);
+ gcm_calibrate_dialog_set_show_expander (priv->calibrate_dialog, FALSE);
+ gcm_calibrate_dialog_set_image_filename (priv->calibrate_dialog, "clock.svg");
+ response = gcm_calibrate_dialog_run (priv->calibrate_dialog);
+ if (response != GTK_RESPONSE_OK) {
+ gcm_calibrate_dialog_hide (priv->calibrate_dialog);
+ g_set_error_literal (error,
+ GCM_CALIBRATE_ERROR,
+ GCM_CALIBRATE_ERROR_USER_ABORT,
+ "user did not wait for ink to dry");
+ ret = FALSE;
+ goto out;
+ }
+ }
+
/* step 3 */
ret = gcm_calibrate_argyll_display_read_chart (calibrate_argyll, error);
if (!ret)
diff --git a/src/gcm-calibrate-dialog.c b/src/gcm-calibrate-dialog.c
index c6ebbc2..3f2264e 100644
--- a/src/gcm-calibrate-dialog.c
+++ b/src/gcm-calibrate-dialog.c
@@ -52,6 +52,7 @@ struct _GcmCalibrateDialogPrivate
GPtrArray *cached_dialogs;
GtkBuilder *builder;
GcmCalibrateDeviceKind device_kind;
+ GcmCalibratePrintKind print_kind;
GcmCalibrateReferenceKind reference_kind;
GtkResponseType response;
GMainLoop *loop;
@@ -66,6 +67,7 @@ enum {
enum {
PROP_0,
PROP_DEVICE_KIND,
+ PROP_PRINT_KIND,
PROP_REFERENCE_KIND,
PROP_LAST
};
@@ -128,6 +130,36 @@ gcm_calibrate_dialog_button_clicked_projector_cb (GtkWidget *widget, GcmCalibrat
}
/**
+ * gcm_calibrate_dialog_button_clicked_print_local_cb:
+ **/
+static void
+gcm_calibrate_dialog_button_clicked_print_local_cb (GtkWidget *widget, GcmCalibrateDialog *calibrate_dialog)
+{
+ calibrate_dialog->priv->print_kind = GCM_CALIBRATE_PRINT_KIND_LOCAL;
+ gcm_calibrate_dialog_emit_response (calibrate_dialog, GTK_RESPONSE_OK);
+}
+
+/**
+ * gcm_calibrate_dialog_button_clicked_print_generate_cb:
+ **/
+static void
+gcm_calibrate_dialog_button_clicked_print_generate_cb (GtkWidget *widget, GcmCalibrateDialog *calibrate_dialog)
+{
+ calibrate_dialog->priv->print_kind = GCM_CALIBRATE_PRINT_KIND_GENERATE;
+ gcm_calibrate_dialog_emit_response (calibrate_dialog, GTK_RESPONSE_OK);
+}
+
+/**
+ * gcm_calibrate_dialog_button_clicked_print_analyse_cb:
+ **/
+static void
+gcm_calibrate_dialog_button_clicked_print_analyse_cb (GtkWidget *widget, GcmCalibrateDialog *calibrate_dialog)
+{
+ calibrate_dialog->priv->print_kind = GCM_CALIBRATE_PRINT_KIND_ANALYSE;
+ gcm_calibrate_dialog_emit_response (calibrate_dialog, GTK_RESPONSE_OK);
+}
+
+/**
* gcm_calibrate_dialog_button_clicked_ok_cb:
**/
static void
@@ -274,6 +306,8 @@ gcm_calibrate_dialog_show (GcmCalibrateDialog *calibrate_dialog,
gtk_widget_set_visible (widget, (tab == GCM_CALIBRATE_DIALOG_TAB_MANUAL));
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "vbox_generic"));
gtk_widget_set_visible (widget, (tab == GCM_CALIBRATE_DIALOG_TAB_GENERIC));
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "vbox_print_mode"));
+ gtk_widget_set_visible (widget, (tab == GCM_CALIBRATE_DIALOG_TAB_PRINT_MODE));
/* reset */
gcm_calibrate_dialog_set_image_filename (calibrate_dialog, NULL);
@@ -563,6 +597,9 @@ gcm_calibrate_dialog_get_property (GObject *object, guint prop_id, GValue *value
case PROP_DEVICE_KIND:
g_value_set_uint (value, priv->device_kind);
break;
+ case PROP_PRINT_KIND:
+ g_value_set_uint (value, priv->print_kind);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -611,6 +648,14 @@ gcm_calibrate_dialog_class_init (GcmCalibrateDialogClass *klass)
g_object_class_install_property (object_class, PROP_DEVICE_KIND, pspec);
/**
+ * GcmCalibrateDialog:print-kind:
+ */
+ pspec = g_param_spec_uint ("print-kind", NULL, NULL,
+ 0, G_MAXUINT, 0,
+ G_PARAM_READABLE);
+ g_object_class_install_property (object_class, PROP_PRINT_KIND, pspec);
+
+ /**
* GcmCalibrateDialog::response:
**/
signals[SIGNAL_RESPONSE] =
@@ -637,6 +682,7 @@ gcm_calibrate_dialog_init (GcmCalibrateDialog *calibrate_dialog)
calibrate_dialog->priv = GCM_CALIBRATE_DIALOG_GET_PRIVATE (calibrate_dialog);
calibrate_dialog->priv->device_kind = GCM_CALIBRATE_DEVICE_KIND_UNKNOWN;
+ calibrate_dialog->priv->print_kind = GCM_CALIBRATE_PRINT_KIND_UNKNOWN;
calibrate_dialog->priv->reference_kind = GCM_CALIBRATE_REFERENCE_KIND_UNKNOWN;
calibrate_dialog->priv->move_window = FALSE;
calibrate_dialog->priv->loop = g_main_loop_new (NULL, FALSE);
@@ -668,6 +714,16 @@ gcm_calibrate_dialog_init (GcmCalibrateDialog *calibrate_dialog)
widget = GTK_WIDGET (gtk_builder_get_object (calibrate_dialog->priv->builder, "button_ok"));
g_signal_connect (widget, "clicked",
G_CALLBACK (gcm_calibrate_dialog_button_clicked_ok_cb), calibrate_dialog);
+ widget = GTK_WIDGET (gtk_builder_get_object (calibrate_dialog->priv->builder, "button_print_local"));
+ g_signal_connect (widget, "clicked",
+ G_CALLBACK (gcm_calibrate_dialog_button_clicked_print_local_cb), calibrate_dialog);
+ widget = GTK_WIDGET (gtk_builder_get_object (calibrate_dialog->priv->builder, "button_print_generate"));
+ g_signal_connect (widget, "clicked",
+ G_CALLBACK (gcm_calibrate_dialog_button_clicked_print_generate_cb), calibrate_dialog);
+ widget = GTK_WIDGET (gtk_builder_get_object (calibrate_dialog->priv->builder, "button_print_analyse"));
+ g_signal_connect (widget, "clicked",
+ G_CALLBACK (gcm_calibrate_dialog_button_clicked_print_analyse_cb), calibrate_dialog);
+
widget = GTK_WIDGET (gtk_builder_get_object (calibrate_dialog->priv->builder, "image_target"));
gtk_widget_set_size_request (widget, 200, 140);
diff --git a/src/gcm-calibrate-dialog.h b/src/gcm-calibrate-dialog.h
index 136a833..c4892f4 100644
--- a/src/gcm-calibrate-dialog.h
+++ b/src/gcm-calibrate-dialog.h
@@ -58,6 +58,7 @@ typedef enum {
GCM_CALIBRATE_DIALOG_TAB_TARGET_TYPE,
GCM_CALIBRATE_DIALOG_TAB_MANUAL,
GCM_CALIBRATE_DIALOG_TAB_GENERIC,
+ GCM_CALIBRATE_DIALOG_TAB_PRINT_MODE,
GCM_CALIBRATE_DIALOG_TAB_LAST
} GcmCalibrateDialogTab;
diff --git a/src/gcm-calibrate.c b/src/gcm-calibrate.c
index e2e4a9e..7e0713b 100644
--- a/src/gcm-calibrate.c
+++ b/src/gcm-calibrate.c
@@ -55,6 +55,7 @@ struct _GcmCalibratePrivate
GcmColorimeter *colorimeter;
GcmCalibrateReferenceKind reference_kind;
GcmCalibrateDeviceKind device_kind;
+ GcmCalibratePrintKind print_kind;
GcmColorimeterKind colorimeter_kind;
GcmCalibrateDialog *calibrate_dialog;
GcmDeviceTypeEnum device_type;
@@ -80,6 +81,7 @@ enum {
PROP_MANUFACTURER,
PROP_REFERENCE_KIND,
PROP_DEVICE_KIND,
+ PROP_PRINT_KIND,
PROP_DEVICE_TYPE,
PROP_COLORIMETER_KIND,
PROP_OUTPUT_NAME,
@@ -668,7 +670,35 @@ gboolean
gcm_calibrate_printer (GcmCalibrate *calibrate, GtkWindow *window, GError **error)
{
gboolean ret = FALSE;
+ const gchar *title;
+ const gchar *message;
+ GtkResponseType response;
GcmCalibrateClass *klass = GCM_CALIBRATE_GET_CLASS (calibrate);
+ GcmCalibratePrivate *priv = calibrate->priv;
+
+ /* TRANSLATORS: title, you can profile all at once, or in steps */
+ title = _("Please choose a profiling mode");
+
+ /* TRANSLATORS: dialog message */
+ message = _("Please indicate if you want to profile a local printer, generate some reference images, or to process some reference images.");
+
+ /* push new messages into the UI */
+ gcm_calibrate_dialog_show (priv->calibrate_dialog, GCM_CALIBRATE_DIALOG_TAB_PRINT_MODE, title, message);
+ gcm_calibrate_dialog_set_show_button_ok (priv->calibrate_dialog, FALSE);
+ gcm_calibrate_dialog_set_show_expander (priv->calibrate_dialog, FALSE);
+ response = gcm_calibrate_dialog_run (priv->calibrate_dialog);
+ if (response != GTK_RESPONSE_OK) {
+ gcm_calibrate_dialog_hide (priv->calibrate_dialog);
+ g_set_error_literal (error,
+ GCM_CALIBRATE_ERROR,
+ GCM_CALIBRATE_ERROR_USER_ABORT,
+ "user did not choose print mode");
+ ret = FALSE;
+ goto out;
+ }
+
+ /* copy */
+ g_object_get (priv->calibrate_dialog, "print-kind", &priv->print_kind, NULL);
/* coldplug source */
if (klass->calibrate_printer == NULL) {
@@ -868,6 +898,9 @@ gcm_calibrate_get_property (GObject *object, guint prop_id, GValue *value, GPara
case PROP_DEVICE_KIND:
g_value_set_uint (value, priv->device_kind);
break;
+ case PROP_PRINT_KIND:
+ g_value_set_uint (value, priv->print_kind);
+ break;
case PROP_DEVICE_TYPE:
g_value_set_uint (value, priv->device_type);
break;
@@ -1025,6 +1058,14 @@ gcm_calibrate_class_init (GcmCalibrateClass *klass)
g_object_class_install_property (object_class, PROP_DEVICE_KIND, pspec);
/**
+ * GcmCalibrate:print-kind:
+ */
+ pspec = g_param_spec_uint ("print-kind", NULL, NULL,
+ 0, G_MAXUINT, 0,
+ G_PARAM_READABLE);
+ g_object_class_install_property (object_class, PROP_PRINT_KIND, pspec);
+
+ /**
* GcmCalibrate:device-type:
*/
pspec = g_param_spec_uint ("device-type", NULL, NULL,
@@ -1141,6 +1182,7 @@ gcm_calibrate_init (GcmCalibrate *calibrate)
calibrate->priv->device = NULL;
calibrate->priv->serial = NULL;
calibrate->priv->device_kind = GCM_CALIBRATE_DEVICE_KIND_UNKNOWN;
+ calibrate->priv->print_kind = GCM_CALIBRATE_PRINT_KIND_UNKNOWN;
calibrate->priv->reference_kind = GCM_CALIBRATE_REFERENCE_KIND_UNKNOWN;
calibrate->priv->colorimeter = gcm_colorimeter_new ();
calibrate->priv->calibrate_dialog = gcm_calibrate_dialog_new ();
diff --git a/src/gcm-calibrate.h b/src/gcm-calibrate.h
index 596232f..3b60045 100644
--- a/src/gcm-calibrate.h
+++ b/src/gcm-calibrate.h
@@ -98,6 +98,13 @@ typedef enum {
GCM_CALIBRATE_DEVICE_KIND_UNKNOWN
} GcmCalibrateDeviceKind;
+typedef enum {
+ GCM_CALIBRATE_PRINT_KIND_LOCAL,
+ GCM_CALIBRATE_PRINT_KIND_GENERATE,
+ GCM_CALIBRATE_PRINT_KIND_ANALYSE,
+ GCM_CALIBRATE_PRINT_KIND_UNKNOWN
+} GcmCalibratePrintKind;
+
GType gcm_calibrate_get_type (void);
GcmCalibrate *gcm_calibrate_new (void);
gboolean gcm_calibrate_display (GcmCalibrate *calibrate,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]