213
* check: A toggle button that defines the state of the options_area
214
* builder: The GTKBuilder data to extract "options_area" from
216
* Toggles the sensitivity of the "options_area" based on the Toggle Button check
220
on_auto_check_unlock_toggled (GtkToggleButton *check, GtkBuilder *builder)
222
GtkWidget *area = GTK_WIDGET (gtk_builder_get_object (builder, "options_area"));
223
gtk_widget_set_sensitive (area, !gtk_toggle_button_get_active (check));
227
213
* builder: The builder object to look for visibility keys in
228
214
* dialog: ignored
428
prepare_lock_label (GtkWidget *unlock, guint option, const gchar *field)
414
prepare_unlock_option (GcrUnlockOptionsWidget *unlock, const gchar *option)
432
label = g_key_file_get_string (input_data, "unlock-options", field, NULL);
434
gcr_unlock_options_widget_set_label (GCR_UNLOCK_OPTIONS_WIDGET (unlock), option, label);
416
GError *error = NULL;
420
text = g_key_file_get_string (input_data, option, "label", NULL);
422
gcr_unlock_options_widget_set_label (unlock, option, text);
425
sensitive = g_key_file_get_boolean (input_data, option, "sensitive", &error);
427
text = g_key_file_get_string (input_data, option, "reason", NULL);
428
gcr_unlock_options_widget_set_sensitive (unlock, option, sensitive, text);
432
g_clear_error (&error);
446
443
prepare_lock (GtkBuilder *builder, GtkDialog *dialog)
448
GtkWidget *unlock, *area;
449
gboolean unlock_auto;
450
GtkToggleButton *button;
451
gint unlock_idle, unlock_timeout;
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);
459
unlock = gcr_unlock_options_widget_new ();
445
GcrUnlockOptionsWidget *unlock;
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);
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);
468
g_object_set (unlock,
469
"unlock-idle", unlock_idle,
470
"unlock-timeout", unlock_timeout,
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));
456
ttl = g_key_file_get_integer (input_data, "unlock-options", "ttl", NULL);
457
gcr_unlock_options_widget_set_ttl (unlock, ttl);
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);
463
prepare_unlock_option (unlock, "always");
464
prepare_unlock_option (unlock, "idle");
465
prepare_unlock_option (unlock, "timeout");
466
prepare_unlock_option (unlock, "session");
773
764
gather_unlock_options (GtkBuilder *builder, GtkDialog *dialog)
775
gint unlock_timeout, unlock_idle;
776
GtkToggleButton *button;
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;
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,
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);
771
choice = gcr_unlock_options_widget_get_choice (unlock);
773
g_key_file_set_integer (output_data, "unlock-options", "ttl",
774
gcr_unlock_options_widget_get_ttl (unlock));
776
g_key_file_set_string (output_data, "unlock-options", "choice", choice);