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