~ubuntu-branches/ubuntu/wily/gnome-color-manager/wily

« back to all changes in this revision

Viewing changes to src/gcm-calibrate-main.c

  • Committer: Package Import Robot
  • Author(s): Andreas Henriksson
  • Date: 2013-04-12 23:07:01 UTC
  • mfrom: (1.3.14) (2.2.3 experimental)
  • Revision ID: package-import@ubuntu.com-20130412230701-l5ur4nrw361pf544
Tags: 3.8.0-1
* New upstream release.
* Bump build-dependencies according to configure.ac:
  - libcolord-dev (>= 0.1.28)
  - libcolord-gtk-dev (>= 0.1.20)
* Drop build-dependency on gnome-doc-utils and itstool in favor
  of yelp-tools.

Show diffs side-by-side

added added

removed removed

Lines of Context:
73
73
        gboolean         has_pending_interaction;
74
74
        gboolean         started_calibration;
75
75
        GcmCalibratePage current_page;
 
76
        gint             inhibit_cookie;
76
77
} GcmCalibratePriv;
77
78
 
78
79
/**
109
110
 * gcm_calib_activate_cb:
110
111
 **/
111
112
static void
112
 
gcm_calib_activate_cb (GApplication *application, GcmCalibratePriv *calib)
 
113
gcm_calib_activate_cb (GApplication *application, GcmCalibratePriv *priv)
113
114
{
114
 
        gtk_window_present (calib->main_window);
 
115
        gtk_window_present (priv->main_window);
115
116
}
116
117
 
117
118
static void
118
119
gcm_calib_confirm_quit_cb (GtkDialog *dialog,
119
120
                           gint response_id,
120
 
                           GcmCalibratePriv *calib)
 
121
                           GcmCalibratePriv *priv)
121
122
{
122
123
        if (response_id != GTK_RESPONSE_CLOSE) {
123
124
                gtk_widget_destroy (GTK_WIDGET (dialog));
124
125
                return;
125
126
        }
126
 
        gcm_calibrate_interaction (calib->calibrate, GTK_RESPONSE_CANCEL);
127
 
        g_application_release (G_APPLICATION (calib->application));
 
127
        gcm_calibrate_interaction (priv->calibrate, GTK_RESPONSE_CANCEL);
 
128
        g_application_release (G_APPLICATION (priv->application));
128
129
}
129
130
 
130
131
/**
131
132
 * gcm_calib_confirm_quit:
132
133
 **/
133
134
static void
134
 
gcm_calib_confirm_quit (GcmCalibratePriv *calib)
 
135
gcm_calib_confirm_quit (GcmCalibratePriv *priv)
135
136
{
136
137
        GtkWidget *dialog;
137
138
 
138
139
        /* do not ask for confirmation on the initial page */
139
 
        if (calib->current_page == GCM_CALIBRATE_PAGE_INTRO)
140
 
                g_application_release (G_APPLICATION (calib->application));
 
140
        if (priv->current_page == GCM_CALIBRATE_PAGE_INTRO)
 
141
                g_application_release (G_APPLICATION (priv->application));
141
142
 
142
 
        dialog = gtk_message_dialog_new (GTK_WINDOW (calib->main_window),
 
143
        dialog = gtk_message_dialog_new (GTK_WINDOW (priv->main_window),
143
144
                                         GTK_DIALOG_MODAL,
144
145
                                         GTK_MESSAGE_QUESTION,
145
146
                                         GTK_BUTTONS_NONE,
157
158
                               GTK_RESPONSE_CLOSE);
158
159
        g_signal_connect (dialog, "response",
159
160
                          G_CALLBACK (gcm_calib_confirm_quit_cb),
160
 
                          calib);
 
161
                          priv);
161
162
        gtk_widget_show (dialog);
162
163
}
163
164
 
165
166
 * gcm_calib_delete_event_cb:
166
167
 **/
167
168
static gboolean
168
 
gcm_calib_delete_event_cb (GtkWidget *widget, GdkEvent *event, GcmCalibratePriv *calib)
 
169
gcm_calib_delete_event_cb (GtkWidget *widget, GdkEvent *event, GcmCalibratePriv *priv)
169
170
{
170
 
        gcm_calib_confirm_quit (calib);
 
171
        gcm_calib_confirm_quit (priv);
171
172
        return FALSE;
172
173
}
173
174
 
175
176
 * gcm_calib_assistant_cancel_cb:
176
177
 **/
177
178
static void
178
 
gcm_calib_assistant_cancel_cb (GtkAssistant *assistant, GcmCalibratePriv *calib)
 
179
gcm_calib_assistant_cancel_cb (GtkAssistant *assistant, GcmCalibratePriv *priv)
179
180
{
180
 
        gcm_calib_confirm_quit (calib);
 
181
        gcm_calib_confirm_quit (priv);
181
182
}
182
183
 
183
184
/**
184
185
 * gcm_calib_assistant_close_cb:
185
186
 **/
186
187
static void
187
 
gcm_calib_assistant_close_cb (GtkAssistant *assistant, GcmCalibratePriv *calib)
 
188
gcm_calib_assistant_close_cb (GtkAssistant *assistant, GcmCalibratePriv *priv)
188
189
{
189
 
        g_application_release (G_APPLICATION (calib->application));
 
190
        g_application_release (G_APPLICATION (priv->application));
190
191
}
191
192
 
192
193
/**
193
194
 * gcm_calib_play_sound:
194
195
 **/
195
196
static void
196
 
gcm_calib_play_sound (GcmCalibratePriv *calib)
 
197
gcm_calib_play_sound (GcmCalibratePriv *priv)
197
198
{
198
199
        /* play sound from the naming spec */
199
200
        ca_context_play (ca_gtk_context_get (), 0,
210
211
 * gcm_calib_get_vbox_for_page:
211
212
 **/
212
213
static GtkWidget *
213
 
gcm_calib_get_vbox_for_page (GcmCalibratePriv *calib,
 
214
gcm_calib_get_vbox_for_page (GcmCalibratePriv *priv,
214
215
                             GcmCalibratePage page)
215
216
{
216
217
        guint i;
217
218
        GtkWidget *tmp;
218
219
        GcmCalibratePage page_tmp;
219
220
 
220
 
        for (i=0; i<calib->pages->len; i++) {
221
 
                tmp = g_ptr_array_index (calib->pages, i);
 
221
        for (i=0; i<priv->pages->len; i++) {
 
222
                tmp = g_ptr_array_index (priv->pages, i);
222
223
                page_tmp = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (tmp),
223
224
                                                                "GcmCalibrateMain::Index"));
224
225
                if (page_tmp == page)
271
272
}
272
273
 
273
274
static gboolean
274
 
gcm_calib_set_extra_metadata (GcmCalibratePriv *calib,
 
275
gcm_calib_set_extra_metadata (GcmCalibratePriv *priv,
275
276
                              const gchar *filename,
276
277
                              GError **error)
277
278
{
310
311
        _cmsDictAddEntryAscii (dict,
311
312
                               CD_PROFILE_METADATA_DATA_SOURCE,
312
313
                               CD_PROFILE_METADATA_DATA_SOURCE_CALIB);
313
 
        sensor = gcm_calibrate_get_sensor (calib->calibrate);
 
314
        sensor = gcm_calibrate_get_sensor (priv->calibrate);
314
315
        if (sensor != NULL) {
315
316
                _cmsDictAddEntryAscii (dict,
316
317
                                       CD_PROFILE_METADATA_MEASUREMENT_DEVICE,
318
319
        }
319
320
        _cmsDictAddEntryAscii (dict,
320
321
                               CD_PROFILE_METADATA_MAPPING_DEVICE_ID,
321
 
                               cd_device_get_id (calib->device));
 
322
                               cd_device_get_id (priv->device));
322
323
 
323
324
        /* add the calibration brightness if an internal panel */
324
 
        percentage = gcm_calibrate_get_screen_brightness (calib->calibrate);
 
325
        percentage = gcm_calibrate_get_screen_brightness (priv->calibrate);
325
326
        if (percentage > 0) {
326
327
                screen_brightness_str = g_strdup_printf ("%i", percentage);
327
328
                _cmsDictAddEntryAscii (dict,
356
357
        return ret;
357
358
}
358
359
 
359
 
#if CD_CHECK_VERSION(0,1,20)
360
360
/**
361
361
 * gcm_calib_set_sensor_options_cb:
362
362
 **/
377
377
                g_error_free (error);
378
378
        }
379
379
}
380
 
#endif
381
380
 
382
381
static void
383
 
gcm_calib_set_sensor_options (GcmCalibratePriv *calib,
 
382
gcm_calib_set_sensor_options (GcmCalibratePriv *priv,
384
383
                              const gchar *filename)
385
384
{
386
 
#if CD_CHECK_VERSION(0,1,20)
387
385
        CdSensor *sensor;
388
386
        gboolean ret;
389
387
        gchar *data = NULL;
393
391
        gsize len;
394
392
 
395
393
        /* get ChSensor */
396
 
        sensor = gcm_calibrate_get_sensor (calib->calibrate);
 
394
        sensor = gcm_calibrate_get_sensor (priv->calibrate);
397
395
        if (sensor == NULL)
398
396
                goto out;
399
397
 
417
415
                             g_variant_ref_sink (g_variant_new_string (sha1)));
418
416
        cd_sensor_set_options (sensor, hash, NULL,
419
417
                               gcm_calib_set_sensor_options_cb,
420
 
                               calib);
 
418
                               priv);
421
419
out:
422
420
        g_free (data);
423
421
        g_free (sha1);
424
422
        if (hash != NULL)
425
423
                g_hash_table_unref (hash);
426
 
#endif
427
424
}
428
425
 
429
426
static gboolean
432
429
        CdProfile *profile = NULL;
433
430
        const gchar *filename;
434
431
        gboolean ret;
 
432
        GcmCalibratePriv *priv = (GcmCalibratePriv *) user_data;
435
433
        GError *error = NULL;
436
434
        GFile *file = NULL;
 
435
        gint inhibit_cookie;
 
436
        GtkAssistant *assistant = GTK_ASSISTANT (priv->main_window);
437
437
        GtkWidget *vbox;
438
 
        GcmCalibratePriv *calib = (GcmCalibratePriv *) user_data;
439
 
        GtkAssistant *assistant = GTK_ASSISTANT (calib->main_window);
440
 
 
441
 
        /* actuall do the action */
442
 
        calib->started_calibration = TRUE;
443
 
        ret = gcm_calibrate_device (calib->calibrate,
444
 
                                    calib->device,
445
 
                                    calib->main_window,
 
438
 
 
439
        /* inhibit */
 
440
        inhibit_cookie = gtk_application_inhibit (priv->application,
 
441
                                                  priv->main_window,
 
442
                                                  GTK_APPLICATION_INHIBIT_LOGOUT |
 
443
                                                  GTK_APPLICATION_INHIBIT_SWITCH |
 
444
                                                  GTK_APPLICATION_INHIBIT_SUSPEND |
 
445
                                                  GTK_APPLICATION_INHIBIT_IDLE,
 
446
                                                  "Calibration in progress");
 
447
 
 
448
        /* actually do the action */
 
449
        priv->started_calibration = TRUE;
 
450
        ret = gcm_calibrate_device (priv->calibrate,
 
451
                                    priv->device,
 
452
                                    priv->main_window,
446
453
                                    &error);
447
454
        if (!ret) {
448
 
                gcm_calibrate_set_title (calib->calibrate,
 
455
                gcm_calibrate_set_title (priv->calibrate,
449
456
                                         _("Failed to calibrate"),
450
457
                                         GCM_CALIBRATE_UI_ERROR);
451
 
                gcm_calibrate_set_message (calib->calibrate,
 
458
                gcm_calibrate_set_message (priv->calibrate,
452
459
                                           error->message,
453
460
                                           GCM_CALIBRATE_UI_ERROR);
454
 
                gcm_calibrate_set_image (calib->calibrate, NULL);
 
461
                gcm_calibrate_set_image (priv->calibrate, NULL);
455
462
 
456
463
                g_warning ("failed to calibrate: %s",
457
464
                           error->message);
458
465
                g_error_free (error);
459
466
 
460
467
                /* mark this box as the end */
461
 
                vbox = gcm_calib_get_vbox_for_page (calib, GCM_CALIBRATE_PAGE_ACTION);
 
468
                vbox = gcm_calib_get_vbox_for_page (priv, GCM_CALIBRATE_PAGE_ACTION);
462
469
                gtk_assistant_set_page_type (assistant, vbox, GTK_ASSISTANT_PAGE_SUMMARY);
463
470
                gtk_assistant_set_page_complete (assistant, vbox, TRUE);
464
471
                goto out;
465
472
        }
466
473
 
467
474
        /* get profile */
468
 
        filename = gcm_calibrate_get_filename_result (calib->calibrate);
 
475
        filename = gcm_calibrate_get_filename_result (priv->calibrate);
469
476
        if (filename == NULL) {
470
477
                g_warning ("failed to get filename from calibration");
471
478
                goto out;
472
479
        }
473
480
 
474
481
        /* set some private properties */
475
 
        ret = gcm_calib_set_extra_metadata (calib, filename, &error);
 
482
        ret = gcm_calib_set_extra_metadata (priv, filename, &error);
476
483
        if (!ret) {
477
484
                g_warning ("failed to set extra metadata: %s",
478
485
                           error->message);
481
488
        }
482
489
 
483
490
        /* inform the sensor about the last successful profile */
484
 
        gcm_calib_set_sensor_options (calib, filename);
 
491
        gcm_calib_set_sensor_options (priv, filename);
485
492
 
486
493
        /* copy the ICC file to the proper location */
487
494
        file = g_file_new_for_path (filename);
488
 
        profile = cd_client_import_profile_sync (calib->client,
 
495
        profile = cd_client_import_profile_sync (priv->client,
489
496
                                                 file,
490
 
                                                 calib->cancellable,
 
497
                                                 priv->cancellable,
491
498
                                                 &error);
492
499
        if (profile == NULL) {
493
500
                g_warning ("failed to find calibration profile: %s",
495
502
                g_error_free (error);
496
503
                goto out;
497
504
        }
498
 
        ret = cd_device_add_profile_sync (calib->device,
 
505
        ret = cd_device_add_profile_sync (priv->device,
499
506
                                          CD_DEVICE_RELATION_HARD,
500
507
                                          profile,
501
 
                                          calib->cancellable,
 
508
                                          priv->cancellable,
502
509
                                          &error);
503
510
        if (!ret) {
504
511
                g_warning ("failed to add %s to %s: %s",
505
512
                           cd_profile_get_object_path (profile),
506
 
                           cd_device_get_object_path (calib->device),
 
513
                           cd_device_get_object_path (priv->device),
507
514
                           error->message);
508
515
                g_error_free (error);
509
516
                goto out;
513
520
        g_unlink (filename);
514
521
 
515
522
        /* allow forward */
516
 
        vbox = gcm_calib_get_vbox_for_page (calib,
 
523
        vbox = gcm_calib_get_vbox_for_page (priv,
517
524
                                            GCM_CALIBRATE_PAGE_ACTION);
518
525
        gtk_assistant_set_page_complete (assistant,
519
526
                                         vbox, TRUE);
522
529
        gtk_assistant_set_current_page (assistant,
523
530
                                        gtk_assistant_get_n_pages (assistant) - 1);
524
531
out:
 
532
        if (inhibit_cookie != 0) {
 
533
                gtk_application_uninhibit (priv->application,
 
534
                                           priv->inhibit_cookie);
 
535
        }
525
536
        if (profile != NULL)
526
537
                g_object_unref (profile);
527
538
        if (file != NULL)
533
544
gcm_calib_assistant_page_forward_cb (gint current_page, gpointer user_data)
534
545
{
535
546
        GtkWidget *vbox;
536
 
        GcmCalibratePriv *calib = (GcmCalibratePriv *) user_data;
 
547
        GcmCalibratePriv *priv = (GcmCalibratePriv *) user_data;
537
548
 
538
549
        /* shouldn't happen... */
539
 
        if (calib->current_page != GCM_CALIBRATE_PAGE_ACTION)
 
550
        if (priv->current_page != GCM_CALIBRATE_PAGE_ACTION)
540
551
                return current_page + 1;
541
552
 
542
 
        if (!calib->has_pending_interaction)
 
553
        if (!priv->has_pending_interaction)
543
554
                return current_page;
544
555
 
545
556
        /* continue calibration */
546
 
        gcm_calibrate_interaction (calib->calibrate, GTK_RESPONSE_OK);
547
 
        calib->has_pending_interaction = FALSE;
 
557
        gcm_calibrate_interaction (priv->calibrate, GTK_RESPONSE_OK);
 
558
        priv->has_pending_interaction = FALSE;
548
559
 
549
560
        /* no longer allow forward */
550
 
        vbox = gcm_calib_get_vbox_for_page (calib,
 
561
        vbox = gcm_calib_get_vbox_for_page (priv,
551
562
                                            GCM_CALIBRATE_PAGE_ACTION);
552
563
 
553
 
        gtk_assistant_set_page_complete (GTK_ASSISTANT (calib->main_window),
 
564
        gtk_assistant_set_page_complete (GTK_ASSISTANT (priv->main_window),
554
565
                                         vbox, FALSE);
555
566
        return current_page;
556
567
}
561
572
static gboolean
562
573
gcm_calib_assistant_prepare_cb (GtkAssistant *assistant,
563
574
                                GtkWidget *page_widget,
564
 
                                GcmCalibratePriv *calib)
 
575
                                GcmCalibratePriv *priv)
565
576
{
566
 
        calib->current_page = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (page_widget),
 
577
        priv->current_page = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (page_widget),
567
578
                                                                   "GcmCalibrateMain::Index"));
568
 
        switch (calib->current_page) {
 
579
        switch (priv->current_page) {
569
580
        case GCM_CALIBRATE_PAGE_LAST:
570
 
                gcm_calib_play_sound (calib);
 
581
                gcm_calib_play_sound (priv);
571
582
                break;
572
583
        case GCM_CALIBRATE_PAGE_ACTION:
573
584
                g_debug ("lights! camera! action!");
574
 
                if (!calib->started_calibration)
575
 
                        g_idle_add (gcm_calib_start_idle_cb, calib);
 
585
                if (!priv->started_calibration)
 
586
                        g_idle_add (gcm_calib_start_idle_cb, priv);
576
587
                break;
577
588
        default:
578
589
                break;
579
590
        }
580
591
 
581
592
        /* ensure we cancel argyllcms if the user clicks back */
582
 
        if (calib->current_page != GCM_CALIBRATE_PAGE_ACTION &&
583
 
            calib->started_calibration) {
584
 
                gcm_calibrate_interaction (calib->calibrate,
 
593
        if (priv->current_page != GCM_CALIBRATE_PAGE_ACTION &&
 
594
            priv->started_calibration) {
 
595
                gcm_calibrate_interaction (priv->calibrate,
585
596
                                           GTK_RESPONSE_CANCEL);
586
 
                calib->started_calibration = FALSE;
 
597
                priv->started_calibration = FALSE;
587
598
        }
588
599
 
589
600
        /* forward on the action page just unsticks the calibration */
590
 
        if (calib->current_page == GCM_CALIBRATE_PAGE_ACTION) {
 
601
        if (priv->current_page == GCM_CALIBRATE_PAGE_ACTION) {
591
602
                gtk_assistant_set_forward_page_func (assistant,
592
603
                                                     gcm_calib_assistant_page_forward_cb,
593
 
                                                     calib,
 
604
                                                     priv,
594
605
                                                     NULL);
595
606
        } else {
596
607
                gtk_assistant_set_forward_page_func (assistant,
598
609
        }
599
610
 
600
611
        /* use the default on each page */
601
 
        switch (calib->current_page) {
 
612
        switch (priv->current_page) {
602
613
        case GCM_CALIBRATE_PAGE_INSTALL_ARGYLLCMS:
603
614
        case GCM_CALIBRATE_PAGE_SENSOR:
604
615
        case GCM_CALIBRATE_PAGE_ACTION:
614
625
 * gcm_calib_add_page_title:
615
626
 **/
616
627
static GtkWidget *
617
 
gcm_calib_add_page_title (GcmCalibratePriv *calib, const gchar *text)
 
628
gcm_calib_add_page_title (GcmCalibratePriv *priv, const gchar *text)
618
629
{
619
630
        GtkWidget *label;
620
631
        GtkWidget *hbox;
640
651
static gboolean
641
652
gcm_calib_label_activate_link_cb (GtkLabel *label,
642
653
                                  gchar *uri,
643
 
                                  GcmCalibratePriv *calib)
 
654
                                  GcmCalibratePriv *priv)
644
655
{
645
656
        gboolean ret;
646
657
        GError *error = NULL;
694
705
 * gcm_calib_setup_page_intro:
695
706
 **/
696
707
static void
697
 
gcm_calib_setup_page_intro (GcmCalibratePriv *calib)
 
708
gcm_calib_setup_page_intro (GcmCalibratePriv *priv)
698
709
{
699
710
        GtkWidget *vbox;
700
711
        GtkWidget *content;
701
 
        GtkAssistant *assistant = GTK_ASSISTANT (calib->main_window);
 
712
        GtkAssistant *assistant = GTK_ASSISTANT (priv->main_window);
702
713
 
703
714
        /* TRANSLATORS: this is intro page text */
704
 
        switch (calib->device_kind) {
 
715
        switch (priv->device_kind) {
705
716
        case CD_DEVICE_KIND_CAMERA:
706
717
        case CD_DEVICE_KIND_WEBCAM:
707
718
                /* TRANSLATORS: this is the page title */
708
 
                vbox = gcm_calib_add_page_title (calib, _("Calibrate your camera"));
 
719
                vbox = gcm_calib_add_page_title (priv, _("Calibrate your camera"));
709
720
                break;
710
721
        case CD_DEVICE_KIND_DISPLAY:
711
722
                /* TRANSLATORS: this is the page title */
712
 
                vbox = gcm_calib_add_page_title (calib, _("Calibrate your display"));
 
723
                vbox = gcm_calib_add_page_title (priv, _("Calibrate your display"));
713
724
                break;
714
725
        case CD_DEVICE_KIND_PRINTER:
715
726
                /* TRANSLATORS: this is the page title */
716
 
                vbox = gcm_calib_add_page_title (calib, _("Calibrate your printer"));
 
727
                vbox = gcm_calib_add_page_title (priv, _("Calibrate your printer"));
717
728
                break;
718
729
        default:
719
730
                /* TRANSLATORS: this is the page title */
720
 
                vbox = gcm_calib_add_page_title (calib, _("Calibrate your device"));
 
731
                vbox = gcm_calib_add_page_title (priv, _("Calibrate your device"));
721
732
                break;
722
733
        }
723
734
 
726
737
        gtk_box_pack_start (GTK_BOX (vbox), content, FALSE, FALSE, 0);
727
738
 
728
739
        /* TRANSLATORS: this is intro page text */
729
 
        switch (calib->device_kind) {
 
740
        switch (priv->device_kind) {
730
741
        case CD_DEVICE_KIND_DISPLAY:
731
742
                /* TRANSLATORS: this is the final intro page text */
732
743
                gcm_calib_add_page_para (content, _("Any existing screen correction will be temporarily turned off and the brightness set to maximum."));
744
755
        /* TRANSLATORS: this is the calibration wizard page title */
745
756
        gtk_assistant_set_page_title (assistant, vbox, _("Introduction"));
746
757
        gtk_assistant_set_page_complete (assistant, vbox, FALSE);
747
 
        g_ptr_array_add (calib->pages, vbox);
 
758
        g_ptr_array_add (priv->pages, vbox);
748
759
        g_object_set_data (G_OBJECT (vbox),
749
760
                           "GcmCalibrateMain::Index",
750
761
                           GUINT_TO_POINTER (GCM_CALIBRATE_PAGE_INTRO));
783
794
 **/
784
795
static void
785
796
gcm_calib_show_profile_button_clicked_cb (GtkButton *button,
786
 
                                          GcmCalibratePriv *calib)
 
797
                                          GcmCalibratePriv *priv)
787
798
{
788
799
        gboolean ret;
789
800
        gchar *command_line;
807
818
 * gcm_calib_get_show_profile_button:
808
819
 **/
809
820
static GtkWidget *
810
 
gcm_calib_get_show_profile_button (GcmCalibratePriv *calib)
 
821
gcm_calib_get_show_profile_button (GcmCalibratePriv *priv)
811
822
{
812
823
        GtkStyleContext *context;
813
824
        GtkWidget *button;
832
843
        gtk_widget_set_tooltip_text (button, _("Click here to show the profile"));
833
844
        g_signal_connect (button, "clicked",
834
845
                          G_CALLBACK (gcm_calib_show_profile_button_clicked_cb),
835
 
                          calib);
 
846
                          priv);
836
847
        gtk_container_set_border_width (GTK_CONTAINER (vbox), 15);
837
848
        gtk_widget_set_halign (button, GTK_ALIGN_CENTER);
838
849
        gtk_widget_show_all (button);
843
854
 * gcm_calib_setup_page_summary:
844
855
 **/
845
856
static void
846
 
gcm_calib_setup_page_summary (GcmCalibratePriv *calib)
 
857
gcm_calib_setup_page_summary (GcmCalibratePriv *priv)
847
858
{
848
859
        gboolean ret;
849
860
        GtkWidget *vbox;
850
861
        GtkWidget *content;
851
862
        GtkWidget *image;
852
 
        GtkAssistant *assistant = GTK_ASSISTANT (calib->main_window);
 
863
        GtkAssistant *assistant = GTK_ASSISTANT (priv->main_window);
853
864
 
854
865
        /* TRANSLATORS: this is the page title */
855
 
        vbox = gcm_calib_add_page_title (calib, _("All done!"));
 
866
        vbox = gcm_calib_add_page_title (priv, _("All done!"));
856
867
 
857
868
        /* main contents */
858
869
        content = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
859
870
        gtk_box_pack_start (GTK_BOX (vbox), content, FALSE, FALSE, 0);
860
871
 
861
 
        switch (calib->device_kind) {
 
872
        switch (priv->device_kind) {
862
873
        case CD_DEVICE_KIND_CAMERA:
863
874
        case CD_DEVICE_KIND_WEBCAM:
864
875
                /* TRANSLATORS: this is the final summary */
879
890
        }
880
891
 
881
892
        /* only display the backlink if not launched from the control center itself */
882
 
        if (calib->xid == 0) {
 
893
        if (priv->xid == 0) {
883
894
                /* TRANSLATORS: this is the final summary */
884
895
                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>."));
885
896
        }
888
899
        ret = gcm_calibrate_is_livecd ();
889
900
        if (ret) {
890
901
                /* show button to copy profile */
891
 
                image = gcm_calib_get_show_profile_button (calib);
 
902
                image = gcm_calib_get_show_profile_button (priv);
892
903
                gtk_box_pack_start (GTK_BOX (content), image, FALSE, FALSE, 30);
893
904
                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."));
894
905
        } else {
904
915
        /* TRANSLATORS: this is the calibration wizard page title */
905
916
        gtk_assistant_set_page_title (assistant, vbox, _("Summary"));
906
917
        gtk_assistant_set_page_complete (assistant, vbox, FALSE);
907
 
        g_ptr_array_add (calib->pages, vbox);
 
918
        g_ptr_array_add (priv->pages, vbox);
908
919
        g_object_set_data (G_OBJECT (vbox),
909
920
                           "GcmCalibrateMain::Index",
910
921
                           GUINT_TO_POINTER (GCM_CALIBRATE_PAGE_LAST));
917
928
 * gcm_calib_setup_page_action:
918
929
 **/
919
930
static void
920
 
gcm_calib_setup_page_action (GcmCalibratePriv *calib)
 
931
gcm_calib_setup_page_action (GcmCalibratePriv *priv)
921
932
{
922
933
        GtkWidget *vbox;
923
934
        GtkWidget *content;
924
935
        GList *list;
925
936
        GList *list2;
926
 
        GtkAssistant *assistant = GTK_ASSISTANT (calib->main_window);
 
937
        GtkAssistant *assistant = GTK_ASSISTANT (priv->main_window);
927
938
 
928
939
        /* TRANSLATORS: this is the page title */
929
 
        vbox = gcm_calib_add_page_title (calib, _("Performing calibration"));
 
940
        vbox = gcm_calib_add_page_title (priv, _("Performing calibration"));
930
941
 
931
942
        /* grab title */
932
943
        list = gtk_container_get_children (GTK_CONTAINER (vbox));
933
944
        list2 = gtk_container_get_children (GTK_CONTAINER (list->data));
934
 
        calib->action_title = list2->data;
 
945
        priv->action_title = list2->data;
935
946
        g_list_free (list);
936
947
        g_list_free (list2);
937
948
 
939
950
        content = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
940
951
        gtk_box_pack_start (GTK_BOX (vbox), content, FALSE, FALSE, 0);
941
952
 
942
 
        calib->action_message = gcm_calib_add_page_para (content, _("Calibration is about to start"));
 
953
        priv->action_message = gcm_calib_add_page_para (content, _("Calibration is about to start"));
943
954
 
944
955
        /* add image for success */
945
 
        calib->action_image = gtk_image_new ();
946
 
        gtk_image_set_from_icon_name (GTK_IMAGE (calib->action_image), "face-frown", GTK_ICON_SIZE_DIALOG);
947
 
        gtk_box_pack_start (GTK_BOX (content), calib->action_image, FALSE, FALSE, 0);
 
956
        priv->action_image = gtk_image_new ();
 
957
        gtk_image_set_from_icon_name (GTK_IMAGE (priv->action_image), "face-frown", GTK_ICON_SIZE_DIALOG);
 
958
        gtk_box_pack_start (GTK_BOX (content), priv->action_image, FALSE, FALSE, 0);
948
959
 
949
960
        /* add progress marker */
950
 
        calib->action_progress = gtk_progress_bar_new ();
951
 
        gtk_box_pack_start (GTK_BOX (content), calib->action_progress, FALSE, FALSE, 0);
 
961
        priv->action_progress = gtk_progress_bar_new ();
 
962
        gtk_box_pack_start (GTK_BOX (content), priv->action_progress, FALSE, FALSE, 0);
952
963
 
953
964
        /* add content widget */
954
 
        gcm_calibrate_set_content_widget (calib->calibrate, vbox);
 
965
        gcm_calibrate_set_content_widget (priv->calibrate, vbox);
955
966
 
956
967
        /* add to assistant */
957
968
        gtk_assistant_append_page (assistant, vbox);
959
970
        /* TRANSLATORS: this is the calibration wizard page title */
960
971
        gtk_assistant_set_page_title (assistant, vbox, _("Action"));
961
972
        gtk_assistant_set_page_complete (assistant, vbox, FALSE);
962
 
        g_ptr_array_add (calib->pages, vbox);
 
973
        g_ptr_array_add (priv->pages, vbox);
963
974
        g_object_set_data (G_OBJECT (vbox),
964
975
                           "GcmCalibrateMain::Index",
965
976
                           GUINT_TO_POINTER (GCM_CALIBRATE_PAGE_ACTION));
966
977
 
967
978
        /* show page */
968
979
        gtk_widget_show_all (vbox);
969
 
        gtk_widget_hide (calib->action_image);
 
980
        gtk_widget_hide (priv->action_image);
970
981
}
971
982
 
972
983
/**
973
984
 * gcm_calib_setup_page_display_configure_wait:
974
985
 **/
975
986
static void
976
 
gcm_calib_setup_page_display_configure_wait (GcmCalibratePriv *calib)
 
987
gcm_calib_setup_page_display_configure_wait (GcmCalibratePriv *priv)
977
988
{
978
989
        GtkWidget *vbox;
979
990
        GtkWidget *content;
980
 
        GtkAssistant *assistant = GTK_ASSISTANT (calib->main_window);
 
991
        GtkAssistant *assistant = GTK_ASSISTANT (priv->main_window);
981
992
 
982
993
        /* TRANSLATORS: dialog message, preface */
983
 
        vbox = gcm_calib_add_page_title (calib, _("Calibration checklist"));
 
994
        vbox = gcm_calib_add_page_title (priv, _("Calibration checklist"));
984
995
 
985
996
        /* main contents */
986
997
        content = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
1018
1029
        /* TRANSLATORS: this is the calibration wizard page title */
1019
1030
        gtk_assistant_set_page_title (assistant, vbox, _("Check Settings"));
1020
1031
        gtk_assistant_set_page_complete (assistant, vbox, FALSE);
1021
 
        g_ptr_array_add (calib->pages, vbox);
 
1032
        g_ptr_array_add (priv->pages, vbox);
1022
1033
        g_object_set_data (G_OBJECT (vbox),
1023
1034
                           "GcmCalibrateMain::Index",
1024
1035
                           GUINT_TO_POINTER (GCM_CALIBRATE_PAGE_DISPLAY_CONFIG));
1031
1042
 * gcm_calib_button_clicked_install_argyllcms_cb:
1032
1043
 **/
1033
1044
static void
1034
 
gcm_calib_button_clicked_install_argyllcms_cb (GtkButton *button, GcmCalibratePriv *calib)
 
1045
gcm_calib_button_clicked_install_argyllcms_cb (GtkButton *button, GcmCalibratePriv *priv)
1035
1046
{
1036
1047
        gboolean ret;
1037
1048
        GtkWidget *vbox;
1038
 
        GtkAssistant *assistant = GTK_ASSISTANT (calib->main_window);
 
1049
        GtkAssistant *assistant = GTK_ASSISTANT (priv->main_window);
1039
1050
 
1040
1051
        ret = gcm_utils_install_package (GCM_PREFS_PACKAGE_NAME_ARGYLLCMS,
1041
 
                                         calib->main_window);
 
1052
                                         priv->main_window);
1042
1053
        /* we can continue now */
1043
1054
        if (TRUE || ret) {
1044
 
                vbox = gcm_calib_get_vbox_for_page (calib,
 
1055
                vbox = gcm_calib_get_vbox_for_page (priv,
1045
1056
                                                    GCM_CALIBRATE_PAGE_INSTALL_ARGYLLCMS);
1046
1057
                gtk_assistant_set_page_complete (assistant, vbox, TRUE);
1047
1058
                gtk_assistant_next_page (assistant);
1055
1066
 * gcm_calib_setup_page_install_argyllcms:
1056
1067
 **/
1057
1068
static void
1058
 
gcm_calib_setup_page_install_argyllcms (GcmCalibratePriv *calib)
 
1069
gcm_calib_setup_page_install_argyllcms (GcmCalibratePriv *priv)
1059
1070
{
1060
1071
        GtkWidget *vbox;
1061
1072
        GtkWidget *content;
1062
1073
        GtkWidget *button;
1063
1074
        GString *string;
1064
 
        GtkAssistant *assistant = GTK_ASSISTANT (calib->main_window);
 
1075
        GtkAssistant *assistant = GTK_ASSISTANT (priv->main_window);
1065
1076
 
1066
1077
        string = g_string_new ("");
1067
1078
 
1073
1084
                                _("These tools are required to build color profiles for devices."));
1074
1085
 
1075
1086
        /* TRANSLATORS: this is the page title */
1076
 
        vbox = gcm_calib_add_page_title (calib, _("More software is required!"));
 
1087
        vbox = gcm_calib_add_page_title (priv, _("More software is required!"));
1077
1088
 
1078
1089
        /* main contents */
1079
1090
        content = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
1085
1096
        button = gtk_button_new_with_label (_("Install required software"));
1086
1097
        g_signal_connect (button, "clicked",
1087
1098
                          G_CALLBACK (gcm_calib_button_clicked_install_argyllcms_cb),
1088
 
                          calib);
 
1099
                          priv);
1089
1100
        gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
1090
1101
 
1091
1102
        /* add to assistant */
1094
1105
        /* TRANSLATORS: this is the calibration wizard page title */
1095
1106
        gtk_assistant_set_page_title (assistant, vbox, _("Install Tools"));
1096
1107
        gtk_assistant_set_page_complete (assistant, vbox, FALSE);
1097
 
        g_ptr_array_add (calib->pages, vbox);
 
1108
        g_ptr_array_add (priv->pages, vbox);
1098
1109
        g_object_set_data (G_OBJECT (vbox),
1099
1110
                           "GcmCalibrateMain::Index",
1100
1111
                           GUINT_TO_POINTER (GCM_CALIBRATE_PAGE_INSTALL_ARGYLLCMS));
1108
1119
 * gcm_calib_button_clicked_install_targets_cb:
1109
1120
 **/
1110
1121
static void
1111
 
gcm_calib_button_clicked_install_targets_cb (GtkButton *button, GcmCalibratePriv *calib)
 
1122
gcm_calib_button_clicked_install_targets_cb (GtkButton *button, GcmCalibratePriv *priv)
1112
1123
{
1113
1124
        gboolean ret;
1114
1125
        GtkWidget *vbox;
1115
 
        GtkAssistant *assistant = GTK_ASSISTANT (calib->main_window);
 
1126
        GtkAssistant *assistant = GTK_ASSISTANT (priv->main_window);
1116
1127
 
1117
1128
        ret = gcm_utils_install_package (GCM_PREFS_PACKAGE_NAME_SHARED_COLOR_TARGETS,
1118
 
                                         calib->main_window);
 
1129
                                         priv->main_window);
1119
1130
        /* we can continue now */
1120
1131
        if (ret) {
1121
 
                vbox = gcm_calib_get_vbox_for_page (calib,
 
1132
                vbox = gcm_calib_get_vbox_for_page (priv,
1122
1133
                                                    GCM_CALIBRATE_PAGE_INSTALL_TARGETS);
1123
1134
                gtk_assistant_next_page (assistant);
1124
1135
 
1131
1142
 * gcm_calib_setup_page_install_targets:
1132
1143
 **/
1133
1144
static void
1134
 
gcm_calib_setup_page_install_targets (GcmCalibratePriv *calib)
 
1145
gcm_calib_setup_page_install_targets (GcmCalibratePriv *priv)
1135
1146
{
1136
1147
        GtkWidget *vbox;
1137
1148
        GtkWidget *content;
1138
1149
        GtkWidget *button;
1139
1150
        GString *string;
1140
 
        GtkAssistant *assistant = GTK_ASSISTANT (calib->main_window);
 
1151
        GtkAssistant *assistant = GTK_ASSISTANT (priv->main_window);
1141
1152
 
1142
1153
        string = g_string_new ("");
1143
1154
 
1151
1162
        g_string_append_printf (string, "%s", _("If you already have the correct file, you can skip this step."));
1152
1163
 
1153
1164
        /* TRANSLATORS: this is the page title */
1154
 
        vbox = gcm_calib_add_page_title (calib, _("Optional data files available"));
 
1165
        vbox = gcm_calib_add_page_title (priv, _("Optional data files available"));
1155
1166
 
1156
1167
        /* main contents */
1157
1168
        content = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
1163
1174
        button = gtk_button_new_with_label (_("Install Now"));
1164
1175
        g_signal_connect (button, "clicked",
1165
1176
                          G_CALLBACK (gcm_calib_button_clicked_install_targets_cb),
1166
 
                          calib);
 
1177
                          priv);
1167
1178
        gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
1168
1179
 
1169
1180
        /* add to assistant */
1172
1183
        gtk_assistant_set_page_complete (assistant, vbox, FALSE);
1173
1184
        /* TRANSLATORS: this is the calibration wizard page title */
1174
1185
        gtk_assistant_set_page_title (assistant, vbox, _("Install Targets"));
1175
 
        g_ptr_array_add (calib->pages, vbox);
 
1186
        g_ptr_array_add (priv->pages, vbox);
1176
1187
        g_object_set_data (G_OBJECT (vbox),
1177
1188
                           "GcmCalibrateMain::Index",
1178
1189
                           GUINT_TO_POINTER (GCM_CALIBRATE_PAGE_INSTALL_TARGETS));
1266
1277
 **/
1267
1278
static void
1268
1279
gcm_calib_reference_kind_combobox_cb (GtkComboBox *combo_box,
1269
 
                                      GcmCalibratePriv *calib)
 
1280
                                      GcmCalibratePriv *priv)
1270
1281
{
1271
1282
        const gchar *filename;
1272
1283
        gchar *path;
1274
1285
 
1275
1286
        /* not sorted so we can just use the index */
1276
1287
        reference_kind = gtk_combo_box_get_active (GTK_COMBO_BOX (combo_box));
1277
 
        g_object_set (calib->calibrate,
 
1288
        g_object_set (priv->calibrate,
1278
1289
                      "reference-kind", reference_kind,
1279
1290
                      NULL);
1280
1291
        filename = gcm_calib_reference_kind_to_image_filename (reference_kind);
1284
1295
                filename = "unknown.png";
1285
1296
 
1286
1297
        path = g_build_filename (GCM_DATA, "targets", filename, NULL);
1287
 
        gtk_image_set_from_file (GTK_IMAGE (calib->reference_preview), path);
 
1298
        gtk_image_set_from_file (GTK_IMAGE (priv->reference_preview), path);
1288
1299
        g_free (path);
1289
1300
}
1290
1301
 
1292
1303
 * gcm_calib_setup_page_target_kind:
1293
1304
 **/
1294
1305
static void
1295
 
gcm_calib_setup_page_target_kind (GcmCalibratePriv *calib)
 
1306
gcm_calib_setup_page_target_kind (GcmCalibratePriv *priv)
1296
1307
{
1297
1308
        GtkWidget *vbox;
1298
1309
        GtkWidget *content;
1299
1310
        GtkWidget *combo;
1300
1311
        GString *string;
1301
1312
        guint i;
1302
 
        GtkAssistant *assistant = GTK_ASSISTANT (calib->main_window);
 
1313
        GtkAssistant *assistant = GTK_ASSISTANT (priv->main_window);
1303
1314
 
1304
1315
        string = g_string_new ("");
1305
1316
 
1308
1319
        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."));
1309
1320
 
1310
1321
        /* scanner specific options */
1311
 
        if (calib->device_kind == CD_DEVICE_KIND_SCANNER) {
 
1322
        if (priv->device_kind == CD_DEVICE_KIND_SCANNER) {
1312
1323
                /* TRANSLATORS: dialog message, preface */
1313
1324
                g_string_append_printf (string, "%s\n", _("Ensure that the contrast and brightness are not changed and color correction profiles have not been applied."));
1314
1325
 
1317
1328
        }
1318
1329
 
1319
1330
        /* camera specific options */
1320
 
        if (calib->device_kind == CD_DEVICE_KIND_CAMERA) {
 
1331
        if (priv->device_kind == CD_DEVICE_KIND_CAMERA) {
1321
1332
                /* TRANSLATORS: dialog message, preface */
1322
1333
                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."));
1323
1334
        }
1326
1337
        g_string_append_printf (string, "\n%s", _("Please select the calibration target type."));
1327
1338
 
1328
1339
        /* TRANSLATORS: this is the page title */
1329
 
        vbox = gcm_calib_add_page_title (calib, _("What target type do you have?"));
 
1340
        vbox = gcm_calib_add_page_title (priv, _("What target type do you have?"));
1330
1341
 
1331
1342
        /* main contents */
1332
1343
        content = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
1336
1347
        gcm_calib_add_page_para (content, string->str);
1337
1348
 
1338
1349
        /* pack in a preview image */
1339
 
        calib->reference_preview = gtk_image_new ();
1340
 
        gtk_box_pack_start (GTK_BOX (vbox), calib->reference_preview, FALSE, FALSE, 0);
 
1350
        priv->reference_preview = gtk_image_new ();
 
1351
        gtk_box_pack_start (GTK_BOX (vbox), priv->reference_preview, FALSE, FALSE, 0);
1341
1352
 
1342
1353
        combo = gtk_combo_box_text_new ();
1343
1354
        for (i=0; i<GCM_CALIBRATE_REFERENCE_KIND_UNKNOWN; i++) {
1346
1357
        }
1347
1358
        g_signal_connect (combo, "changed",
1348
1359
                          G_CALLBACK (gcm_calib_reference_kind_combobox_cb),
1349
 
                          calib);
 
1360
                          priv);
1350
1361
 
1351
1362
        /* use IT8 by default */
1352
1363
        gtk_combo_box_set_active (GTK_COMBO_BOX (combo), GCM_CALIBRATE_REFERENCE_KIND_IT8);
1359
1370
        gtk_assistant_set_page_complete (assistant, vbox, FALSE);
1360
1371
        /* TRANSLATORS: this is the calibration wizard page title */
1361
1372
        gtk_assistant_set_page_title (assistant, vbox, _("Select Target"));
1362
 
        g_ptr_array_add (calib->pages, vbox);
 
1373
        g_ptr_array_add (priv->pages, vbox);
1363
1374
        g_object_set_data (G_OBJECT (vbox),
1364
1375
                           "GcmCalibrateMain::Index",
1365
1376
                           GUINT_TO_POINTER (GCM_CALIBRATE_PAGE_TARGET_KIND));
1371
1382
 
1372
1383
static void
1373
1384
gcm_calib_display_kind_toggled_cb (GtkToggleButton *togglebutton,
1374
 
                                   GcmCalibratePriv *calib)
 
1385
                                   GcmCalibratePriv *priv)
1375
1386
{
1376
1387
        GcmCalibrateDisplayKind  display_kind;
1377
1388
 
1379
1390
                return;
1380
1391
        display_kind = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (togglebutton),
1381
1392
                                                            "GcmCalib::display-kind"));
1382
 
        g_object_set (calib->calibrate,
 
1393
        g_object_set (priv->calibrate,
1383
1394
                      "display-kind", display_kind,
1384
1395
                      NULL);
1385
1396
}
1388
1399
 * gcm_calib_setup_page_display_kind:
1389
1400
 **/
1390
1401
static void
1391
 
gcm_calib_setup_page_display_kind (GcmCalibratePriv *calib)
 
1402
gcm_calib_setup_page_display_kind (GcmCalibratePriv *priv)
1392
1403
{
1393
1404
        GtkWidget *vbox;
1394
1405
        GtkWidget *content;
1395
1406
        GtkWidget *widget;
1396
1407
        GSList *list;
1397
 
        GtkAssistant *assistant = GTK_ASSISTANT (calib->main_window);
 
1408
        GtkAssistant *assistant = GTK_ASSISTANT (priv->main_window);
1398
1409
 
1399
1410
        /* TRANSLATORS: this is the page title */
1400
 
        vbox = gcm_calib_add_page_title (calib, _("Choose your display type"));
 
1411
        vbox = gcm_calib_add_page_title (priv, _("Choose your display type"));
1401
1412
 
1402
1413
        /* main contents */
1403
1414
        content = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
1411
1422
                           "GcmCalib::display-kind",
1412
1423
                           GUINT_TO_POINTER (GCM_CALIBRATE_DEVICE_KIND_LCD));
1413
1424
        g_signal_connect (widget, "toggled",
1414
 
                          G_CALLBACK (gcm_calib_display_kind_toggled_cb), calib);
 
1425
                          G_CALLBACK (gcm_calib_display_kind_toggled_cb), priv);
1415
1426
        gtk_box_pack_start (GTK_BOX (content), widget, FALSE, FALSE, 0);
1416
1427
 
1417
1428
        list = gtk_radio_button_get_group (GTK_RADIO_BUTTON (widget));
1420
1431
                           "GcmCalib::display-kind",
1421
1432
                           GUINT_TO_POINTER (GCM_CALIBRATE_DEVICE_KIND_CRT));
1422
1433
        g_signal_connect (widget, "toggled",
1423
 
                          G_CALLBACK (gcm_calib_display_kind_toggled_cb), calib);
 
1434
                          G_CALLBACK (gcm_calib_display_kind_toggled_cb), priv);
1424
1435
        gtk_box_pack_start (GTK_BOX (content), widget, FALSE, FALSE, 0);
1425
1436
 
1426
1437
        list = gtk_radio_button_get_group (GTK_RADIO_BUTTON (widget));
1429
1440
                           "GcmCalib::display-kind",
1430
1441
                           GUINT_TO_POINTER (GCM_CALIBRATE_DEVICE_KIND_CRT));
1431
1442
        g_signal_connect (widget, "toggled",
1432
 
                          G_CALLBACK (gcm_calib_display_kind_toggled_cb), calib);
 
1443
                          G_CALLBACK (gcm_calib_display_kind_toggled_cb), priv);
1433
1444
        gtk_box_pack_start (GTK_BOX (content), widget, FALSE, FALSE, 0);
1434
1445
 
1435
1446
        list = gtk_radio_button_get_group (GTK_RADIO_BUTTON (widget));
1438
1449
                           "GcmCalib::display-kind",
1439
1450
                           GUINT_TO_POINTER (GCM_CALIBRATE_DEVICE_KIND_PROJECTOR));
1440
1451
        g_signal_connect (widget, "toggled",
1441
 
                          G_CALLBACK (gcm_calib_display_kind_toggled_cb), calib);
 
1452
                          G_CALLBACK (gcm_calib_display_kind_toggled_cb), priv);
1442
1453
        gtk_box_pack_start (GTK_BOX (content), widget, FALSE, FALSE, 0);
1443
1454
 
1444
1455
        /* add to assistant */
1447
1458
        /* TRANSLATORS: this is the calibration wizard page title */
1448
1459
        gtk_assistant_set_page_title (assistant, vbox, _("Choose Display Type"));
1449
1460
        gtk_assistant_set_page_complete (assistant, vbox, FALSE);
1450
 
        g_ptr_array_add (calib->pages, vbox);
 
1461
        g_ptr_array_add (priv->pages, vbox);
1451
1462
        g_object_set_data (G_OBJECT (vbox),
1452
1463
                           "GcmCalibrateMain::Index",
1453
1464
                           GUINT_TO_POINTER (GCM_CALIBRATE_PAGE_DISPLAY_KIND));
1458
1469
 
1459
1470
static void
1460
1471
gcm_calib_display_temp_toggled_cb (GtkToggleButton *togglebutton,
1461
 
                                   GcmCalibratePriv *calib)
 
1472
                                   GcmCalibratePriv *priv)
1462
1473
{
1463
1474
        guint display_temp;
1464
1475
        if (!gtk_toggle_button_get_active (togglebutton))
1465
1476
                return;
1466
1477
        display_temp = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (togglebutton),
1467
1478
                                                            "GcmCalib::display-temp"));
1468
 
        g_object_set (calib->calibrate,
 
1479
        g_object_set (priv->calibrate,
1469
1480
                      "target-whitepoint", display_temp,
1470
1481
                      NULL);
1471
1482
}
1474
1485
 * gcm_calib_setup_page_display_temp:
1475
1486
 **/
1476
1487
static void
1477
 
gcm_calib_setup_page_display_temp (GcmCalibratePriv *calib)
 
1488
gcm_calib_setup_page_display_temp (GcmCalibratePriv *priv)
1478
1489
{
1479
1490
        GtkWidget *vbox;
1480
1491
        GtkWidget *content;
1481
1492
        GtkWidget *widget;
1482
1493
        GSList *list;
1483
 
        GtkAssistant *assistant = GTK_ASSISTANT (calib->main_window);
 
1494
        GtkAssistant *assistant = GTK_ASSISTANT (priv->main_window);
1484
1495
 
1485
1496
        /* TRANSLATORS: this is the page title */
1486
 
        vbox = gcm_calib_add_page_title (calib, _("Choose your display target white point"));
 
1497
        vbox = gcm_calib_add_page_title (priv, _("Choose your display target white point"));
1487
1498
 
1488
1499
        /* main contents */
1489
1500
        content = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
1497
1508
                           "GcmCalib::display-temp",
1498
1509
                           GUINT_TO_POINTER (5000));
1499
1510
        g_signal_connect (widget, "toggled",
1500
 
                          G_CALLBACK (gcm_calib_display_temp_toggled_cb), calib);
 
1511
                          G_CALLBACK (gcm_calib_display_temp_toggled_cb), priv);
1501
1512
        gtk_box_pack_start (GTK_BOX (content), widget, FALSE, FALSE, 0);
1502
1513
 
1503
1514
        list = gtk_radio_button_get_group (GTK_RADIO_BUTTON (widget));
1506
1517
                           "GcmCalib::display-temp",
1507
1518
                           GUINT_TO_POINTER (5500));
1508
1519
        g_signal_connect (widget, "toggled",
1509
 
                          G_CALLBACK (gcm_calib_display_temp_toggled_cb), calib);
 
1520
                          G_CALLBACK (gcm_calib_display_temp_toggled_cb), priv);
1510
1521
        gtk_box_pack_start (GTK_BOX (content), widget, FALSE, FALSE, 0);
1511
1522
 
1512
1523
        list = gtk_radio_button_get_group (GTK_RADIO_BUTTON (widget));
1515
1526
                           "GcmCalib::display-temp",
1516
1527
                           GUINT_TO_POINTER (6500));
1517
1528
        g_signal_connect (widget, "toggled",
1518
 
                          G_CALLBACK (gcm_calib_display_temp_toggled_cb), calib);
 
1529
                          G_CALLBACK (gcm_calib_display_temp_toggled_cb), priv);
1519
1530
        gtk_box_pack_start (GTK_BOX (content), widget, FALSE, FALSE, 0);
1520
1531
        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE);
1521
1532
 
1525
1536
                           "GcmCalib::display-temp",
1526
1537
                           GUINT_TO_POINTER (7500));
1527
1538
        g_signal_connect (widget, "toggled",
1528
 
                          G_CALLBACK (gcm_calib_display_temp_toggled_cb), calib);
 
1539
                          G_CALLBACK (gcm_calib_display_temp_toggled_cb), priv);
1529
1540
        gtk_box_pack_start (GTK_BOX (content), widget, FALSE, FALSE, 0);
1530
1541
 
1531
1542
        list = gtk_radio_button_get_group (GTK_RADIO_BUTTON (widget));
1534
1545
                           "GcmCalib::display-temp",
1535
1546
                           GUINT_TO_POINTER (0));
1536
1547
        g_signal_connect (widget, "toggled",
1537
 
                          G_CALLBACK (gcm_calib_display_temp_toggled_cb), calib);
 
1548
                          G_CALLBACK (gcm_calib_display_temp_toggled_cb), priv);
1538
1549
        gtk_box_pack_start (GTK_BOX (content), widget, FALSE, FALSE, 0);
1539
1550
 
1540
1551
        /* add to assistant */
1543
1554
        /* TRANSLATORS: this is the calibration wizard page title */
1544
1555
        gtk_assistant_set_page_title (assistant, vbox, _("Choose Display Whitepoint"));
1545
1556
        gtk_assistant_set_page_complete (assistant, vbox, FALSE);
1546
 
        g_ptr_array_add (calib->pages, vbox);
 
1557
        g_ptr_array_add (priv->pages, vbox);
1547
1558
        g_object_set_data (G_OBJECT (vbox),
1548
1559
                           "GcmCalibrateMain::Index",
1549
1560
                           GUINT_TO_POINTER (GCM_CALIBRATE_PAGE_DISPLAY_TEMPERATURE));
1554
1565
 
1555
1566
static void
1556
1567
gcm_calib_print_kind_toggled_cb (GtkToggleButton *togglebutton,
1557
 
                                   GcmCalibratePriv *calib)
 
1568
                                   GcmCalibratePriv *priv)
1558
1569
{
1559
1570
        GcmCalibratePrintKind print_kind;
1560
1571
        if (!gtk_toggle_button_get_active (togglebutton))
1561
1572
                return;
1562
1573
        print_kind = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (togglebutton),
1563
1574
                                                          "GcmCalib::print-kind"));
1564
 
        g_object_set (calib->calibrate,
 
1575
        g_object_set (priv->calibrate,
1565
1576
                      "print-kind", print_kind,
1566
1577
                      NULL);
1567
1578
}
1570
1581
 * gcm_calib_setup_page_print_kind:
1571
1582
 **/
1572
1583
static void
1573
 
gcm_calib_setup_page_print_kind (GcmCalibratePriv *calib)
 
1584
gcm_calib_setup_page_print_kind (GcmCalibratePriv *priv)
1574
1585
{
1575
1586
        GtkWidget *vbox;
1576
1587
        GtkWidget *content;
1577
1588
        GtkWidget *widget;
1578
1589
        GSList *list;
1579
 
        GtkAssistant *assistant = GTK_ASSISTANT (calib->main_window);
 
1590
        GtkAssistant *assistant = GTK_ASSISTANT (priv->main_window);
1580
1591
 
1581
1592
        /* TRANSLATORS: this is the page title */
1582
 
        vbox = gcm_calib_add_page_title (calib, _("Choose profiling mode"));
 
1593
        vbox = gcm_calib_add_page_title (priv, _("Choose profiling mode"));
1583
1594
 
1584
1595
        /* main contents */
1585
1596
        content = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
1593
1604
                           "GcmCalib::print-kind",
1594
1605
                           GUINT_TO_POINTER (GCM_CALIBRATE_PRINT_KIND_LOCAL));
1595
1606
        g_signal_connect (widget, "toggled",
1596
 
                          G_CALLBACK (gcm_calib_print_kind_toggled_cb), calib);
 
1607
                          G_CALLBACK (gcm_calib_print_kind_toggled_cb), priv);
1597
1608
        gtk_box_pack_start (GTK_BOX (content), widget, FALSE, FALSE, 0);
1598
1609
 
1599
1610
        list = gtk_radio_button_get_group (GTK_RADIO_BUTTON (widget));
1602
1613
                           "GcmCalib::print-kind",
1603
1614
                           GUINT_TO_POINTER (GCM_CALIBRATE_PRINT_KIND_GENERATE));
1604
1615
        g_signal_connect (widget, "toggled",
1605
 
                          G_CALLBACK (gcm_calib_print_kind_toggled_cb), calib);
 
1616
                          G_CALLBACK (gcm_calib_print_kind_toggled_cb), priv);
1606
1617
        gtk_box_pack_start (GTK_BOX (content), widget, FALSE, FALSE, 0);
1607
1618
 
1608
1619
        list = gtk_radio_button_get_group (GTK_RADIO_BUTTON (widget));
1611
1622
                           "GcmCalib::print-kind",
1612
1623
                           GUINT_TO_POINTER (GCM_CALIBRATE_PRINT_KIND_ANALYZE));
1613
1624
        g_signal_connect (widget, "toggled",
1614
 
                          G_CALLBACK (gcm_calib_print_kind_toggled_cb), calib);
 
1625
                          G_CALLBACK (gcm_calib_print_kind_toggled_cb), priv);
1615
1626
        gtk_box_pack_start (GTK_BOX (content), widget, FALSE, FALSE, 0);
1616
1627
 
1617
1628
        /* sync the default */
1618
 
        g_object_set (calib->calibrate,
 
1629
        g_object_set (priv->calibrate,
1619
1630
                      "print-kind", GCM_CALIBRATE_PRINT_KIND_LOCAL,
1620
1631
                      NULL);
1621
1632
 
1625
1636
        /* TRANSLATORS: this is the calibration wizard page title */
1626
1637
        gtk_assistant_set_page_title (assistant, vbox, _("Calibration Mode"));
1627
1638
        gtk_assistant_set_page_complete (assistant, vbox, FALSE);
1628
 
        g_ptr_array_add (calib->pages, vbox);
 
1639
        g_ptr_array_add (priv->pages, vbox);
1629
1640
        g_object_set_data (G_OBJECT (vbox),
1630
1641
                           "GcmCalibrateMain::Index",
1631
1642
                           GUINT_TO_POINTER (GCM_CALIBRATE_PAGE_PRINT_KIND));
1636
1647
 
1637
1648
static void
1638
1649
gcm_calib_precision_toggled_cb (GtkToggleButton *togglebutton,
1639
 
                                GcmCalibratePriv *calib)
 
1650
                                GcmCalibratePriv *priv)
1640
1651
{
1641
1652
        GcmCalibratePrecision precision;
1642
1653
        if (!gtk_toggle_button_get_active (togglebutton))
1643
1654
                return;
1644
1655
        precision = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (togglebutton),
1645
1656
                                                         "GcmCalib::precision"));
1646
 
        g_object_set (calib->calibrate,
 
1657
        g_object_set (priv->calibrate,
1647
1658
                      "precision", precision,
1648
1659
                      NULL);
1649
1660
}
1652
1663
 * gcm_calib_setup_page_precision:
1653
1664
 **/
1654
1665
static void
1655
 
gcm_calib_setup_page_precision (GcmCalibratePriv *calib)
 
1666
gcm_calib_setup_page_precision (GcmCalibratePriv *priv)
1656
1667
{
1657
1668
        GtkWidget *vbox;
1658
1669
        GtkWidget *content;
1660
1671
        GSList *list;
1661
1672
        GString *labels[3];
1662
1673
        guint i;
1663
 
        guint values_printer[] = { 20, 10, 4}; /* sheets */
1664
 
        guint values_display[] = { 20, 10, 4}; /* minutes */
1665
 
        GtkAssistant *assistant = GTK_ASSISTANT (calib->main_window);
 
1674
        guint values_printer[] = { 6, 4, 2}; /* sheets */
 
1675
        guint values_display[] = { 30, 20, 10}; /* minutes */
 
1676
        GtkAssistant *assistant = GTK_ASSISTANT (priv->main_window);
1666
1677
 
1667
1678
        /* TRANSLATORS: this is the page title */
1668
 
        vbox = gcm_calib_add_page_title (calib, _("Choose calibration quality"));
 
1679
        vbox = gcm_calib_add_page_title (priv, _("Choose calibration quality"));
1669
1680
 
1670
1681
        /* main contents */
1671
1682
        content = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
1682
1693
        g_string_append_printf (string, "\n%s", _("For a typical workflow, a normal precision profile is sufficient."));
1683
1694
 
1684
1695
        /* printer specific options */
1685
 
        if (calib->device_kind == CD_DEVICE_KIND_PRINTER) {
 
1696
        if (priv->device_kind == CD_DEVICE_KIND_PRINTER) {
1686
1697
                /* TRANSLATORS: dialog message, preface */
1687
1698
                g_string_append_printf (string, "\n%s", _("The high precision profile also requires more paper and printer ink."));
1688
1699
        }
1692
1703
        labels[0] = g_string_new (_("Accurate"));
1693
1704
        labels[1] = g_string_new (_("Normal"));
1694
1705
        labels[2] = g_string_new (_("Quick"));
1695
 
        switch (calib->device_kind) {
 
1706
        switch (priv->device_kind) {
1696
1707
        case CD_DEVICE_KIND_PRINTER:
1697
1708
                for (i=0; i<3; i++) {
1698
1709
                        g_string_append (labels[i], " ");
1724
1735
                           "GcmCalib::precision",
1725
1736
                           GUINT_TO_POINTER (GCM_CALIBRATE_PRECISION_LONG));
1726
1737
        g_signal_connect (widget, "toggled",
1727
 
                          G_CALLBACK (gcm_calib_precision_toggled_cb), calib);
 
1738
                          G_CALLBACK (gcm_calib_precision_toggled_cb), priv);
1728
1739
        gtk_box_pack_start (GTK_BOX (content), widget, FALSE, FALSE, 0);
1729
1740
 
1730
1741
        list = gtk_radio_button_get_group (GTK_RADIO_BUTTON (widget));
1733
1744
                           "GcmCalib::precision",
1734
1745
                           GUINT_TO_POINTER (GCM_CALIBRATE_PRECISION_NORMAL));
1735
1746
        g_signal_connect (widget, "toggled",
1736
 
                          G_CALLBACK (gcm_calib_precision_toggled_cb), calib);
 
1747
                          G_CALLBACK (gcm_calib_precision_toggled_cb), priv);
1737
1748
        gtk_box_pack_start (GTK_BOX (content), widget, FALSE, FALSE, 0);
1738
1749
        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE);
1739
1750
 
1743
1754
                           "GcmCalib::precision",
1744
1755
                           GUINT_TO_POINTER (GCM_CALIBRATE_PRECISION_SHORT));
1745
1756
        g_signal_connect (widget, "toggled",
1746
 
                          G_CALLBACK (gcm_calib_precision_toggled_cb), calib);
 
1757
                          G_CALLBACK (gcm_calib_precision_toggled_cb), priv);
1747
1758
        gtk_box_pack_start (GTK_BOX (content), widget, FALSE, FALSE, 0);
1748
1759
 
1749
1760
        /* add to assistant */
1752
1763
        /* TRANSLATORS: this is the calibration wizard page title */
1753
1764
        gtk_assistant_set_page_title (assistant, vbox, _("Calibration Quality"));
1754
1765
        gtk_assistant_set_page_complete (assistant, vbox, FALSE);
1755
 
        g_ptr_array_add (calib->pages, vbox);
 
1766
        g_ptr_array_add (priv->pages, vbox);
1756
1767
        g_object_set_data (G_OBJECT (vbox),
1757
1768
                           "GcmCalibrateMain::Index",
1758
1769
                           GUINT_TO_POINTER (GCM_CALIBRATE_PAGE_PRECISION));
1766
1777
 
1767
1778
static void
1768
1779
gcm_calib_text_changed_cb (GtkEntry *entry,
1769
 
                           GcmCalibratePriv *calib)
 
1780
                           GcmCalibratePriv *priv)
1770
1781
{
1771
 
        g_object_set (calib->calibrate,
 
1782
        g_object_set (priv->calibrate,
1772
1783
                      "description", gtk_entry_get_text (entry),
1773
1784
                      NULL);
1774
1785
}
1777
1788
 * gcm_calib_setup_page_profile_title:
1778
1789
 **/
1779
1790
static void
1780
 
gcm_calib_setup_page_profile_title (GcmCalibratePriv *calib)
 
1791
gcm_calib_setup_page_profile_title (GcmCalibratePriv *priv)
1781
1792
{
1782
1793
        GtkWidget *vbox;
1783
1794
        GtkWidget *content;
1784
1795
        GtkWidget *widget;
1785
1796
        gchar *tmp = NULL;
1786
 
        GtkAssistant *assistant = GTK_ASSISTANT (calib->main_window);
 
1797
        GtkAssistant *assistant = GTK_ASSISTANT (priv->main_window);
1787
1798
 
1788
1799
        /* TRANSLATORS: this is the page title */
1789
 
        vbox = gcm_calib_add_page_title (calib, _("Profile title"));
 
1800
        vbox = gcm_calib_add_page_title (priv, _("Profile title"));
1790
1801
 
1791
1802
        /* main contents */
1792
1803
        content = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
1800
1811
        gtk_entry_set_max_length (GTK_ENTRY (widget), 128);
1801
1812
 
1802
1813
        /* set the current title */
1803
 
        g_object_get (calib->calibrate,
 
1814
        g_object_get (priv->calibrate,
1804
1815
                      "description", &tmp,
1805
1816
                      NULL);
1806
1817
        gtk_entry_set_text (GTK_ENTRY (widget), tmp);
1808
1819
 
1809
1820
        /* watch for changes */
1810
1821
        g_signal_connect (GTK_EDITABLE (widget), "changed",
1811
 
                          G_CALLBACK (gcm_calib_text_changed_cb), calib);
 
1822
                          G_CALLBACK (gcm_calib_text_changed_cb), priv);
1812
1823
 
1813
1824
        /* add to assistant */
1814
1825
        gtk_assistant_append_page (assistant, vbox);
1816
1827
        /* TRANSLATORS: this is the calibration wizard page title */
1817
1828
        gtk_assistant_set_page_title (assistant, vbox, _("Profile Title"));
1818
1829
        gtk_assistant_set_page_complete (assistant, vbox, TRUE);
1819
 
        g_ptr_array_add (calib->pages, vbox);
 
1830
        g_ptr_array_add (priv->pages, vbox);
1820
1831
        g_object_set_data (G_OBJECT (vbox),
1821
1832
                           "GcmCalibrateMain::Index",
1822
1833
                           GUINT_TO_POINTER (GCM_CALIBRATE_PAGE_TITLE));
1829
1840
 * gcm_calib_setup_page_sensor:
1830
1841
 **/
1831
1842
static void
1832
 
gcm_calib_setup_page_sensor (GcmCalibratePriv *calib)
 
1843
gcm_calib_setup_page_sensor (GcmCalibratePriv *priv)
1833
1844
{
1834
1845
        GtkWidget *vbox;
1835
1846
        GtkWidget *content;
1836
 
        GtkAssistant *assistant = GTK_ASSISTANT (calib->main_window);
 
1847
        GtkAssistant *assistant = GTK_ASSISTANT (priv->main_window);
1837
1848
 
1838
1849
        /* TRANSLATORS: this is the page title */
1839
 
        vbox = gcm_calib_add_page_title (calib, _("Insert sensor hardware"));
 
1850
        vbox = gcm_calib_add_page_title (priv, _("Insert sensor hardware"));
1840
1851
 
1841
1852
        /* main contents */
1842
1853
        content = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
1851
1862
        /* TRANSLATORS: this is the calibration wizard page title */
1852
1863
        gtk_assistant_set_page_title (assistant, vbox, _("Sensor Check"));
1853
1864
        gtk_assistant_set_page_complete (assistant, vbox, FALSE);
1854
 
        g_ptr_array_add (calib->pages, vbox);
 
1865
        g_ptr_array_add (priv->pages, vbox);
1855
1866
        g_object_set_data (G_OBJECT (vbox),
1856
1867
                           "GcmCalibrateMain::Index",
1857
1868
                           GUINT_TO_POINTER (GCM_CALIBRATE_PAGE_SENSOR));
1864
1875
 * gcm_calib_setup_page_failure:
1865
1876
 **/
1866
1877
static void
1867
 
gcm_calib_setup_page_failure (GcmCalibratePriv *calib)
 
1878
gcm_calib_setup_page_failure (GcmCalibratePriv *priv)
1868
1879
{
1869
1880
        GtkWidget *vbox;
1870
1881
        GtkWidget *content;
1871
 
        GtkAssistant *assistant = GTK_ASSISTANT (calib->main_window);
 
1882
        GtkAssistant *assistant = GTK_ASSISTANT (priv->main_window);
1872
1883
 
1873
1884
        /* TRANSLATORS: this is the page title */
1874
 
        vbox = gcm_calib_add_page_title (calib, _("Failed to calibrate"));
 
1885
        vbox = gcm_calib_add_page_title (priv, _("Failed to calibrate"));
1875
1886
 
1876
1887
        /* main contents */
1877
1888
        content = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
1886
1897
        /* TRANSLATORS: this is the calibration wizard page title */
1887
1898
        gtk_assistant_set_page_title (assistant, vbox, _("Summary"));
1888
1899
        gtk_assistant_set_page_complete (assistant, vbox, TRUE);
1889
 
        g_ptr_array_add (calib->pages, vbox);
 
1900
        g_ptr_array_add (priv->pages, vbox);
1890
1901
        g_object_set_data (G_OBJECT (vbox),
1891
1902
                           "GcmCalibrateMain::Index",
1892
1903
                           GUINT_TO_POINTER (GCM_CALIBRATE_PAGE_FAILURE));
1899
1910
 * gcm_calib_got_sensor:
1900
1911
 **/
1901
1912
static void
1902
 
gcm_calib_got_sensor (GcmCalibratePriv *calib, CdSensor *sensor)
 
1913
gcm_calib_got_sensor (GcmCalibratePriv *priv, CdSensor *sensor)
1903
1914
{
1904
1915
        gboolean is_lowend = FALSE;
1905
1916
        gboolean ret;
1914
1925
                g_error_free (error);
1915
1926
                goto out;
1916
1927
        }
1917
 
        gcm_calibrate_set_sensor (calib->calibrate, sensor);
 
1928
        gcm_calibrate_set_sensor (priv->calibrate, sensor);
1918
1929
 
1919
1930
        /* hide the prompt for the user to insert a sensor */
1920
 
        vbox = gcm_calib_get_vbox_for_page (calib,
 
1931
        vbox = gcm_calib_get_vbox_for_page (priv,
1921
1932
                                            GCM_CALIBRATE_PAGE_SENSOR);
1922
1933
        gtk_widget_hide (vbox);
1923
1934
 
1927
1938
        if (cd_sensor_get_kind (sensor) == CD_SENSOR_KIND_COLORHUG) {
1928
1939
                is_lowend = TRUE;
1929
1940
        }
1930
 
        if (calib->device_kind == CD_DEVICE_KIND_DISPLAY) {
1931
 
                vbox = gcm_calib_get_vbox_for_page (calib,
 
1941
        if (priv->device_kind == CD_DEVICE_KIND_DISPLAY) {
 
1942
                vbox = gcm_calib_get_vbox_for_page (priv,
1932
1943
                                                    GCM_CALIBRATE_PAGE_DISPLAY_TEMPERATURE);
1933
1944
                gtk_widget_set_visible (vbox, !is_lowend);
1934
1945
        }
1946
1957
{
1947
1958
        CdClient *client = CD_CLIENT (object);
1948
1959
        CdSensor *sensor_tmp;
1949
 
        GcmCalibratePriv *calib = (GcmCalibratePriv *) user_data;
 
1960
        GcmCalibratePriv *priv = (GcmCalibratePriv *) user_data;
1950
1961
        GError *error = NULL;
1951
1962
        GPtrArray *sensors;
1952
1963
 
1962
1973
        /* we've got a sensor */
1963
1974
        if (sensors->len != 0) {
1964
1975
                sensor_tmp = g_ptr_array_index (sensors, 0);
1965
 
                gcm_calib_got_sensor (calib, sensor_tmp);
 
1976
                gcm_calib_got_sensor (priv, sensor_tmp);
1966
1977
        }
1967
1978
out:
1968
1979
        if (sensors != NULL)
1973
1984
 * gcm_calib_add_pages:
1974
1985
 **/
1975
1986
static void
1976
 
gcm_calib_add_pages (GcmCalibratePriv *calib)
 
1987
gcm_calib_add_pages (GcmCalibratePriv *priv)
1977
1988
{
1978
1989
        gboolean ret;
1979
1990
        const gchar *xrandr_name;
1980
1991
 
1981
1992
        /* device not found */
1982
 
        if (calib->device_kind == CD_DEVICE_KIND_UNKNOWN) {
1983
 
                gcm_calib_setup_page_failure (calib);
1984
 
                gtk_widget_show_all (GTK_WIDGET (calib->main_window));
 
1993
        if (priv->device_kind == CD_DEVICE_KIND_UNKNOWN) {
 
1994
                gcm_calib_setup_page_failure (priv);
 
1995
                gtk_widget_show_all (GTK_WIDGET (priv->main_window));
1985
1996
                return;
1986
1997
        }
1987
1998
 
1988
 
        gcm_calib_setup_page_intro (calib);
 
1999
        gcm_calib_setup_page_intro (priv);
1989
2000
 
1990
 
        if (calib->device_kind == CD_DEVICE_KIND_DISPLAY ||
1991
 
            calib->device_kind == CD_DEVICE_KIND_PRINTER)
1992
 
                gcm_calib_setup_page_sensor (calib);
 
2001
        if (priv->device_kind == CD_DEVICE_KIND_DISPLAY ||
 
2002
            priv->device_kind == CD_DEVICE_KIND_PRINTER)
 
2003
                gcm_calib_setup_page_sensor (priv);
1993
2004
 
1994
2005
        /* find whether argyllcms is installed using a tool which should exist */
1995
 
        ret = gcm_calibrate_get_enabled (calib->calibrate);
 
2006
        ret = gcm_calibrate_get_enabled (priv->calibrate);
1996
2007
        if (!ret)
1997
 
                gcm_calib_setup_page_install_argyllcms (calib);
 
2008
                gcm_calib_setup_page_install_argyllcms (priv);
1998
2009
 
1999
 
        xrandr_name = cd_device_get_metadata_item (calib->device,
 
2010
        xrandr_name = cd_device_get_metadata_item (priv->device,
2000
2011
                                                   CD_DEVICE_METADATA_XRANDR_NAME);
2001
2012
        if (xrandr_name != NULL)
2002
 
                calib->internal_lcd = gcm_utils_output_is_lcd_internal (xrandr_name);
2003
 
        if (!calib->internal_lcd && calib->device_kind == CD_DEVICE_KIND_DISPLAY)
2004
 
                gcm_calib_setup_page_display_configure_wait (calib);
2005
 
 
2006
 
        gcm_calib_setup_page_precision (calib);
2007
 
 
2008
 
        if (calib->device_kind == CD_DEVICE_KIND_DISPLAY) {
2009
 
                if (!calib->internal_lcd) {
2010
 
                        gcm_calib_setup_page_display_kind (calib);
 
2013
                priv->internal_lcd = gcm_utils_output_is_lcd_internal (xrandr_name);
 
2014
        if (!priv->internal_lcd && priv->device_kind == CD_DEVICE_KIND_DISPLAY)
 
2015
                gcm_calib_setup_page_display_configure_wait (priv);
 
2016
 
 
2017
        gcm_calib_setup_page_precision (priv);
 
2018
 
 
2019
        if (priv->device_kind == CD_DEVICE_KIND_DISPLAY) {
 
2020
                if (!priv->internal_lcd) {
 
2021
                        gcm_calib_setup_page_display_kind (priv);
2011
2022
                } else {
2012
 
                        g_object_set (calib->calibrate,
 
2023
                        g_object_set (priv->calibrate,
2013
2024
                                      "display-kind", GCM_CALIBRATE_DEVICE_KIND_LCD,
2014
2025
                                      NULL);
2015
2026
                }
2016
 
                gcm_calib_setup_page_display_temp (calib);
2017
 
        } else if (calib->device_kind == CD_DEVICE_KIND_PRINTER) {
2018
 
                gcm_calib_setup_page_print_kind (calib);
 
2027
                gcm_calib_setup_page_display_temp (priv);
 
2028
        } else if (priv->device_kind == CD_DEVICE_KIND_PRINTER) {
 
2029
                gcm_calib_setup_page_print_kind (priv);
2019
2030
        } else {
2020
 
                gcm_calib_setup_page_target_kind (calib);
 
2031
                gcm_calib_setup_page_target_kind (priv);
2021
2032
                ret = g_file_test ("/usr/share/shared-color-targets", G_FILE_TEST_IS_DIR);
2022
 
                if (!ret) 
2023
 
                        gcm_calib_setup_page_install_targets (calib);
 
2033
                if (!ret)
 
2034
                        gcm_calib_setup_page_install_targets (priv);
2024
2035
        }
2025
2036
 
2026
 
        gcm_calib_setup_page_profile_title (calib);
2027
 
        gcm_calib_setup_page_action (calib);
 
2037
        gcm_calib_setup_page_profile_title (priv);
 
2038
        gcm_calib_setup_page_action (priv);
2028
2039
 
2029
 
        gcm_calib_setup_page_summary (calib);
 
2040
        gcm_calib_setup_page_summary (priv);
2030
2041
 
2031
2042
        /* see if we can hide the sensor check */
2032
 
        cd_client_get_sensors (calib->client,
 
2043
        cd_client_get_sensors (priv->client,
2033
2044
                               NULL,
2034
2045
                               gcm_calib_get_sensors_cb,
2035
 
                               calib);
 
2046
                               priv);
2036
2047
}
2037
2048
 
2038
2049
/**
2039
2050
 * gcm_calib_sensor_added_cb:
2040
2051
 **/
2041
2052
static void
2042
 
gcm_calib_sensor_added_cb (CdClient *client, CdSensor *sensor, GcmCalibratePriv *calib)
 
2053
gcm_calib_sensor_added_cb (CdClient *client, CdSensor *sensor, GcmCalibratePriv *priv)
2043
2054
{
2044
2055
        g_debug ("sensor inserted");
2045
 
        gcm_calib_got_sensor (calib, sensor);
2046
 
        gtk_assistant_next_page (GTK_ASSISTANT (calib->main_window));
 
2056
        gcm_calib_got_sensor (priv, sensor);
 
2057
        gtk_assistant_next_page (GTK_ASSISTANT (priv->main_window));
2047
2058
}
2048
2059
 
2049
2060
/**
2050
2061
 * gcm_calib_startup_cb:
2051
2062
 **/
2052
2063
static void
2053
 
gcm_calib_startup_cb (GApplication *application, GcmCalibratePriv *calib)
 
2064
gcm_calib_startup_cb (GApplication *application, GcmCalibratePriv *priv)
2054
2065
{
2055
2066
        const gint window_width  = 640;
2056
2067
        const gint window_height = 440;
2070
2081
                                           GCM_DATA G_DIR_SEPARATOR_S "icons");
2071
2082
 
2072
2083
        /* connect to colord */
2073
 
        calib->client = cd_client_new ();
2074
 
        g_signal_connect (calib->client, "sensor-added",
2075
 
                          G_CALLBACK (gcm_calib_sensor_added_cb), calib);
2076
 
        ret = cd_client_connect_sync (calib->client,
 
2084
        priv->client = cd_client_new ();
 
2085
        g_signal_connect (priv->client, "sensor-added",
 
2086
                          G_CALLBACK (gcm_calib_sensor_added_cb), priv);
 
2087
        ret = cd_client_connect_sync (priv->client,
2077
2088
                                      NULL,
2078
2089
                                      &error);
2079
2090
        if (!ret) {
2084
2095
        }
2085
2096
 
2086
2097
        /* show main UI */
2087
 
        calib->main_window = GTK_WINDOW (gtk_assistant_new ());
2088
 
        gtk_window_set_default_size (calib->main_window, window_width, window_height);
2089
 
        gtk_window_set_resizable (calib->main_window, TRUE);
2090
 
        gtk_window_set_title (calib->main_window, "");
2091
 
        gtk_container_set_border_width (GTK_CONTAINER (calib->main_window), 12);
2092
 
        g_signal_connect (calib->main_window, "delete_event",
2093
 
                          G_CALLBACK (gcm_calib_delete_event_cb), calib);
2094
 
        g_signal_connect (calib->main_window, "close",
2095
 
                          G_CALLBACK (gcm_calib_assistant_close_cb), calib);
2096
 
        g_signal_connect (calib->main_window, "cancel",
2097
 
                          G_CALLBACK (gcm_calib_assistant_cancel_cb), calib);
2098
 
        g_signal_connect (calib->main_window, "prepare",
2099
 
                          G_CALLBACK (gcm_calib_assistant_prepare_cb), calib);
2100
 
        gtk_application_add_window (calib->application,
2101
 
                                    calib->main_window);
 
2098
        priv->main_window = GTK_WINDOW (gtk_assistant_new ());
 
2099
        gtk_window_set_default_size (priv->main_window, window_width, window_height);
 
2100
        gtk_window_set_resizable (priv->main_window, TRUE);
 
2101
        gtk_window_set_title (priv->main_window, "");
 
2102
        gtk_container_set_border_width (GTK_CONTAINER (priv->main_window), 12);
 
2103
        g_signal_connect (priv->main_window, "delete_event",
 
2104
                          G_CALLBACK (gcm_calib_delete_event_cb), priv);
 
2105
        g_signal_connect (priv->main_window, "close",
 
2106
                          G_CALLBACK (gcm_calib_assistant_close_cb), priv);
 
2107
        g_signal_connect (priv->main_window, "cancel",
 
2108
                          G_CALLBACK (gcm_calib_assistant_cancel_cb), priv);
 
2109
        g_signal_connect (priv->main_window, "prepare",
 
2110
                          G_CALLBACK (gcm_calib_assistant_prepare_cb), priv);
 
2111
        gtk_application_add_window (priv->application,
 
2112
                                    priv->main_window);
2102
2113
 
2103
2114
        /* set the parent window if it is specified */
2104
 
        if (calib->xid != 0) {
2105
 
                g_debug ("Setting xid %i", calib->xid);
2106
 
                gcm_window_set_parent_xid (GTK_WINDOW (calib->main_window), calib->xid);
 
2115
        if (priv->xid != 0) {
 
2116
                g_debug ("Setting xid %i", priv->xid);
 
2117
                gcm_window_set_parent_xid (GTK_WINDOW (priv->main_window), priv->xid);
2107
2118
        }
2108
2119
 
2109
2120
        /* select a specific profile only */
2110
 
        calib->device = cd_client_find_device_sync (calib->client,
2111
 
                                                    calib->device_id,
 
2121
        priv->device = cd_client_find_device_sync (priv->client,
 
2122
                                                    priv->device_id,
2112
2123
                                                    NULL,
2113
2124
                                                    &error);
2114
 
        if (calib->device == NULL) {
 
2125
        if (priv->device == NULL) {
2115
2126
                g_warning ("failed to get device %s: %s",
2116
 
                           calib->device_id,
 
2127
                           priv->device_id,
2117
2128
                           error->message);
2118
2129
                g_error_free (error);
2119
2130
                goto out;
2120
2131
        }
2121
2132
 
2122
2133
        /* connect to the device */
2123
 
        ret = cd_device_connect_sync (calib->device,
 
2134
        ret = cd_device_connect_sync (priv->device,
2124
2135
                                      NULL,
2125
2136
                                      &error);
2126
2137
        if (!ret) {
2131
2142
        }
2132
2143
 
2133
2144
        /* get the device properties */
2134
 
        calib->device_kind = cd_device_get_kind (calib->device);
 
2145
        priv->device_kind = cd_device_get_kind (priv->device);
2135
2146
 
2136
2147
        /* for display calibration move the window to lower right area to
2137
2148
         * limit argyll from obscuring the window (too much) */
2138
 
        if (calib->device_kind == CD_DEVICE_KIND_DISPLAY) {
2139
 
                gtk_window_set_gravity (calib->main_window, GDK_GRAVITY_SOUTH_EAST);
2140
 
                gtk_window_move (calib->main_window, gdk_screen_width()  - window_width,
 
2149
        if (priv->device_kind == CD_DEVICE_KIND_DISPLAY) {
 
2150
                gtk_window_set_gravity (priv->main_window, GDK_GRAVITY_SOUTH_EAST);
 
2151
                gtk_window_move (priv->main_window, gdk_screen_width()  - window_width,
2141
2152
                                                     gdk_screen_height() - window_height);
2142
2153
        }
2143
2154
 
2144
2155
        /* set, with fallbacks */
2145
 
        serial = cd_device_get_serial (calib->device);
 
2156
        serial = cd_device_get_serial (priv->device);
2146
2157
        if (serial == NULL) {
2147
2158
                /* TRANSLATORS: this is saved in the profile */
2148
2159
                serial = _("Unknown serial");
2149
2160
        }
2150
 
        model = cd_device_get_model (calib->device);
 
2161
        model = cd_device_get_model (priv->device);
2151
2162
        if (model == NULL) {
2152
2163
                /* TRANSLATORS: this is saved in the profile */
2153
2164
                model = _("Unknown model");
2154
2165
        }
2155
 
        description = cd_device_get_model (calib->device);
 
2166
        description = cd_device_get_model (priv->device);
2156
2167
        if (description == NULL) {
2157
2168
                /* TRANSLATORS: this is saved in the profile */
2158
2169
                description = _("Unknown description");
2159
2170
        }
2160
 
        manufacturer = cd_device_get_vendor (calib->device);
 
2171
        manufacturer = cd_device_get_vendor (priv->device);
2161
2172
        if (manufacturer == NULL) {
2162
2173
                /* TRANSLATORS: this is saved in the profile */
2163
2174
                manufacturer = _("Unknown manufacturer");
2172
2183
                                     g_get_real_name ());
2173
2184
 
2174
2185
        /* set the proper values */
2175
 
        g_object_set (calib->calibrate,
2176
 
                      "device-kind", calib->device_kind,
 
2186
        g_object_set (priv->calibrate,
 
2187
                      "device-kind", priv->device_kind,
2177
2188
                      "model", model,
2178
2189
                      "description", description,
2179
2190
                      "manufacturer", manufacturer,
2182
2193
                      NULL);
2183
2194
 
2184
2195
        /* display specific properties */
2185
 
        if (calib->device_kind == CD_DEVICE_KIND_DISPLAY) {
2186
 
                native_device = cd_device_get_metadata_item (calib->device,
 
2196
        if (priv->device_kind == CD_DEVICE_KIND_DISPLAY) {
 
2197
                native_device = cd_device_get_metadata_item (priv->device,
2187
2198
                                                             CD_DEVICE_METADATA_XRANDR_NAME);
2188
2199
                if (native_device == NULL) {
2189
2200
                        g_warning ("failed to get output");
2190
2201
                        goto out;
2191
2202
                }
2192
 
                g_object_set (calib->calibrate,
 
2203
                g_object_set (priv->calibrate,
2193
2204
                              "output-name", native_device,
2194
2205
                              NULL);
2195
2206
        }
2196
2207
out:
2197
2208
        /* add different pages depending on the device kind */
2198
 
        gcm_calib_add_pages (calib);
2199
 
        gtk_assistant_set_current_page (GTK_ASSISTANT (calib->main_window), 0);
 
2209
        gcm_calib_add_pages (priv);
 
2210
        gtk_assistant_set_current_page (GTK_ASSISTANT (priv->main_window), 0);
2200
2211
        if (dt != NULL)
2201
2212
                g_date_time_unref (dt);
2202
2213
        g_free (copyright);
2205
2216
static void
2206
2217
gcm_calib_title_changed_cb (GcmCalibrate *calibrate,
2207
2218
                            const gchar *title,
2208
 
                            GcmCalibratePriv *calib)
 
2219
                            GcmCalibratePriv *priv)
2209
2220
{
2210
2221
        gchar *markup;
2211
2222
 
2212
2223
        markup = g_strdup_printf ("<span size=\"large\" font_weight=\"bold\">%s</span>", title);
2213
 
        gtk_label_set_markup (GTK_LABEL (calib->action_title), markup);
 
2224
        gtk_label_set_markup (GTK_LABEL (priv->action_title), markup);
2214
2225
        g_free (markup);
2215
2226
}
2216
2227
 
2217
2228
static void
2218
2229
gcm_calib_message_changed_cb (GcmCalibrate *calibrate,
2219
2230
                              const gchar *title,
2220
 
                              GcmCalibratePriv *calib)
 
2231
                              GcmCalibratePriv *priv)
2221
2232
{
2222
 
        gtk_label_set_label (GTK_LABEL (calib->action_message), title);
 
2233
        gtk_label_set_label (GTK_LABEL (priv->action_message), title);
2223
2234
}
2224
2235
 
2225
2236
static void
2226
2237
gcm_calib_progress_changed_cb (GcmCalibrate *calibrate,
2227
2238
                               guint percentage,
2228
 
                               GcmCalibratePriv *calib)
 
2239
                               GcmCalibratePriv *priv)
2229
2240
{
2230
 
        gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (calib->action_progress),
 
2241
        gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (priv->action_progress),
2231
2242
                                       percentage / 100.0f);
2232
2243
}
2233
2244
 
2234
2245
static void
2235
2246
gcm_calib_image_changed_cb (GcmCalibrate *calibrate,
2236
2247
                            const gchar *filename,
2237
 
                            GcmCalibratePriv *calib)
 
2248
                            GcmCalibratePriv *priv)
2238
2249
{
2239
2250
        gchar *path;
2240
2251
        GdkPixbuf *pixbuf;
2246
2257
                if (pixbuf == NULL) {
2247
2258
                        g_warning ("failed to load image: %s", error->message);
2248
2259
                        g_error_free (error);
2249
 
                        gtk_widget_hide (calib->action_image);
 
2260
                        gtk_widget_hide (priv->action_image);
2250
2261
                } else {
2251
 
                        gtk_image_set_from_pixbuf (GTK_IMAGE (calib->action_image), pixbuf);
2252
 
                        gtk_widget_show (calib->action_image);
 
2262
                        gtk_image_set_from_pixbuf (GTK_IMAGE (priv->action_image), pixbuf);
 
2263
                        gtk_widget_show (priv->action_image);
2253
2264
                }
2254
2265
                g_free (path);
2255
2266
        } else {
2256
 
                gtk_widget_hide (calib->action_image);
 
2267
                gtk_widget_hide (priv->action_image);
2257
2268
        }
2258
2269
}
2259
2270
 
2260
2271
static void
2261
2272
gcm_calib_interaction_required_cb (GcmCalibrate *calibrate,
2262
2273
                                   const gchar *button_text,
2263
 
                                   GcmCalibratePriv *calib)
 
2274
                                   GcmCalibratePriv *priv)
2264
2275
{
2265
2276
        GtkWidget *vbox;
2266
 
        vbox = gcm_calib_get_vbox_for_page (calib,
 
2277
        vbox = gcm_calib_get_vbox_for_page (priv,
2267
2278
                                            GCM_CALIBRATE_PAGE_ACTION);
2268
 
        gtk_assistant_set_page_complete (GTK_ASSISTANT (calib->main_window),
 
2279
        gtk_assistant_set_page_complete (GTK_ASSISTANT (priv->main_window),
2269
2280
                                         vbox, TRUE);
2270
 
        calib->has_pending_interaction = TRUE;
 
2281
        priv->has_pending_interaction = TRUE;
2271
2282
}
2272
2283
 
2273
2284
/**
2277
2288
main (int argc, char **argv)
2278
2289
{
2279
2290
        gchar *device_id = NULL;
2280
 
        GcmCalibratePriv *calib;
 
2291
        GcmCalibratePriv *priv;
2281
2292
        GOptionContext *context;
2282
2293
        guint xid = 0;
2283
2294
        int status = 0;
2307
2318
        g_option_context_parse (context, &argc, &argv, NULL);
2308
2319
        g_option_context_free (context);
2309
2320
 
2310
 
        calib = g_new0 (GcmCalibratePriv, 1);
2311
 
        calib->pages = g_ptr_array_new ();
2312
 
        calib->xid = xid;
2313
 
        calib->device_id = device_id;
2314
 
        calib->calibrate = gcm_calibrate_argyll_new ();
2315
 
        g_object_set (calib->calibrate,
 
2321
        priv = g_new0 (GcmCalibratePriv, 1);
 
2322
        priv->pages = g_ptr_array_new ();
 
2323
        priv->xid = xid;
 
2324
        priv->device_id = device_id;
 
2325
        priv->calibrate = gcm_calibrate_argyll_new ();
 
2326
        g_object_set (priv->calibrate,
2316
2327
                      "precision", GCM_CALIBRATE_PRECISION_LONG,
2317
2328
                      NULL);
2318
 
        calib->device_kind = CD_DEVICE_KIND_UNKNOWN;
2319
 
        g_signal_connect (calib->calibrate, "title-changed",
2320
 
                          G_CALLBACK (gcm_calib_title_changed_cb), calib);
2321
 
        g_signal_connect (calib->calibrate, "message-changed",
2322
 
                          G_CALLBACK (gcm_calib_message_changed_cb), calib);
2323
 
        g_signal_connect (calib->calibrate, "image-changed",
2324
 
                          G_CALLBACK (gcm_calib_image_changed_cb), calib);
2325
 
        g_signal_connect (calib->calibrate, "progress-changed",
2326
 
                          G_CALLBACK (gcm_calib_progress_changed_cb), calib);
2327
 
        g_signal_connect (calib->calibrate, "interaction-required",
2328
 
                          G_CALLBACK (gcm_calib_interaction_required_cb), calib);
 
2329
        priv->device_kind = CD_DEVICE_KIND_UNKNOWN;
 
2330
        g_signal_connect (priv->calibrate, "title-changed",
 
2331
                          G_CALLBACK (gcm_calib_title_changed_cb), priv);
 
2332
        g_signal_connect (priv->calibrate, "message-changed",
 
2333
                          G_CALLBACK (gcm_calib_message_changed_cb), priv);
 
2334
        g_signal_connect (priv->calibrate, "image-changed",
 
2335
                          G_CALLBACK (gcm_calib_image_changed_cb), priv);
 
2336
        g_signal_connect (priv->calibrate, "progress-changed",
 
2337
                          G_CALLBACK (gcm_calib_progress_changed_cb), priv);
 
2338
        g_signal_connect (priv->calibrate, "interaction-required",
 
2339
                          G_CALLBACK (gcm_calib_interaction_required_cb), priv);
2329
2340
 
2330
2341
        /* nothing specified */
2331
 
        if (calib->device_id == NULL) {
 
2342
        if (priv->device_id == NULL) {
2332
2343
                g_print ("%s\n", _("No device was specified!"));
2333
2344
                goto out;
2334
2345
        }
2335
2346
 
2336
2347
        /* ensure single instance */
2337
 
        calib->application = gtk_application_new ("org.gnome.ColorManager.Calibration", 0);
2338
 
        g_signal_connect (calib->application, "startup",
2339
 
                          G_CALLBACK (gcm_calib_startup_cb), calib);
2340
 
        g_signal_connect (calib->application, "activate",
2341
 
                          G_CALLBACK (gcm_calib_activate_cb), calib);
 
2348
        priv->application = gtk_application_new ("org.gnome.ColorManager.Calibration", 0);
 
2349
        g_signal_connect (priv->application, "startup",
 
2350
                          G_CALLBACK (gcm_calib_startup_cb), priv);
 
2351
        g_signal_connect (priv->application, "activate",
 
2352
                          G_CALLBACK (gcm_calib_activate_cb), priv);
2342
2353
 
2343
2354
        /* wait */
2344
 
        status = g_application_run (G_APPLICATION (calib->application), argc, argv);
 
2355
        status = g_application_run (G_APPLICATION (priv->application), argc, argv);
2345
2356
 
2346
 
        g_ptr_array_unref (calib->pages);
2347
 
        g_object_unref (calib->application);
2348
 
        g_object_unref (calib->calibrate);
2349
 
        if (calib->client != NULL)
2350
 
                g_object_unref (calib->client);
2351
 
        if (calib->device_id != NULL)
2352
 
                g_free (calib->device_id);
2353
 
        if (calib->device != NULL)
2354
 
                g_object_unref (calib->device);
2355
 
        g_free (calib);
 
2357
        g_ptr_array_unref (priv->pages);
 
2358
        g_object_unref (priv->application);
 
2359
        g_object_unref (priv->calibrate);
 
2360
        if (priv->client != NULL)
 
2361
                g_object_unref (priv->client);
 
2362
        if (priv->device_id != NULL)
 
2363
                g_free (priv->device_id);
 
2364
        if (priv->device != NULL)
 
2365
                g_object_unref (priv->device);
 
2366
        g_free (priv);
2356
2367
out:
2357
2368
        return status;
2358
2369
}