Merge lp:~noskcaj/ubuntu/vivid/gnome-color-manager/3.14 into lp:ubuntu/vivid/gnome-color-manager

Proposed by Jackson Doak on 2015-01-02
Status: Needs review
Proposed branch: lp:~noskcaj/ubuntu/vivid/gnome-color-manager/3.14
Merge into: lp:ubuntu/vivid/gnome-color-manager
Diff against target: 133582 lines (+37805/-31465)
178 files modified
.pc/01_unity_control_center.patch/src/gcm-calibrate-main.c (+0/-2370)
.pc/applied-patches (+0/-1)
ChangeLog (+1855/-85)
INSTALL (+2/-2)
Makefile.am (+13/-8)
Makefile.in (+30/-20)
NEWS (+231/-29)
aclocal.m4 (+478/-285)
config.guess (+27/-165)
config.h (+3/-9)
config.h.in (+0/-6)
config.sub (+25/-15)
configure (+292/-654)
configure.ac (+7/-30)
data/Makefile.am (+2/-0)
data/Makefile.in (+8/-9)
data/appdata/Makefile.am (+8/-0)
data/appdata/Makefile.in (+502/-0)
data/appdata/gcm-viewer.appdata.xml.in (+26/-0)
data/figures/Makefile.am (+1/-0)
data/figures/Makefile.in (+7/-9)
data/gcm-picker.ui (+310/-421)
data/gcm-viewer.ui (+3/-48)
data/icons/16x16/Makefile.am (+2/-0)
data/icons/16x16/Makefile.in (+7/-9)
data/icons/22x22/Makefile.am (+2/-0)
data/icons/22x22/Makefile.in (+7/-9)
data/icons/24x24/Makefile.am (+2/-0)
data/icons/24x24/Makefile.in (+7/-9)
data/icons/256x256/Makefile.am (+2/-0)
data/icons/256x256/Makefile.in (+7/-9)
data/icons/32x32/Makefile.am (+2/-0)
data/icons/32x32/Makefile.in (+7/-9)
data/icons/48x48/Makefile.am (+2/-0)
data/icons/48x48/Makefile.in (+7/-9)
data/icons/64x64/Makefile.am (+2/-0)
data/icons/64x64/Makefile.in (+7/-9)
data/icons/Makefile.am (+1/-0)
data/icons/Makefile.in (+7/-9)
data/icons/scalable/Makefile.am (+1/-0)
data/icons/scalable/Makefile.in (+7/-9)
data/targets/Makefile.am (+1/-0)
data/targets/Makefile.in (+7/-9)
data/tests/Makefile.am (+1/-0)
data/tests/Makefile.in (+7/-9)
data/ti1/Makefile.am (+2/-0)
data/ti1/Makefile.in (+7/-9)
debian/changelog (+56/-0)
debian/control (+8/-10)
debian/control.in (+8/-10)
debian/patches/01_unity_control_center.patch (+28/-10)
debian/rules (+1/-0)
help/Makefile.am (+5/-1)
help/Makefile.in (+10/-10)
help/fi/color-import-linux.page (+26/-0)
help/fi/color-import-osx.page (+26/-0)
help/fi/color-import-windows.page (+46/-0)
help/fi/fi.po (+256/-0)
help/fi/legal.xml (+4/-0)
help/gl/color-import-linux.page (+26/-0)
help/gl/color-import-osx.page (+26/-0)
help/gl/color-import-windows.page (+46/-0)
help/gl/gl.po (+256/-0)
help/gl/legal.xml (+4/-0)
help/hu/color-import-linux.page (+26/-0)
help/hu/color-import-osx.page (+26/-0)
help/hu/color-import-windows.page (+46/-0)
help/hu/hu.po (+263/-0)
help/hu/legal.xml (+4/-0)
help/zh_CN/color-import-osx.page (+1/-4)
help/zh_CN/legal.xml (+1/-2)
help/zh_CN/zh_CN.po (+2/-2)
help/zh_HK/color-import-linux.page (+26/-0)
help/zh_HK/color-import-osx.page (+34/-0)
help/zh_HK/color-import-windows.page (+95/-0)
help/zh_HK/legal.xml (+4/-0)
help/zh_HK/zh_HK.po (+199/-0)
help/zh_TW/color-import-linux.page (+26/-0)
help/zh_TW/color-import-osx.page (+34/-0)
help/zh_TW/color-import-windows.page (+95/-0)
help/zh_TW/legal.xml (+4/-0)
help/zh_TW/zh_TW.po (+207/-0)
m4/libtool.m4 (+9/-3)
man/Makefile.am (+5/-0)
man/Makefile.in (+12/-9)
missing (+2/-2)
po/LINGUAS (+4/-0)
po/POTFILES.in (+1/-1)
po/as.po (+428/-369)
po/bn_IN.po (+577/-409)
po/ca.po (+423/-376)
po/ca@valencia.po (+427/-379)
po/cs.po (+396/-373)
po/da.po (+425/-377)
po/de.po (+459/-404)
po/el.po (+495/-446)
po/es.po (+415/-368)
po/et.po (+37/-26)
po/eu.po (+424/-375)
po/fa.po (+431/-387)
po/fi.po (+553/-472)
po/fr.po (+398/-374)
po/fur.po (+1753/-0)
po/gl.po (+421/-373)
po/gu.po (+435/-374)
po/he.po (+578/-457)
po/hi.po (+433/-374)
po/hu.po (+430/-373)
po/id.po (+393/-369)
po/it.po (+391/-367)
po/ja.po (+497/-394)
po/kk.po (+1824/-0)
po/kn.po (+438/-393)
po/ko.po (+570/-543)
po/lt.po (+399/-369)
po/lv.po (+426/-373)
po/ml.po (+255/-249)
po/mr.po (+440/-381)
po/nb.po (+407/-383)
po/ne.po (+1812/-0)
po/nl.po (+1843/-0)
po/or.po (+427/-368)
po/pa.po (+421/-366)
po/pl.po (+392/-369)
po/pt.po (+427/-1273)
po/pt_BR.po (+422/-372)
po/ro.po (+1922/-1500)
po/ru.po (+442/-434)
po/sk.po (+511/-369)
po/sl.po (+417/-368)
po/sr.po (+413/-365)
po/sr@latin.po (+413/-365)
po/sv.po (+712/-487)
po/ta.po (+427/-378)
po/te.po (+435/-378)
po/tg.po (+728/-596)
po/tr.po (+499/-464)
po/ug.po (+39/-55)
po/uk.po (+431/-376)
po/zh_CN.po (+492/-369)
po/zh_HK.po (+413/-370)
po/zh_TW.po (+415/-370)
src/Makefile.am (+2/-28)
src/Makefile.in (+34/-172)
src/gcm-calibrate-argyll.c (+90/-24)
src/gcm-calibrate-main.c (+76/-26)
src/gcm-calibrate.c (+6/-10)
src/gcm-calibrate.h (+5/-1)
src/gcm-cell-renderer-color.c (+12/-8)
src/gcm-cell-renderer-color.h (+1/-1)
src/gcm-cell-renderer-profile-text.c (+1/-2)
src/gcm-cie-widget.c (+1/-1)
src/gcm-cie-widget.h (+2/-2)
src/gcm-clut.c (+0/-251)
src/gcm-clut.h (+0/-69)
src/gcm-exif.c (+12/-4)
src/gcm-hull-widget.c (+0/-371)
src/gcm-hull-widget.h (+0/-62)
src/gcm-hull.c (+0/-279)
src/gcm-hull.h (+0/-68)
src/gcm-image.c (+0/-528)
src/gcm-image.h (+0/-76)
src/gcm-import.c (+13/-10)
src/gcm-inspect.c (+10/-8)
src/gcm-named-color.c (+0/-248)
src/gcm-named-color.h (+0/-62)
src/gcm-picker-resources.c (+479/-223)
src/gcm-picker.c (+44/-27)
src/gcm-print.c (+1/-5)
src/gcm-profile.c (+0/-2479)
src/gcm-profile.h (+0/-150)
src/gcm-self-test.c (+14/-369)
src/gcm-trc-widget.c (+32/-39)
src/gcm-utils.c (+101/-23)
src/gcm-utils.h (+6/-29)
src/gcm-viewer-resources.c (+433/-433)
src/gcm-viewer.c (+91/-136)
test-driver (+16/-4)
To merge this branch: bzr merge lp:~noskcaj/ubuntu/vivid/gnome-color-manager/3.14
Reviewer Review Type Date Requested Status
Daniel Holbach 2015-01-02 Approve on 2015-01-06
Review via email: mp+245494@code.launchpad.net

Description of the change

Merge from debian.

To post a comment you must log in.
Daniel Holbach (dholbach) wrote :

Thanks. Uploaded.

review: Approve

Unmerged revisions

40. By Jackson Doak on 2015-01-02

Add .pc files, again

39. By Jackson Doak on 2015-01-02

Actually new upstream release

38. By Jackson Doak on 2015-01-02

New upstream release.

37. By Jackson Doak on 2015-01-02

Update-maintaner

36. By Jackson Doak on 2015-01-02

Add .pc files

35. By Jackson Doak on 2015-01-02

* Merge from debian. Remiaining changes:
  - debian/patches/01_unity_control_center.patch:
    + Use Unity Control Center in Unity
* New upstream release.
* Point Homepage to the upstream git repository as there is no real project
  website now.
* Bump Standards-Version to 3.9.6.
* New upstream release
* debian/rules: enable parallel build. Closes: #759118
* debian/control: Use vte2.91 instead of vte2.90
* New upstream release.
* Bump Standards-Version to 3.9.5
* Team upload.
* New upstream release
* New upstream release (3.10.1).
* Update 'libcolord-dev' and 'colord' dependency according to configure.ac.
* New upstream release (3.12.0).
* Update build-dependencies according to configure.ac changes:
  - Drop unused libxrandr-dev, libx11-dev and libgnome-desktop-3-dev.

34. By Jackson Doak on 2015-01-02

Merging shared upstream rev into target branch.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added directory '.pc/01_unity_control_center.patch'
2=== removed directory '.pc/01_unity_control_center.patch'
3=== added file '.pc/01_unity_control_center.patch/.timestamp'
4=== added directory '.pc/01_unity_control_center.patch/src'
5=== removed directory '.pc/01_unity_control_center.patch/src'
6=== added file '.pc/01_unity_control_center.patch/src/gcm-calibrate-main.c'
7--- .pc/01_unity_control_center.patch/src/gcm-calibrate-main.c 1970-01-01 00:00:00 +0000
8+++ .pc/01_unity_control_center.patch/src/gcm-calibrate-main.c 2015-01-02 20:29:31 +0000
9@@ -0,0 +1,2415 @@
10+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
11+ *
12+ * Copyright (C) 2009-2011 Richard Hughes <richard@hughsie.com>
13+ *
14+ * Licensed under the GNU General Public License Version 2
15+ *
16+ * This program is free software; you can redistribute it and/or modify
17+ * it under the terms of the GNU General Public License as published by
18+ * the Free Software Foundation; either version 2 of the License, or
19+ * (at your option) any later version.
20+ *
21+ * This program is distributed in the hope that it will be useful,
22+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
23+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24+ * GNU General Public License for more details.
25+ *
26+ * You should have received a copy of the GNU General Public License
27+ * along with this program; if not, write to the Free Software
28+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
29+ */
30+
31+#include "config.h"
32+
33+#include <glib/gi18n.h>
34+#include <gtk/gtk.h>
35+#include <gdk/gdkx.h>
36+#include <glib/gstdio.h>
37+#include <locale.h>
38+#include <canberra-gtk.h>
39+#include <colord.h>
40+#include <lcms2.h>
41+#include <stdlib.h>
42+
43+#include "gcm-utils.h"
44+#include "gcm-debug.h"
45+#include "gcm-calibrate.h"
46+#include "gcm-calibrate-argyll.h"
47+
48+typedef enum {
49+ GCM_CALIBRATE_PAGE_INTRO,
50+ GCM_CALIBRATE_PAGE_DISPLAY_KIND,
51+ GCM_CALIBRATE_PAGE_DISPLAY_TEMPERATURE,
52+ GCM_CALIBRATE_PAGE_DISPLAY_CONFIG,
53+ GCM_CALIBRATE_PAGE_INSTALL_ARGYLLCMS,
54+ GCM_CALIBRATE_PAGE_INSTALL_TARGETS,
55+ GCM_CALIBRATE_PAGE_PRECISION,
56+ GCM_CALIBRATE_PAGE_PRINT_KIND,
57+ GCM_CALIBRATE_PAGE_TARGET_KIND,
58+ GCM_CALIBRATE_PAGE_SENSOR,
59+ GCM_CALIBRATE_PAGE_ACTION,
60+ GCM_CALIBRATE_PAGE_FAILURE,
61+ GCM_CALIBRATE_PAGE_TITLE,
62+ GCM_CALIBRATE_PAGE_LAST
63+} GcmCalibratePage;
64+
65+typedef struct {
66+ GtkApplication *application;
67+ CdClient *client;
68+ GcmCalibrate *calibrate;
69+ CdDevice *device;
70+ CdDeviceKind device_kind;
71+ GCancellable *cancellable;
72+ gchar *device_id;
73+ guint xid;
74+ GtkWindow *main_window;
75+ GPtrArray *pages;
76+ gboolean internal_lcd;
77+ GtkWidget *reference_preview;
78+ GtkWidget *action_title;
79+ GtkWidget *action_message;
80+ GtkWidget *action_image;
81+ GtkWidget *action_progress;
82+ gboolean has_pending_interaction;
83+ gboolean started_calibration;
84+ GcmCalibratePage current_page;
85+ gint inhibit_cookie;
86+} GcmCalibratePriv;
87+
88+/**
89+ * gcm_window_set_parent_xid:
90+ **/
91+static void
92+gcm_window_set_parent_xid (GtkWindow *window, guint32 xid)
93+{
94+ GdkDisplay *display;
95+ GdkWindow *parent_window;
96+ GdkWindow *our_window;
97+
98+ display = gdk_display_get_default ();
99+ parent_window = gdk_x11_window_foreign_new_for_display (display, xid);
100+ if (parent_window == NULL) {
101+ g_warning ("failed to get parent window");
102+ return;
103+ }
104+
105+ gtk_widget_realize (GTK_WIDGET (window));
106+ our_window = gtk_widget_get_window (GTK_WIDGET (window));
107+ if (our_window == NULL) {
108+ g_warning ("failed to get our window");
109+ return;
110+ }
111+
112+ /* set this above our parent */
113+ gtk_window_set_modal (window, TRUE);
114+ gdk_window_set_transient_for (our_window, parent_window);
115+ gtk_window_set_title (window, "");
116+}
117+
118+/**
119+ * gcm_calib_activate_cb:
120+ **/
121+static void
122+gcm_calib_activate_cb (GApplication *application, GcmCalibratePriv *priv)
123+{
124+ gtk_window_present (priv->main_window);
125+}
126+
127+static void
128+gcm_calib_confirm_quit_cb (GtkDialog *dialog,
129+ gint response_id,
130+ GcmCalibratePriv *priv)
131+{
132+ if (response_id != GTK_RESPONSE_CLOSE) {
133+ gtk_widget_destroy (GTK_WIDGET (dialog));
134+ return;
135+ }
136+ gcm_calibrate_interaction (priv->calibrate, GTK_RESPONSE_CANCEL);
137+ g_application_release (G_APPLICATION (priv->application));
138+}
139+
140+/**
141+ * gcm_calib_confirm_quit:
142+ **/
143+static void
144+gcm_calib_confirm_quit (GcmCalibratePriv *priv)
145+{
146+ GtkWidget *dialog;
147+
148+ /* do not ask for confirmation on the initial page */
149+ if (priv->current_page == GCM_CALIBRATE_PAGE_INTRO)
150+ g_application_release (G_APPLICATION (priv->application));
151+
152+ dialog = gtk_message_dialog_new (GTK_WINDOW (priv->main_window),
153+ GTK_DIALOG_MODAL,
154+ GTK_MESSAGE_QUESTION,
155+ GTK_BUTTONS_NONE,
156+ "%s", _("Calibration is not complete"));
157+ gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
158+ "%s",
159+ _("Are you sure you want to cancel the calibration?"));
160+ /* TRANSLATORS: button text */
161+ gtk_dialog_add_button (GTK_DIALOG (dialog),
162+ _("Continue calibration"),
163+ GTK_RESPONSE_CANCEL);
164+ /* TRANSLATORS: button text */
165+ gtk_dialog_add_button (GTK_DIALOG (dialog),
166+ _("Cancel and close"),
167+ GTK_RESPONSE_CLOSE);
168+ g_signal_connect (dialog, "response",
169+ G_CALLBACK (gcm_calib_confirm_quit_cb),
170+ priv);
171+ gtk_widget_show (dialog);
172+}
173+
174+/**
175+ * gcm_calib_delete_event_cb:
176+ **/
177+static gboolean
178+gcm_calib_delete_event_cb (GtkWidget *widget, GdkEvent *event, GcmCalibratePriv *priv)
179+{
180+ gcm_calib_confirm_quit (priv);
181+ return FALSE;
182+}
183+
184+/**
185+ * gcm_calib_assistant_cancel_cb:
186+ **/
187+static void
188+gcm_calib_assistant_cancel_cb (GtkAssistant *assistant, GcmCalibratePriv *priv)
189+{
190+ gcm_calib_confirm_quit (priv);
191+}
192+
193+/**
194+ * gcm_calib_assistant_close_cb:
195+ **/
196+static void
197+gcm_calib_assistant_close_cb (GtkAssistant *assistant, GcmCalibratePriv *priv)
198+{
199+ g_application_release (G_APPLICATION (priv->application));
200+}
201+
202+/**
203+ * gcm_calib_play_sound:
204+ **/
205+static void
206+gcm_calib_play_sound (GcmCalibratePriv *priv)
207+{
208+ /* play sound from the naming spec */
209+ ca_context_play (ca_gtk_context_get (), 0,
210+ CA_PROP_EVENT_ID, "complete",
211+ /* TRANSLATORS: this is the application name for libcanberra */
212+ CA_PROP_APPLICATION_NAME, _("GNOME Color Manager"),
213+ /* TRANSLATORS: this is the sound description */
214+ CA_PROP_EVENT_DESCRIPTION, _("Profiling completed"),
215+ NULL);
216+}
217+
218+
219+/**
220+ * gcm_calib_get_vbox_for_page:
221+ **/
222+static GtkWidget *
223+gcm_calib_get_vbox_for_page (GcmCalibratePriv *priv,
224+ GcmCalibratePage page)
225+{
226+ guint i;
227+ GtkWidget *tmp;
228+ GcmCalibratePage page_tmp;
229+
230+ for (i=0; i<priv->pages->len; i++) {
231+ tmp = g_ptr_array_index (priv->pages, i);
232+ page_tmp = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (tmp),
233+ "GcmCalibrateMain::Index"));
234+ if (page_tmp == page)
235+ return tmp;
236+ }
237+ return NULL;
238+}
239+
240+static wchar_t *
241+utf8_to_wchar_t (const char *src)
242+{
243+ gsize len;
244+ gsize converted;
245+ wchar_t *buf = NULL;
246+
247+ len = mbstowcs (NULL, src, 0);
248+ if (len == (gsize) -1) {
249+ g_warning ("Invalid UTF-8 in string %s", src);
250+ goto out;
251+ }
252+ len += 1;
253+ buf = g_malloc (sizeof (wchar_t) * len);
254+ converted = mbstowcs (buf, src, len - 1);
255+ g_assert (converted != (gsize) -1);
256+ buf[converted] = '\0';
257+out:
258+ return buf;
259+}
260+
261+static cmsBool
262+_cmsDictAddEntryAscii (cmsHANDLE dict,
263+ const gchar *key,
264+ const gchar *value)
265+{
266+ cmsBool ret = FALSE;
267+ wchar_t *mb_key = NULL;
268+ wchar_t *mb_value = NULL;
269+
270+ mb_key = utf8_to_wchar_t (key);
271+ if (mb_key == NULL)
272+ goto out;
273+ mb_value = utf8_to_wchar_t (value);
274+ if (mb_value == NULL)
275+ goto out;
276+ ret = cmsDictAddEntry (dict, mb_key, mb_value, NULL, NULL);
277+out:
278+ g_free (mb_key);
279+ g_free (mb_value);
280+ return ret;
281+}
282+
283+static gboolean
284+gcm_calib_set_extra_metadata (GcmCalibratePriv *priv,
285+ const gchar *filename,
286+ GError **error)
287+{
288+ cmsHANDLE dict = NULL;
289+ cmsHPROFILE lcms_profile;
290+ gboolean ret = TRUE;
291+ gchar *data = NULL;
292+ gchar *screen_brightness_str = NULL;
293+ gsize len;
294+ guint percentage;
295+ CdSensor *sensor;
296+
297+ /* parse */
298+ ret = g_file_get_contents (filename, &data, &len, error);
299+ if (!ret)
300+ goto out;
301+ lcms_profile = cmsOpenProfileFromMem (data, len);
302+ if (lcms_profile == NULL) {
303+ g_set_error_literal (error, 1, 0,
304+ "failed to open profile");
305+ ret = FALSE;
306+ goto out;
307+ }
308+
309+ /* just create a new dict */
310+ dict = cmsDictAlloc (NULL);
311+ _cmsDictAddEntryAscii (dict,
312+ CD_PROFILE_METADATA_CMF_PRODUCT,
313+ PACKAGE_NAME);
314+ _cmsDictAddEntryAscii (dict,
315+ CD_PROFILE_METADATA_CMF_BINARY,
316+ "gcm-calibrate");
317+ _cmsDictAddEntryAscii (dict,
318+ CD_PROFILE_METADATA_CMF_VERSION,
319+ PACKAGE_VERSION);
320+ _cmsDictAddEntryAscii (dict,
321+ CD_PROFILE_METADATA_DATA_SOURCE,
322+ CD_PROFILE_METADATA_DATA_SOURCE_CALIB);
323+ sensor = gcm_calibrate_get_sensor (priv->calibrate);
324+ if (sensor != NULL) {
325+ _cmsDictAddEntryAscii (dict,
326+ CD_PROFILE_METADATA_MEASUREMENT_DEVICE,
327+ cd_sensor_kind_to_string (cd_sensor_get_kind (sensor)));
328+ }
329+ _cmsDictAddEntryAscii (dict,
330+ CD_PROFILE_METADATA_MAPPING_DEVICE_ID,
331+ cd_device_get_id (priv->device));
332+
333+ /* add the calibration brightness if an internal panel */
334+ percentage = gcm_calibrate_get_screen_brightness (priv->calibrate);
335+ if (percentage > 0) {
336+ screen_brightness_str = g_strdup_printf ("%i", percentage);
337+ _cmsDictAddEntryAscii (dict,
338+ CD_PROFILE_METADATA_SCREEN_BRIGHTNESS,
339+ screen_brightness_str);
340+ }
341+
342+ /* just write dict */
343+ ret = cmsWriteTag (lcms_profile, cmsSigMetaTag, dict);
344+ if (!ret) {
345+ g_set_error_literal (error, 1, 0,
346+ "cannot write metadata");
347+ goto out;
348+ }
349+
350+ /* write profile id */
351+ ret = cmsMD5computeID (lcms_profile);
352+ if (!ret) {
353+ g_set_error_literal (error, 1, 0,
354+ "failed to write profile id");
355+ goto out;
356+ }
357+
358+ /* save, TODO: get error */
359+ cmsSaveProfileToFile (lcms_profile, filename);
360+ ret = TRUE;
361+out:
362+ g_free (screen_brightness_str);
363+ g_free (data);
364+ if (dict != NULL)
365+ cmsDictFree (dict);
366+ return ret;
367+}
368+
369+/**
370+ * gcm_calib_set_sensor_options_cb:
371+ **/
372+static void
373+gcm_calib_set_sensor_options_cb (GObject *object,
374+ GAsyncResult *res,
375+ gpointer user_data)
376+{
377+ CdSensor *sensor = CD_SENSOR (object);
378+ gboolean ret;
379+ GError *error = NULL;
380+
381+ /* get return value */
382+ ret = cd_sensor_set_options_finish (sensor, res, &error);
383+ if (!ret) {
384+ g_warning ("Failed to set sensor option: %s",
385+ error->message);
386+ g_error_free (error);
387+ }
388+}
389+
390+static void
391+gcm_calib_set_sensor_options (GcmCalibratePriv *priv,
392+ const gchar *filename)
393+{
394+ CdSensor *sensor;
395+ gboolean ret;
396+ gchar *data = NULL;
397+ gchar *sha1 = NULL;
398+ GError *error = NULL;
399+ GHashTable *hash = NULL;
400+ gsize len;
401+
402+ /* get ChSensor */
403+ sensor = gcm_calibrate_get_sensor (priv->calibrate);
404+ if (sensor == NULL)
405+ goto out;
406+
407+ /* set the remote profile hash */
408+ hash = g_hash_table_new_full (g_str_hash,
409+ g_str_equal,
410+ g_free,
411+ (GDestroyNotify) g_variant_unref);
412+ ret = g_file_get_contents (filename, &data, &len, &error);
413+ if (!ret) {
414+ g_warning ("Failed to get SHA1 hash: %s",
415+ error->message);
416+ g_error_free (error);
417+ goto out;
418+ }
419+ sha1 = g_compute_checksum_for_data (G_CHECKSUM_SHA1,
420+ (const guchar *) data,
421+ len);
422+ g_hash_table_insert (hash,
423+ g_strdup ("remote-profile-hash"),
424+ g_variant_ref_sink (g_variant_new_string (sha1)));
425+ cd_sensor_set_options (sensor, hash, NULL,
426+ gcm_calib_set_sensor_options_cb,
427+ priv);
428+out:
429+ g_free (data);
430+ g_free (sha1);
431+ if (hash != NULL)
432+ g_hash_table_unref (hash);
433+}
434+
435+static gboolean
436+gcm_calib_start_idle_cb (gpointer user_data)
437+{
438+ CdProfile *profile = NULL;
439+ const gchar *filename;
440+ gboolean ret;
441+ GcmCalibratePriv *priv = (GcmCalibratePriv *) user_data;
442+ GError *error = NULL;
443+ GFile *file = NULL;
444+ gint inhibit_cookie;
445+ GtkAssistant *assistant = GTK_ASSISTANT (priv->main_window);
446+ GtkWidget *vbox;
447+
448+ /* inhibit */
449+ inhibit_cookie = gtk_application_inhibit (priv->application,
450+ priv->main_window,
451+ GTK_APPLICATION_INHIBIT_LOGOUT |
452+ GTK_APPLICATION_INHIBIT_SWITCH |
453+ GTK_APPLICATION_INHIBIT_SUSPEND |
454+ GTK_APPLICATION_INHIBIT_IDLE,
455+ "Calibration in progress");
456+
457+ /* actually do the action */
458+ priv->started_calibration = TRUE;
459+ ret = gcm_calibrate_device (priv->calibrate,
460+ priv->device,
461+ priv->main_window,
462+ &error);
463+ if (!ret) {
464+ gcm_calibrate_set_title (priv->calibrate,
465+ _("Failed to calibrate"),
466+ GCM_CALIBRATE_UI_ERROR);
467+ gcm_calibrate_set_message (priv->calibrate,
468+ error->message,
469+ GCM_CALIBRATE_UI_ERROR);
470+ gcm_calibrate_set_image (priv->calibrate, NULL);
471+
472+ g_warning ("failed to calibrate: %s",
473+ error->message);
474+ g_error_free (error);
475+
476+ /* mark this box as the end */
477+ vbox = gcm_calib_get_vbox_for_page (priv, GCM_CALIBRATE_PAGE_ACTION);
478+ gtk_assistant_set_page_type (assistant, vbox, GTK_ASSISTANT_PAGE_SUMMARY);
479+ gtk_assistant_set_page_complete (assistant, vbox, TRUE);
480+ goto out;
481+ }
482+
483+ /* get profile */
484+ filename = gcm_calibrate_get_filename_result (priv->calibrate);
485+ if (filename == NULL) {
486+ g_warning ("failed to get filename from calibration");
487+ goto out;
488+ }
489+
490+ /* set some private properties */
491+ ret = gcm_calib_set_extra_metadata (priv, filename, &error);
492+ if (!ret) {
493+ g_warning ("failed to set extra metadata: %s",
494+ error->message);
495+ g_error_free (error);
496+ goto out;
497+ }
498+
499+ /* inform the sensor about the last successful profile */
500+ gcm_calib_set_sensor_options (priv, filename);
501+
502+ /* copy the ICC file to the proper location */
503+ file = g_file_new_for_path (filename);
504+ profile = cd_client_import_profile_sync (priv->client,
505+ file,
506+ priv->cancellable,
507+ &error);
508+ if (profile == NULL) {
509+ g_warning ("failed to find calibration profile: %s",
510+ error->message);
511+ g_error_free (error);
512+ goto out;
513+ }
514+ ret = cd_device_add_profile_sync (priv->device,
515+ CD_DEVICE_RELATION_HARD,
516+ profile,
517+ priv->cancellable,
518+ &error);
519+ if (!ret) {
520+ g_warning ("failed to add %s to %s: %s",
521+ cd_profile_get_object_path (profile),
522+ cd_device_get_object_path (priv->device),
523+ error->message);
524+ g_error_free (error);
525+ goto out;
526+ }
527+
528+ /* remove temporary file */
529+ g_unlink (filename);
530+
531+ /* allow forward */
532+ vbox = gcm_calib_get_vbox_for_page (priv,
533+ GCM_CALIBRATE_PAGE_ACTION);
534+ gtk_assistant_set_page_complete (assistant,
535+ vbox, TRUE);
536+
537+ /* set to summary page */
538+ gtk_assistant_set_current_page (assistant,
539+ gtk_assistant_get_n_pages (assistant) - 1);
540+out:
541+ if (inhibit_cookie != 0) {
542+ gtk_application_uninhibit (priv->application,
543+ priv->inhibit_cookie);
544+ }
545+ if (profile != NULL)
546+ g_object_unref (profile);
547+ if (file != NULL)
548+ g_object_unref (file);
549+ return FALSE;
550+}
551+
552+static gint
553+gcm_calib_assistant_page_forward_cb (gint current_page, gpointer user_data)
554+{
555+ GtkWidget *vbox;
556+ GcmCalibratePriv *priv = (GcmCalibratePriv *) user_data;
557+
558+ /* shouldn't happen... */
559+ if (priv->current_page != GCM_CALIBRATE_PAGE_ACTION)
560+ return current_page + 1;
561+
562+ if (!priv->has_pending_interaction)
563+ return current_page;
564+
565+ /* continue calibration */
566+ gcm_calibrate_interaction (priv->calibrate, GTK_RESPONSE_OK);
567+ priv->has_pending_interaction = FALSE;
568+
569+ /* no longer allow forward */
570+ vbox = gcm_calib_get_vbox_for_page (priv,
571+ GCM_CALIBRATE_PAGE_ACTION);
572+
573+ gtk_assistant_set_page_complete (GTK_ASSISTANT (priv->main_window),
574+ vbox, FALSE);
575+ return current_page;
576+}
577+
578+/**
579+ * gcm_calib_assistant_prepare_cb:
580+ **/
581+static gboolean
582+gcm_calib_assistant_prepare_cb (GtkAssistant *assistant,
583+ GtkWidget *page_widget,
584+ GcmCalibratePriv *priv)
585+{
586+ priv->current_page = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (page_widget),
587+ "GcmCalibrateMain::Index"));
588+ switch (priv->current_page) {
589+ case GCM_CALIBRATE_PAGE_LAST:
590+ gcm_calib_play_sound (priv);
591+ break;
592+ case GCM_CALIBRATE_PAGE_ACTION:
593+ g_debug ("lights! camera! action!");
594+ if (!priv->started_calibration)
595+ g_idle_add (gcm_calib_start_idle_cb, priv);
596+ break;
597+ default:
598+ break;
599+ }
600+
601+ /* ensure we cancel argyllcms if the user clicks back */
602+ if (priv->current_page != GCM_CALIBRATE_PAGE_ACTION &&
603+ priv->started_calibration) {
604+ gcm_calibrate_interaction (priv->calibrate,
605+ GTK_RESPONSE_CANCEL);
606+ priv->started_calibration = FALSE;
607+ }
608+
609+ /* forward on the action page just unsticks the calibration */
610+ if (priv->current_page == GCM_CALIBRATE_PAGE_ACTION) {
611+ gtk_assistant_set_forward_page_func (assistant,
612+ gcm_calib_assistant_page_forward_cb,
613+ priv,
614+ NULL);
615+ } else {
616+ gtk_assistant_set_forward_page_func (assistant,
617+ NULL, NULL, NULL);
618+ }
619+
620+ /* use the default on each page */
621+ switch (priv->current_page) {
622+ case GCM_CALIBRATE_PAGE_INSTALL_ARGYLLCMS:
623+ case GCM_CALIBRATE_PAGE_SENSOR:
624+ case GCM_CALIBRATE_PAGE_ACTION:
625+ break;
626+ default:
627+ gtk_assistant_set_page_complete (assistant, page_widget, TRUE);
628+ break;
629+ }
630+ return FALSE;
631+}
632+
633+/**
634+ * gcm_calib_add_page_title:
635+ **/
636+static GtkWidget *
637+gcm_calib_add_page_title (GcmCalibratePriv *priv, const gchar *text)
638+{
639+ GtkWidget *label;
640+ GtkWidget *hbox;
641+ GtkWidget *vbox;
642+ gchar *markup;
643+
644+ markup = g_strdup_printf ("<span size=\"large\" font_weight=\"bold\">%s</span>", text);
645+ label = gtk_label_new (NULL);
646+ gtk_label_set_markup (GTK_LABEL (label), markup);
647+
648+ /* make left aligned */
649+ hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
650+ gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, TRUE, 0);
651+
652+ /* header */
653+ vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 20);
654+ gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
655+
656+ g_free (markup);
657+ return vbox;
658+}
659+
660+static gboolean
661+gcm_calib_label_activate_link_cb (GtkLabel *label,
662+ gchar *uri,
663+ GcmCalibratePriv *priv)
664+{
665+ gboolean ret;
666+ GError *error = NULL;
667+ const gchar *argv[] = { BINDIR "/gnome-control-center color",
668+ "color",
669+ NULL };
670+ ret = g_spawn_async (NULL,
671+ (gchar **) argv,
672+ NULL,
673+ 0,
674+ NULL, NULL,
675+ NULL,
676+ &error);
677+ if (!ret) {
678+ g_warning ("failed to launch the control center: %s",
679+ error->message);
680+ g_error_free (error);
681+ }
682+ return ret;
683+}
684+
685+/**
686+ * gcm_calib_add_page_para:
687+ **/
688+static GtkWidget *
689+gcm_calib_add_page_para (GtkWidget *vbox, const gchar *text)
690+{
691+ GtkWidget *label;
692+ GtkWidget *hbox;
693+
694+ label = gtk_label_new (NULL);
695+ g_signal_connect (label, "activate-link",
696+ G_CALLBACK (gcm_calib_label_activate_link_cb),
697+ NULL);
698+ gtk_label_set_markup (GTK_LABEL (label), text);
699+ gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
700+ gtk_label_set_width_chars (GTK_LABEL (label), 40);
701+ gtk_misc_set_alignment (GTK_MISC (label), 0.0f, 0.0f);
702+
703+ /* make left aligned */
704+ hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
705+ gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, TRUE, 0);
706+ gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
707+ return label;
708+}
709+
710+/**
711+ * gcm_calib_add_page_bullet:
712+ **/
713+static void
714+gcm_calib_add_page_bullet (GtkWidget *vbox, const gchar *text)
715+{
716+ gchar *markup;
717+ markup = g_strdup_printf ("• %s", text);
718+ gcm_calib_add_page_para (vbox, markup);
719+ g_free (markup);
720+}
721+
722+/**
723+ * gcm_calib_setup_page_intro:
724+ **/
725+static void
726+gcm_calib_setup_page_intro (GcmCalibratePriv *priv)
727+{
728+ GtkWidget *vbox;
729+ GtkWidget *content;
730+ GtkAssistant *assistant = GTK_ASSISTANT (priv->main_window);
731+
732+ /* TRANSLATORS: this is intro page text */
733+ switch (priv->device_kind) {
734+ case CD_DEVICE_KIND_CAMERA:
735+ case CD_DEVICE_KIND_WEBCAM:
736+ /* TRANSLATORS: this is the page title */
737+ vbox = gcm_calib_add_page_title (priv, _("Calibrate your camera"));
738+ break;
739+ case CD_DEVICE_KIND_DISPLAY:
740+ /* TRANSLATORS: this is the page title */
741+ vbox = gcm_calib_add_page_title (priv, _("Calibrate your display"));
742+ break;
743+ case CD_DEVICE_KIND_PRINTER:
744+ /* TRANSLATORS: this is the page title */
745+ vbox = gcm_calib_add_page_title (priv, _("Calibrate your printer"));
746+ break;
747+ default:
748+ /* TRANSLATORS: this is the page title */
749+ vbox = gcm_calib_add_page_title (priv, _("Calibrate your device"));
750+ break;
751+ }
752+
753+ /* main contents */
754+ content = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
755+ gtk_box_pack_start (GTK_BOX (vbox), content, FALSE, FALSE, 0);
756+
757+ /* TRANSLATORS: this is intro page text */
758+ switch (priv->device_kind) {
759+ case CD_DEVICE_KIND_DISPLAY:
760+ /* TRANSLATORS: this is the final intro page text */
761+ gcm_calib_add_page_para (content, _("Any existing screen correction will be temporarily turned off and the brightness set to maximum."));
762+ break;
763+ default:
764+ break;
765+ }
766+
767+ /* TRANSLATORS: this is the final intro page text */
768+ gcm_calib_add_page_para (content, _("You can cancel this process at any stage by pressing the cancel button."));
769+
770+ /* add to assistant */
771+ gtk_assistant_append_page (assistant, vbox);
772+ gtk_assistant_set_page_type (assistant, vbox, GTK_ASSISTANT_PAGE_INTRO);
773+ /* TRANSLATORS: this is the calibration wizard page title */
774+ gtk_assistant_set_page_title (assistant, vbox, _("Introduction"));
775+ gtk_assistant_set_page_complete (assistant, vbox, FALSE);
776+ g_ptr_array_add (priv->pages, vbox);
777+ g_object_set_data (G_OBJECT (vbox),
778+ "GcmCalibrateMain::Index",
779+ GUINT_TO_POINTER (GCM_CALIBRATE_PAGE_INTRO));
780+
781+ /* show page */
782+ gtk_widget_show_all (vbox);
783+}
784+
785+/**
786+ * gcm_calibrate_is_livecd:
787+ **/
788+static gboolean
789+gcm_calibrate_is_livecd (void)
790+{
791+#ifdef __linux__
792+ gboolean ret;
793+ gchar *data = NULL;
794+ GError *error = NULL;
795+
796+ /* get the kernel commandline */
797+ ret = g_file_get_contents ("/proc/cmdline", &data, NULL, &error);
798+ if (!ret) {
799+ g_warning ("failed to get kernel command line: %s",
800+ error->message);
801+ g_error_free (error);
802+ goto out;
803+ }
804+ ret = (g_strstr_len (data, -1, "liveimg") != NULL ||
805+ g_strstr_len (data, -1, "casper") != NULL);
806+out:
807+ g_free (data);
808+ return ret;
809+#else
810+ return FALSE;
811+#endif
812+}
813+
814+/**
815+ * gcm_calib_show_profile_button_clicked_cb:
816+ **/
817+static void
818+gcm_calib_show_profile_button_clicked_cb (GtkButton *button,
819+ GcmCalibratePriv *priv)
820+{
821+ const gchar *argv[] = { BINDIR "/nautilus", "", NULL };
822+ gboolean ret;
823+ gchar *path;
824+ GError *error = NULL;
825+
826+ /* just hardcode nautilus to open the folder */
827+ path = g_build_filename (g_get_user_data_dir (), "icc", NULL);
828+ argv[1] = path;
829+ ret = g_spawn_async (NULL,
830+ (gchar **) argv,
831+ NULL,
832+ 0,
833+ NULL, NULL,
834+ NULL,
835+ &error);
836+ if (!ret) {
837+ g_warning ("failed to show profile: %s", error->message);
838+ g_error_free (error);
839+ goto out;
840+ }
841+out:
842+ g_free (path);
843+}
844+
845+/**
846+ * gcm_calib_get_show_profile_button:
847+ **/
848+static GtkWidget *
849+gcm_calib_get_show_profile_button (GcmCalibratePriv *priv)
850+{
851+ GtkStyleContext *context;
852+ GtkWidget *button;
853+ GtkWidget *image;
854+ GtkWidget *label;
855+ GtkWidget *vbox;
856+
857+ /* add button to show profile */
858+ button = gtk_button_new ();
859+ vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
860+ image = gtk_image_new_from_icon_name ("folder-publicshare-symbolic",
861+ GTK_ICON_SIZE_DIALOG);
862+
863+ /* make image have a gray foreground */
864+ context = gtk_widget_get_style_context (image);
865+ gtk_style_context_add_class (context, GTK_STYLE_CLASS_IMAGE);
866+
867+ gtk_box_pack_start (GTK_BOX (vbox), image, FALSE, FALSE, 0);
868+ label = gtk_label_new (_("Show File"));
869+ gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
870+ gtk_container_add (GTK_CONTAINER (button), vbox);
871+ gtk_widget_set_tooltip_text (button, _("Click here to show the profile"));
872+ g_signal_connect (button, "clicked",
873+ G_CALLBACK (gcm_calib_show_profile_button_clicked_cb),
874+ priv);
875+ gtk_container_set_border_width (GTK_CONTAINER (vbox), 15);
876+ gtk_widget_set_halign (button, GTK_ALIGN_CENTER);
877+ gtk_widget_show_all (button);
878+ return button;
879+}
880+
881+/**
882+ * gcm_calib_setup_page_summary:
883+ **/
884+static void
885+gcm_calib_setup_page_summary (GcmCalibratePriv *priv)
886+{
887+ gboolean ret;
888+ GtkWidget *vbox;
889+ GtkWidget *content;
890+ GtkWidget *image;
891+ GtkAssistant *assistant = GTK_ASSISTANT (priv->main_window);
892+
893+ /* TRANSLATORS: this is the page title */
894+ vbox = gcm_calib_add_page_title (priv, _("All done!"));
895+
896+ /* main contents */
897+ content = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
898+ gtk_box_pack_start (GTK_BOX (vbox), content, FALSE, FALSE, 0);
899+
900+ switch (priv->device_kind) {
901+ case CD_DEVICE_KIND_CAMERA:
902+ case CD_DEVICE_KIND_WEBCAM:
903+ /* TRANSLATORS: this is the final summary */
904+ gcm_calib_add_page_para (content, _("The camera has been calibrated successfully."));
905+ break;
906+ case CD_DEVICE_KIND_DISPLAY:
907+ /* TRANSLATORS: this is the final summary */
908+ gcm_calib_add_page_para (content, _("The display has been calibrated successfully."));
909+ break;
910+ case CD_DEVICE_KIND_PRINTER:
911+ /* TRANSLATORS: this is the final summary */
912+ gcm_calib_add_page_para (content, _("The printer has been calibrated successfully."));
913+ break;
914+ default:
915+ /* TRANSLATORS: this is the final summary */
916+ gcm_calib_add_page_para (content, _("The device has been calibrated successfully."));
917+ break;
918+ }
919+
920+ /* only display the backlink if not launched from the control center itself */
921+ if (priv->xid == 0) {
922+ /* TRANSLATORS: this is the final summary */
923+ gcm_calib_add_page_para (content, _("To view details about the new profile or to undo the calibration visit the <a href=\"control-center://color\">control center</a>."));
924+ }
925+
926+ /* show the user the profile to copy off the live system */
927+ ret = gcm_calibrate_is_livecd ();
928+ if (ret) {
929+ /* show button to copy profile */
930+ image = gcm_calib_get_show_profile_button (priv);
931+ gtk_box_pack_start (GTK_BOX (content), image, FALSE, FALSE, 30);
932+ gcm_calib_add_page_para (content, _("You can use the profile with <a href=\"import-linux\">Linux</a>, <a href=\"import-osx\">Apple OS X</a> and <a href=\"import-windows\">Microsoft Windows</a> systems."));
933+ } else {
934+ /* add image for success */
935+ image = gtk_image_new ();
936+ gtk_image_set_from_icon_name (GTK_IMAGE (image), "face-smile", GTK_ICON_SIZE_DIALOG);
937+ gtk_box_pack_start (GTK_BOX (content), image, FALSE, FALSE, 0);
938+ }
939+
940+ /* add to assistant */
941+ gtk_assistant_append_page (assistant, vbox);
942+ gtk_assistant_set_page_type (assistant, vbox, GTK_ASSISTANT_PAGE_SUMMARY);
943+ /* TRANSLATORS: this is the calibration wizard page title */
944+ gtk_assistant_set_page_title (assistant, vbox, _("Summary"));
945+ gtk_assistant_set_page_complete (assistant, vbox, FALSE);
946+ g_ptr_array_add (priv->pages, vbox);
947+ g_object_set_data (G_OBJECT (vbox),
948+ "GcmCalibrateMain::Index",
949+ GUINT_TO_POINTER (GCM_CALIBRATE_PAGE_LAST));
950+
951+ /* show page */
952+ gtk_widget_show_all (vbox);
953+}
954+
955+/**
956+ * gcm_calib_setup_page_action:
957+ **/
958+static void
959+gcm_calib_setup_page_action (GcmCalibratePriv *priv)
960+{
961+ GtkWidget *vbox;
962+ GtkWidget *content;
963+ GList *list;
964+ GList *list2;
965+ GtkAssistant *assistant = GTK_ASSISTANT (priv->main_window);
966+
967+ /* TRANSLATORS: this is the page title */
968+ vbox = gcm_calib_add_page_title (priv, _("Performing calibration"));
969+
970+ /* grab title */
971+ list = gtk_container_get_children (GTK_CONTAINER (vbox));
972+ list2 = gtk_container_get_children (GTK_CONTAINER (list->data));
973+ priv->action_title = list2->data;
974+ g_list_free (list);
975+ g_list_free (list2);
976+
977+ /* main contents */
978+ content = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
979+ gtk_box_pack_start (GTK_BOX (vbox), content, FALSE, FALSE, 0);
980+
981+ priv->action_message = gcm_calib_add_page_para (content, _("Calibration is about to start"));
982+
983+ /* add image for success */
984+ priv->action_image = gtk_image_new ();
985+ gtk_image_set_from_icon_name (GTK_IMAGE (priv->action_image), "face-frown", GTK_ICON_SIZE_DIALOG);
986+ gtk_box_pack_start (GTK_BOX (content), priv->action_image, FALSE, FALSE, 0);
987+
988+ /* add progress marker */
989+ priv->action_progress = gtk_progress_bar_new ();
990+ gtk_box_pack_start (GTK_BOX (content), priv->action_progress, FALSE, FALSE, 0);
991+
992+ /* add content widget */
993+ gcm_calibrate_set_content_widget (priv->calibrate, vbox);
994+
995+ /* add to assistant */
996+ gtk_assistant_append_page (assistant, vbox);
997+ gtk_assistant_set_page_type (assistant, vbox, GTK_ASSISTANT_PAGE_CONTENT);
998+ /* TRANSLATORS: this is the calibration wizard page title */
999+ gtk_assistant_set_page_title (assistant, vbox, _("Action"));
1000+ gtk_assistant_set_page_complete (assistant, vbox, FALSE);
1001+ g_ptr_array_add (priv->pages, vbox);
1002+ g_object_set_data (G_OBJECT (vbox),
1003+ "GcmCalibrateMain::Index",
1004+ GUINT_TO_POINTER (GCM_CALIBRATE_PAGE_ACTION));
1005+
1006+ /* show page */
1007+ gtk_widget_show_all (vbox);
1008+ gtk_widget_hide (priv->action_image);
1009+}
1010+
1011+/**
1012+ * gcm_calib_setup_page_display_configure_wait:
1013+ **/
1014+static void
1015+gcm_calib_setup_page_display_configure_wait (GcmCalibratePriv *priv)
1016+{
1017+ GtkWidget *vbox;
1018+ GtkWidget *content;
1019+ GtkAssistant *assistant = GTK_ASSISTANT (priv->main_window);
1020+
1021+ /* TRANSLATORS: dialog message, preface */
1022+ vbox = gcm_calib_add_page_title (priv, _("Calibration checklist"));
1023+
1024+ /* main contents */
1025+ content = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
1026+ gtk_box_pack_start (GTK_BOX (vbox), content, FALSE, FALSE, 0);
1027+
1028+ /* TRANSLATORS: this is intro page text */
1029+ gcm_calib_add_page_para (content, _("Before calibrating the display, it is recommended to configure your display with the following settings to get optimal results."));
1030+
1031+ /* TRANSLATORS: dialog message, preface */
1032+if(0) gcm_calib_add_page_para (content, _("You may want to consult the owner's manual for your display on how to achieve these settings."));
1033+
1034+ /* TRANSLATORS: dialog message, bullet item */
1035+if(0) gcm_calib_add_page_bullet (content, _("Reset your display to the factory defaults."));
1036+
1037+ /* TRANSLATORS: dialog message, bullet item */
1038+if(0) gcm_calib_add_page_bullet (content, _("Disable dynamic contrast if your display has this feature."));
1039+
1040+ /* TRANSLATORS: dialog message, bullet item */
1041+if(0) gcm_calib_add_page_bullet (content, _("Configure your display with custom color settings and ensure the RGB channels are set to the same values."));
1042+
1043+ /* TRANSLATORS: dialog message, addition to bullet item */
1044+if(0) gcm_calib_add_page_para (content, _("If custom color is not available then use a 6500K color temperature."));
1045+
1046+ /* TRANSLATORS: dialog message, bullet item */
1047+if(0) gcm_calib_add_page_bullet (content, _("Adjust the display brightness to a comfortable level for prolonged viewing."));
1048+
1049+ gcm_calib_add_page_para (content, "");
1050+
1051+ /* TRANSLATORS: dialog message, suffix */
1052+ gcm_calib_add_page_para (content, _("For best results, the display should have been powered for at least 15 minutes before starting the calibration."));
1053+
1054+ /* add to assistant */
1055+ gtk_assistant_append_page (assistant, vbox);
1056+ gtk_assistant_set_page_type (assistant, vbox, GTK_ASSISTANT_PAGE_CONTENT);
1057+ /* TRANSLATORS: this is the calibration wizard page title */
1058+ gtk_assistant_set_page_title (assistant, vbox, _("Check Settings"));
1059+ gtk_assistant_set_page_complete (assistant, vbox, FALSE);
1060+ g_ptr_array_add (priv->pages, vbox);
1061+ g_object_set_data (G_OBJECT (vbox),
1062+ "GcmCalibrateMain::Index",
1063+ GUINT_TO_POINTER (GCM_CALIBRATE_PAGE_DISPLAY_CONFIG));
1064+
1065+ /* show page */
1066+ gtk_widget_show_all (vbox);
1067+}
1068+
1069+/**
1070+ * gcm_calib_button_clicked_install_argyllcms_cb:
1071+ **/
1072+static void
1073+gcm_calib_button_clicked_install_argyllcms_cb (GtkButton *button, GcmCalibratePriv *priv)
1074+{
1075+ gboolean ret;
1076+ GtkWidget *vbox;
1077+ GtkAssistant *assistant = GTK_ASSISTANT (priv->main_window);
1078+
1079+ ret = gcm_utils_install_package (GCM_PREFS_PACKAGE_NAME_ARGYLLCMS,
1080+ priv->main_window);
1081+ /* we can continue now */
1082+ if (TRUE || ret) {
1083+ vbox = gcm_calib_get_vbox_for_page (priv,
1084+ GCM_CALIBRATE_PAGE_INSTALL_ARGYLLCMS);
1085+ gtk_assistant_set_page_complete (assistant, vbox, TRUE);
1086+ gtk_assistant_next_page (assistant);
1087+
1088+ /* we ddn't need to re-install now */
1089+ gtk_widget_hide (vbox);
1090+ }
1091+}
1092+
1093+/**
1094+ * gcm_calib_setup_page_install_argyllcms:
1095+ **/
1096+static void
1097+gcm_calib_setup_page_install_argyllcms (GcmCalibratePriv *priv)
1098+{
1099+ GtkWidget *vbox;
1100+ GtkWidget *content;
1101+ GtkWidget *button;
1102+ GString *string;
1103+ GtkAssistant *assistant = GTK_ASSISTANT (priv->main_window);
1104+
1105+ string = g_string_new ("");
1106+
1107+ /* TRANSLATORS: dialog message saying the argyllcms is not installed */
1108+ g_string_append_printf (string, "%s\n",
1109+ _("Calibration and profiling software is not installed."));
1110+ /* TRANSLATORS: dialog message saying the color targets are not installed */
1111+ g_string_append_printf (string, "%s",
1112+ _("These tools are required to build color profiles for devices."));
1113+
1114+ /* TRANSLATORS: this is the page title */
1115+ vbox = gcm_calib_add_page_title (priv, _("More software is required!"));
1116+
1117+ /* main contents */
1118+ content = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
1119+ gtk_box_pack_start (GTK_BOX (vbox), content, FALSE, FALSE, 0);
1120+
1121+ /* TRANSLATORS: this is intro page text */
1122+ gcm_calib_add_page_para (content, string->str);
1123+
1124+ button = gtk_button_new_with_label (_("Install required software"));
1125+ g_signal_connect (button, "clicked",
1126+ G_CALLBACK (gcm_calib_button_clicked_install_argyllcms_cb),
1127+ priv);
1128+ gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
1129+
1130+ /* add to assistant */
1131+ gtk_assistant_append_page (assistant, vbox);
1132+ gtk_assistant_set_page_type (assistant, vbox, GTK_ASSISTANT_PAGE_CONTENT);
1133+ /* TRANSLATORS: this is the calibration wizard page title */
1134+ gtk_assistant_set_page_title (assistant, vbox, _("Install Tools"));
1135+ gtk_assistant_set_page_complete (assistant, vbox, FALSE);
1136+ g_ptr_array_add (priv->pages, vbox);
1137+ g_object_set_data (G_OBJECT (vbox),
1138+ "GcmCalibrateMain::Index",
1139+ GUINT_TO_POINTER (GCM_CALIBRATE_PAGE_INSTALL_ARGYLLCMS));
1140+ g_string_free (string, TRUE);
1141+
1142+ /* show page */
1143+ gtk_widget_show_all (vbox);
1144+}
1145+
1146+/**
1147+ * gcm_calib_button_clicked_install_targets_cb:
1148+ **/
1149+static void
1150+gcm_calib_button_clicked_install_targets_cb (GtkButton *button, GcmCalibratePriv *priv)
1151+{
1152+ gboolean ret;
1153+ GtkWidget *vbox;
1154+ GtkAssistant *assistant = GTK_ASSISTANT (priv->main_window);
1155+
1156+ ret = gcm_utils_install_package (GCM_PREFS_PACKAGE_NAME_SHARED_COLOR_TARGETS,
1157+ priv->main_window);
1158+ /* we can continue now */
1159+ if (ret) {
1160+ vbox = gcm_calib_get_vbox_for_page (priv,
1161+ GCM_CALIBRATE_PAGE_INSTALL_TARGETS);
1162+ gtk_assistant_next_page (assistant);
1163+
1164+ /* we ddn't need to re-install now */
1165+ gtk_widget_hide (vbox);
1166+ }
1167+}
1168+
1169+/**
1170+ * gcm_calib_setup_page_install_targets:
1171+ **/
1172+static void
1173+gcm_calib_setup_page_install_targets (GcmCalibratePriv *priv)
1174+{
1175+ GtkWidget *vbox;
1176+ GtkWidget *content;
1177+ GtkWidget *button;
1178+ GString *string;
1179+ GtkAssistant *assistant = GTK_ASSISTANT (priv->main_window);
1180+
1181+ string = g_string_new ("");
1182+
1183+ /* TRANSLATORS: dialog message saying the color targets are not installed */
1184+ g_string_append_printf (string, "%s\n", _("Common color target files are not installed on this computer."));
1185+ /* TRANSLATORS: dialog message saying the color targets are not installed */
1186+ g_string_append_printf (string, "%s\n\n", _("Color target files are needed to convert the image to a color profile."));
1187+ /* TRANSLATORS: dialog message, asking if it's okay to install them */
1188+ g_string_append_printf (string, "%s\n\n", _("Do you want them to be installed?"));
1189+ /* TRANSLATORS: dialog message, if the user has the target file on a CDROM then there's no need for this package */
1190+ g_string_append_printf (string, "%s", _("If you already have the correct file, you can skip this step."));
1191+
1192+ /* TRANSLATORS: this is the page title */
1193+ vbox = gcm_calib_add_page_title (priv, _("Optional data files available"));
1194+
1195+ /* main contents */
1196+ content = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
1197+ gtk_box_pack_start (GTK_BOX (vbox), content, FALSE, FALSE, 0);
1198+
1199+ /* TRANSLATORS: this is intro page text */
1200+ gcm_calib_add_page_para (content, string->str);
1201+
1202+ button = gtk_button_new_with_label (_("Install Now"));
1203+ g_signal_connect (button, "clicked",
1204+ G_CALLBACK (gcm_calib_button_clicked_install_targets_cb),
1205+ priv);
1206+ gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
1207+
1208+ /* add to assistant */
1209+ gtk_assistant_append_page (assistant, vbox);
1210+ gtk_assistant_set_page_type (assistant, vbox, GTK_ASSISTANT_PAGE_CONTENT);
1211+ gtk_assistant_set_page_complete (assistant, vbox, FALSE);
1212+ /* TRANSLATORS: this is the calibration wizard page title */
1213+ gtk_assistant_set_page_title (assistant, vbox, _("Install Targets"));
1214+ g_ptr_array_add (priv->pages, vbox);
1215+ g_object_set_data (G_OBJECT (vbox),
1216+ "GcmCalibrateMain::Index",
1217+ GUINT_TO_POINTER (GCM_CALIBRATE_PAGE_INSTALL_TARGETS));
1218+ g_string_free (string, TRUE);
1219+
1220+ /* show page */
1221+ gtk_widget_show_all (vbox);
1222+}
1223+
1224+
1225+/**
1226+ * gcm_calib_reference_kind_to_localised_string:
1227+ **/
1228+static const gchar *
1229+gcm_calib_reference_kind_to_localised_string (GcmCalibrateReferenceKind kind)
1230+{
1231+ if (kind == GCM_CALIBRATE_REFERENCE_KIND_CMP_DIGITAL_TARGET_3) {
1232+ /* TRANSLATORS: this is probably a brand name */
1233+ return _("CMP Digital Target 3");
1234+ }
1235+ if (kind == GCM_CALIBRATE_REFERENCE_KIND_CMP_DT_003) {
1236+ /* TRANSLATORS: this is probably a brand name */
1237+ return _("CMP DT 003");
1238+ }
1239+ if (kind == GCM_CALIBRATE_REFERENCE_KIND_COLOR_CHECKER) {
1240+ /* TRANSLATORS: this is probably a brand name */
1241+ return _("ColorChecker");
1242+ }
1243+ if (kind == GCM_CALIBRATE_REFERENCE_KIND_COLOR_CHECKER_DC) {
1244+ /* TRANSLATORS: this is probably a brand name */
1245+ return _("ColorChecker DC");
1246+ }
1247+ if (kind == GCM_CALIBRATE_REFERENCE_KIND_COLOR_CHECKER_SG) {
1248+ /* TRANSLATORS: this is probably a brand name */
1249+ return _("ColorChecker SG");
1250+ }
1251+ if (kind == GCM_CALIBRATE_REFERENCE_KIND_HUTCHCOLOR) {
1252+ /* TRANSLATORS: this is probably a brand name */
1253+ return _("Hutchcolor");
1254+ }
1255+ if (kind == GCM_CALIBRATE_REFERENCE_KIND_I1_RGB_SCAN_1_4) {
1256+ /* TRANSLATORS: this is probably a brand name */
1257+ return _("i1 RGB Scan 1.4");
1258+ }
1259+ if (kind == GCM_CALIBRATE_REFERENCE_KIND_IT8) {
1260+ /* TRANSLATORS: this is probably a brand name */
1261+ return _("IT8.7/2");
1262+ }
1263+ if (kind == GCM_CALIBRATE_REFERENCE_KIND_LASER_SOFT_DC_PRO) {
1264+ /* TRANSLATORS: this is probably a brand name */
1265+ return _("Laser Soft DC Pro");
1266+ }
1267+ if (kind == GCM_CALIBRATE_REFERENCE_KIND_QPCARD_201) {
1268+ /* TRANSLATORS: this is probably a brand name */
1269+ return _("QPcard 201");
1270+ }
1271+ return NULL;
1272+}
1273+
1274+/**
1275+ * gcm_calib_reference_kind_to_image_filename:
1276+ **/
1277+static const gchar *
1278+gcm_calib_reference_kind_to_image_filename (GcmCalibrateReferenceKind kind)
1279+{
1280+ if (kind == GCM_CALIBRATE_REFERENCE_KIND_CMP_DIGITAL_TARGET_3)
1281+ return "CMP-DigitalTarget3.png";
1282+ if (kind == GCM_CALIBRATE_REFERENCE_KIND_CMP_DT_003)
1283+ return "CMP_DT_003.png";
1284+ if (kind == GCM_CALIBRATE_REFERENCE_KIND_COLOR_CHECKER)
1285+ return "ColorChecker24.png";
1286+ if (kind == GCM_CALIBRATE_REFERENCE_KIND_COLOR_CHECKER_DC)
1287+ return "ColorCheckerDC.png";
1288+ if (kind == GCM_CALIBRATE_REFERENCE_KIND_COLOR_CHECKER_SG)
1289+ return "ColorCheckerSG.png";
1290+ if (kind == GCM_CALIBRATE_REFERENCE_KIND_HUTCHCOLOR)
1291+ return NULL;
1292+ if (kind == GCM_CALIBRATE_REFERENCE_KIND_I1_RGB_SCAN_1_4)
1293+ return "i1_RGB_Scan_14.png";
1294+ if (kind == GCM_CALIBRATE_REFERENCE_KIND_IT8)
1295+ return "IT872.png";
1296+ if (kind == GCM_CALIBRATE_REFERENCE_KIND_LASER_SOFT_DC_PRO)
1297+ return "LaserSoftDCPro.png";
1298+ if (kind == GCM_CALIBRATE_REFERENCE_KIND_QPCARD_201)
1299+ return "QPcard_201.png";
1300+ return NULL;
1301+}
1302+
1303+/**
1304+ * gcm_calib_reference_kind_combobox_cb:
1305+ **/
1306+static void
1307+gcm_calib_reference_kind_combobox_cb (GtkComboBox *combo_box,
1308+ GcmCalibratePriv *priv)
1309+{
1310+ const gchar *filename;
1311+ gchar *path;
1312+ GcmCalibrateReferenceKind reference_kind;
1313+
1314+ /* not sorted so we can just use the index */
1315+ reference_kind = gtk_combo_box_get_active (GTK_COMBO_BOX (combo_box));
1316+ g_object_set (priv->calibrate,
1317+ "reference-kind", reference_kind,
1318+ NULL);
1319+ filename = gcm_calib_reference_kind_to_image_filename (reference_kind);
1320+
1321+ /* fallback */
1322+ if (filename == NULL)
1323+ filename = "unknown.png";
1324+
1325+ path = g_build_filename (GCM_DATA, "targets", filename, NULL);
1326+ gtk_image_set_from_file (GTK_IMAGE (priv->reference_preview), path);
1327+ g_free (path);
1328+}
1329+
1330+/**
1331+ * gcm_calib_setup_page_target_kind:
1332+ **/
1333+static void
1334+gcm_calib_setup_page_target_kind (GcmCalibratePriv *priv)
1335+{
1336+ GtkWidget *vbox;
1337+ GtkWidget *content;
1338+ GtkWidget *combo;
1339+ GString *string;
1340+ guint i;
1341+ GtkAssistant *assistant = GTK_ASSISTANT (priv->main_window);
1342+
1343+ string = g_string_new ("");
1344+
1345+ /* TRANSLATORS: dialog message, preface. A calibration target looks like
1346+ * this: http://www.colorreference.de/targets/target.jpg */
1347+ g_string_append_printf (string, "%s\n", _("Before profiling the device, you have to manually capture an image of a calibration target and save it as a TIFF image file."));
1348+
1349+ /* scanner specific options */
1350+ if (priv->device_kind == CD_DEVICE_KIND_SCANNER) {
1351+ /* TRANSLATORS: dialog message, preface */
1352+ g_string_append_printf (string, "%s\n", _("Ensure that the contrast and brightness are not changed and color correction profiles have not been applied."));
1353+
1354+ /* TRANSLATORS: dialog message, suffix */
1355+ g_string_append_printf (string, "%s\n", _("The device sensor should have been cleaned prior to scanning and the output file resolution should be at least 200dpi."));
1356+ }
1357+
1358+ /* camera specific options */
1359+ if (priv->device_kind == CD_DEVICE_KIND_CAMERA) {
1360+ /* TRANSLATORS: dialog message, preface */
1361+ g_string_append_printf (string, "%s\n", _("Ensure that the white-balance has not been modified by the camera and that the lens is clean."));
1362+ }
1363+
1364+ /* TRANSLATORS: this is the message body for the chart selection */
1365+ g_string_append_printf (string, "\n%s", _("Please select the calibration target type."));
1366+
1367+ /* TRANSLATORS: this is the page title */
1368+ vbox = gcm_calib_add_page_title (priv, _("What target type do you have?"));
1369+
1370+ /* main contents */
1371+ content = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
1372+ gtk_box_pack_start (GTK_BOX (vbox), content, FALSE, FALSE, 0);
1373+
1374+ /* TRANSLATORS: this is intro page text */
1375+ gcm_calib_add_page_para (content, string->str);
1376+
1377+ /* pack in a preview image */
1378+ priv->reference_preview = gtk_image_new ();
1379+ gtk_box_pack_start (GTK_BOX (vbox), priv->reference_preview, FALSE, FALSE, 0);
1380+
1381+ combo = gtk_combo_box_text_new ();
1382+ for (i=0; i<GCM_CALIBRATE_REFERENCE_KIND_UNKNOWN; i++) {
1383+ gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo),
1384+ gcm_calib_reference_kind_to_localised_string (i));
1385+ }
1386+ g_signal_connect (combo, "changed",
1387+ G_CALLBACK (gcm_calib_reference_kind_combobox_cb),
1388+ priv);
1389+
1390+ /* use IT8 by default */
1391+ gtk_combo_box_set_active (GTK_COMBO_BOX (combo), GCM_CALIBRATE_REFERENCE_KIND_IT8);
1392+
1393+ gtk_box_pack_start (GTK_BOX (vbox), combo, FALSE, FALSE, 0);
1394+
1395+ /* add to assistant */
1396+ gtk_assistant_append_page (assistant, vbox);
1397+ gtk_assistant_set_page_type (assistant, vbox, GTK_ASSISTANT_PAGE_CONTENT);
1398+ gtk_assistant_set_page_complete (assistant, vbox, FALSE);
1399+ /* TRANSLATORS: this is the calibration wizard page title */
1400+ gtk_assistant_set_page_title (assistant, vbox, _("Select Target"));
1401+ g_ptr_array_add (priv->pages, vbox);
1402+ g_object_set_data (G_OBJECT (vbox),
1403+ "GcmCalibrateMain::Index",
1404+ GUINT_TO_POINTER (GCM_CALIBRATE_PAGE_TARGET_KIND));
1405+ g_string_free (string, TRUE);
1406+
1407+ /* show page */
1408+ gtk_widget_show_all (vbox);
1409+}
1410+
1411+static void
1412+gcm_calib_display_kind_toggled_cb (GtkToggleButton *togglebutton,
1413+ GcmCalibratePriv *priv)
1414+{
1415+ GcmCalibrateDisplayKind display_kind;
1416+
1417+ if (!gtk_toggle_button_get_active (togglebutton))
1418+ return;
1419+ display_kind = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (togglebutton),
1420+ "GcmCalib::display-kind"));
1421+ g_object_set (priv->calibrate,
1422+ "display-kind", display_kind,
1423+ NULL);
1424+}
1425+
1426+/**
1427+ * gcm_calib_setup_page_display_kind:
1428+ **/
1429+static void
1430+gcm_calib_setup_page_display_kind (GcmCalibratePriv *priv)
1431+{
1432+ GtkWidget *vbox;
1433+ GtkWidget *content;
1434+ GtkWidget *widget;
1435+ GSList *list;
1436+ GtkAssistant *assistant = GTK_ASSISTANT (priv->main_window);
1437+
1438+ /* TRANSLATORS: this is the page title */
1439+ vbox = gcm_calib_add_page_title (priv, _("Choose your display type"));
1440+
1441+ /* main contents */
1442+ content = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
1443+ gtk_box_pack_start (GTK_BOX (vbox), content, FALSE, FALSE, 0);
1444+
1445+ /* TRANSLATORS: this is intro page text */
1446+ gcm_calib_add_page_para (content, _("Select the monitor type that is attached to your computer."));
1447+
1448+ widget = gtk_radio_button_new_with_label (NULL, _("LCD (CCFL backlight)"));
1449+ g_object_set_data (G_OBJECT (widget),
1450+ "GcmCalib::display-kind",
1451+ GUINT_TO_POINTER (GCM_CALIBRATE_DEVICE_KIND_LCD_CCFL));
1452+ g_signal_connect (widget, "toggled",
1453+ G_CALLBACK (gcm_calib_display_kind_toggled_cb), priv);
1454+ gtk_box_pack_start (GTK_BOX (content), widget, FALSE, FALSE, 0);
1455+
1456+ list = gtk_radio_button_get_group (GTK_RADIO_BUTTON (widget));
1457+ widget = gtk_radio_button_new_with_label (list, _("LCD (White LED backlight)"));
1458+ g_object_set_data (G_OBJECT (widget),
1459+ "GcmCalib::display-kind",
1460+ GUINT_TO_POINTER (GCM_CALIBRATE_DEVICE_KIND_LCD_LED_WHITE));
1461+ g_signal_connect (widget, "toggled",
1462+ G_CALLBACK (gcm_calib_display_kind_toggled_cb), priv);
1463+ gtk_box_pack_start (GTK_BOX (content), widget, FALSE, FALSE, 0);
1464+
1465+ list = gtk_radio_button_get_group (GTK_RADIO_BUTTON (widget));
1466+ widget = gtk_radio_button_new_with_label (list, _("LCD (RGB LED backlight)"));
1467+ g_object_set_data (G_OBJECT (widget),
1468+ "GcmCalib::display-kind",
1469+ GUINT_TO_POINTER (GCM_CALIBRATE_DEVICE_KIND_LCD_LED_RGB));
1470+ g_signal_connect (widget, "toggled",
1471+ G_CALLBACK (gcm_calib_display_kind_toggled_cb), priv);
1472+ gtk_box_pack_start (GTK_BOX (content), widget, FALSE, FALSE, 0);
1473+
1474+ list = gtk_radio_button_get_group (GTK_RADIO_BUTTON (widget));
1475+ widget = gtk_radio_button_new_with_label (list, _("LCD (Wide Gamut RGB LED backlight)"));
1476+ g_object_set_data (G_OBJECT (widget),
1477+ "GcmCalib::display-kind",
1478+ GUINT_TO_POINTER (GCM_CALIBRATE_DEVICE_KIND_LCD_LED_RGB_WIDE));
1479+ g_signal_connect (widget, "toggled",
1480+ G_CALLBACK (gcm_calib_display_kind_toggled_cb), priv);
1481+ gtk_box_pack_start (GTK_BOX (content), widget, FALSE, FALSE, 0);
1482+
1483+ list = gtk_radio_button_get_group (GTK_RADIO_BUTTON (widget));
1484+ widget = gtk_radio_button_new_with_label (list, _("LCD (Wide Gamut CCFL backlight)"));
1485+ g_object_set_data (G_OBJECT (widget),
1486+ "GcmCalib::display-kind",
1487+ GUINT_TO_POINTER (GCM_CALIBRATE_DEVICE_KIND_LCD_CCFL_WIDE));
1488+ g_signal_connect (widget, "toggled",
1489+ G_CALLBACK (gcm_calib_display_kind_toggled_cb), priv);
1490+ gtk_box_pack_start (GTK_BOX (content), widget, FALSE, FALSE, 0);
1491+
1492+ list = gtk_radio_button_get_group (GTK_RADIO_BUTTON (widget));
1493+ widget = gtk_radio_button_new_with_label (list, _("CRT"));
1494+ g_object_set_data (G_OBJECT (widget),
1495+ "GcmCalib::display-kind",
1496+ GUINT_TO_POINTER (GCM_CALIBRATE_DEVICE_KIND_CRT));
1497+ g_signal_connect (widget, "toggled",
1498+ G_CALLBACK (gcm_calib_display_kind_toggled_cb), priv);
1499+ gtk_box_pack_start (GTK_BOX (content), widget, FALSE, FALSE, 0);
1500+
1501+ list = gtk_radio_button_get_group (GTK_RADIO_BUTTON (widget));
1502+ widget = gtk_radio_button_new_with_label (list, _("Plasma"));
1503+ g_object_set_data (G_OBJECT (widget),
1504+ "GcmCalib::display-kind",
1505+ GUINT_TO_POINTER (GCM_CALIBRATE_DEVICE_KIND_CRT));
1506+ g_signal_connect (widget, "toggled",
1507+ G_CALLBACK (gcm_calib_display_kind_toggled_cb), priv);
1508+ gtk_box_pack_start (GTK_BOX (content), widget, FALSE, FALSE, 0);
1509+
1510+ list = gtk_radio_button_get_group (GTK_RADIO_BUTTON (widget));
1511+ widget = gtk_radio_button_new_with_label (list, _("Projector"));
1512+ g_object_set_data (G_OBJECT (widget),
1513+ "GcmCalib::display-kind",
1514+ GUINT_TO_POINTER (GCM_CALIBRATE_DEVICE_KIND_PROJECTOR));
1515+ g_signal_connect (widget, "toggled",
1516+ G_CALLBACK (gcm_calib_display_kind_toggled_cb), priv);
1517+ gtk_box_pack_start (GTK_BOX (content), widget, FALSE, FALSE, 0);
1518+
1519+ /* add to assistant */
1520+ gtk_assistant_append_page (assistant, vbox);
1521+ gtk_assistant_set_page_type (assistant, vbox, GTK_ASSISTANT_PAGE_CONTENT);
1522+ /* TRANSLATORS: this is the calibration wizard page title */
1523+ gtk_assistant_set_page_title (assistant, vbox, _("Choose Display Type"));
1524+ gtk_assistant_set_page_complete (assistant, vbox, FALSE);
1525+ g_ptr_array_add (priv->pages, vbox);
1526+ g_object_set_data (G_OBJECT (vbox),
1527+ "GcmCalibrateMain::Index",
1528+ GUINT_TO_POINTER (GCM_CALIBRATE_PAGE_DISPLAY_KIND));
1529+
1530+ /* show page */
1531+ gtk_widget_show_all (vbox);
1532+}
1533+
1534+static void
1535+gcm_calib_display_temp_toggled_cb (GtkToggleButton *togglebutton,
1536+ GcmCalibratePriv *priv)
1537+{
1538+ guint display_temp;
1539+ if (!gtk_toggle_button_get_active (togglebutton))
1540+ return;
1541+ display_temp = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (togglebutton),
1542+ "GcmCalib::display-temp"));
1543+ g_object_set (priv->calibrate,
1544+ "target-whitepoint", display_temp,
1545+ NULL);
1546+}
1547+
1548+/**
1549+ * gcm_calib_setup_page_display_temp:
1550+ **/
1551+static void
1552+gcm_calib_setup_page_display_temp (GcmCalibratePriv *priv)
1553+{
1554+ GtkWidget *vbox;
1555+ GtkWidget *content;
1556+ GtkWidget *widget;
1557+ GSList *list;
1558+ GtkAssistant *assistant = GTK_ASSISTANT (priv->main_window);
1559+
1560+ /* TRANSLATORS: this is the page title */
1561+ vbox = gcm_calib_add_page_title (priv, _("Choose your display target white point"));
1562+
1563+ /* main contents */
1564+ content = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
1565+ gtk_box_pack_start (GTK_BOX (vbox), content, FALSE, FALSE, 0);
1566+
1567+ /* TRANSLATORS: this is intro page text */
1568+ gcm_calib_add_page_para (content, _("Most displays should be calibrated to a CIE D65 illuminant for general usage."));
1569+
1570+ widget = gtk_radio_button_new_with_label (NULL, _("CIE D50 (Printing and publishing)"));
1571+ g_object_set_data (G_OBJECT (widget),
1572+ "GcmCalib::display-temp",
1573+ GUINT_TO_POINTER (5000));
1574+ g_signal_connect (widget, "toggled",
1575+ G_CALLBACK (gcm_calib_display_temp_toggled_cb), priv);
1576+ gtk_box_pack_start (GTK_BOX (content), widget, FALSE, FALSE, 0);
1577+
1578+ list = gtk_radio_button_get_group (GTK_RADIO_BUTTON (widget));
1579+ widget = gtk_radio_button_new_with_label (list, _("CIE D55"));
1580+ g_object_set_data (G_OBJECT (widget),
1581+ "GcmCalib::display-temp",
1582+ GUINT_TO_POINTER (5500));
1583+ g_signal_connect (widget, "toggled",
1584+ G_CALLBACK (gcm_calib_display_temp_toggled_cb), priv);
1585+ gtk_box_pack_start (GTK_BOX (content), widget, FALSE, FALSE, 0);
1586+
1587+ list = gtk_radio_button_get_group (GTK_RADIO_BUTTON (widget));
1588+ widget = gtk_radio_button_new_with_label (list, _("CIE D65 (Photography and graphics)"));
1589+ g_object_set_data (G_OBJECT (widget),
1590+ "GcmCalib::display-temp",
1591+ GUINT_TO_POINTER (6500));
1592+ g_signal_connect (widget, "toggled",
1593+ G_CALLBACK (gcm_calib_display_temp_toggled_cb), priv);
1594+ gtk_box_pack_start (GTK_BOX (content), widget, FALSE, FALSE, 0);
1595+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE);
1596+
1597+ list = gtk_radio_button_get_group (GTK_RADIO_BUTTON (widget));
1598+ widget = gtk_radio_button_new_with_label (list, _("CIE D75"));
1599+ g_object_set_data (G_OBJECT (widget),
1600+ "GcmCalib::display-temp",
1601+ GUINT_TO_POINTER (7500));
1602+ g_signal_connect (widget, "toggled",
1603+ G_CALLBACK (gcm_calib_display_temp_toggled_cb), priv);
1604+ gtk_box_pack_start (GTK_BOX (content), widget, FALSE, FALSE, 0);
1605+
1606+ list = gtk_radio_button_get_group (GTK_RADIO_BUTTON (widget));
1607+ widget = gtk_radio_button_new_with_label (list, _("Native (Already set manually)"));
1608+ g_object_set_data (G_OBJECT (widget),
1609+ "GcmCalib::display-temp",
1610+ GUINT_TO_POINTER (0));
1611+ g_signal_connect (widget, "toggled",
1612+ G_CALLBACK (gcm_calib_display_temp_toggled_cb), priv);
1613+ gtk_box_pack_start (GTK_BOX (content), widget, FALSE, FALSE, 0);
1614+
1615+ /* add to assistant */
1616+ gtk_assistant_append_page (assistant, vbox);
1617+ gtk_assistant_set_page_type (assistant, vbox, GTK_ASSISTANT_PAGE_CONTENT);
1618+ /* TRANSLATORS: this is the calibration wizard page title */
1619+ gtk_assistant_set_page_title (assistant, vbox, _("Choose Display Whitepoint"));
1620+ gtk_assistant_set_page_complete (assistant, vbox, FALSE);
1621+ g_ptr_array_add (priv->pages, vbox);
1622+ g_object_set_data (G_OBJECT (vbox),
1623+ "GcmCalibrateMain::Index",
1624+ GUINT_TO_POINTER (GCM_CALIBRATE_PAGE_DISPLAY_TEMPERATURE));
1625+
1626+ /* show page */
1627+ gtk_widget_show_all (vbox);
1628+}
1629+
1630+static void
1631+gcm_calib_print_kind_toggled_cb (GtkToggleButton *togglebutton,
1632+ GcmCalibratePriv *priv)
1633+{
1634+ GcmCalibratePrintKind print_kind;
1635+ if (!gtk_toggle_button_get_active (togglebutton))
1636+ return;
1637+ print_kind = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (togglebutton),
1638+ "GcmCalib::print-kind"));
1639+ g_object_set (priv->calibrate,
1640+ "print-kind", print_kind,
1641+ NULL);
1642+}
1643+
1644+/**
1645+ * gcm_calib_setup_page_print_kind:
1646+ **/
1647+static void
1648+gcm_calib_setup_page_print_kind (GcmCalibratePriv *priv)
1649+{
1650+ GtkWidget *vbox;
1651+ GtkWidget *content;
1652+ GtkWidget *widget;
1653+ GSList *list;
1654+ GtkAssistant *assistant = GTK_ASSISTANT (priv->main_window);
1655+
1656+ /* TRANSLATORS: this is the page title */
1657+ vbox = gcm_calib_add_page_title (priv, _("Choose profiling mode"));
1658+
1659+ /* main contents */
1660+ content = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
1661+ gtk_box_pack_start (GTK_BOX (vbox), content, FALSE, FALSE, 0);
1662+
1663+ /* TRANSLATORS: this is intro page text */
1664+ gcm_calib_add_page_para (content, _("Please indicate if you want to profile a local printer, generate some test patches, or profile using existing test patches."));
1665+
1666+ widget = gtk_radio_button_new_with_label (NULL, "Local printer");
1667+ g_object_set_data (G_OBJECT (widget),
1668+ "GcmCalib::print-kind",
1669+ GUINT_TO_POINTER (GCM_CALIBRATE_PRINT_KIND_LOCAL));
1670+ g_signal_connect (widget, "toggled",
1671+ G_CALLBACK (gcm_calib_print_kind_toggled_cb), priv);
1672+ gtk_box_pack_start (GTK_BOX (content), widget, FALSE, FALSE, 0);
1673+
1674+ list = gtk_radio_button_get_group (GTK_RADIO_BUTTON (widget));
1675+ widget = gtk_radio_button_new_with_label (list, "Generate patches for remote printer");
1676+ g_object_set_data (G_OBJECT (widget),
1677+ "GcmCalib::print-kind",
1678+ GUINT_TO_POINTER (GCM_CALIBRATE_PRINT_KIND_GENERATE));
1679+ g_signal_connect (widget, "toggled",
1680+ G_CALLBACK (gcm_calib_print_kind_toggled_cb), priv);
1681+ gtk_box_pack_start (GTK_BOX (content), widget, FALSE, FALSE, 0);
1682+
1683+ list = gtk_radio_button_get_group (GTK_RADIO_BUTTON (widget));
1684+ widget = gtk_radio_button_new_with_label (list, "Generate profile from existing test patches");
1685+ g_object_set_data (G_OBJECT (widget),
1686+ "GcmCalib::print-kind",
1687+ GUINT_TO_POINTER (GCM_CALIBRATE_PRINT_KIND_ANALYZE));
1688+ g_signal_connect (widget, "toggled",
1689+ G_CALLBACK (gcm_calib_print_kind_toggled_cb), priv);
1690+ gtk_box_pack_start (GTK_BOX (content), widget, FALSE, FALSE, 0);
1691+
1692+ /* sync the default */
1693+ g_object_set (priv->calibrate,
1694+ "print-kind", GCM_CALIBRATE_PRINT_KIND_LOCAL,
1695+ NULL);
1696+
1697+ /* add to assistant */
1698+ gtk_assistant_append_page (assistant, vbox);
1699+ gtk_assistant_set_page_type (assistant, vbox, GTK_ASSISTANT_PAGE_CONTENT);
1700+ /* TRANSLATORS: this is the calibration wizard page title */
1701+ gtk_assistant_set_page_title (assistant, vbox, _("Calibration Mode"));
1702+ gtk_assistant_set_page_complete (assistant, vbox, FALSE);
1703+ g_ptr_array_add (priv->pages, vbox);
1704+ g_object_set_data (G_OBJECT (vbox),
1705+ "GcmCalibrateMain::Index",
1706+ GUINT_TO_POINTER (GCM_CALIBRATE_PAGE_PRINT_KIND));
1707+
1708+ /* show page */
1709+ gtk_widget_show_all (vbox);
1710+}
1711+
1712+static void
1713+gcm_calib_precision_toggled_cb (GtkToggleButton *togglebutton,
1714+ GcmCalibratePriv *priv)
1715+{
1716+ GcmCalibratePrecision precision;
1717+ if (!gtk_toggle_button_get_active (togglebutton))
1718+ return;
1719+ precision = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (togglebutton),
1720+ "GcmCalib::precision"));
1721+ g_object_set (priv->calibrate,
1722+ "precision", precision,
1723+ NULL);
1724+}
1725+
1726+/**
1727+ * gcm_calib_setup_page_precision:
1728+ **/
1729+static void
1730+gcm_calib_setup_page_precision (GcmCalibratePriv *priv)
1731+{
1732+ GtkWidget *vbox;
1733+ GtkWidget *content;
1734+ GtkWidget *widget;
1735+ GSList *list;
1736+ GString *labels[3];
1737+ guint i;
1738+ guint values_printer[] = { 6, 4, 2}; /* sheets */
1739+ guint values_display[] = { 60, 40, 20}; /* minutes */
1740+ GtkAssistant *assistant = GTK_ASSISTANT (priv->main_window);
1741+
1742+ /* TRANSLATORS: this is the page title */
1743+ vbox = gcm_calib_add_page_title (priv, _("Choose calibration quality"));
1744+
1745+ /* main contents */
1746+ content = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
1747+ gtk_box_pack_start (GTK_BOX (vbox), content, FALSE, FALSE, 0);
1748+
1749+ /* TRANSLATORS: this is intro page text */
1750+ gcm_calib_add_page_para (content, _("Higher quality calibration requires many color samples and more time."));
1751+
1752+#if 0
1753+ /* TRANSLATORS: this is the message body for the chart selection */
1754+ g_string_append (string, _("A higher precision profile provides higher accuracy in color matching but requires more time for reading the color patches."));
1755+
1756+ /* TRANSLATORS: this is the message body for the chart selection */
1757+ g_string_append_printf (string, "\n%s", _("For a typical workflow, a normal precision profile is sufficient."));
1758+
1759+ /* printer specific options */
1760+ if (priv->device_kind == CD_DEVICE_KIND_PRINTER) {
1761+ /* TRANSLATORS: dialog message, preface */
1762+ g_string_append_printf (string, "\n%s", _("The high precision profile also requires more paper and printer ink."));
1763+ }
1764+#endif
1765+
1766+ /* TRANSLATORS: radio options for calibration precision */
1767+ labels[0] = g_string_new (_("Accurate"));
1768+ labels[1] = g_string_new (_("Normal"));
1769+ labels[2] = g_string_new (_("Quick"));
1770+ switch (priv->device_kind) {
1771+ case CD_DEVICE_KIND_PRINTER:
1772+ for (i=0; i<3; i++) {
1773+ g_string_append (labels[i], " ");
1774+ /* TRANSLATORS: radio options for calibration precision */
1775+ g_string_append_printf (labels[i], ngettext (
1776+ "(about %i sheet of paper)",
1777+ "(about %i sheets of paper)",
1778+ values_printer[i]),
1779+ values_printer[i]);
1780+ }
1781+ break;
1782+ case CD_DEVICE_KIND_DISPLAY:
1783+ for (i=0; i<3; i++) {
1784+ g_string_append (labels[i], " ");
1785+ /* TRANSLATORS: radio options for calibration precision */
1786+ g_string_append_printf (labels[i], ngettext (
1787+ "(about %i minute)",
1788+ "(about %i minutes)",
1789+ values_display[i]),
1790+ values_display[i]);
1791+ }
1792+ break;
1793+ default:
1794+ break;
1795+ }
1796+
1797+ widget = gtk_radio_button_new_with_label (NULL, labels[0]->str);
1798+ g_object_set_data (G_OBJECT (widget),
1799+ "GcmCalib::precision",
1800+ GUINT_TO_POINTER (GCM_CALIBRATE_PRECISION_LONG));
1801+ g_signal_connect (widget, "toggled",
1802+ G_CALLBACK (gcm_calib_precision_toggled_cb), priv);
1803+ gtk_box_pack_start (GTK_BOX (content), widget, FALSE, FALSE, 0);
1804+
1805+ list = gtk_radio_button_get_group (GTK_RADIO_BUTTON (widget));
1806+ widget = gtk_radio_button_new_with_label (list, labels[1]->str);
1807+ g_object_set_data (G_OBJECT (widget),
1808+ "GcmCalib::precision",
1809+ GUINT_TO_POINTER (GCM_CALIBRATE_PRECISION_NORMAL));
1810+ g_signal_connect (widget, "toggled",
1811+ G_CALLBACK (gcm_calib_precision_toggled_cb), priv);
1812+ gtk_box_pack_start (GTK_BOX (content), widget, FALSE, FALSE, 0);
1813+
1814+ list = gtk_radio_button_get_group (GTK_RADIO_BUTTON (widget));
1815+ widget = gtk_radio_button_new_with_label (list, labels[2]->str);
1816+ g_object_set_data (G_OBJECT (widget),
1817+ "GcmCalib::precision",
1818+ GUINT_TO_POINTER (GCM_CALIBRATE_PRECISION_SHORT));
1819+ g_signal_connect (widget, "toggled",
1820+ G_CALLBACK (gcm_calib_precision_toggled_cb), priv);
1821+ gtk_box_pack_start (GTK_BOX (content), widget, FALSE, FALSE, 0);
1822+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE);
1823+
1824+ /* add to assistant */
1825+ gtk_assistant_append_page (assistant, vbox);
1826+ gtk_assistant_set_page_type (assistant, vbox, GTK_ASSISTANT_PAGE_CONTENT);
1827+ /* TRANSLATORS: this is the calibration wizard page title */
1828+ gtk_assistant_set_page_title (assistant, vbox, _("Calibration Quality"));
1829+ gtk_assistant_set_page_complete (assistant, vbox, FALSE);
1830+ g_ptr_array_add (priv->pages, vbox);
1831+ g_object_set_data (G_OBJECT (vbox),
1832+ "GcmCalibrateMain::Index",
1833+ GUINT_TO_POINTER (GCM_CALIBRATE_PAGE_PRECISION));
1834+
1835+ for (i=0; i<3; i++)
1836+ g_string_free (labels[i], TRUE);
1837+
1838+ /* show page */
1839+ gtk_widget_show_all (vbox);
1840+}
1841+
1842+static void
1843+gcm_calib_text_changed_cb (GtkEntry *entry,
1844+ GcmCalibratePriv *priv)
1845+{
1846+ g_object_set (priv->calibrate,
1847+ "description", gtk_entry_get_text (entry),
1848+ NULL);
1849+}
1850+
1851+/**
1852+ * gcm_calib_setup_page_profile_title:
1853+ **/
1854+static void
1855+gcm_calib_setup_page_profile_title (GcmCalibratePriv *priv)
1856+{
1857+ GtkWidget *vbox;
1858+ GtkWidget *content;
1859+ GtkWidget *widget;
1860+ gchar *tmp = NULL;
1861+ GtkAssistant *assistant = GTK_ASSISTANT (priv->main_window);
1862+
1863+ /* TRANSLATORS: this is the page title */
1864+ vbox = gcm_calib_add_page_title (priv, _("Profile title"));
1865+
1866+ /* main contents */
1867+ content = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
1868+ gtk_box_pack_start (GTK_BOX (vbox), content, FALSE, FALSE, 0);
1869+
1870+ /* TRANSLATORS: this is intro page text */
1871+ gcm_calib_add_page_para (content, _("Choose a title to identify the profile on your system."));
1872+
1873+ widget = gtk_entry_new ();
1874+ gtk_box_pack_start (GTK_BOX (content), widget, FALSE, FALSE, 0);
1875+ gtk_entry_set_max_length (GTK_ENTRY (widget), 128);
1876+
1877+ /* set the current title */
1878+ g_object_get (priv->calibrate,
1879+ "description", &tmp,
1880+ NULL);
1881+ gtk_entry_set_text (GTK_ENTRY (widget), tmp);
1882+ g_free (tmp);
1883+
1884+ /* watch for changes */
1885+ g_signal_connect (GTK_EDITABLE (widget), "changed",
1886+ G_CALLBACK (gcm_calib_text_changed_cb), priv);
1887+
1888+ /* add to assistant */
1889+ gtk_assistant_append_page (assistant, vbox);
1890+ gtk_assistant_set_page_type (assistant, vbox, GTK_ASSISTANT_PAGE_CONTENT);
1891+ /* TRANSLATORS: this is the calibration wizard page title */
1892+ gtk_assistant_set_page_title (assistant, vbox, _("Profile Title"));
1893+ gtk_assistant_set_page_complete (assistant, vbox, TRUE);
1894+ g_ptr_array_add (priv->pages, vbox);
1895+ g_object_set_data (G_OBJECT (vbox),
1896+ "GcmCalibrateMain::Index",
1897+ GUINT_TO_POINTER (GCM_CALIBRATE_PAGE_TITLE));
1898+
1899+ /* show page */
1900+ gtk_widget_show_all (vbox);
1901+}
1902+
1903+/**
1904+ * gcm_calib_setup_page_sensor:
1905+ **/
1906+static void
1907+gcm_calib_setup_page_sensor (GcmCalibratePriv *priv)
1908+{
1909+ GtkWidget *vbox;
1910+ GtkWidget *content;
1911+ GtkAssistant *assistant = GTK_ASSISTANT (priv->main_window);
1912+
1913+ /* TRANSLATORS: this is the page title */
1914+ vbox = gcm_calib_add_page_title (priv, _("Insert sensor hardware"));
1915+
1916+ /* main contents */
1917+ content = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
1918+ gtk_box_pack_start (GTK_BOX (vbox), content, FALSE, FALSE, 0);
1919+
1920+ /* TRANSLATORS: this is intro page text */
1921+ gcm_calib_add_page_para (content, _("You need to insert sensor hardware to continue."));
1922+
1923+ /* add to assistant */
1924+ gtk_assistant_append_page (assistant, vbox);
1925+ gtk_assistant_set_page_type (assistant, vbox, GTK_ASSISTANT_PAGE_CONTENT);
1926+ /* TRANSLATORS: this is the calibration wizard page title */
1927+ gtk_assistant_set_page_title (assistant, vbox, _("Sensor Check"));
1928+ gtk_assistant_set_page_complete (assistant, vbox, FALSE);
1929+ g_ptr_array_add (priv->pages, vbox);
1930+ g_object_set_data (G_OBJECT (vbox),
1931+ "GcmCalibrateMain::Index",
1932+ GUINT_TO_POINTER (GCM_CALIBRATE_PAGE_SENSOR));
1933+
1934+ /* show page */
1935+ gtk_widget_show_all (vbox);
1936+}
1937+
1938+/**
1939+ * gcm_calib_setup_page_failure:
1940+ **/
1941+static void
1942+gcm_calib_setup_page_failure (GcmCalibratePriv *priv)
1943+{
1944+ GtkWidget *vbox;
1945+ GtkWidget *content;
1946+ GtkAssistant *assistant = GTK_ASSISTANT (priv->main_window);
1947+
1948+ /* TRANSLATORS: this is the page title */
1949+ vbox = gcm_calib_add_page_title (priv, _("Failed to calibrate"));
1950+
1951+ /* main contents */
1952+ content = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
1953+ gtk_box_pack_start (GTK_BOX (vbox), content, FALSE, FALSE, 0);
1954+
1955+ /* TRANSLATORS: this is intro page text */
1956+ gcm_calib_add_page_para (content, _("The device could not be found. Ensure it is plugged in and turned on."));
1957+
1958+ /* add to assistant */
1959+ gtk_assistant_append_page (assistant, vbox);
1960+ gtk_assistant_set_page_type (assistant, vbox, GTK_ASSISTANT_PAGE_SUMMARY);
1961+ /* TRANSLATORS: this is the calibration wizard page title */
1962+ gtk_assistant_set_page_title (assistant, vbox, _("Summary"));
1963+ gtk_assistant_set_page_complete (assistant, vbox, TRUE);
1964+ g_ptr_array_add (priv->pages, vbox);
1965+ g_object_set_data (G_OBJECT (vbox),
1966+ "GcmCalibrateMain::Index",
1967+ GUINT_TO_POINTER (GCM_CALIBRATE_PAGE_FAILURE));
1968+
1969+ /* show page */
1970+ gtk_widget_show_all (vbox);
1971+}
1972+
1973+/**
1974+ * gcm_calib_got_sensor:
1975+ **/
1976+static void
1977+gcm_calib_got_sensor (GcmCalibratePriv *priv, CdSensor *sensor)
1978+{
1979+ gboolean is_lowend = FALSE;
1980+ gboolean ret;
1981+ GError *error = NULL;
1982+ GtkWidget *vbox;
1983+
1984+ /* connect to sensor */
1985+ ret = cd_sensor_connect_sync (sensor, NULL, &error);
1986+ if (!ret) {
1987+ g_warning ("failed to connect to sensor: %s",
1988+ error->message);
1989+ g_error_free (error);
1990+ goto out;
1991+ }
1992+ gcm_calibrate_set_sensor (priv->calibrate, sensor);
1993+
1994+ /* hide the prompt for the user to insert a sensor */
1995+ vbox = gcm_calib_get_vbox_for_page (priv,
1996+ GCM_CALIBRATE_PAGE_SENSOR);
1997+ gtk_widget_hide (vbox);
1998+
1999+ /* if the device is a simple colorimeter, hide the temperature
2000+ * chooser. Only expensive accurate spectrophotometers are
2001+ * accurate enough to do a good job without a color cast */
2002+ if (cd_sensor_get_kind (sensor) == CD_SENSOR_KIND_COLORHUG) {
2003+ is_lowend = TRUE;
2004+ }
2005+ if (priv->device_kind == CD_DEVICE_KIND_DISPLAY) {
2006+ vbox = gcm_calib_get_vbox_for_page (priv,
2007+ GCM_CALIBRATE_PAGE_DISPLAY_TEMPERATURE);
2008+ gtk_widget_set_visible (vbox, !is_lowend);
2009+ }
2010+out:
2011+ return;
2012+}
2013+
2014+/**
2015+ * gcm_calib_get_sensors_cb:
2016+ **/
2017+static void
2018+gcm_calib_get_sensors_cb (GObject *object,
2019+ GAsyncResult *res,
2020+ gpointer user_data)
2021+{
2022+ CdClient *client = CD_CLIENT (object);
2023+ CdSensor *sensor_tmp;
2024+ GcmCalibratePriv *priv = (GcmCalibratePriv *) user_data;
2025+ GError *error = NULL;
2026+ GPtrArray *sensors;
2027+
2028+ /* get the result */
2029+ sensors = cd_client_get_sensors_finish (client, res, &error);
2030+ if (sensors == NULL) {
2031+ g_warning ("failed to get sensors: %s",
2032+ error->message);
2033+ g_error_free (error);
2034+ goto out;
2035+ }
2036+
2037+ /* we've got a sensor */
2038+ if (sensors->len != 0) {
2039+ sensor_tmp = g_ptr_array_index (sensors, 0);
2040+ gcm_calib_got_sensor (priv, sensor_tmp);
2041+ }
2042+out:
2043+ if (sensors != NULL)
2044+ g_ptr_array_unref (sensors);
2045+}
2046+
2047+/**
2048+ * gcm_calib_add_pages:
2049+ **/
2050+static void
2051+gcm_calib_add_pages (GcmCalibratePriv *priv)
2052+{
2053+ gboolean ret;
2054+ const gchar *xrandr_name;
2055+
2056+ /* device not found */
2057+ if (priv->device_kind == CD_DEVICE_KIND_UNKNOWN) {
2058+ gcm_calib_setup_page_failure (priv);
2059+ gtk_widget_show_all (GTK_WIDGET (priv->main_window));
2060+ return;
2061+ }
2062+
2063+ gcm_calib_setup_page_intro (priv);
2064+
2065+ if (priv->device_kind == CD_DEVICE_KIND_DISPLAY ||
2066+ priv->device_kind == CD_DEVICE_KIND_PRINTER)
2067+ gcm_calib_setup_page_sensor (priv);
2068+
2069+ /* find whether argyllcms is installed using a tool which should exist */
2070+ ret = gcm_calibrate_get_enabled (priv->calibrate);
2071+ if (!ret)
2072+ gcm_calib_setup_page_install_argyllcms (priv);
2073+
2074+ xrandr_name = cd_device_get_metadata_item (priv->device,
2075+ CD_DEVICE_METADATA_XRANDR_NAME);
2076+ if (xrandr_name != NULL)
2077+ priv->internal_lcd = gcm_utils_output_is_lcd_internal (xrandr_name);
2078+ if (!priv->internal_lcd && priv->device_kind == CD_DEVICE_KIND_DISPLAY)
2079+ gcm_calib_setup_page_display_configure_wait (priv);
2080+
2081+ gcm_calib_setup_page_precision (priv);
2082+
2083+ if (priv->device_kind == CD_DEVICE_KIND_DISPLAY) {
2084+ gcm_calib_setup_page_display_kind (priv);
2085+ gcm_calib_setup_page_display_temp (priv);
2086+ } else if (priv->device_kind == CD_DEVICE_KIND_PRINTER) {
2087+ gcm_calib_setup_page_print_kind (priv);
2088+ } else {
2089+ gcm_calib_setup_page_target_kind (priv);
2090+ ret = g_file_test ("/usr/share/shared-color-targets", G_FILE_TEST_IS_DIR);
2091+ if (!ret)
2092+ gcm_calib_setup_page_install_targets (priv);
2093+ }
2094+
2095+ gcm_calib_setup_page_profile_title (priv);
2096+ gcm_calib_setup_page_action (priv);
2097+
2098+ gcm_calib_setup_page_summary (priv);
2099+
2100+ /* see if we can hide the sensor check */
2101+ cd_client_get_sensors (priv->client,
2102+ NULL,
2103+ gcm_calib_get_sensors_cb,
2104+ priv);
2105+}
2106+
2107+/**
2108+ * gcm_calib_sensor_added_cb:
2109+ **/
2110+static void
2111+gcm_calib_sensor_added_cb (CdClient *client, CdSensor *sensor, GcmCalibratePriv *priv)
2112+{
2113+ g_debug ("sensor inserted");
2114+ gcm_calib_got_sensor (priv, sensor);
2115+ gtk_assistant_next_page (GTK_ASSISTANT (priv->main_window));
2116+}
2117+
2118+/**
2119+ * gcm_calib_startup_cb:
2120+ **/
2121+static void
2122+gcm_calib_startup_cb (GApplication *application, GcmCalibratePriv *priv)
2123+{
2124+ const gint window_width = 640;
2125+ const gint window_height = 440;
2126+
2127+ const gchar *description;
2128+ const gchar *manufacturer;
2129+ const gchar *model;
2130+ const gchar *native_device;
2131+ const gchar *serial;
2132+ gchar *copyright = NULL;
2133+ gboolean ret;
2134+ GDateTime *dt = NULL;
2135+ GError *error = NULL;
2136+
2137+ /* add application specific icons to search path */
2138+ gtk_icon_theme_append_search_path (gtk_icon_theme_get_default (),
2139+ GCM_DATA G_DIR_SEPARATOR_S "icons");
2140+
2141+ /* connect to colord */
2142+ priv->client = cd_client_new ();
2143+ g_signal_connect (priv->client, "sensor-added",
2144+ G_CALLBACK (gcm_calib_sensor_added_cb), priv);
2145+ ret = cd_client_connect_sync (priv->client,
2146+ NULL,
2147+ &error);
2148+ if (!ret) {
2149+ g_warning ("failed to connect to colord: %s",
2150+ error->message);
2151+ g_error_free (error);
2152+ goto out;
2153+ }
2154+
2155+ /* show main UI */
2156+ priv->main_window = GTK_WINDOW (gtk_assistant_new ());
2157+ gtk_window_set_default_size (priv->main_window, window_width, window_height);
2158+ gtk_window_set_resizable (priv->main_window, TRUE);
2159+ gtk_window_set_title (priv->main_window, "");
2160+ gtk_container_set_border_width (GTK_CONTAINER (priv->main_window), 12);
2161+ g_signal_connect (priv->main_window, "delete_event",
2162+ G_CALLBACK (gcm_calib_delete_event_cb), priv);
2163+ g_signal_connect (priv->main_window, "close",
2164+ G_CALLBACK (gcm_calib_assistant_close_cb), priv);
2165+ g_signal_connect (priv->main_window, "cancel",
2166+ G_CALLBACK (gcm_calib_assistant_cancel_cb), priv);
2167+ g_signal_connect (priv->main_window, "prepare",
2168+ G_CALLBACK (gcm_calib_assistant_prepare_cb), priv);
2169+ gtk_application_add_window (priv->application,
2170+ priv->main_window);
2171+
2172+ /* set the parent window if it is specified */
2173+ if (priv->xid != 0) {
2174+ g_debug ("Setting xid %i", priv->xid);
2175+ gcm_window_set_parent_xid (GTK_WINDOW (priv->main_window), priv->xid);
2176+ }
2177+
2178+ /* select a specific profile only */
2179+ priv->device = cd_client_find_device_sync (priv->client,
2180+ priv->device_id,
2181+ NULL,
2182+ &error);
2183+ if (priv->device == NULL) {
2184+ g_warning ("failed to get device %s: %s",
2185+ priv->device_id,
2186+ error->message);
2187+ g_error_free (error);
2188+ goto out;
2189+ }
2190+
2191+ /* connect to the device */
2192+ ret = cd_device_connect_sync (priv->device,
2193+ NULL,
2194+ &error);
2195+ if (!ret) {
2196+ g_warning ("failed to connect to device: %s",
2197+ error->message);
2198+ g_error_free (error);
2199+ goto out;
2200+ }
2201+
2202+ /* get the device properties */
2203+ priv->device_kind = cd_device_get_kind (priv->device);
2204+
2205+ /* for display calibration move the window to lower right area to
2206+ * limit argyll from obscuring the window (too much) */
2207+ if (priv->device_kind == CD_DEVICE_KIND_DISPLAY) {
2208+ gtk_window_set_gravity (priv->main_window, GDK_GRAVITY_SOUTH_EAST);
2209+ gtk_window_move (priv->main_window, gdk_screen_width() - window_width,
2210+ gdk_screen_height() - window_height);
2211+ }
2212+
2213+ /* set, with fallbacks */
2214+ serial = cd_device_get_serial (priv->device);
2215+ if (serial == NULL) {
2216+ /* TRANSLATORS: this is saved in the profile */
2217+ serial = _("Unknown serial");
2218+ }
2219+ model = cd_device_get_model (priv->device);
2220+ if (model == NULL) {
2221+ /* TRANSLATORS: this is saved in the profile */
2222+ model = _("Unknown model");
2223+ }
2224+ description = cd_device_get_model (priv->device);
2225+ if (description == NULL) {
2226+ /* TRANSLATORS: this is saved in the profile */
2227+ description = _("Unknown description");
2228+ }
2229+ manufacturer = cd_device_get_vendor (priv->device);
2230+ if (manufacturer == NULL) {
2231+ /* TRANSLATORS: this is saved in the profile */
2232+ manufacturer = _("Unknown manufacturer");
2233+ }
2234+
2235+ dt = g_date_time_new_now_local ();
2236+ /* TRANSLATORS: this is the copyright string, where it might be
2237+ * "Copyright (c) 2009 Edward Scissorhands"
2238+ * BIG RED FLASHING NOTE: YOU NEED TO USE ASCII ONLY */
2239+ copyright = g_strdup_printf ("%s %04i %s", _("Copyright (c)"),
2240+ g_date_time_get_year (dt),
2241+ g_get_real_name ());
2242+
2243+ /* set the proper values */
2244+ g_object_set (priv->calibrate,
2245+ "device-kind", priv->device_kind,
2246+ "model", model,
2247+ "description", description,
2248+ "manufacturer", manufacturer,
2249+ "serial", serial,
2250+ "copyright", copyright,
2251+ NULL);
2252+
2253+ /* display specific properties */
2254+ if (priv->device_kind == CD_DEVICE_KIND_DISPLAY) {
2255+ native_device = cd_device_get_metadata_item (priv->device,
2256+ CD_DEVICE_METADATA_XRANDR_NAME);
2257+ if (native_device == NULL) {
2258+ g_warning ("failed to get output");
2259+ goto out;
2260+ }
2261+ g_object_set (priv->calibrate,
2262+ "output-name", native_device,
2263+ NULL);
2264+ }
2265+out:
2266+ /* add different pages depending on the device kind */
2267+ gcm_calib_add_pages (priv);
2268+ gtk_assistant_set_current_page (GTK_ASSISTANT (priv->main_window), 0);
2269+ if (dt != NULL)
2270+ g_date_time_unref (dt);
2271+ g_free (copyright);
2272+}
2273+
2274+static void
2275+gcm_calib_title_changed_cb (GcmCalibrate *calibrate,
2276+ const gchar *title,
2277+ GcmCalibratePriv *priv)
2278+{
2279+ gchar *markup;
2280+
2281+ markup = g_strdup_printf ("<span size=\"large\" font_weight=\"bold\">%s</span>", title);
2282+ gtk_label_set_markup (GTK_LABEL (priv->action_title), markup);
2283+ g_free (markup);
2284+}
2285+
2286+static void
2287+gcm_calib_message_changed_cb (GcmCalibrate *calibrate,
2288+ const gchar *title,
2289+ GcmCalibratePriv *priv)
2290+{
2291+ gtk_label_set_label (GTK_LABEL (priv->action_message), title);
2292+}
2293+
2294+static void
2295+gcm_calib_progress_changed_cb (GcmCalibrate *calibrate,
2296+ guint percentage,
2297+ GcmCalibratePriv *priv)
2298+{
2299+ gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (priv->action_progress),
2300+ percentage / 100.0f);
2301+}
2302+
2303+static void
2304+gcm_calib_image_changed_cb (GcmCalibrate *calibrate,
2305+ const gchar *filename,
2306+ GcmCalibratePriv *priv)
2307+{
2308+ GdkPixbuf *pixbuf;
2309+ GError *error = NULL;
2310+
2311+ if (filename != NULL) {
2312+ pixbuf = gdk_pixbuf_new_from_file_at_size (filename, 200, 400, &error);
2313+ if (pixbuf == NULL) {
2314+ g_warning ("failed to load image: %s", error->message);
2315+ g_error_free (error);
2316+ gtk_widget_hide (priv->action_image);
2317+ } else {
2318+ gtk_image_set_from_pixbuf (GTK_IMAGE (priv->action_image), pixbuf);
2319+ gtk_widget_show (priv->action_image);
2320+ }
2321+ } else {
2322+ gtk_widget_hide (priv->action_image);
2323+ }
2324+}
2325+
2326+static void
2327+gcm_calib_interaction_required_cb (GcmCalibrate *calibrate,
2328+ const gchar *button_text,
2329+ GcmCalibratePriv *priv)
2330+{
2331+ GtkWidget *vbox;
2332+ vbox = gcm_calib_get_vbox_for_page (priv,
2333+ GCM_CALIBRATE_PAGE_ACTION);
2334+ gtk_assistant_set_page_complete (GTK_ASSISTANT (priv->main_window),
2335+ vbox, TRUE);
2336+ priv->has_pending_interaction = TRUE;
2337+}
2338+
2339+/**
2340+ * main:
2341+ **/
2342+int
2343+main (int argc, char **argv)
2344+{
2345+ gchar *device_id = NULL;
2346+ GcmCalibratePriv *priv;
2347+ GOptionContext *context;
2348+ guint xid = 0;
2349+ int status = 0;
2350+
2351+ const GOptionEntry options[] = {
2352+ { "parent-window", 'p', 0, G_OPTION_ARG_INT, &xid,
2353+ /* TRANSLATORS: we can make this modal (stay on top of) another window */
2354+ _("Set the parent window to make this modal"), NULL },
2355+ { "device", 'd', 0, G_OPTION_ARG_STRING, &device_id,
2356+ /* TRANSLATORS: show just the one profile, rather than all */
2357+ _("Set the specific device to calibrate"), NULL },
2358+ { NULL}
2359+ };
2360+
2361+ setlocale (LC_ALL, "");
2362+
2363+ bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
2364+ bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
2365+ textdomain (GETTEXT_PACKAGE);
2366+
2367+ gtk_init (&argc, &argv);
2368+
2369+ context = g_option_context_new ("gnome-color-manager calibration tool");
2370+ g_option_context_add_main_entries (context, options, NULL);
2371+ g_option_context_add_group (context, gcm_debug_get_option_group ());
2372+ g_option_context_add_group (context, gtk_get_option_group (TRUE));
2373+ g_option_context_parse (context, &argc, &argv, NULL);
2374+ g_option_context_free (context);
2375+
2376+ priv = g_new0 (GcmCalibratePriv, 1);
2377+ priv->pages = g_ptr_array_new ();
2378+ priv->xid = xid;
2379+ priv->device_id = device_id;
2380+ priv->calibrate = gcm_calibrate_argyll_new ();
2381+ g_object_set (priv->calibrate,
2382+ "precision", GCM_CALIBRATE_PRECISION_LONG,
2383+ NULL);
2384+ priv->device_kind = CD_DEVICE_KIND_UNKNOWN;
2385+ g_signal_connect (priv->calibrate, "title-changed",
2386+ G_CALLBACK (gcm_calib_title_changed_cb), priv);
2387+ g_signal_connect (priv->calibrate, "message-changed",
2388+ G_CALLBACK (gcm_calib_message_changed_cb), priv);
2389+ g_signal_connect (priv->calibrate, "image-changed",
2390+ G_CALLBACK (gcm_calib_image_changed_cb), priv);
2391+ g_signal_connect (priv->calibrate, "progress-changed",
2392+ G_CALLBACK (gcm_calib_progress_changed_cb), priv);
2393+ g_signal_connect (priv->calibrate, "interaction-required",
2394+ G_CALLBACK (gcm_calib_interaction_required_cb), priv);
2395+
2396+ /* nothing specified */
2397+ if (priv->device_id == NULL) {
2398+ g_print ("%s\n", _("No device was specified!"));
2399+ goto out;
2400+ }
2401+
2402+ /* ensure single instance */
2403+ priv->application = gtk_application_new ("org.gnome.ColorManager.Calibration", 0);
2404+ g_signal_connect (priv->application, "startup",
2405+ G_CALLBACK (gcm_calib_startup_cb), priv);
2406+ g_signal_connect (priv->application, "activate",
2407+ G_CALLBACK (gcm_calib_activate_cb), priv);
2408+
2409+ /* wait */
2410+ status = g_application_run (G_APPLICATION (priv->application), argc, argv);
2411+
2412+ g_ptr_array_unref (priv->pages);
2413+ g_object_unref (priv->application);
2414+ g_object_unref (priv->calibrate);
2415+ if (priv->client != NULL)
2416+ g_object_unref (priv->client);
2417+ if (priv->device_id != NULL)
2418+ g_free (priv->device_id);
2419+ if (priv->device != NULL)
2420+ g_object_unref (priv->device);
2421+ g_free (priv);
2422+out:
2423+ return status;
2424+}
2425
2426=== removed file '.pc/01_unity_control_center.patch/src/gcm-calibrate-main.c'
2427--- .pc/01_unity_control_center.patch/src/gcm-calibrate-main.c 2014-01-15 16:15:06 +0000
2428+++ .pc/01_unity_control_center.patch/src/gcm-calibrate-main.c 1970-01-01 00:00:00 +0000
2429@@ -1,2370 +0,0 @@
2430-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
2431- *
2432- * Copyright (C) 2009-2011 Richard Hughes <richard@hughsie.com>
2433- *
2434- * Licensed under the GNU General Public License Version 2
2435- *
2436- * This program is free software; you can redistribute it and/or modify
2437- * it under the terms of the GNU General Public License as published by
2438- * the Free Software Foundation; either version 2 of the License, or
2439- * (at your option) any later version.
2440- *
2441- * This program is distributed in the hope that it will be useful,
2442- * but WITHOUT ANY WARRANTY; without even the implied warranty of
2443- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2444- * GNU General Public License for more details.
2445- *
2446- * You should have received a copy of the GNU General Public License
2447- * along with this program; if not, write to the Free Software
2448- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
2449- */
2450-
2451-#include "config.h"
2452-
2453-#include <glib/gi18n.h>
2454-#include <gtk/gtk.h>
2455-#include <gdk/gdkx.h>
2456-#include <glib/gstdio.h>
2457-#include <locale.h>
2458-#include <canberra-gtk.h>
2459-#include <colord.h>
2460-#include <lcms2.h>
2461-#include <stdlib.h>
2462-
2463-#include "gcm-utils.h"
2464-#include "gcm-debug.h"
2465-#include "gcm-calibrate.h"
2466-#include "gcm-calibrate-argyll.h"
2467-
2468-typedef enum {
2469- GCM_CALIBRATE_PAGE_INTRO,
2470- GCM_CALIBRATE_PAGE_DISPLAY_KIND,
2471- GCM_CALIBRATE_PAGE_DISPLAY_TEMPERATURE,
2472- GCM_CALIBRATE_PAGE_DISPLAY_CONFIG,
2473- GCM_CALIBRATE_PAGE_INSTALL_ARGYLLCMS,
2474- GCM_CALIBRATE_PAGE_INSTALL_TARGETS,
2475- GCM_CALIBRATE_PAGE_PRECISION,
2476- GCM_CALIBRATE_PAGE_PRINT_KIND,
2477- GCM_CALIBRATE_PAGE_TARGET_KIND,
2478- GCM_CALIBRATE_PAGE_SENSOR,
2479- GCM_CALIBRATE_PAGE_ACTION,
2480- GCM_CALIBRATE_PAGE_FAILURE,
2481- GCM_CALIBRATE_PAGE_TITLE,
2482- GCM_CALIBRATE_PAGE_LAST
2483-} GcmCalibratePage;
2484-
2485-typedef struct {
2486- GtkApplication *application;
2487- CdClient *client;
2488- GcmCalibrate *calibrate;
2489- CdDevice *device;
2490- CdDeviceKind device_kind;
2491- GCancellable *cancellable;
2492- gchar *device_id;
2493- guint xid;
2494- GtkWindow *main_window;
2495- GPtrArray *pages;
2496- gboolean internal_lcd;
2497- GtkWidget *reference_preview;
2498- GtkWidget *action_title;
2499- GtkWidget *action_message;
2500- GtkWidget *action_image;
2501- GtkWidget *action_progress;
2502- gboolean has_pending_interaction;
2503- gboolean started_calibration;
2504- GcmCalibratePage current_page;
2505- gint inhibit_cookie;
2506-} GcmCalibratePriv;
2507-
2508-/**
2509- * gcm_window_set_parent_xid:
2510- **/
2511-static void
2512-gcm_window_set_parent_xid (GtkWindow *window, guint32 xid)
2513-{
2514- GdkDisplay *display;
2515- GdkWindow *parent_window;
2516- GdkWindow *our_window;
2517-
2518- display = gdk_display_get_default ();
2519- parent_window = gdk_x11_window_foreign_new_for_display (display, xid);
2520- if (parent_window == NULL) {
2521- g_warning ("failed to get parent window");
2522- return;
2523- }
2524-
2525- gtk_widget_realize (GTK_WIDGET (window));
2526- our_window = gtk_widget_get_window (GTK_WIDGET (window));
2527- if (our_window == NULL) {
2528- g_warning ("failed to get our window");
2529- return;
2530- }
2531-
2532- /* set this above our parent */
2533- gtk_window_set_modal (window, TRUE);
2534- gdk_window_set_transient_for (our_window, parent_window);
2535- gtk_window_set_title (window, "");
2536-}
2537-
2538-/**
2539- * gcm_calib_activate_cb:
2540- **/
2541-static void
2542-gcm_calib_activate_cb (GApplication *application, GcmCalibratePriv *priv)
2543-{
2544- gtk_window_present (priv->main_window);
2545-}
2546-
2547-static void
2548-gcm_calib_confirm_quit_cb (GtkDialog *dialog,
2549- gint response_id,
2550- GcmCalibratePriv *priv)
2551-{
2552- if (response_id != GTK_RESPONSE_CLOSE) {
2553- gtk_widget_destroy (GTK_WIDGET (dialog));
2554- return;
2555- }
2556- gcm_calibrate_interaction (priv->calibrate, GTK_RESPONSE_CANCEL);
2557- g_application_release (G_APPLICATION (priv->application));
2558-}
2559-
2560-/**
2561- * gcm_calib_confirm_quit:
2562- **/
2563-static void
2564-gcm_calib_confirm_quit (GcmCalibratePriv *priv)
2565-{
2566- GtkWidget *dialog;
2567-
2568- /* do not ask for confirmation on the initial page */
2569- if (priv->current_page == GCM_CALIBRATE_PAGE_INTRO)
2570- g_application_release (G_APPLICATION (priv->application));
2571-
2572- dialog = gtk_message_dialog_new (GTK_WINDOW (priv->main_window),
2573- GTK_DIALOG_MODAL,
2574- GTK_MESSAGE_QUESTION,
2575- GTK_BUTTONS_NONE,
2576- "%s", _("Calibration is not complete"));
2577- gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
2578- "%s",
2579- _("Are you sure you want to cancel the calibration?"));
2580- /* TRANSLATORS: button text */
2581- gtk_dialog_add_button (GTK_DIALOG (dialog),
2582- _("Continue calibration"),
2583- GTK_RESPONSE_CANCEL);
2584- /* TRANSLATORS: button text */
2585- gtk_dialog_add_button (GTK_DIALOG (dialog),
2586- _("Cancel and close"),
2587- GTK_RESPONSE_CLOSE);
2588- g_signal_connect (dialog, "response",
2589- G_CALLBACK (gcm_calib_confirm_quit_cb),
2590- priv);
2591- gtk_widget_show (dialog);
2592-}
2593-
2594-/**
2595- * gcm_calib_delete_event_cb:
2596- **/
2597-static gboolean
2598-gcm_calib_delete_event_cb (GtkWidget *widget, GdkEvent *event, GcmCalibratePriv *priv)
2599-{
2600- gcm_calib_confirm_quit (priv);
2601- return FALSE;
2602-}
2603-
2604-/**
2605- * gcm_calib_assistant_cancel_cb:
2606- **/
2607-static void
2608-gcm_calib_assistant_cancel_cb (GtkAssistant *assistant, GcmCalibratePriv *priv)
2609-{
2610- gcm_calib_confirm_quit (priv);
2611-}
2612-
2613-/**
2614- * gcm_calib_assistant_close_cb:
2615- **/
2616-static void
2617-gcm_calib_assistant_close_cb (GtkAssistant *assistant, GcmCalibratePriv *priv)
2618-{
2619- g_application_release (G_APPLICATION (priv->application));
2620-}
2621-
2622-/**
2623- * gcm_calib_play_sound:
2624- **/
2625-static void
2626-gcm_calib_play_sound (GcmCalibratePriv *priv)
2627-{
2628- /* play sound from the naming spec */
2629- ca_context_play (ca_gtk_context_get (), 0,
2630- CA_PROP_EVENT_ID, "complete",
2631- /* TRANSLATORS: this is the application name for libcanberra */
2632- CA_PROP_APPLICATION_NAME, _("GNOME Color Manager"),
2633- /* TRANSLATORS: this is the sound description */
2634- CA_PROP_EVENT_DESCRIPTION, _("Profiling completed"),
2635- NULL);
2636-}
2637-
2638-
2639-/**
2640- * gcm_calib_get_vbox_for_page:
2641- **/
2642-static GtkWidget *
2643-gcm_calib_get_vbox_for_page (GcmCalibratePriv *priv,
2644- GcmCalibratePage page)
2645-{
2646- guint i;
2647- GtkWidget *tmp;
2648- GcmCalibratePage page_tmp;
2649-
2650- for (i=0; i<priv->pages->len; i++) {
2651- tmp = g_ptr_array_index (priv->pages, i);
2652- page_tmp = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (tmp),
2653- "GcmCalibrateMain::Index"));
2654- if (page_tmp == page)
2655- return tmp;
2656- }
2657- return NULL;
2658-}
2659-
2660-static wchar_t *
2661-utf8_to_wchar_t (const char *src)
2662-{
2663- gsize len;
2664- gsize converted;
2665- wchar_t *buf = NULL;
2666-
2667- len = mbstowcs (NULL, src, 0);
2668- if (len == (gsize) -1) {
2669- g_warning ("Invalid UTF-8 in string %s", src);
2670- goto out;
2671- }
2672- len += 1;
2673- buf = g_malloc (sizeof (wchar_t) * len);
2674- converted = mbstowcs (buf, src, len - 1);
2675- g_assert (converted != (gsize) -1);
2676- buf[converted] = '\0';
2677-out:
2678- return buf;
2679-}
2680-
2681-static cmsBool
2682-_cmsDictAddEntryAscii (cmsHANDLE dict,
2683- const gchar *key,
2684- const gchar *value)
2685-{
2686- cmsBool ret = FALSE;
2687- wchar_t *mb_key = NULL;
2688- wchar_t *mb_value = NULL;
2689-
2690- mb_key = utf8_to_wchar_t (key);
2691- if (mb_key == NULL)
2692- goto out;
2693- mb_value = utf8_to_wchar_t (value);
2694- if (mb_value == NULL)
2695- goto out;
2696- ret = cmsDictAddEntry (dict, mb_key, mb_value, NULL, NULL);
2697-out:
2698- g_free (mb_key);
2699- g_free (mb_value);
2700- return ret;
2701-}
2702-
2703-static gboolean
2704-gcm_calib_set_extra_metadata (GcmCalibratePriv *priv,
2705- const gchar *filename,
2706- GError **error)
2707-{
2708- cmsHANDLE dict = NULL;
2709- cmsHPROFILE lcms_profile;
2710- gboolean ret = TRUE;
2711- gchar *data = NULL;
2712- gchar *screen_brightness_str = NULL;
2713- gsize len;
2714- guint percentage;
2715- CdSensor *sensor;
2716-
2717- /* parse */
2718- ret = g_file_get_contents (filename, &data, &len, error);
2719- if (!ret)
2720- goto out;
2721- lcms_profile = cmsOpenProfileFromMem (data, len);
2722- if (lcms_profile == NULL) {
2723- g_set_error_literal (error, 1, 0,
2724- "failed to open profile");
2725- ret = FALSE;
2726- goto out;
2727- }
2728-
2729- /* just create a new dict */
2730- dict = cmsDictAlloc (NULL);
2731- _cmsDictAddEntryAscii (dict,
2732- CD_PROFILE_METADATA_CMF_PRODUCT,
2733- PACKAGE_NAME);
2734- _cmsDictAddEntryAscii (dict,
2735- CD_PROFILE_METADATA_CMF_BINARY,
2736- "gcm-calibrate");
2737- _cmsDictAddEntryAscii (dict,
2738- CD_PROFILE_METADATA_CMF_VERSION,
2739- PACKAGE_VERSION);
2740- _cmsDictAddEntryAscii (dict,
2741- CD_PROFILE_METADATA_DATA_SOURCE,
2742- CD_PROFILE_METADATA_DATA_SOURCE_CALIB);
2743- sensor = gcm_calibrate_get_sensor (priv->calibrate);
2744- if (sensor != NULL) {
2745- _cmsDictAddEntryAscii (dict,
2746- CD_PROFILE_METADATA_MEASUREMENT_DEVICE,
2747- cd_sensor_kind_to_string (cd_sensor_get_kind (sensor)));
2748- }
2749- _cmsDictAddEntryAscii (dict,
2750- CD_PROFILE_METADATA_MAPPING_DEVICE_ID,
2751- cd_device_get_id (priv->device));
2752-
2753- /* add the calibration brightness if an internal panel */
2754- percentage = gcm_calibrate_get_screen_brightness (priv->calibrate);
2755- if (percentage > 0) {
2756- screen_brightness_str = g_strdup_printf ("%i", percentage);
2757- _cmsDictAddEntryAscii (dict,
2758- CD_PROFILE_METADATA_SCREEN_BRIGHTNESS,
2759- screen_brightness_str);
2760- }
2761-
2762- /* just write dict */
2763- ret = cmsWriteTag (lcms_profile, cmsSigMetaTag, dict);
2764- if (!ret) {
2765- g_set_error_literal (error, 1, 0,
2766- "cannot write metadata");
2767- goto out;
2768- }
2769-
2770- /* write profile id */
2771- ret = cmsMD5computeID (lcms_profile);
2772- if (!ret) {
2773- g_set_error_literal (error, 1, 0,
2774- "failed to write profile id");
2775- goto out;
2776- }
2777-
2778- /* save, TODO: get error */
2779- cmsSaveProfileToFile (lcms_profile, filename);
2780- ret = TRUE;
2781-out:
2782- g_free (screen_brightness_str);
2783- g_free (data);
2784- if (dict != NULL)
2785- cmsDictFree (dict);
2786- return ret;
2787-}
2788-
2789-/**
2790- * gcm_calib_set_sensor_options_cb:
2791- **/
2792-static void
2793-gcm_calib_set_sensor_options_cb (GObject *object,
2794- GAsyncResult *res,
2795- gpointer user_data)
2796-{
2797- CdSensor *sensor = CD_SENSOR (object);
2798- gboolean ret;
2799- GError *error = NULL;
2800-
2801- /* get return value */
2802- ret = cd_sensor_set_options_finish (sensor, res, &error);
2803- if (!ret) {
2804- g_warning ("Failed to set sensor option: %s",
2805- error->message);
2806- g_error_free (error);
2807- }
2808-}
2809-
2810-static void
2811-gcm_calib_set_sensor_options (GcmCalibratePriv *priv,
2812- const gchar *filename)
2813-{
2814- CdSensor *sensor;
2815- gboolean ret;
2816- gchar *data = NULL;
2817- gchar *sha1 = NULL;
2818- GError *error = NULL;
2819- GHashTable *hash = NULL;
2820- gsize len;
2821-
2822- /* get ChSensor */
2823- sensor = gcm_calibrate_get_sensor (priv->calibrate);
2824- if (sensor == NULL)
2825- goto out;
2826-
2827- /* set the remote profile hash */
2828- hash = g_hash_table_new_full (g_str_hash,
2829- g_str_equal,
2830- g_free,
2831- (GDestroyNotify) g_variant_unref);
2832- ret = g_file_get_contents (filename, &data, &len, &error);
2833- if (!ret) {
2834- g_warning ("Failed to get SHA1 hash: %s",
2835- error->message);
2836- g_error_free (error);
2837- goto out;
2838- }
2839- sha1 = g_compute_checksum_for_data (G_CHECKSUM_SHA1,
2840- (const guchar *) data,
2841- len);
2842- g_hash_table_insert (hash,
2843- g_strdup ("remote-profile-hash"),
2844- g_variant_ref_sink (g_variant_new_string (sha1)));
2845- cd_sensor_set_options (sensor, hash, NULL,
2846- gcm_calib_set_sensor_options_cb,
2847- priv);
2848-out:
2849- g_free (data);
2850- g_free (sha1);
2851- if (hash != NULL)
2852- g_hash_table_unref (hash);
2853-}
2854-
2855-static gboolean
2856-gcm_calib_start_idle_cb (gpointer user_data)
2857-{
2858- CdProfile *profile = NULL;
2859- const gchar *filename;
2860- gboolean ret;
2861- GcmCalibratePriv *priv = (GcmCalibratePriv *) user_data;
2862- GError *error = NULL;
2863- GFile *file = NULL;
2864- gint inhibit_cookie;
2865- GtkAssistant *assistant = GTK_ASSISTANT (priv->main_window);
2866- GtkWidget *vbox;
2867-
2868- /* inhibit */
2869- inhibit_cookie = gtk_application_inhibit (priv->application,
2870- priv->main_window,
2871- GTK_APPLICATION_INHIBIT_LOGOUT |
2872- GTK_APPLICATION_INHIBIT_SWITCH |
2873- GTK_APPLICATION_INHIBIT_SUSPEND |
2874- GTK_APPLICATION_INHIBIT_IDLE,
2875- "Calibration in progress");
2876-
2877- /* actually do the action */
2878- priv->started_calibration = TRUE;
2879- ret = gcm_calibrate_device (priv->calibrate,
2880- priv->device,
2881- priv->main_window,
2882- &error);
2883- if (!ret) {
2884- gcm_calibrate_set_title (priv->calibrate,
2885- _("Failed to calibrate"),
2886- GCM_CALIBRATE_UI_ERROR);
2887- gcm_calibrate_set_message (priv->calibrate,
2888- error->message,
2889- GCM_CALIBRATE_UI_ERROR);
2890- gcm_calibrate_set_image (priv->calibrate, NULL);
2891-
2892- g_warning ("failed to calibrate: %s",
2893- error->message);
2894- g_error_free (error);
2895-
2896- /* mark this box as the end */
2897- vbox = gcm_calib_get_vbox_for_page (priv, GCM_CALIBRATE_PAGE_ACTION);
2898- gtk_assistant_set_page_type (assistant, vbox, GTK_ASSISTANT_PAGE_SUMMARY);
2899- gtk_assistant_set_page_complete (assistant, vbox, TRUE);
2900- goto out;
2901- }
2902-
2903- /* get profile */
2904- filename = gcm_calibrate_get_filename_result (priv->calibrate);
2905- if (filename == NULL) {
2906- g_warning ("failed to get filename from calibration");
2907- goto out;
2908- }
2909-
2910- /* set some private properties */
2911- ret = gcm_calib_set_extra_metadata (priv, filename, &error);
2912- if (!ret) {
2913- g_warning ("failed to set extra metadata: %s",
2914- error->message);
2915- g_error_free (error);
2916- goto out;
2917- }
2918-
2919- /* inform the sensor about the last successful profile */
2920- gcm_calib_set_sensor_options (priv, filename);
2921-
2922- /* copy the ICC file to the proper location */
2923- file = g_file_new_for_path (filename);
2924- profile = cd_client_import_profile_sync (priv->client,
2925- file,
2926- priv->cancellable,
2927- &error);
2928- if (profile == NULL) {
2929- g_warning ("failed to find calibration profile: %s",
2930- error->message);
2931- g_error_free (error);
2932- goto out;
2933- }
2934- ret = cd_device_add_profile_sync (priv->device,
2935- CD_DEVICE_RELATION_HARD,
2936- profile,
2937- priv->cancellable,
2938- &error);
2939- if (!ret) {
2940- g_warning ("failed to add %s to %s: %s",
2941- cd_profile_get_object_path (profile),
2942- cd_device_get_object_path (priv->device),
2943- error->message);
2944- g_error_free (error);
2945- goto out;
2946- }
2947-
2948- /* remove temporary file */
2949- g_unlink (filename);
2950-
2951- /* allow forward */
2952- vbox = gcm_calib_get_vbox_for_page (priv,
2953- GCM_CALIBRATE_PAGE_ACTION);
2954- gtk_assistant_set_page_complete (assistant,
2955- vbox, TRUE);
2956-
2957- /* set to summary page */
2958- gtk_assistant_set_current_page (assistant,
2959- gtk_assistant_get_n_pages (assistant) - 1);
2960-out:
2961- if (inhibit_cookie != 0) {
2962- gtk_application_uninhibit (priv->application,
2963- priv->inhibit_cookie);
2964- }
2965- if (profile != NULL)
2966- g_object_unref (profile);
2967- if (file != NULL)
2968- g_object_unref (file);
2969- return FALSE;
2970-}
2971-
2972-static gint
2973-gcm_calib_assistant_page_forward_cb (gint current_page, gpointer user_data)
2974-{
2975- GtkWidget *vbox;
2976- GcmCalibratePriv *priv = (GcmCalibratePriv *) user_data;
2977-
2978- /* shouldn't happen... */
2979- if (priv->current_page != GCM_CALIBRATE_PAGE_ACTION)
2980- return current_page + 1;
2981-
2982- if (!priv->has_pending_interaction)
2983- return current_page;
2984-
2985- /* continue calibration */
2986- gcm_calibrate_interaction (priv->calibrate, GTK_RESPONSE_OK);
2987- priv->has_pending_interaction = FALSE;
2988-
2989- /* no longer allow forward */
2990- vbox = gcm_calib_get_vbox_for_page (priv,
2991- GCM_CALIBRATE_PAGE_ACTION);
2992-
2993- gtk_assistant_set_page_complete (GTK_ASSISTANT (priv->main_window),
2994- vbox, FALSE);
2995- return current_page;
2996-}
2997-
2998-/**
2999- * gcm_calib_assistant_prepare_cb:
3000- **/
3001-static gboolean
3002-gcm_calib_assistant_prepare_cb (GtkAssistant *assistant,
3003- GtkWidget *page_widget,
3004- GcmCalibratePriv *priv)
3005-{
3006- priv->current_page = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (page_widget),
3007- "GcmCalibrateMain::Index"));
3008- switch (priv->current_page) {
3009- case GCM_CALIBRATE_PAGE_LAST:
3010- gcm_calib_play_sound (priv);
3011- break;
3012- case GCM_CALIBRATE_PAGE_ACTION:
3013- g_debug ("lights! camera! action!");
3014- if (!priv->started_calibration)
3015- g_idle_add (gcm_calib_start_idle_cb, priv);
3016- break;
3017- default:
3018- break;
3019- }
3020-
3021- /* ensure we cancel argyllcms if the user clicks back */
3022- if (priv->current_page != GCM_CALIBRATE_PAGE_ACTION &&
3023- priv->started_calibration) {
3024- gcm_calibrate_interaction (priv->calibrate,
3025- GTK_RESPONSE_CANCEL);
3026- priv->started_calibration = FALSE;
3027- }
3028-
3029- /* forward on the action page just unsticks the calibration */
3030- if (priv->current_page == GCM_CALIBRATE_PAGE_ACTION) {
3031- gtk_assistant_set_forward_page_func (assistant,
3032- gcm_calib_assistant_page_forward_cb,
3033- priv,
3034- NULL);
3035- } else {
3036- gtk_assistant_set_forward_page_func (assistant,
3037- NULL, NULL, NULL);
3038- }
3039-
3040- /* use the default on each page */
3041- switch (priv->current_page) {
3042- case GCM_CALIBRATE_PAGE_INSTALL_ARGYLLCMS:
3043- case GCM_CALIBRATE_PAGE_SENSOR:
3044- case GCM_CALIBRATE_PAGE_ACTION:
3045- break;
3046- default:
3047- gtk_assistant_set_page_complete (assistant, page_widget, TRUE);
3048- break;
3049- }
3050- return FALSE;
3051-}
3052-
3053-/**
3054- * gcm_calib_add_page_title:
3055- **/
3056-static GtkWidget *
3057-gcm_calib_add_page_title (GcmCalibratePriv *priv, const gchar *text)
3058-{
3059- GtkWidget *label;
3060- GtkWidget *hbox;
3061- GtkWidget *vbox;
3062- gchar *markup;
3063-
3064- markup = g_strdup_printf ("<span size=\"large\" font_weight=\"bold\">%s</span>", text);
3065- label = gtk_label_new (NULL);
3066- gtk_label_set_markup (GTK_LABEL (label), markup);
3067-
3068- /* make left aligned */
3069- hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
3070- gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, TRUE, 0);
3071-
3072- /* header */
3073- vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 20);
3074- gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
3075-
3076- g_free (markup);
3077- return vbox;
3078-}
3079-
3080-static gboolean
3081-gcm_calib_label_activate_link_cb (GtkLabel *label,
3082- gchar *uri,
3083- GcmCalibratePriv *priv)
3084-{
3085- gboolean ret;
3086- GError *error = NULL;
3087- ret = g_spawn_command_line_async (BINDIR "/gnome-control-center color", &error);
3088- if (!ret) {
3089- g_warning ("failed to launch the control center: %s",
3090- error->message);
3091- g_error_free (error);
3092- }
3093- return ret;
3094-}
3095-
3096-/**
3097- * gcm_calib_add_page_para:
3098- **/
3099-static GtkWidget *
3100-gcm_calib_add_page_para (GtkWidget *vbox, const gchar *text)
3101-{
3102- GtkWidget *label;
3103- GtkWidget *hbox;
3104-
3105- label = gtk_label_new (NULL);
3106- g_signal_connect (label, "activate-link",
3107- G_CALLBACK (gcm_calib_label_activate_link_cb),
3108- NULL);
3109- gtk_label_set_markup (GTK_LABEL (label), text);
3110- gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
3111- gtk_label_set_width_chars (GTK_LABEL (label), 40);
3112- gtk_misc_set_alignment (GTK_MISC (label), 0.0f, 0.0f);
3113-
3114- /* make left aligned */
3115- hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
3116- gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, TRUE, 0);
3117- gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
3118- return label;
3119-}
3120-
3121-/**
3122- * gcm_calib_add_page_bullet:
3123- **/
3124-static void
3125-gcm_calib_add_page_bullet (GtkWidget *vbox, const gchar *text)
3126-{
3127- gchar *markup;
3128- markup = g_strdup_printf ("• %s", text);
3129- gcm_calib_add_page_para (vbox, markup);
3130- g_free (markup);
3131-}
3132-
3133-/**
3134- * gcm_calib_setup_page_intro:
3135- **/
3136-static void
3137-gcm_calib_setup_page_intro (GcmCalibratePriv *priv)
3138-{
3139- GtkWidget *vbox;
3140- GtkWidget *content;
3141- GtkAssistant *assistant = GTK_ASSISTANT (priv->main_window);
3142-
3143- /* TRANSLATORS: this is intro page text */
3144- switch (priv->device_kind) {
3145- case CD_DEVICE_KIND_CAMERA:
3146- case CD_DEVICE_KIND_WEBCAM:
3147- /* TRANSLATORS: this is the page title */
3148- vbox = gcm_calib_add_page_title (priv, _("Calibrate your camera"));
3149- break;
3150- case CD_DEVICE_KIND_DISPLAY:
3151- /* TRANSLATORS: this is the page title */
3152- vbox = gcm_calib_add_page_title (priv, _("Calibrate your display"));
3153- break;
3154- case CD_DEVICE_KIND_PRINTER:
3155- /* TRANSLATORS: this is the page title */
3156- vbox = gcm_calib_add_page_title (priv, _("Calibrate your printer"));
3157- break;
3158- default:
3159- /* TRANSLATORS: this is the page title */
3160- vbox = gcm_calib_add_page_title (priv, _("Calibrate your device"));
3161- break;
3162- }
3163-
3164- /* main contents */
3165- content = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
3166- gtk_box_pack_start (GTK_BOX (vbox), content, FALSE, FALSE, 0);
3167-
3168- /* TRANSLATORS: this is intro page text */
3169- switch (priv->device_kind) {
3170- case CD_DEVICE_KIND_DISPLAY:
3171- /* TRANSLATORS: this is the final intro page text */
3172- gcm_calib_add_page_para (content, _("Any existing screen correction will be temporarily turned off and the brightness set to maximum."));
3173- break;
3174- default:
3175- break;
3176- }
3177-
3178- /* TRANSLATORS: this is the final intro page text */
3179- gcm_calib_add_page_para (content, _("You can cancel this process at any stage by pressing the cancel button."));
3180-
3181- /* add to assistant */
3182- gtk_assistant_append_page (assistant, vbox);
3183- gtk_assistant_set_page_type (assistant, vbox, GTK_ASSISTANT_PAGE_INTRO);
3184- /* TRANSLATORS: this is the calibration wizard page title */
3185- gtk_assistant_set_page_title (assistant, vbox, _("Introduction"));
3186- gtk_assistant_set_page_complete (assistant, vbox, FALSE);
3187- g_ptr_array_add (priv->pages, vbox);
3188- g_object_set_data (G_OBJECT (vbox),
3189- "GcmCalibrateMain::Index",
3190- GUINT_TO_POINTER (GCM_CALIBRATE_PAGE_INTRO));
3191-
3192- /* show page */
3193- gtk_widget_show_all (vbox);
3194-}
3195-
3196-/**
3197- * gcm_calibrate_is_livecd:
3198- **/
3199-static gboolean
3200-gcm_calibrate_is_livecd (void)
3201-{
3202-#ifdef __linux__
3203- gboolean ret;
3204- gchar *data = NULL;
3205- GError *error = NULL;
3206-
3207- /* get the kernel commandline */
3208- ret = g_file_get_contents ("/proc/cmdline", &data, NULL, &error);
3209- if (!ret) {
3210- g_warning ("failed to get kernel command line: %s",
3211- error->message);
3212- g_error_free (error);
3213- goto out;
3214- }
3215- ret = (g_strstr_len (data, -1, "liveimg") != NULL ||
3216- g_strstr_len (data, -1, "casper") != NULL);
3217-out:
3218- g_free (data);
3219- return ret;
3220-#else
3221- return FALSE;
3222-#endif
3223-}
3224-
3225-/**
3226- * gcm_calib_show_profile_button_clicked_cb:
3227- **/
3228-static void
3229-gcm_calib_show_profile_button_clicked_cb (GtkButton *button,
3230- GcmCalibratePriv *priv)
3231-{
3232- gboolean ret;
3233- gchar *command_line;
3234- GError *error = NULL;
3235-
3236- /* just hardcode nautilus to open the folder */
3237- command_line = g_strdup_printf ("nautilus %s/%s",
3238- g_get_user_data_dir (),
3239- "icc");
3240- ret = g_spawn_command_line_async (command_line, &error);
3241- if (!ret) {
3242- g_warning ("failed to show profile: %s", error->message);
3243- g_error_free (error);
3244- goto out;
3245- }
3246-out:
3247- g_free (command_line);
3248-}
3249-
3250-/**
3251- * gcm_calib_get_show_profile_button:
3252- **/
3253-static GtkWidget *
3254-gcm_calib_get_show_profile_button (GcmCalibratePriv *priv)
3255-{
3256- GtkStyleContext *context;
3257- GtkWidget *button;
3258- GtkWidget *image;
3259- GtkWidget *label;
3260- GtkWidget *vbox;
3261-
3262- /* add button to show profile */
3263- button = gtk_button_new ();
3264- vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
3265- image = gtk_image_new_from_icon_name ("folder-publicshare-symbolic",
3266- GTK_ICON_SIZE_DIALOG);
3267-
3268- /* make image have a gray foreground */
3269- context = gtk_widget_get_style_context (image);
3270- gtk_style_context_add_class (context, GTK_STYLE_CLASS_IMAGE);
3271-
3272- gtk_box_pack_start (GTK_BOX (vbox), image, FALSE, FALSE, 0);
3273- label = gtk_label_new (_("Show File"));
3274- gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
3275- gtk_container_add (GTK_CONTAINER (button), vbox);
3276- gtk_widget_set_tooltip_text (button, _("Click here to show the profile"));
3277- g_signal_connect (button, "clicked",
3278- G_CALLBACK (gcm_calib_show_profile_button_clicked_cb),
3279- priv);
3280- gtk_container_set_border_width (GTK_CONTAINER (vbox), 15);
3281- gtk_widget_set_halign (button, GTK_ALIGN_CENTER);
3282- gtk_widget_show_all (button);
3283- return button;
3284-}
3285-
3286-/**
3287- * gcm_calib_setup_page_summary:
3288- **/
3289-static void
3290-gcm_calib_setup_page_summary (GcmCalibratePriv *priv)
3291-{
3292- gboolean ret;
3293- GtkWidget *vbox;
3294- GtkWidget *content;
3295- GtkWidget *image;
3296- GtkAssistant *assistant = GTK_ASSISTANT (priv->main_window);
3297-
3298- /* TRANSLATORS: this is the page title */
3299- vbox = gcm_calib_add_page_title (priv, _("All done!"));
3300-
3301- /* main contents */
3302- content = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
3303- gtk_box_pack_start (GTK_BOX (vbox), content, FALSE, FALSE, 0);
3304-
3305- switch (priv->device_kind) {
3306- case CD_DEVICE_KIND_CAMERA:
3307- case CD_DEVICE_KIND_WEBCAM:
3308- /* TRANSLATORS: this is the final summary */
3309- gcm_calib_add_page_para (content, _("The camera has been calibrated successfully."));
3310- break;
3311- case CD_DEVICE_KIND_DISPLAY:
3312- /* TRANSLATORS: this is the final summary */
3313- gcm_calib_add_page_para (content, _("The display has been calibrated successfully."));
3314- break;
3315- case CD_DEVICE_KIND_PRINTER:
3316- /* TRANSLATORS: this is the final summary */
3317- gcm_calib_add_page_para (content, _("The printer has been calibrated successfully."));
3318- break;
3319- default:
3320- /* TRANSLATORS: this is the final summary */
3321- gcm_calib_add_page_para (content, _("The device has been calibrated successfully."));
3322- break;
3323- }
3324-
3325- /* only display the backlink if not launched from the control center itself */
3326- if (priv->xid == 0) {
3327- /* TRANSLATORS: this is the final summary */
3328- gcm_calib_add_page_para (content, _("To view details about the new profile or to undo the calibration visit the <a href=\"control-center://color\">control center</a>."));
3329- }
3330-
3331- /* show the user the profile to copy off the live system */
3332- ret = gcm_calibrate_is_livecd ();
3333- if (ret) {
3334- /* show button to copy profile */
3335- image = gcm_calib_get_show_profile_button (priv);
3336- gtk_box_pack_start (GTK_BOX (content), image, FALSE, FALSE, 30);
3337- gcm_calib_add_page_para (content, _("You can use the profile with <a href=\"import-linux\">Linux</a>, <a href=\"import-osx\">Apple OS X</a> and <a href=\"import-windows\">Microsoft Windows</a> systems."));
3338- } else {
3339- /* add image for success */
3340- image = gtk_image_new ();
3341- gtk_image_set_from_icon_name (GTK_IMAGE (image), "face-smile", GTK_ICON_SIZE_DIALOG);
3342- gtk_box_pack_start (GTK_BOX (content), image, FALSE, FALSE, 0);
3343- }
3344-
3345- /* add to assistant */
3346- gtk_assistant_append_page (assistant, vbox);
3347- gtk_assistant_set_page_type (assistant, vbox, GTK_ASSISTANT_PAGE_SUMMARY);
3348- /* TRANSLATORS: this is the calibration wizard page title */
3349- gtk_assistant_set_page_title (assistant, vbox, _("Summary"));
3350- gtk_assistant_set_page_complete (assistant, vbox, FALSE);
3351- g_ptr_array_add (priv->pages, vbox);
3352- g_object_set_data (G_OBJECT (vbox),
3353- "GcmCalibrateMain::Index",
3354- GUINT_TO_POINTER (GCM_CALIBRATE_PAGE_LAST));
3355-
3356- /* show page */
3357- gtk_widget_show_all (vbox);
3358-}
3359-
3360-/**
3361- * gcm_calib_setup_page_action:
3362- **/
3363-static void
3364-gcm_calib_setup_page_action (GcmCalibratePriv *priv)
3365-{
3366- GtkWidget *vbox;
3367- GtkWidget *content;
3368- GList *list;
3369- GList *list2;
3370- GtkAssistant *assistant = GTK_ASSISTANT (priv->main_window);
3371-
3372- /* TRANSLATORS: this is the page title */
3373- vbox = gcm_calib_add_page_title (priv, _("Performing calibration"));
3374-
3375- /* grab title */
3376- list = gtk_container_get_children (GTK_CONTAINER (vbox));
3377- list2 = gtk_container_get_children (GTK_CONTAINER (list->data));
3378- priv->action_title = list2->data;
3379- g_list_free (list);
3380- g_list_free (list2);
3381-
3382- /* main contents */
3383- content = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
3384- gtk_box_pack_start (GTK_BOX (vbox), content, FALSE, FALSE, 0);
3385-
3386- priv->action_message = gcm_calib_add_page_para (content, _("Calibration is about to start"));
3387-
3388- /* add image for success */
3389- priv->action_image = gtk_image_new ();
3390- gtk_image_set_from_icon_name (GTK_IMAGE (priv->action_image), "face-frown", GTK_ICON_SIZE_DIALOG);
3391- gtk_box_pack_start (GTK_BOX (content), priv->action_image, FALSE, FALSE, 0);
3392-
3393- /* add progress marker */
3394- priv->action_progress = gtk_progress_bar_new ();
3395- gtk_box_pack_start (GTK_BOX (content), priv->action_progress, FALSE, FALSE, 0);
3396-
3397- /* add content widget */
3398- gcm_calibrate_set_content_widget (priv->calibrate, vbox);
3399-
3400- /* add to assistant */
3401- gtk_assistant_append_page (assistant, vbox);
3402- gtk_assistant_set_page_type (assistant, vbox, GTK_ASSISTANT_PAGE_CONTENT);
3403- /* TRANSLATORS: this is the calibration wizard page title */
3404- gtk_assistant_set_page_title (assistant, vbox, _("Action"));
3405- gtk_assistant_set_page_complete (assistant, vbox, FALSE);
3406- g_ptr_array_add (priv->pages, vbox);
3407- g_object_set_data (G_OBJECT (vbox),
3408- "GcmCalibrateMain::Index",
3409- GUINT_TO_POINTER (GCM_CALIBRATE_PAGE_ACTION));
3410-
3411- /* show page */
3412- gtk_widget_show_all (vbox);
3413- gtk_widget_hide (priv->action_image);
3414-}
3415-
3416-/**
3417- * gcm_calib_setup_page_display_configure_wait:
3418- **/
3419-static void
3420-gcm_calib_setup_page_display_configure_wait (GcmCalibratePriv *priv)
3421-{
3422- GtkWidget *vbox;
3423- GtkWidget *content;
3424- GtkAssistant *assistant = GTK_ASSISTANT (priv->main_window);
3425-
3426- /* TRANSLATORS: dialog message, preface */
3427- vbox = gcm_calib_add_page_title (priv, _("Calibration checklist"));
3428-
3429- /* main contents */
3430- content = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
3431- gtk_box_pack_start (GTK_BOX (vbox), content, FALSE, FALSE, 0);
3432-
3433- /* TRANSLATORS: this is intro page text */
3434- gcm_calib_add_page_para (content, _("Before calibrating the display, it is recommended to configure your display with the following settings to get optimal results."));
3435-
3436- /* TRANSLATORS: dialog message, preface */
3437-if(0) gcm_calib_add_page_para (content, _("You may want to consult the owner's manual for your display on how to achieve these settings."));
3438-
3439- /* TRANSLATORS: dialog message, bullet item */
3440-if(0) gcm_calib_add_page_bullet (content, _("Reset your display to the factory defaults."));
3441-
3442- /* TRANSLATORS: dialog message, bullet item */
3443-if(0) gcm_calib_add_page_bullet (content, _("Disable dynamic contrast if your display has this feature."));
3444-
3445- /* TRANSLATORS: dialog message, bullet item */
3446-if(0) gcm_calib_add_page_bullet (content, _("Configure your display with custom color settings and ensure the RGB channels are set to the same values."));
3447-
3448- /* TRANSLATORS: dialog message, addition to bullet item */
3449-if(0) gcm_calib_add_page_para (content, _("If custom color is not available then use a 6500K color temperature."));
3450-
3451- /* TRANSLATORS: dialog message, bullet item */
3452-if(0) gcm_calib_add_page_bullet (content, _("Adjust the display brightness to a comfortable level for prolonged viewing."));
3453-
3454- gcm_calib_add_page_para (content, "");
3455-
3456- /* TRANSLATORS: dialog message, suffix */
3457- gcm_calib_add_page_para (content, _("For best results, the display should have been powered for at least 15 minutes before starting the calibration."));
3458-
3459- /* add to assistant */
3460- gtk_assistant_append_page (assistant, vbox);
3461- gtk_assistant_set_page_type (assistant, vbox, GTK_ASSISTANT_PAGE_CONTENT);
3462- /* TRANSLATORS: this is the calibration wizard page title */
3463- gtk_assistant_set_page_title (assistant, vbox, _("Check Settings"));
3464- gtk_assistant_set_page_complete (assistant, vbox, FALSE);
3465- g_ptr_array_add (priv->pages, vbox);
3466- g_object_set_data (G_OBJECT (vbox),
3467- "GcmCalibrateMain::Index",
3468- GUINT_TO_POINTER (GCM_CALIBRATE_PAGE_DISPLAY_CONFIG));
3469-
3470- /* show page */
3471- gtk_widget_show_all (vbox);
3472-}
3473-
3474-/**
3475- * gcm_calib_button_clicked_install_argyllcms_cb:
3476- **/
3477-static void
3478-gcm_calib_button_clicked_install_argyllcms_cb (GtkButton *button, GcmCalibratePriv *priv)
3479-{
3480- gboolean ret;
3481- GtkWidget *vbox;
3482- GtkAssistant *assistant = GTK_ASSISTANT (priv->main_window);
3483-
3484- ret = gcm_utils_install_package (GCM_PREFS_PACKAGE_NAME_ARGYLLCMS,
3485- priv->main_window);
3486- /* we can continue now */
3487- if (TRUE || ret) {
3488- vbox = gcm_calib_get_vbox_for_page (priv,
3489- GCM_CALIBRATE_PAGE_INSTALL_ARGYLLCMS);
3490- gtk_assistant_set_page_complete (assistant, vbox, TRUE);
3491- gtk_assistant_next_page (assistant);
3492-
3493- /* we ddn't need to re-install now */
3494- gtk_widget_hide (vbox);
3495- }
3496-}
3497-
3498-/**
3499- * gcm_calib_setup_page_install_argyllcms:
3500- **/
3501-static void
3502-gcm_calib_setup_page_install_argyllcms (GcmCalibratePriv *priv)
3503-{
3504- GtkWidget *vbox;
3505- GtkWidget *content;
3506- GtkWidget *button;
3507- GString *string;
3508- GtkAssistant *assistant = GTK_ASSISTANT (priv->main_window);
3509-
3510- string = g_string_new ("");
3511-
3512- /* TRANSLATORS: dialog message saying the argyllcms is not installed */
3513- g_string_append_printf (string, "%s\n",
3514- _("Calibration and profiling software is not installed."));
3515- /* TRANSLATORS: dialog message saying the color targets are not installed */
3516- g_string_append_printf (string, "%s",
3517- _("These tools are required to build color profiles for devices."));
3518-
3519- /* TRANSLATORS: this is the page title */
3520- vbox = gcm_calib_add_page_title (priv, _("More software is required!"));
3521-
3522- /* main contents */
3523- content = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
3524- gtk_box_pack_start (GTK_BOX (vbox), content, FALSE, FALSE, 0);
3525-
3526- /* TRANSLATORS: this is intro page text */
3527- gcm_calib_add_page_para (content, string->str);
3528-
3529- button = gtk_button_new_with_label (_("Install required software"));
3530- g_signal_connect (button, "clicked",
3531- G_CALLBACK (gcm_calib_button_clicked_install_argyllcms_cb),
3532- priv);
3533- gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
3534-
3535- /* add to assistant */
3536- gtk_assistant_append_page (assistant, vbox);
3537- gtk_assistant_set_page_type (assistant, vbox, GTK_ASSISTANT_PAGE_CONTENT);
3538- /* TRANSLATORS: this is the calibration wizard page title */
3539- gtk_assistant_set_page_title (assistant, vbox, _("Install Tools"));
3540- gtk_assistant_set_page_complete (assistant, vbox, FALSE);
3541- g_ptr_array_add (priv->pages, vbox);
3542- g_object_set_data (G_OBJECT (vbox),
3543- "GcmCalibrateMain::Index",
3544- GUINT_TO_POINTER (GCM_CALIBRATE_PAGE_INSTALL_ARGYLLCMS));
3545- g_string_free (string, TRUE);
3546-
3547- /* show page */
3548- gtk_widget_show_all (vbox);
3549-}
3550-
3551-/**
3552- * gcm_calib_button_clicked_install_targets_cb:
3553- **/
3554-static void
3555-gcm_calib_button_clicked_install_targets_cb (GtkButton *button, GcmCalibratePriv *priv)
3556-{
3557- gboolean ret;
3558- GtkWidget *vbox;
3559- GtkAssistant *assistant = GTK_ASSISTANT (priv->main_window);
3560-
3561- ret = gcm_utils_install_package (GCM_PREFS_PACKAGE_NAME_SHARED_COLOR_TARGETS,
3562- priv->main_window);
3563- /* we can continue now */
3564- if (ret) {
3565- vbox = gcm_calib_get_vbox_for_page (priv,
3566- GCM_CALIBRATE_PAGE_INSTALL_TARGETS);
3567- gtk_assistant_next_page (assistant);
3568-
3569- /* we ddn't need to re-install now */
3570- gtk_widget_hide (vbox);
3571- }
3572-}
3573-
3574-/**
3575- * gcm_calib_setup_page_install_targets:
3576- **/
3577-static void
3578-gcm_calib_setup_page_install_targets (GcmCalibratePriv *priv)
3579-{
3580- GtkWidget *vbox;
3581- GtkWidget *content;
3582- GtkWidget *button;
3583- GString *string;
3584- GtkAssistant *assistant = GTK_ASSISTANT (priv->main_window);
3585-
3586- string = g_string_new ("");
3587-
3588- /* TRANSLATORS: dialog message saying the color targets are not installed */
3589- g_string_append_printf (string, "%s\n", _("Common color target files are not installed on this computer."));
3590- /* TRANSLATORS: dialog message saying the color targets are not installed */
3591- g_string_append_printf (string, "%s\n\n", _("Color target files are needed to convert the image to a color profile."));
3592- /* TRANSLATORS: dialog message, asking if it's okay to install them */
3593- g_string_append_printf (string, "%s\n\n", _("Do you want them to be installed?"));
3594- /* TRANSLATORS: dialog message, if the user has the target file on a CDROM then there's no need for this package */
3595- g_string_append_printf (string, "%s", _("If you already have the correct file, you can skip this step."));
3596-
3597- /* TRANSLATORS: this is the page title */
3598- vbox = gcm_calib_add_page_title (priv, _("Optional data files available"));
3599-
3600- /* main contents */
3601- content = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
3602- gtk_box_pack_start (GTK_BOX (vbox), content, FALSE, FALSE, 0);
3603-
3604- /* TRANSLATORS: this is intro page text */
3605- gcm_calib_add_page_para (content, string->str);
3606-
3607- button = gtk_button_new_with_label (_("Install Now"));
3608- g_signal_connect (button, "clicked",
3609- G_CALLBACK (gcm_calib_button_clicked_install_targets_cb),
3610- priv);
3611- gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
3612-
3613- /* add to assistant */
3614- gtk_assistant_append_page (assistant, vbox);
3615- gtk_assistant_set_page_type (assistant, vbox, GTK_ASSISTANT_PAGE_CONTENT);
3616- gtk_assistant_set_page_complete (assistant, vbox, FALSE);
3617- /* TRANSLATORS: this is the calibration wizard page title */
3618- gtk_assistant_set_page_title (assistant, vbox, _("Install Targets"));
3619- g_ptr_array_add (priv->pages, vbox);
3620- g_object_set_data (G_OBJECT (vbox),
3621- "GcmCalibrateMain::Index",
3622- GUINT_TO_POINTER (GCM_CALIBRATE_PAGE_INSTALL_TARGETS));
3623- g_string_free (string, TRUE);
3624-
3625- /* show page */
3626- gtk_widget_show_all (vbox);
3627-}
3628-
3629-
3630-/**
3631- * gcm_calib_reference_kind_to_localised_string:
3632- **/
3633-static const gchar *
3634-gcm_calib_reference_kind_to_localised_string (GcmCalibrateReferenceKind kind)
3635-{
3636- if (kind == GCM_CALIBRATE_REFERENCE_KIND_CMP_DIGITAL_TARGET_3) {
3637- /* TRANSLATORS: this is probably a brand name */
3638- return _("CMP Digital Target 3");
3639- }
3640- if (kind == GCM_CALIBRATE_REFERENCE_KIND_CMP_DT_003) {
3641- /* TRANSLATORS: this is probably a brand name */
3642- return _("CMP DT 003");
3643- }
3644- if (kind == GCM_CALIBRATE_REFERENCE_KIND_COLOR_CHECKER) {
3645- /* TRANSLATORS: this is probably a brand name */
3646- return _("Color Checker");
3647- }
3648- if (kind == GCM_CALIBRATE_REFERENCE_KIND_COLOR_CHECKER_DC) {
3649- /* TRANSLATORS: this is probably a brand name */
3650- return _("Color Checker DC");
3651- }
3652- if (kind == GCM_CALIBRATE_REFERENCE_KIND_COLOR_CHECKER_SG) {
3653- /* TRANSLATORS: this is probably a brand name */
3654- return _("Color Checker SG");
3655- }
3656- if (kind == GCM_CALIBRATE_REFERENCE_KIND_HUTCHCOLOR) {
3657- /* TRANSLATORS: this is probably a brand name */
3658- return _("Hutchcolor");
3659- }
3660- if (kind == GCM_CALIBRATE_REFERENCE_KIND_I1_RGB_SCAN_1_4) {
3661- /* TRANSLATORS: this is probably a brand name */
3662- return _("i1 RGB Scan 1.4");
3663- }
3664- if (kind == GCM_CALIBRATE_REFERENCE_KIND_IT8) {
3665- /* TRANSLATORS: this is probably a brand name */
3666- return _("IT8.7/2");
3667- }
3668- if (kind == GCM_CALIBRATE_REFERENCE_KIND_LASER_SOFT_DC_PRO) {
3669- /* TRANSLATORS: this is probably a brand name */
3670- return _("Laser Soft DC Pro");
3671- }
3672- if (kind == GCM_CALIBRATE_REFERENCE_KIND_QPCARD_201) {
3673- /* TRANSLATORS: this is probably a brand name */
3674- return _("QPcard 201");
3675- }
3676- return NULL;
3677-}
3678-
3679-/**
3680- * gcm_calib_reference_kind_to_image_filename:
3681- **/
3682-static const gchar *
3683-gcm_calib_reference_kind_to_image_filename (GcmCalibrateReferenceKind kind)
3684-{
3685- if (kind == GCM_CALIBRATE_REFERENCE_KIND_CMP_DIGITAL_TARGET_3)
3686- return "CMP-DigitalTarget3.png";
3687- if (kind == GCM_CALIBRATE_REFERENCE_KIND_CMP_DT_003)
3688- return "CMP_DT_003.png";
3689- if (kind == GCM_CALIBRATE_REFERENCE_KIND_COLOR_CHECKER)
3690- return "ColorChecker24.png";
3691- if (kind == GCM_CALIBRATE_REFERENCE_KIND_COLOR_CHECKER_DC)
3692- return "ColorCheckerDC.png";
3693- if (kind == GCM_CALIBRATE_REFERENCE_KIND_COLOR_CHECKER_SG)
3694- return "ColorCheckerSG.png";
3695- if (kind == GCM_CALIBRATE_REFERENCE_KIND_HUTCHCOLOR)
3696- return NULL;
3697- if (kind == GCM_CALIBRATE_REFERENCE_KIND_I1_RGB_SCAN_1_4)
3698- return "i1_RGB_Scan_14.png";
3699- if (kind == GCM_CALIBRATE_REFERENCE_KIND_IT8)
3700- return "IT872.png";
3701- if (kind == GCM_CALIBRATE_REFERENCE_KIND_LASER_SOFT_DC_PRO)
3702- return "LaserSoftDCPro.png";
3703- if (kind == GCM_CALIBRATE_REFERENCE_KIND_QPCARD_201)
3704- return "QPcard_201.png";
3705- return NULL;
3706-}
3707-
3708-/**
3709- * gcm_calib_reference_kind_combobox_cb:
3710- **/
3711-static void
3712-gcm_calib_reference_kind_combobox_cb (GtkComboBox *combo_box,
3713- GcmCalibratePriv *priv)
3714-{
3715- const gchar *filename;
3716- gchar *path;
3717- GcmCalibrateReferenceKind reference_kind;
3718-
3719- /* not sorted so we can just use the index */
3720- reference_kind = gtk_combo_box_get_active (GTK_COMBO_BOX (combo_box));
3721- g_object_set (priv->calibrate,
3722- "reference-kind", reference_kind,
3723- NULL);
3724- filename = gcm_calib_reference_kind_to_image_filename (reference_kind);
3725-
3726- /* fallback */
3727- if (filename == NULL)
3728- filename = "unknown.png";
3729-
3730- path = g_build_filename (GCM_DATA, "targets", filename, NULL);
3731- gtk_image_set_from_file (GTK_IMAGE (priv->reference_preview), path);
3732- g_free (path);
3733-}
3734-
3735-/**
3736- * gcm_calib_setup_page_target_kind:
3737- **/
3738-static void
3739-gcm_calib_setup_page_target_kind (GcmCalibratePriv *priv)
3740-{
3741- GtkWidget *vbox;
3742- GtkWidget *content;
3743- GtkWidget *combo;
3744- GString *string;
3745- guint i;
3746- GtkAssistant *assistant = GTK_ASSISTANT (priv->main_window);
3747-
3748- string = g_string_new ("");
3749-
3750- /* TRANSLATORS: dialog message, preface. A calibration target looks like
3751- * this: http://www.colorreference.de/targets/target.jpg */
3752- g_string_append_printf (string, "%s\n", _("Before profiling the device, you have to manually capture an image of a calibration target and save it as a TIFF image file."));
3753-
3754- /* scanner specific options */
3755- if (priv->device_kind == CD_DEVICE_KIND_SCANNER) {
3756- /* TRANSLATORS: dialog message, preface */
3757- g_string_append_printf (string, "%s\n", _("Ensure that the contrast and brightness are not changed and color correction profiles have not been applied."));
3758-
3759- /* TRANSLATORS: dialog message, suffix */
3760- g_string_append_printf (string, "%s\n", _("The device sensor should have been cleaned prior to scanning and the output file resolution should be at least 200dpi."));
3761- }
3762-
3763- /* camera specific options */
3764- if (priv->device_kind == CD_DEVICE_KIND_CAMERA) {
3765- /* TRANSLATORS: dialog message, preface */
3766- g_string_append_printf (string, "%s\n", _("Ensure that the white-balance has not been modified by the camera and that the lens is clean."));
3767- }
3768-
3769- /* TRANSLATORS: this is the message body for the chart selection */
3770- g_string_append_printf (string, "\n%s", _("Please select the calibration target type."));
3771-
3772- /* TRANSLATORS: this is the page title */
3773- vbox = gcm_calib_add_page_title (priv, _("What target type do you have?"));
3774-
3775- /* main contents */
3776- content = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
3777- gtk_box_pack_start (GTK_BOX (vbox), content, FALSE, FALSE, 0);
3778-
3779- /* TRANSLATORS: this is intro page text */
3780- gcm_calib_add_page_para (content, string->str);
3781-
3782- /* pack in a preview image */
3783- priv->reference_preview = gtk_image_new ();
3784- gtk_box_pack_start (GTK_BOX (vbox), priv->reference_preview, FALSE, FALSE, 0);
3785-
3786- combo = gtk_combo_box_text_new ();
3787- for (i=0; i<GCM_CALIBRATE_REFERENCE_KIND_UNKNOWN; i++) {
3788- gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo),
3789- gcm_calib_reference_kind_to_localised_string (i));
3790- }
3791- g_signal_connect (combo, "changed",
3792- G_CALLBACK (gcm_calib_reference_kind_combobox_cb),
3793- priv);
3794-
3795- /* use IT8 by default */
3796- gtk_combo_box_set_active (GTK_COMBO_BOX (combo), GCM_CALIBRATE_REFERENCE_KIND_IT8);
3797-
3798- gtk_box_pack_start (GTK_BOX (vbox), combo, FALSE, FALSE, 0);
3799-
3800- /* add to assistant */
3801- gtk_assistant_append_page (assistant, vbox);
3802- gtk_assistant_set_page_type (assistant, vbox, GTK_ASSISTANT_PAGE_CONTENT);
3803- gtk_assistant_set_page_complete (assistant, vbox, FALSE);
3804- /* TRANSLATORS: this is the calibration wizard page title */
3805- gtk_assistant_set_page_title (assistant, vbox, _("Select Target"));
3806- g_ptr_array_add (priv->pages, vbox);
3807- g_object_set_data (G_OBJECT (vbox),
3808- "GcmCalibrateMain::Index",
3809- GUINT_TO_POINTER (GCM_CALIBRATE_PAGE_TARGET_KIND));
3810- g_string_free (string, TRUE);
3811-
3812- /* show page */
3813- gtk_widget_show_all (vbox);
3814-}
3815-
3816-static void
3817-gcm_calib_display_kind_toggled_cb (GtkToggleButton *togglebutton,
3818- GcmCalibratePriv *priv)
3819-{
3820- GcmCalibrateDisplayKind display_kind;
3821-
3822- if (!gtk_toggle_button_get_active (togglebutton))
3823- return;
3824- display_kind = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (togglebutton),
3825- "GcmCalib::display-kind"));
3826- g_object_set (priv->calibrate,
3827- "display-kind", display_kind,
3828- NULL);
3829-}
3830-
3831-/**
3832- * gcm_calib_setup_page_display_kind:
3833- **/
3834-static void
3835-gcm_calib_setup_page_display_kind (GcmCalibratePriv *priv)
3836-{
3837- GtkWidget *vbox;
3838- GtkWidget *content;
3839- GtkWidget *widget;
3840- GSList *list;
3841- GtkAssistant *assistant = GTK_ASSISTANT (priv->main_window);
3842-
3843- /* TRANSLATORS: this is the page title */
3844- vbox = gcm_calib_add_page_title (priv, _("Choose your display type"));
3845-
3846- /* main contents */
3847- content = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
3848- gtk_box_pack_start (GTK_BOX (vbox), content, FALSE, FALSE, 0);
3849-
3850- /* TRANSLATORS: this is intro page text */
3851- gcm_calib_add_page_para (content, _("Select the monitor type that is attached to your computer."));
3852-
3853- widget = gtk_radio_button_new_with_label (NULL, _("LCD"));
3854- g_object_set_data (G_OBJECT (widget),
3855- "GcmCalib::display-kind",
3856- GUINT_TO_POINTER (GCM_CALIBRATE_DEVICE_KIND_LCD));
3857- g_signal_connect (widget, "toggled",
3858- G_CALLBACK (gcm_calib_display_kind_toggled_cb), priv);
3859- gtk_box_pack_start (GTK_BOX (content), widget, FALSE, FALSE, 0);
3860-
3861- list = gtk_radio_button_get_group (GTK_RADIO_BUTTON (widget));
3862- widget = gtk_radio_button_new_with_label (list, _("CRT"));
3863- g_object_set_data (G_OBJECT (widget),
3864- "GcmCalib::display-kind",
3865- GUINT_TO_POINTER (GCM_CALIBRATE_DEVICE_KIND_CRT));
3866- g_signal_connect (widget, "toggled",
3867- G_CALLBACK (gcm_calib_display_kind_toggled_cb), priv);
3868- gtk_box_pack_start (GTK_BOX (content), widget, FALSE, FALSE, 0);
3869-
3870- list = gtk_radio_button_get_group (GTK_RADIO_BUTTON (widget));
3871- widget = gtk_radio_button_new_with_label (list, _("Plasma"));
3872- g_object_set_data (G_OBJECT (widget),
3873- "GcmCalib::display-kind",
3874- GUINT_TO_POINTER (GCM_CALIBRATE_DEVICE_KIND_CRT));
3875- g_signal_connect (widget, "toggled",
3876- G_CALLBACK (gcm_calib_display_kind_toggled_cb), priv);
3877- gtk_box_pack_start (GTK_BOX (content), widget, FALSE, FALSE, 0);
3878-
3879- list = gtk_radio_button_get_group (GTK_RADIO_BUTTON (widget));
3880- widget = gtk_radio_button_new_with_label (list, _("Projector"));
3881- g_object_set_data (G_OBJECT (widget),
3882- "GcmCalib::display-kind",
3883- GUINT_TO_POINTER (GCM_CALIBRATE_DEVICE_KIND_PROJECTOR));
3884- g_signal_connect (widget, "toggled",
3885- G_CALLBACK (gcm_calib_display_kind_toggled_cb), priv);
3886- gtk_box_pack_start (GTK_BOX (content), widget, FALSE, FALSE, 0);
3887-
3888- /* add to assistant */
3889- gtk_assistant_append_page (assistant, vbox);
3890- gtk_assistant_set_page_type (assistant, vbox, GTK_ASSISTANT_PAGE_CONTENT);
3891- /* TRANSLATORS: this is the calibration wizard page title */
3892- gtk_assistant_set_page_title (assistant, vbox, _("Choose Display Type"));
3893- gtk_assistant_set_page_complete (assistant, vbox, FALSE);
3894- g_ptr_array_add (priv->pages, vbox);
3895- g_object_set_data (G_OBJECT (vbox),
3896- "GcmCalibrateMain::Index",
3897- GUINT_TO_POINTER (GCM_CALIBRATE_PAGE_DISPLAY_KIND));
3898-
3899- /* show page */
3900- gtk_widget_show_all (vbox);
3901-}
3902-
3903-static void
3904-gcm_calib_display_temp_toggled_cb (GtkToggleButton *togglebutton,
3905- GcmCalibratePriv *priv)
3906-{
3907- guint display_temp;
3908- if (!gtk_toggle_button_get_active (togglebutton))
3909- return;
3910- display_temp = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (togglebutton),
3911- "GcmCalib::display-temp"));
3912- g_object_set (priv->calibrate,
3913- "target-whitepoint", display_temp,
3914- NULL);
3915-}
3916-
3917-/**
3918- * gcm_calib_setup_page_display_temp:
3919- **/
3920-static void
3921-gcm_calib_setup_page_display_temp (GcmCalibratePriv *priv)
3922-{
3923- GtkWidget *vbox;
3924- GtkWidget *content;
3925- GtkWidget *widget;
3926- GSList *list;
3927- GtkAssistant *assistant = GTK_ASSISTANT (priv->main_window);
3928-
3929- /* TRANSLATORS: this is the page title */
3930- vbox = gcm_calib_add_page_title (priv, _("Choose your display target white point"));
3931-
3932- /* main contents */
3933- content = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
3934- gtk_box_pack_start (GTK_BOX (vbox), content, FALSE, FALSE, 0);
3935-
3936- /* TRANSLATORS: this is intro page text */
3937- gcm_calib_add_page_para (content, _("Most displays should be calibrated to a CIE D65 illuminant for general usage."));
3938-
3939- widget = gtk_radio_button_new_with_label (NULL, _("CIE D50 (Printing and publishing)"));
3940- g_object_set_data (G_OBJECT (widget),
3941- "GcmCalib::display-temp",
3942- GUINT_TO_POINTER (5000));
3943- g_signal_connect (widget, "toggled",
3944- G_CALLBACK (gcm_calib_display_temp_toggled_cb), priv);
3945- gtk_box_pack_start (GTK_BOX (content), widget, FALSE, FALSE, 0);
3946-
3947- list = gtk_radio_button_get_group (GTK_RADIO_BUTTON (widget));
3948- widget = gtk_radio_button_new_with_label (list, _("CIE D55"));
3949- g_object_set_data (G_OBJECT (widget),
3950- "GcmCalib::display-temp",
3951- GUINT_TO_POINTER (5500));
3952- g_signal_connect (widget, "toggled",
3953- G_CALLBACK (gcm_calib_display_temp_toggled_cb), priv);
3954- gtk_box_pack_start (GTK_BOX (content), widget, FALSE, FALSE, 0);
3955-
3956- list = gtk_radio_button_get_group (GTK_RADIO_BUTTON (widget));
3957- widget = gtk_radio_button_new_with_label (list, _("CIE D65 (Photography and graphics)"));
3958- g_object_set_data (G_OBJECT (widget),
3959- "GcmCalib::display-temp",
3960- GUINT_TO_POINTER (6500));
3961- g_signal_connect (widget, "toggled",
3962- G_CALLBACK (gcm_calib_display_temp_toggled_cb), priv);
3963- gtk_box_pack_start (GTK_BOX (content), widget, FALSE, FALSE, 0);
3964- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE);
3965-
3966- list = gtk_radio_button_get_group (GTK_RADIO_BUTTON (widget));
3967- widget = gtk_radio_button_new_with_label (list, _("CIE D75"));
3968- g_object_set_data (G_OBJECT (widget),
3969- "GcmCalib::display-temp",
3970- GUINT_TO_POINTER (7500));
3971- g_signal_connect (widget, "toggled",
3972- G_CALLBACK (gcm_calib_display_temp_toggled_cb), priv);
3973- gtk_box_pack_start (GTK_BOX (content), widget, FALSE, FALSE, 0);
3974-
3975- list = gtk_radio_button_get_group (GTK_RADIO_BUTTON (widget));
3976- widget = gtk_radio_button_new_with_label (list, _("Native (Already set manually)"));
3977- g_object_set_data (G_OBJECT (widget),
3978- "GcmCalib::display-temp",
3979- GUINT_TO_POINTER (0));
3980- g_signal_connect (widget, "toggled",
3981- G_CALLBACK (gcm_calib_display_temp_toggled_cb), priv);
3982- gtk_box_pack_start (GTK_BOX (content), widget, FALSE, FALSE, 0);
3983-
3984- /* add to assistant */
3985- gtk_assistant_append_page (assistant, vbox);
3986- gtk_assistant_set_page_type (assistant, vbox, GTK_ASSISTANT_PAGE_CONTENT);
3987- /* TRANSLATORS: this is the calibration wizard page title */
3988- gtk_assistant_set_page_title (assistant, vbox, _("Choose Display Whitepoint"));
3989- gtk_assistant_set_page_complete (assistant, vbox, FALSE);
3990- g_ptr_array_add (priv->pages, vbox);
3991- g_object_set_data (G_OBJECT (vbox),
3992- "GcmCalibrateMain::Index",
3993- GUINT_TO_POINTER (GCM_CALIBRATE_PAGE_DISPLAY_TEMPERATURE));
3994-
3995- /* show page */
3996- gtk_widget_show_all (vbox);
3997-}
3998-
3999-static void
4000-gcm_calib_print_kind_toggled_cb (GtkToggleButton *togglebutton,
4001- GcmCalibratePriv *priv)
4002-{
4003- GcmCalibratePrintKind print_kind;
4004- if (!gtk_toggle_button_get_active (togglebutton))
4005- return;
4006- print_kind = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (togglebutton),
4007- "GcmCalib::print-kind"));
4008- g_object_set (priv->calibrate,
4009- "print-kind", print_kind,
4010- NULL);
4011-}
4012-
4013-/**
4014- * gcm_calib_setup_page_print_kind:
4015- **/
4016-static void
4017-gcm_calib_setup_page_print_kind (GcmCalibratePriv *priv)
4018-{
4019- GtkWidget *vbox;
4020- GtkWidget *content;
4021- GtkWidget *widget;
4022- GSList *list;
4023- GtkAssistant *assistant = GTK_ASSISTANT (priv->main_window);
4024-
4025- /* TRANSLATORS: this is the page title */
4026- vbox = gcm_calib_add_page_title (priv, _("Choose profiling mode"));
4027-
4028- /* main contents */
4029- content = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
4030- gtk_box_pack_start (GTK_BOX (vbox), content, FALSE, FALSE, 0);
4031-
4032- /* TRANSLATORS: this is intro page text */
4033- gcm_calib_add_page_para (content, _("Please indicate if you want to profile a local printer, generate some test patches, or profile using existing test patches."));
4034-
4035- widget = gtk_radio_button_new_with_label (NULL, "Local printer");
4036- g_object_set_data (G_OBJECT (widget),
4037- "GcmCalib::print-kind",
4038- GUINT_TO_POINTER (GCM_CALIBRATE_PRINT_KIND_LOCAL));
4039- g_signal_connect (widget, "toggled",
4040- G_CALLBACK (gcm_calib_print_kind_toggled_cb), priv);
4041- gtk_box_pack_start (GTK_BOX (content), widget, FALSE, FALSE, 0);
4042-
4043- list = gtk_radio_button_get_group (GTK_RADIO_BUTTON (widget));
4044- widget = gtk_radio_button_new_with_label (list, "Generate patches for remote printer");
4045- g_object_set_data (G_OBJECT (widget),
4046- "GcmCalib::print-kind",
4047- GUINT_TO_POINTER (GCM_CALIBRATE_PRINT_KIND_GENERATE));
4048- g_signal_connect (widget, "toggled",
4049- G_CALLBACK (gcm_calib_print_kind_toggled_cb), priv);
4050- gtk_box_pack_start (GTK_BOX (content), widget, FALSE, FALSE, 0);
4051-
4052- list = gtk_radio_button_get_group (GTK_RADIO_BUTTON (widget));
4053- widget = gtk_radio_button_new_with_label (list, "Generate profile from existing test patches");
4054- g_object_set_data (G_OBJECT (widget),
4055- "GcmCalib::print-kind",
4056- GUINT_TO_POINTER (GCM_CALIBRATE_PRINT_KIND_ANALYZE));
4057- g_signal_connect (widget, "toggled",
4058- G_CALLBACK (gcm_calib_print_kind_toggled_cb), priv);
4059- gtk_box_pack_start (GTK_BOX (content), widget, FALSE, FALSE, 0);
4060-
4061- /* sync the default */
4062- g_object_set (priv->calibrate,
4063- "print-kind", GCM_CALIBRATE_PRINT_KIND_LOCAL,
4064- NULL);
4065-
4066- /* add to assistant */
4067- gtk_assistant_append_page (assistant, vbox);
4068- gtk_assistant_set_page_type (assistant, vbox, GTK_ASSISTANT_PAGE_CONTENT);
4069- /* TRANSLATORS: this is the calibration wizard page title */
4070- gtk_assistant_set_page_title (assistant, vbox, _("Calibration Mode"));
4071- gtk_assistant_set_page_complete (assistant, vbox, FALSE);
4072- g_ptr_array_add (priv->pages, vbox);
4073- g_object_set_data (G_OBJECT (vbox),
4074- "GcmCalibrateMain::Index",
4075- GUINT_TO_POINTER (GCM_CALIBRATE_PAGE_PRINT_KIND));
4076-
4077- /* show page */
4078- gtk_widget_show_all (vbox);
4079-}
4080-
4081-static void
4082-gcm_calib_precision_toggled_cb (GtkToggleButton *togglebutton,
4083- GcmCalibratePriv *priv)
4084-{
4085- GcmCalibratePrecision precision;
4086- if (!gtk_toggle_button_get_active (togglebutton))
4087- return;
4088- precision = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (togglebutton),
4089- "GcmCalib::precision"));
4090- g_object_set (priv->calibrate,
4091- "precision", precision,
4092- NULL);
4093-}
4094-
4095-/**
4096- * gcm_calib_setup_page_precision:
4097- **/
4098-static void
4099-gcm_calib_setup_page_precision (GcmCalibratePriv *priv)
4100-{
4101- GtkWidget *vbox;
4102- GtkWidget *content;
4103- GtkWidget *widget;
4104- GSList *list;
4105- GString *labels[3];
4106- guint i;
4107- guint values_printer[] = { 6, 4, 2}; /* sheets */
4108- guint values_display[] = { 30, 20, 10}; /* minutes */
4109- GtkAssistant *assistant = GTK_ASSISTANT (priv->main_window);
4110-
4111- /* TRANSLATORS: this is the page title */
4112- vbox = gcm_calib_add_page_title (priv, _("Choose calibration quality"));
4113-
4114- /* main contents */
4115- content = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
4116- gtk_box_pack_start (GTK_BOX (vbox), content, FALSE, FALSE, 0);
4117-
4118- /* TRANSLATORS: this is intro page text */
4119- gcm_calib_add_page_para (content, _("Higher quality calibration requires many color samples and more time."));
4120-
4121-#if 0
4122- /* TRANSLATORS: this is the message body for the chart selection */
4123- g_string_append (string, _("A higher precision profile provides higher accuracy in color matching but requires more time for reading the color patches."));
4124-
4125- /* TRANSLATORS: this is the message body for the chart selection */
4126- g_string_append_printf (string, "\n%s", _("For a typical workflow, a normal precision profile is sufficient."));
4127-
4128- /* printer specific options */
4129- if (priv->device_kind == CD_DEVICE_KIND_PRINTER) {
4130- /* TRANSLATORS: dialog message, preface */
4131- g_string_append_printf (string, "\n%s", _("The high precision profile also requires more paper and printer ink."));
4132- }
4133-#endif
4134-
4135- /* TRANSLATORS: radio options for calibration precision */
4136- labels[0] = g_string_new (_("Accurate"));
4137- labels[1] = g_string_new (_("Normal"));
4138- labels[2] = g_string_new (_("Quick"));
4139- switch (priv->device_kind) {
4140- case CD_DEVICE_KIND_PRINTER:
4141- for (i=0; i<3; i++) {
4142- g_string_append (labels[i], " ");
4143- /* TRANSLATORS: radio options for calibration precision */
4144- g_string_append_printf (labels[i], ngettext (
4145- "(about %i sheet of paper)",
4146- "(about %i sheets of paper)",
4147- values_printer[i]),
4148- values_printer[i]);
4149- }
4150- break;
4151- case CD_DEVICE_KIND_DISPLAY:
4152- for (i=0; i<3; i++) {
4153- g_string_append (labels[i], " ");
4154- /* TRANSLATORS: radio options for calibration precision */
4155- g_string_append_printf (labels[i], ngettext (
4156- "(about %i minute)",
4157- "(about %i minutes)",
4158- values_display[i]),
4159- values_display[i]);
4160- }
4161- break;
4162- default:
4163- break;
4164- }
4165-
4166- widget = gtk_radio_button_new_with_label (NULL, labels[0]->str);
4167- g_object_set_data (G_OBJECT (widget),
4168- "GcmCalib::precision",
4169- GUINT_TO_POINTER (GCM_CALIBRATE_PRECISION_LONG));
4170- g_signal_connect (widget, "toggled",
4171- G_CALLBACK (gcm_calib_precision_toggled_cb), priv);
4172- gtk_box_pack_start (GTK_BOX (content), widget, FALSE, FALSE, 0);
4173-
4174- list = gtk_radio_button_get_group (GTK_RADIO_BUTTON (widget));
4175- widget = gtk_radio_button_new_with_label (list, labels[1]->str);
4176- g_object_set_data (G_OBJECT (widget),
4177- "GcmCalib::precision",
4178- GUINT_TO_POINTER (GCM_CALIBRATE_PRECISION_NORMAL));
4179- g_signal_connect (widget, "toggled",
4180- G_CALLBACK (gcm_calib_precision_toggled_cb), priv);
4181- gtk_box_pack_start (GTK_BOX (content), widget, FALSE, FALSE, 0);
4182- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE);
4183-
4184- list = gtk_radio_button_get_group (GTK_RADIO_BUTTON (widget));
4185- widget = gtk_radio_button_new_with_label (list, labels[2]->str);
4186- g_object_set_data (G_OBJECT (widget),
4187- "GcmCalib::precision",
4188- GUINT_TO_POINTER (GCM_CALIBRATE_PRECISION_SHORT));
4189- g_signal_connect (widget, "toggled",
4190- G_CALLBACK (gcm_calib_precision_toggled_cb), priv);
4191- gtk_box_pack_start (GTK_BOX (content), widget, FALSE, FALSE, 0);
4192-
4193- /* add to assistant */
4194- gtk_assistant_append_page (assistant, vbox);
4195- gtk_assistant_set_page_type (assistant, vbox, GTK_ASSISTANT_PAGE_CONTENT);
4196- /* TRANSLATORS: this is the calibration wizard page title */
4197- gtk_assistant_set_page_title (assistant, vbox, _("Calibration Quality"));
4198- gtk_assistant_set_page_complete (assistant, vbox, FALSE);
4199- g_ptr_array_add (priv->pages, vbox);
4200- g_object_set_data (G_OBJECT (vbox),
4201- "GcmCalibrateMain::Index",
4202- GUINT_TO_POINTER (GCM_CALIBRATE_PAGE_PRECISION));
4203-
4204- for (i=0; i<3; i++)
4205- g_string_free (labels[i], TRUE);
4206-
4207- /* show page */
4208- gtk_widget_show_all (vbox);
4209-}
4210-
4211-static void
4212-gcm_calib_text_changed_cb (GtkEntry *entry,
4213- GcmCalibratePriv *priv)
4214-{
4215- g_object_set (priv->calibrate,
4216- "description", gtk_entry_get_text (entry),
4217- NULL);
4218-}
4219-
4220-/**
4221- * gcm_calib_setup_page_profile_title:
4222- **/
4223-static void
4224-gcm_calib_setup_page_profile_title (GcmCalibratePriv *priv)
4225-{
4226- GtkWidget *vbox;
4227- GtkWidget *content;
4228- GtkWidget *widget;
4229- gchar *tmp = NULL;
4230- GtkAssistant *assistant = GTK_ASSISTANT (priv->main_window);
4231-
4232- /* TRANSLATORS: this is the page title */
4233- vbox = gcm_calib_add_page_title (priv, _("Profile title"));
4234-
4235- /* main contents */
4236- content = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
4237- gtk_box_pack_start (GTK_BOX (vbox), content, FALSE, FALSE, 0);
4238-
4239- /* TRANSLATORS: this is intro page text */
4240- gcm_calib_add_page_para (content, _("Choose a title to identify the profile on your system."));
4241-
4242- widget = gtk_entry_new ();
4243- gtk_box_pack_start (GTK_BOX (content), widget, FALSE, FALSE, 0);
4244- gtk_entry_set_max_length (GTK_ENTRY (widget), 128);
4245-
4246- /* set the current title */
4247- g_object_get (priv->calibrate,
4248- "description", &tmp,
4249- NULL);
4250- gtk_entry_set_text (GTK_ENTRY (widget), tmp);
4251- g_free (tmp);
4252-
4253- /* watch for changes */
4254- g_signal_connect (GTK_EDITABLE (widget), "changed",
4255- G_CALLBACK (gcm_calib_text_changed_cb), priv);
4256-
4257- /* add to assistant */
4258- gtk_assistant_append_page (assistant, vbox);
4259- gtk_assistant_set_page_type (assistant, vbox, GTK_ASSISTANT_PAGE_CONTENT);
4260- /* TRANSLATORS: this is the calibration wizard page title */
4261- gtk_assistant_set_page_title (assistant, vbox, _("Profile Title"));
4262- gtk_assistant_set_page_complete (assistant, vbox, TRUE);
4263- g_ptr_array_add (priv->pages, vbox);
4264- g_object_set_data (G_OBJECT (vbox),
4265- "GcmCalibrateMain::Index",
4266- GUINT_TO_POINTER (GCM_CALIBRATE_PAGE_TITLE));
4267-
4268- /* show page */
4269- gtk_widget_show_all (vbox);
4270-}
4271-
4272-/**
4273- * gcm_calib_setup_page_sensor:
4274- **/
4275-static void
4276-gcm_calib_setup_page_sensor (GcmCalibratePriv *priv)
4277-{
4278- GtkWidget *vbox;
4279- GtkWidget *content;
4280- GtkAssistant *assistant = GTK_ASSISTANT (priv->main_window);
4281-
4282- /* TRANSLATORS: this is the page title */
4283- vbox = gcm_calib_add_page_title (priv, _("Insert sensor hardware"));
4284-
4285- /* main contents */
4286- content = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
4287- gtk_box_pack_start (GTK_BOX (vbox), content, FALSE, FALSE, 0);
4288-
4289- /* TRANSLATORS: this is intro page text */
4290- gcm_calib_add_page_para (content, _("You need to insert sensor hardware to continue."));
4291-
4292- /* add to assistant */
4293- gtk_assistant_append_page (assistant, vbox);
4294- gtk_assistant_set_page_type (assistant, vbox, GTK_ASSISTANT_PAGE_CONTENT);
4295- /* TRANSLATORS: this is the calibration wizard page title */
4296- gtk_assistant_set_page_title (assistant, vbox, _("Sensor Check"));
4297- gtk_assistant_set_page_complete (assistant, vbox, FALSE);
4298- g_ptr_array_add (priv->pages, vbox);
4299- g_object_set_data (G_OBJECT (vbox),
4300- "GcmCalibrateMain::Index",
4301- GUINT_TO_POINTER (GCM_CALIBRATE_PAGE_SENSOR));
4302-
4303- /* show page */
4304- gtk_widget_show_all (vbox);
4305-}
4306-
4307-/**
4308- * gcm_calib_setup_page_failure:
4309- **/
4310-static void
4311-gcm_calib_setup_page_failure (GcmCalibratePriv *priv)
4312-{
4313- GtkWidget *vbox;
4314- GtkWidget *content;
4315- GtkAssistant *assistant = GTK_ASSISTANT (priv->main_window);
4316-
4317- /* TRANSLATORS: this is the page title */
4318- vbox = gcm_calib_add_page_title (priv, _("Failed to calibrate"));
4319-
4320- /* main contents */
4321- content = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
4322- gtk_box_pack_start (GTK_BOX (vbox), content, FALSE, FALSE, 0);
4323-
4324- /* TRANSLATORS: this is intro page text */
4325- gcm_calib_add_page_para (content, _("The device could not be found. Ensure it is plugged in and turned on."));
4326-
4327- /* add to assistant */
4328- gtk_assistant_append_page (assistant, vbox);
4329- gtk_assistant_set_page_type (assistant, vbox, GTK_ASSISTANT_PAGE_SUMMARY);
4330- /* TRANSLATORS: this is the calibration wizard page title */
4331- gtk_assistant_set_page_title (assistant, vbox, _("Summary"));
4332- gtk_assistant_set_page_complete (assistant, vbox, TRUE);
4333- g_ptr_array_add (priv->pages, vbox);
4334- g_object_set_data (G_OBJECT (vbox),
4335- "GcmCalibrateMain::Index",
4336- GUINT_TO_POINTER (GCM_CALIBRATE_PAGE_FAILURE));
4337-
4338- /* show page */
4339- gtk_widget_show_all (vbox);
4340-}
4341-
4342-/**
4343- * gcm_calib_got_sensor:
4344- **/
4345-static void
4346-gcm_calib_got_sensor (GcmCalibratePriv *priv, CdSensor *sensor)
4347-{
4348- gboolean is_lowend = FALSE;
4349- gboolean ret;
4350- GError *error = NULL;
4351- GtkWidget *vbox;
4352-
4353- /* connect to sensor */
4354- ret = cd_sensor_connect_sync (sensor, NULL, &error);
4355- if (!ret) {
4356- g_warning ("failed to connect to sensor: %s",
4357- error->message);
4358- g_error_free (error);
4359- goto out;
4360- }
4361- gcm_calibrate_set_sensor (priv->calibrate, sensor);
4362-
4363- /* hide the prompt for the user to insert a sensor */
4364- vbox = gcm_calib_get_vbox_for_page (priv,
4365- GCM_CALIBRATE_PAGE_SENSOR);
4366- gtk_widget_hide (vbox);
4367-
4368- /* if the device is a simple colorimeter, hide the temperature
4369- * chooser. Only expensive accurate spectrophotometers are
4370- * accurate enough to do a good job without a color cast */
4371- if (cd_sensor_get_kind (sensor) == CD_SENSOR_KIND_COLORHUG) {
4372- is_lowend = TRUE;
4373- }
4374- if (priv->device_kind == CD_DEVICE_KIND_DISPLAY) {
4375- vbox = gcm_calib_get_vbox_for_page (priv,
4376- GCM_CALIBRATE_PAGE_DISPLAY_TEMPERATURE);
4377- gtk_widget_set_visible (vbox, !is_lowend);
4378- }
4379-out:
4380- return;
4381-}
4382-
4383-/**
4384- * gcm_calib_get_sensors_cb:
4385- **/
4386-static void
4387-gcm_calib_get_sensors_cb (GObject *object,
4388- GAsyncResult *res,
4389- gpointer user_data)
4390-{
4391- CdClient *client = CD_CLIENT (object);
4392- CdSensor *sensor_tmp;
4393- GcmCalibratePriv *priv = (GcmCalibratePriv *) user_data;
4394- GError *error = NULL;
4395- GPtrArray *sensors;
4396-
4397- /* get the result */
4398- sensors = cd_client_get_sensors_finish (client, res, &error);
4399- if (sensors == NULL) {
4400- g_warning ("failed to get sensors: %s",
4401- error->message);
4402- g_error_free (error);
4403- goto out;
4404- }
4405-
4406- /* we've got a sensor */
4407- if (sensors->len != 0) {
4408- sensor_tmp = g_ptr_array_index (sensors, 0);
4409- gcm_calib_got_sensor (priv, sensor_tmp);
4410- }
4411-out:
4412- if (sensors != NULL)
4413- g_ptr_array_unref (sensors);
4414-}
4415-
4416-/**
4417- * gcm_calib_add_pages:
4418- **/
4419-static void
4420-gcm_calib_add_pages (GcmCalibratePriv *priv)
4421-{
4422- gboolean ret;
4423- const gchar *xrandr_name;
4424-
4425- /* device not found */
4426- if (priv->device_kind == CD_DEVICE_KIND_UNKNOWN) {
4427- gcm_calib_setup_page_failure (priv);
4428- gtk_widget_show_all (GTK_WIDGET (priv->main_window));
4429- return;
4430- }
4431-
4432- gcm_calib_setup_page_intro (priv);
4433-
4434- if (priv->device_kind == CD_DEVICE_KIND_DISPLAY ||
4435- priv->device_kind == CD_DEVICE_KIND_PRINTER)
4436- gcm_calib_setup_page_sensor (priv);
4437-
4438- /* find whether argyllcms is installed using a tool which should exist */
4439- ret = gcm_calibrate_get_enabled (priv->calibrate);
4440- if (!ret)
4441- gcm_calib_setup_page_install_argyllcms (priv);
4442-
4443- xrandr_name = cd_device_get_metadata_item (priv->device,
4444- CD_DEVICE_METADATA_XRANDR_NAME);
4445- if (xrandr_name != NULL)
4446- priv->internal_lcd = gcm_utils_output_is_lcd_internal (xrandr_name);
4447- if (!priv->internal_lcd && priv->device_kind == CD_DEVICE_KIND_DISPLAY)
4448- gcm_calib_setup_page_display_configure_wait (priv);
4449-
4450- gcm_calib_setup_page_precision (priv);
4451-
4452- if (priv->device_kind == CD_DEVICE_KIND_DISPLAY) {
4453- if (!priv->internal_lcd) {
4454- gcm_calib_setup_page_display_kind (priv);
4455- } else {
4456- g_object_set (priv->calibrate,
4457- "display-kind", GCM_CALIBRATE_DEVICE_KIND_LCD,
4458- NULL);
4459- }
4460- gcm_calib_setup_page_display_temp (priv);
4461- } else if (priv->device_kind == CD_DEVICE_KIND_PRINTER) {
4462- gcm_calib_setup_page_print_kind (priv);
4463- } else {
4464- gcm_calib_setup_page_target_kind (priv);
4465- ret = g_file_test ("/usr/share/shared-color-targets", G_FILE_TEST_IS_DIR);
4466- if (!ret)
4467- gcm_calib_setup_page_install_targets (priv);
4468- }
4469-
4470- gcm_calib_setup_page_profile_title (priv);
4471- gcm_calib_setup_page_action (priv);
4472-
4473- gcm_calib_setup_page_summary (priv);
4474-
4475- /* see if we can hide the sensor check */
4476- cd_client_get_sensors (priv->client,
4477- NULL,
4478- gcm_calib_get_sensors_cb,
4479- priv);
4480-}
4481-
4482-/**
4483- * gcm_calib_sensor_added_cb:
4484- **/
4485-static void
4486-gcm_calib_sensor_added_cb (CdClient *client, CdSensor *sensor, GcmCalibratePriv *priv)
4487-{
4488- g_debug ("sensor inserted");
4489- gcm_calib_got_sensor (priv, sensor);
4490- gtk_assistant_next_page (GTK_ASSISTANT (priv->main_window));
4491-}
4492-
4493-/**
4494- * gcm_calib_startup_cb:
4495- **/
4496-static void
4497-gcm_calib_startup_cb (GApplication *application, GcmCalibratePriv *priv)
4498-{
4499- const gint window_width = 640;
4500- const gint window_height = 440;
4501-
4502- const gchar *description;
4503- const gchar *manufacturer;
4504- const gchar *model;
4505- const gchar *native_device;
4506- const gchar *serial;
4507- gchar *copyright = NULL;
4508- gboolean ret;
4509- GDateTime *dt = NULL;
4510- GError *error = NULL;
4511-
4512- /* add application specific icons to search path */
4513- gtk_icon_theme_append_search_path (gtk_icon_theme_get_default (),
4514- GCM_DATA G_DIR_SEPARATOR_S "icons");
4515-
4516- /* connect to colord */
4517- priv->client = cd_client_new ();
4518- g_signal_connect (priv->client, "sensor-added",
4519- G_CALLBACK (gcm_calib_sensor_added_cb), priv);
4520- ret = cd_client_connect_sync (priv->client,
4521- NULL,
4522- &error);
4523- if (!ret) {
4524- g_warning ("failed to connect to colord: %s",
4525- error->message);
4526- g_error_free (error);
4527- goto out;
4528- }
4529-
4530- /* show main UI */
4531- priv->main_window = GTK_WINDOW (gtk_assistant_new ());
4532- gtk_window_set_default_size (priv->main_window, window_width, window_height);
4533- gtk_window_set_resizable (priv->main_window, TRUE);
4534- gtk_window_set_title (priv->main_window, "");
4535- gtk_container_set_border_width (GTK_CONTAINER (priv->main_window), 12);
4536- g_signal_connect (priv->main_window, "delete_event",
4537- G_CALLBACK (gcm_calib_delete_event_cb), priv);
4538- g_signal_connect (priv->main_window, "close",
4539- G_CALLBACK (gcm_calib_assistant_close_cb), priv);
4540- g_signal_connect (priv->main_window, "cancel",
4541- G_CALLBACK (gcm_calib_assistant_cancel_cb), priv);
4542- g_signal_connect (priv->main_window, "prepare",
4543- G_CALLBACK (gcm_calib_assistant_prepare_cb), priv);
4544- gtk_application_add_window (priv->application,
4545- priv->main_window);
4546-
4547- /* set the parent window if it is specified */
4548- if (priv->xid != 0) {
4549- g_debug ("Setting xid %i", priv->xid);
4550- gcm_window_set_parent_xid (GTK_WINDOW (priv->main_window), priv->xid);
4551- }
4552-
4553- /* select a specific profile only */
4554- priv->device = cd_client_find_device_sync (priv->client,
4555- priv->device_id,
4556- NULL,
4557- &error);
4558- if (priv->device == NULL) {
4559- g_warning ("failed to get device %s: %s",
4560- priv->device_id,
4561- error->message);
4562- g_error_free (error);
4563- goto out;
4564- }
4565-
4566- /* connect to the device */
4567- ret = cd_device_connect_sync (priv->device,
4568- NULL,
4569- &error);
4570- if (!ret) {
4571- g_warning ("failed to connect to device: %s",
4572- error->message);
4573- g_error_free (error);
4574- goto out;
4575- }
4576-
4577- /* get the device properties */
4578- priv->device_kind = cd_device_get_kind (priv->device);
4579-
4580- /* for display calibration move the window to lower right area to
4581- * limit argyll from obscuring the window (too much) */
4582- if (priv->device_kind == CD_DEVICE_KIND_DISPLAY) {
4583- gtk_window_set_gravity (priv->main_window, GDK_GRAVITY_SOUTH_EAST);
4584- gtk_window_move (priv->main_window, gdk_screen_width() - window_width,
4585- gdk_screen_height() - window_height);
4586- }
4587-
4588- /* set, with fallbacks */
4589- serial = cd_device_get_serial (priv->device);
4590- if (serial == NULL) {
4591- /* TRANSLATORS: this is saved in the profile */
4592- serial = _("Unknown serial");
4593- }
4594- model = cd_device_get_model (priv->device);
4595- if (model == NULL) {
4596- /* TRANSLATORS: this is saved in the profile */
4597- model = _("Unknown model");
4598- }
4599- description = cd_device_get_model (priv->device);
4600- if (description == NULL) {
4601- /* TRANSLATORS: this is saved in the profile */
4602- description = _("Unknown description");
4603- }
4604- manufacturer = cd_device_get_vendor (priv->device);
4605- if (manufacturer == NULL) {
4606- /* TRANSLATORS: this is saved in the profile */
4607- manufacturer = _("Unknown manufacturer");
4608- }
4609-
4610- dt = g_date_time_new_now_local ();
4611- /* TRANSLATORS: this is the copyright string, where it might be
4612- * "Copyright (c) 2009 Edward Scissorhands"
4613- * BIG RED FLASHING NOTE: YOU NEED TO USE ASCII ONLY */
4614- copyright = g_strdup_printf ("%s %04i %s", _("Copyright (c)"),
4615- g_date_time_get_year (dt),
4616- g_get_real_name ());
4617-
4618- /* set the proper values */
4619- g_object_set (priv->calibrate,
4620- "device-kind", priv->device_kind,
4621- "model", model,
4622- "description", description,
4623- "manufacturer", manufacturer,
4624- "serial", serial,
4625- "copyright", copyright,
4626- NULL);
4627-
4628- /* display specific properties */
4629- if (priv->device_kind == CD_DEVICE_KIND_DISPLAY) {
4630- native_device = cd_device_get_metadata_item (priv->device,
4631- CD_DEVICE_METADATA_XRANDR_NAME);
4632- if (native_device == NULL) {
4633- g_warning ("failed to get output");
4634- goto out;
4635- }
4636- g_object_set (priv->calibrate,
4637- "output-name", native_device,
4638- NULL);
4639- }
4640-out:
4641- /* add different pages depending on the device kind */
4642- gcm_calib_add_pages (priv);
4643- gtk_assistant_set_current_page (GTK_ASSISTANT (priv->main_window), 0);
4644- if (dt != NULL)
4645- g_date_time_unref (dt);
4646- g_free (copyright);
4647-}
4648-
4649-static void
4650-gcm_calib_title_changed_cb (GcmCalibrate *calibrate,
4651- const gchar *title,
4652- GcmCalibratePriv *priv)
4653-{
4654- gchar *markup;
4655-
4656- markup = g_strdup_printf ("<span size=\"large\" font_weight=\"bold\">%s</span>", title);
4657- gtk_label_set_markup (GTK_LABEL (priv->action_title), markup);
4658- g_free (markup);
4659-}
4660-
4661-static void
4662-gcm_calib_message_changed_cb (GcmCalibrate *calibrate,
4663- const gchar *title,
4664- GcmCalibratePriv *priv)
4665-{
4666- gtk_label_set_label (GTK_LABEL (priv->action_message), title);
4667-}
4668-
4669-static void
4670-gcm_calib_progress_changed_cb (GcmCalibrate *calibrate,
4671- guint percentage,
4672- GcmCalibratePriv *priv)
4673-{
4674- gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (priv->action_progress),
4675- percentage / 100.0f);
4676-}
4677-
4678-static void
4679-gcm_calib_image_changed_cb (GcmCalibrate *calibrate,
4680- const gchar *filename,
4681- GcmCalibratePriv *priv)
4682-{
4683- GdkPixbuf *pixbuf;
4684- GError *error = NULL;
4685-
4686- if (filename != NULL) {
4687- pixbuf = gdk_pixbuf_new_from_file_at_size (filename, 200, 400, &error);
4688- if (pixbuf == NULL) {
4689- g_warning ("failed to load image: %s", error->message);
4690- g_error_free (error);
4691- gtk_widget_hide (priv->action_image);
4692- } else {
4693- gtk_image_set_from_pixbuf (GTK_IMAGE (priv->action_image), pixbuf);
4694- gtk_widget_show (priv->action_image);
4695- }
4696- } else {
4697- gtk_widget_hide (priv->action_image);
4698- }
4699-}
4700-
4701-static void
4702-gcm_calib_interaction_required_cb (GcmCalibrate *calibrate,
4703- const gchar *button_text,
4704- GcmCalibratePriv *priv)
4705-{
4706- GtkWidget *vbox;
4707- vbox = gcm_calib_get_vbox_for_page (priv,
4708- GCM_CALIBRATE_PAGE_ACTION);
4709- gtk_assistant_set_page_complete (GTK_ASSISTANT (priv->main_window),
4710- vbox, TRUE);
4711- priv->has_pending_interaction = TRUE;
4712-}
4713-
4714-/**
4715- * main:
4716- **/
4717-int
4718-main (int argc, char **argv)
4719-{
4720- gchar *device_id = NULL;
4721- GcmCalibratePriv *priv;
4722- GOptionContext *context;
4723- guint xid = 0;
4724- int status = 0;
4725-
4726- const GOptionEntry options[] = {
4727- { "parent-window", 'p', 0, G_OPTION_ARG_INT, &xid,
4728- /* TRANSLATORS: we can make this modal (stay on top of) another window */
4729- _("Set the parent window to make this modal"), NULL },
4730- { "device", 'd', 0, G_OPTION_ARG_STRING, &device_id,
4731- /* TRANSLATORS: show just the one profile, rather than all */
4732- _("Set the specific device to calibrate"), NULL },
4733- { NULL}
4734- };
4735-
4736- setlocale (LC_ALL, "");
4737-
4738- bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
4739- bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
4740- textdomain (GETTEXT_PACKAGE);
4741-
4742- gtk_init (&argc, &argv);
4743-
4744- context = g_option_context_new ("gnome-color-manager calibration tool");
4745- g_option_context_add_main_entries (context, options, NULL);
4746- g_option_context_add_group (context, gcm_debug_get_option_group ());
4747- g_option_context_add_group (context, gtk_get_option_group (TRUE));
4748- g_option_context_parse (context, &argc, &argv, NULL);
4749- g_option_context_free (context);
4750-
4751- priv = g_new0 (GcmCalibratePriv, 1);
4752- priv->pages = g_ptr_array_new ();
4753- priv->xid = xid;
4754- priv->device_id = device_id;
4755- priv->calibrate = gcm_calibrate_argyll_new ();
4756- g_object_set (priv->calibrate,
4757- "precision", GCM_CALIBRATE_PRECISION_LONG,
4758- NULL);
4759- priv->device_kind = CD_DEVICE_KIND_UNKNOWN;
4760- g_signal_connect (priv->calibrate, "title-changed",
4761- G_CALLBACK (gcm_calib_title_changed_cb), priv);
4762- g_signal_connect (priv->calibrate, "message-changed",
4763- G_CALLBACK (gcm_calib_message_changed_cb), priv);
4764- g_signal_connect (priv->calibrate, "image-changed",
4765- G_CALLBACK (gcm_calib_image_changed_cb), priv);
4766- g_signal_connect (priv->calibrate, "progress-changed",
4767- G_CALLBACK (gcm_calib_progress_changed_cb), priv);
4768- g_signal_connect (priv->calibrate, "interaction-required",
4769- G_CALLBACK (gcm_calib_interaction_required_cb), priv);
4770-
4771- /* nothing specified */
4772- if (priv->device_id == NULL) {
4773- g_print ("%s\n", _("No device was specified!"));
4774- goto out;
4775- }
4776-
4777- /* ensure single instance */
4778- priv->application = gtk_application_new ("org.gnome.ColorManager.Calibration", 0);
4779- g_signal_connect (priv->application, "startup",
4780- G_CALLBACK (gcm_calib_startup_cb), priv);
4781- g_signal_connect (priv->application, "activate",
4782- G_CALLBACK (gcm_calib_activate_cb), priv);
4783-
4784- /* wait */
4785- status = g_application_run (G_APPLICATION (priv->application), argc, argv);
4786-
4787- g_ptr_array_unref (priv->pages);
4788- g_object_unref (priv->application);
4789- g_object_unref (priv->calibrate);
4790- if (priv->client != NULL)
4791- g_object_unref (priv->client);
4792- if (priv->device_id != NULL)
4793- g_free (priv->device_id);
4794- if (priv->device != NULL)
4795- g_object_unref (priv->device);
4796- g_free (priv);
4797-out:
4798- return status;
4799-}
4800
4801=== added file '.pc/applied-patches'
4802--- .pc/applied-patches 1970-01-01 00:00:00 +0000
4803+++ .pc/applied-patches 2015-01-02 20:29:31 +0000
4804@@ -0,0 +1,1 @@
4805+01_unity_control_center.patch
4806
4807=== removed file '.pc/applied-patches'
4808--- .pc/applied-patches 2014-01-15 16:15:06 +0000
4809+++ .pc/applied-patches 1970-01-01 00:00:00 +0000
4810@@ -1,1 +0,0 @@
4811-01_unity_control_center.patch
4812
4813=== modified file 'ChangeLog'
4814--- ChangeLog 2013-09-21 20:59:17 +0000
4815+++ ChangeLog 2015-01-02 20:29:31 +0000
4816@@ -1,12 +1,1489 @@
4817-commit 1372f2ad40edf6859be7164e7105c96963a4821b
4818-Author: Richard Hughes <richard@hughsie.com>
4819-Date: 2013-09-13
4820-
4821- Release version 3.8.3
4822-
4823-M NEWS
4824-
4825-commit 210739aa088a2771adc4b69fa5c718b6819088ef
4826+commit 5d41872e5e61c7163e4f576c8adc6f1f7714c9e6
4827+Author: Richard Hughes <richard@hughsie.com>
4828+Date: 2014-11-10
4829+
4830+ Release version 3.14.2
4831+
4832+M NEWS
4833+
4834+commit 638f1518dd5ec3454b545ba660a08dc8d3809f76
4835+Author: Baurzhan Muftakhidinov <baurthefirst@gmail.com>
4836+Date: 2014-11-05
4837+
4838+ Updated Kazakh translation
4839+
4840+M po/kk.po
4841+
4842+commit 5c2a1495a67a6b33432fc14af76542530e035c80
4843+Author: Richard Hughes <richard@hughsie.com>
4844+Date: 2014-10-12
4845+
4846+ trivial: Fix up the homepage address
4847+
4848+M gnome-color-manager.doap
4849+
4850+commit 7186351d915ad1772675911603c2c5e9f386b0b2
4851+Author: Richard Hughes <richard@hughsie.com>
4852+Date: 2014-10-12
4853+
4854+ trivial: Post release version bump
4855+
4856+M RELEASE
4857+M configure.ac
4858+
4859+commit 18d192ad31f9ce77debb4236e12d4fc31a4f76b3
4860+Author: Richard Hughes <richard@hughsie.com>
4861+Date: 2014-10-12
4862+
4863+ trivial: Fix a small compile warning
4864+
4865+M src/gcm-utils.c
4866+
4867+commit f83a0c12a83642816ec914f44c2294c4103a45e7
4868+Author: Richard Hughes <richard@hughsie.com>
4869+Date: 2014-10-12
4870+
4871+ Release version 3.14.1
4872+
4873+M NEWS
4874+
4875+commit f9ce2a35d95d3a64d7d6c3a6899e519b7a8f9af3
4876+Author: Fabio Tomat <f.t.public@gmail.com>
4877+Date: 2014-10-11
4878+
4879+ Added Friulian translation
4880+
4881+M po/LINGUAS
4882+A po/fur.po
4883+
4884+commit a1dba885f84f3a3779e93944aca6fa66893c0d72
4885+Author: Arash Mousavi <mousavi.arash@gmail.com>
4886+Date: 2014-10-10
4887+
4888+ Updates Persian Translations
4889+
4890+M po/fa.po
4891+
4892+commit 53bcec7250cb72e45d00383486fbbeba0ff74df8
4893+Author: Richard Hughes <richard@hughsie.com>
4894+Date: 2014-10-08
4895+
4896+ Prevent a crash when profiling a printer
4897+
4898+ Resolves: https://bugzilla.gnome.org/show_bug.cgi?id=732869
4899+
4900+M src/gcm-print.c
4901+
4902+commit 9938cf72ca5830bae5021fd1d22bcf464992cfb2
4903+Author: Changwoo Ryu <cwryu@debian.org>
4904+Date: 2014-10-05
4905+
4906+ Updated Korean translation
4907+
4908+M po/ko.po
4909+
4910+commit 1754afbfebbe620c22355d9cff7dd97fafb7a238
4911+Author: Saibal Ray <sray@redhat.com>
4912+Date: 2014-09-24
4913+
4914+ Updated Bengali (India) translation
4915+
4916+M po/bn_IN.po
4917+
4918+commit c72571357088722695e0fa061d6784257bf2e831
4919+Author: Krishnababu Krothapalli <k.meetme@gmail.com>
4920+Date: 2014-09-23
4921+
4922+ Updated Telugu translation
4923+
4924+M po/te.po
4925+
4926+commit beddd6071ff59714553f3f585345c9ce9b19195d
4927+Author: Richard Hughes <richard@hughsie.com>
4928+Date: 2014-09-23
4929+
4930+ trivial: Post release version bump
4931+
4932+M RELEASE
4933+M configure.ac
4934+
4935+commit df8185ae82d92f23bb70c605f6769d72b00ee0f2
4936+Author: Richard Hughes <richard@hughsie.com>
4937+Date: 2014-09-23
4938+
4939+ Release version 3.14.0
4940+
4941+M NEWS
4942+M RELEASE
4943+M configure.ac
4944+
4945+commit 18771b62c3bf943ef5cb1fc3c7cc26e23849892e
4946+Author: Rajesh Ranjan <rajeshkajha@yahoo.com>
4947+Date: 2014-09-22
4948+
4949+ Updated Hindi translation
4950+
4951+M po/hi.po
4952+
4953+commit aebc4009ba48670ebb5c02f6022363765889b9fb
4954+Author: Мирослав Николић <miroslavnikolic@rocketmail.com>
4955+Date: 2014-09-19
4956+
4957+ Updated Serbian translation
4958+
4959+M po/sr.po
4960+M po/sr@latin.po
4961+
4962+commit fcc132f54021efd009ab32055e263b0dd7ee90ae
4963+Author: Manoj Kumar Giri <mgiri@redhat.com>
4964+Date: 2014-09-19
4965+
4966+ Updated Oriya translation
4967+
4968+M po/or.po
4969+
4970+commit 81cd70429a207fe3df20dd16baa38abbbdbc4e56
4971+Author: Pawan Chitrakar <chautari@gmail.com>
4972+Date: 2014-09-17
4973+
4974+ Updated Nepali translation
4975+
4976+M po/ne.po
4977+
4978+commit d38229f6e21e5aa48ece3d9b796464748ab32d6c
4979+Author: Changwoo Ryu <cwryu@debian.org>
4980+Date: 2014-09-18
4981+
4982+ Updated Korean translation
4983+
4984+M po/ko.po
4985+
4986+commit 70f788c46f55fc0b620e65058974dd2f6eeaff75
4987+Author: Saibal Ray <sray@redhat.com>
4988+Date: 2014-09-17
4989+
4990+ Updated Bengali (India) translation
4991+
4992+M po/bn_IN.po
4993+
4994+commit fa5333274adf7a029c0f9c9521faf186b025186b
4995+Author: Shantha kumar <shantha.thamizh@gmail.com>
4996+Date: 2014-09-15
4997+
4998+ Updated Tamil translation
4999+
5000+M po/ta.po
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches

to all changes: