[gnome-keyring] [prompt] Hook up the various toggle options sensitivity.



commit 383ce1f36976640fb44af8b0f4067c7b687e4109
Author: Stef Walter <stef memberwebs com>
Date:   Wed Jan 6 03:35:07 2010 +0000

    [prompt] Hook up the various toggle options sensitivity.
    
    Disable certain lock options when others are selected.

 daemon/prompt/gkd-prompt-tool.c           |   39 +++++++++++++++++++++++++++++
 daemon/prompt/gkd-prompt.ui               |    3 +-
 daemon/prompt/tests/test-data/prompt-full |    3 +-
 3 files changed, 42 insertions(+), 3 deletions(-)
---
diff --git a/daemon/prompt/gkd-prompt-tool.c b/daemon/prompt/gkd-prompt-tool.c
index 8fec75c..a50300e 100644
--- a/daemon/prompt/gkd-prompt-tool.c
+++ b/daemon/prompt/gkd-prompt-tool.c
@@ -304,6 +304,44 @@ prepare_security (GtkBuilder *builder, GtkDialog *dialog)
 	g_signal_connect (dialog, "window-state-event", G_CALLBACK (window_state_changed), NULL);
 }
 
+static void
+on_auto_check_unlock_toggled (GtkToggleButton *check, GtkBuilder *builder)
+{
+	GtkWidget *area;
+
+	area = GTK_WIDGET (gtk_builder_get_object (builder, "options_area"));
+	gtk_widget_set_sensitive (area, !gtk_toggle_button_get_active (check));
+}
+
+static void
+on_timeout_choices_toggled (GtkToggleButton *unused, GtkBuilder *builder)
+{
+	GtkWidget *spin, *after, *idle;
+
+	spin = GTK_WIDGET (gtk_builder_get_object (builder, "lock_minutes_spin"));
+	after = GTK_WIDGET (gtk_builder_get_object (builder, "lock_after_choice"));
+	idle = GTK_WIDGET (gtk_builder_get_object (builder, "lock_idle_choice"));
+	gtk_widget_set_sensitive (spin, gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (after)) ||
+	                                gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(idle)));
+
+}
+
+static void
+prepare_lock (GtkBuilder *builder, GtkDialog *dialog)
+{
+	GtkWidget *check;
+
+	check = GTK_WIDGET (gtk_builder_get_object (builder, "auto_unlock_check"));
+	g_signal_connect (check, "toggled", G_CALLBACK (on_auto_check_unlock_toggled), builder);
+	on_auto_check_unlock_toggled (GTK_TOGGLE_BUTTON (check), builder);
+
+	check = GTK_WIDGET (gtk_builder_get_object (builder, "lock_after_choice"));
+	g_signal_connect (check, "toggled", G_CALLBACK (on_timeout_choices_toggled), builder);
+	check = GTK_WIDGET (gtk_builder_get_object (builder, "lock_idle_choice"));
+	g_signal_connect (check, "toggled", G_CALLBACK (on_timeout_choices_toggled), builder);
+	on_timeout_choices_toggled (GTK_TOGGLE_BUTTON (check), builder);
+}
+
 static GtkDialog*
 prepare_dialog (GtkBuilder *builder)
 {
@@ -326,6 +364,7 @@ prepare_dialog (GtkBuilder *builder)
 	prepare_buttons (builder, dialog);
 	prepare_passwords (builder, dialog);
 	prepare_security (builder, dialog);
+	prepare_lock (builder, dialog);
 
 	return dialog;
 }
diff --git a/daemon/prompt/gkd-prompt.ui b/daemon/prompt/gkd-prompt.ui
index 893ebae..4d7ee8e 100644
--- a/daemon/prompt/gkd-prompt.ui
+++ b/daemon/prompt/gkd-prompt.ui
@@ -269,7 +269,7 @@ An application wants access to the keyring 'xxx', but it is locked.</property>
                             <property name="label_xalign">0</property>
                             <property name="shadow_type">none</property>
                             <child>
-                              <object class="GtkAlignment" id="alignment2">
+                              <object class="GtkAlignment" id="options_area">
                                 <property name="visible">True</property>
                                 <property name="top_padding">3</property>
                                 <property name="left_padding">12</property>
@@ -395,7 +395,6 @@ An application wants access to the keyring 'xxx', but it is locked.</property>
                         </child>
                         <child>
                           <object class="GtkAlignment" id="info_area">
-                            <property name="visible">True</property>
                             <property name="left_padding">6</property>
                             <child>
                               <object class="GtkTable" id="table1">
diff --git a/daemon/prompt/tests/test-data/prompt-full b/daemon/prompt/tests/test-data/prompt-full
index 6189939..ab20a18 100644
--- a/daemon/prompt/tests/test-data/prompt-full
+++ b/daemon/prompt/tests/test-data/prompt-full
@@ -8,7 +8,8 @@ window-id=
 name_area=false
 original_area=false
 confirm_area=true
-details_area=false
+details_area=true
+lock_area=true
 
 [transport]
 prime=00E9991CBC77057BEB3E8165025E8338722BDB00297A910EA441129EA84ED091AF9DA55681A192E7E7C283FF6FA9EC5A81E03A8C0999F66B19DF80BE867D0A79B1DB3E42AE7EC1FCA057889F3ED666E86C3C248AA47C8E699997183C7A8093242C0D741CE5D4E1BA99CB5ACE895C53B92D9B9FE6B0D8203B5A8286567B8E9C2A33



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]