~ubuntu-branches/ubuntu/natty/gnome-keyring/natty

« back to all changes in this revision

Viewing changes to ui/gku-prompt-tool.c

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2010-12-06 17:58:28 UTC
  • mfrom: (1.1.65 upstream)
  • Revision ID: james.westby@ubuntu.com-20101206175828-8xjojyxw89qacpq7
Tags: 2.92.92.is.2.32.1-0ubuntu1
* New upstream version
* debian/control.in:
  - updated the libglib requirement
* debian/libgcr0.symbols:
  - new version update
* debian/patches/02_uidir_relocate.patch:
  - updated for the new version
* debian/patches/10_git_fix_cka_trusted_collections.patch:
  - dropped, the patch is the new version
* debian/patches/90_git_pam_headers.patch:
  - dropped, the patch is the new version

Show diffs side-by-side

added added

removed removed

Lines of Context:
210
210
}
211
211
 
212
212
/**
213
 
* check: A toggle button that defines the state of the options_area
214
 
* builder: The GTKBuilder data to extract "options_area" from
215
 
*
216
 
* Toggles the sensitivity of the "options_area" based on the Toggle Button check
217
 
*
218
 
**/
219
 
static void
220
 
on_auto_check_unlock_toggled (GtkToggleButton *check, GtkBuilder *builder)
221
 
{
222
 
        GtkWidget *area = GTK_WIDGET (gtk_builder_get_object (builder, "options_area"));
223
 
        gtk_widget_set_sensitive (area, !gtk_toggle_button_get_active (check));
224
 
}
225
 
 
226
 
/**
227
213
* builder: The builder object to look for visibility keys in
228
214
* dialog: ignored
229
215
*
425
411
}
426
412
 
427
413
static void
428
 
prepare_lock_label (GtkWidget *unlock, guint option, const gchar *field)
 
414
prepare_unlock_option (GcrUnlockOptionsWidget *unlock, const gchar *option)
429
415
{
430
 
        gchar *label;
431
 
 
432
 
        label = g_key_file_get_string (input_data, "unlock-options", field, NULL);
433
 
        if (label)
434
 
                gcr_unlock_options_widget_set_label (GCR_UNLOCK_OPTIONS_WIDGET (unlock), option, label);
435
 
        g_free (label);
 
416
        GError *error = NULL;
 
417
        gboolean sensitive;
 
418
        gchar *text;
 
419
 
 
420
        text = g_key_file_get_string (input_data, option, "label", NULL);
 
421
        if (text)
 
422
                gcr_unlock_options_widget_set_label (unlock, option, text);
 
423
        g_free (text);
 
424
 
 
425
        sensitive = g_key_file_get_boolean (input_data, option, "sensitive", &error);
 
426
        if (error == NULL) {
 
427
                text = g_key_file_get_string (input_data, option, "reason", NULL);
 
428
                gcr_unlock_options_widget_set_sensitive (unlock, option, sensitive, text);
 
429
                g_free (text);
 
430
        }
 
431
 
 
432
        g_clear_error (&error);
436
433
}
437
434
 
438
435
/**
445
442
static void
446
443
prepare_lock (GtkBuilder *builder, GtkDialog *dialog)
447
444
{
448
 
        GtkWidget *unlock, *area;
449
 
        gboolean unlock_auto;
450
 
        GtkToggleButton *button;
451
 
        gint unlock_idle, unlock_timeout;
452
 
 
453
 
        button = GTK_TOGGLE_BUTTON (gtk_builder_get_object (builder, "auto_unlock_check"));
454
 
        g_signal_connect (button, "toggled", G_CALLBACK (on_auto_check_unlock_toggled), builder);
455
 
        unlock_auto = g_key_file_get_boolean (input_data, "unlock-options", "unlock-auto", NULL);
456
 
        gtk_toggle_button_set_active (button, unlock_auto);
457
 
        on_auto_check_unlock_toggled (button, builder);
458
 
 
459
 
        unlock = gcr_unlock_options_widget_new ();
 
445
        GcrUnlockOptionsWidget *unlock;
 
446
        GtkWidget *area;
 
447
        gchar *option;
 
448
        guint ttl;
 
449
 
 
450
        unlock = GCR_UNLOCK_OPTIONS_WIDGET (gcr_unlock_options_widget_new ());
460
451
        area = GTK_WIDGET (gtk_builder_get_object (builder, "options_area"));
461
452
        g_object_set_data (G_OBJECT (dialog), "unlock-options-widget", unlock);
462
 
        gtk_container_add (GTK_CONTAINER (area), unlock);
463
 
        gtk_widget_show (unlock);
464
 
 
465
 
        unlock_idle = g_key_file_get_integer (input_data, "unlock-options", "unlock-idle", NULL);
466
 
        unlock_timeout = g_key_file_get_integer (input_data, "unlock-options", "unlock-timeout", NULL);
467
 
 
468
 
        g_object_set (unlock,
469
 
                      "unlock-idle", unlock_idle,
470
 
                      "unlock-timeout", unlock_timeout,
471
 
                      NULL);
472
 
 
473
 
        prepare_lock_label (unlock, GCR_UNLOCK_OPTION_IDLE, "label-idle");
474
 
        prepare_lock_label (unlock, GCR_UNLOCK_OPTION_TIMEOUT, "label-timeout");
475
 
        prepare_lock_label (unlock, GCR_UNLOCK_OPTION_SESSION, "label-session");
 
453
        gtk_container_add (GTK_CONTAINER (area), GTK_WIDGET (unlock));
 
454
        gtk_widget_show (GTK_WIDGET (unlock));
 
455
 
 
456
        ttl = g_key_file_get_integer (input_data, "unlock-options", "ttl", NULL);
 
457
        gcr_unlock_options_widget_set_ttl (unlock, ttl);
 
458
 
 
459
        option = g_key_file_get_string (input_data, "unlock-options", "choice", NULL);
 
460
        gcr_unlock_options_widget_set_choice (unlock, option ? option : GCR_UNLOCK_OPTION_SESSION);
 
461
        g_free (option);
 
462
 
 
463
        prepare_unlock_option (unlock, "always");
 
464
        prepare_unlock_option (unlock, "idle");
 
465
        prepare_unlock_option (unlock, "timeout");
 
466
        prepare_unlock_option (unlock, "session");
476
467
}
477
468
 
478
469
/**
772
763
static void
773
764
gather_unlock_options (GtkBuilder *builder, GtkDialog *dialog)
774
765
{
775
 
        gint unlock_timeout, unlock_idle;
776
 
        GtkToggleButton *button;
777
 
        GtkWidget *unlock;
778
 
 
779
 
        button = GTK_TOGGLE_BUTTON (gtk_builder_get_object (builder, "auto_unlock_check"));
780
 
        g_key_file_set_boolean (output_data, "unlock-options", "unlock-auto",
781
 
                                gtk_toggle_button_get_active (button));
 
766
        GcrUnlockOptionsWidget *unlock;
 
767
        const gchar *choice;
782
768
 
783
769
        unlock = g_object_get_data (G_OBJECT (dialog), "unlock-options-widget");
784
 
        g_object_get (unlock,
785
 
                      "unlock-timeout", &unlock_timeout,
786
 
                      "unlock-idle", &unlock_idle,
787
 
                      NULL);
788
 
 
789
 
        g_key_file_set_integer (output_data, "unlock-options", "unlock-timeout", unlock_timeout);
790
 
        g_key_file_set_integer (output_data, "unlock-options", "unlock-idle", unlock_idle);
 
770
 
 
771
        choice = gcr_unlock_options_widget_get_choice (unlock);
 
772
        if (choice) {
 
773
                g_key_file_set_integer (output_data, "unlock-options", "ttl",
 
774
                                        gcr_unlock_options_widget_get_ttl (unlock));
 
775
 
 
776
                g_key_file_set_string (output_data, "unlock-options", "choice", choice);
 
777
        }
791
778
}
792
779
 
793
780
/**