[gcr] Move the 'always unlock' option out of the unlock options widget.
authorStef Walter <stef@memberwebs.com>
Mon, 1 Feb 2010 03:09:52 +0000 (03:09 +0000)
committerStef Walter <stef@memberwebs.com>
Mon, 1 Feb 2010 03:09:52 +0000 (03:09 +0000)
gcr/gcr-unlock-options-widget.c
gcr/gcr-unlock-options-widget.ui

index 217598a..44afb8a 100644 (file)
 
 enum {
        PROP_0,
-       PROP_UNLOCK_AUTO,
        PROP_UNLOCK_TIMEOUT,
        PROP_UNLOCK_IDLE
 };
 
 struct _GcrUnlockOptionsWidgetPrivate {
        GtkBuilder *builder;
-       GtkToggleButton *auto_unlock;
        GtkToggleButton *lock_logout;
        GtkToggleButton *lock_after;
        GtkToggleButton *lock_idle;
@@ -62,13 +60,6 @@ builder_get_spin_button (GtkBuilder *builder, const gchar *name)
 }
 
 static void
-on_auto_check_unlock_toggled (GtkToggleButton *check, GtkBuilder *builder)
-{
-       GtkWidget *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;
@@ -106,10 +97,6 @@ gcr_unlock_options_widget_constructor (GType type, guint n_props, GObjectConstru
                gtk_container_add (GTK_CONTAINER (self), widget);
                gtk_widget_show (widget);
 
-               button = builder_get_toggle_button (self->pv->builder, "auto_unlock_check");
-               g_signal_connect (button, "toggled", G_CALLBACK (on_auto_check_unlock_toggled), self->pv->builder);
-               on_auto_check_unlock_toggled (button, self->pv->builder);
-
                button = builder_get_toggle_button (self->pv->builder, "lock_logout_choice");
                g_signal_connect (button, "toggled", G_CALLBACK (on_timeout_choices_toggled), self->pv->builder);
                button = builder_get_toggle_button (self->pv->builder, "lock_after_choice");
@@ -163,10 +150,6 @@ gcr_unlock_options_widget_set_property (GObject *obj, guint prop_id, const GValu
        spin = builder_get_spin_button (self->pv->builder, "lock_minutes_spin");
 
        switch (prop_id) {
-       case PROP_UNLOCK_AUTO:
-               button = builder_get_toggle_button (self->pv->builder, "auto_unlock_check");
-               gtk_toggle_button_set_active (button, g_value_get_boolean (value));
-               break;
        case PROP_UNLOCK_TIMEOUT:
                button = builder_get_toggle_button (self->pv->builder, "lock_after_choice");
                seconds = g_value_get_int (value);
@@ -202,40 +185,25 @@ gcr_unlock_options_widget_get_property (GObject *obj, guint prop_id, GValue *val
        GcrUnlockOptionsWidget *self = GCR_UNLOCK_OPTIONS_WIDGET (obj);
        GtkToggleButton *button;
        GtkSpinButton *spin;
-       gboolean auto_unlock;
        gint minutes;
 
-       button = builder_get_toggle_button (self->pv->builder, "auto_unlock_check");
-       auto_unlock = gtk_toggle_button_get_active (button);
-
        spin = builder_get_spin_button (self->pv->builder, "lock_minutes_spin");
        minutes = gtk_spin_button_get_value_as_int (spin);
 
        switch (prop_id) {
-       case PROP_UNLOCK_AUTO:
-               g_value_set_boolean (value, auto_unlock);
-               break;
        case PROP_UNLOCK_TIMEOUT:
-               if (auto_unlock) {
+               button = builder_get_toggle_button (self->pv->builder, "lock_after_choice");
+               if (!gtk_toggle_button_get_active (button))
                        g_value_set_int (value, 0);
-               } else {
-                       button = builder_get_toggle_button (self->pv->builder, "lock_after_choice");
-                       if (!gtk_toggle_button_get_active (button))
-                               g_value_set_int (value, 0);
-                       else
-                               g_value_set_int (value, minutes * 60);
-               }
+               else
+                       g_value_set_int (value, minutes * 60);
                break;
        case PROP_UNLOCK_IDLE:
-               if (auto_unlock) {
+               button = builder_get_toggle_button (self->pv->builder, "lock_idle_choice");
+               if (!gtk_toggle_button_get_active (button))
                        g_value_set_int (value, 0);
-               } else {
-                       button = builder_get_toggle_button (self->pv->builder, "lock_idle_choice");
-                       if (!gtk_toggle_button_get_active (button))
-                               g_value_set_int (value, 0);
-                       else
-                               g_value_set_int (value, minutes * 60);
-               }
+               else
+                       g_value_set_int (value, minutes * 60);
                break;
        default:
                G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
@@ -257,10 +225,6 @@ gcr_unlock_options_widget_class_init (GcrUnlockOptionsWidgetClass *klass)
        gobject_class->set_property = gcr_unlock_options_widget_set_property;
        gobject_class->get_property = gcr_unlock_options_widget_get_property;
 
-       g_object_class_install_property (gobject_class, PROP_UNLOCK_AUTO,
-                      g_param_spec_boolean ("unlock-auto", "Unlock Auto", "Unlock Automatically",
-                                            FALSE, G_PARAM_READWRITE));
-
        g_object_class_install_property (gobject_class, PROP_UNLOCK_TIMEOUT,
                       g_param_spec_int ("unlock-timeout", "Unlock Timeout", "Unlock Timeout",
                                         0, G_MAXINT, 0, G_PARAM_READWRITE));
index cfa8a55..5ab4509 100644 (file)
 <interface>
   <requires lib="gtk+" version="2.16"/>
   <!-- interface-naming-policy project-wide -->
-  <object class="GtkFrame" id="unlock-options-widget">
+  <object class="GtkAdjustment" id="spin_adjustment">
+    <property name="lower">1</property>
+    <property name="upper">999</property>
+    <property name="step_increment">1</property>
+    <property name="page_increment">10</property>
+  </object>
+  <object class="GtkVBox" id="unlock-options-widget">
     <property name="visible">True</property>
-    <property name="label_xalign">0</property>
-    <property name="shadow_type">none</property>
+    <property name="orientation">vertical</property>
+    <property name="spacing">6</property>
+    <child>
+      <object class="GtkRadioButton" id="lock_logout_choice">
+        <property name="label" translatable="yes">Lock this keyring when I log out.</property>
+        <property name="visible">True</property>
+        <property name="can_focus">True</property>
+        <property name="receives_default">False</property>
+        <property name="active">True</property>
+        <property name="draw_indicator">True</property>
+      </object>
+      <packing>
+        <property name="position">0</property>
+      </packing>
+    </child>
     <child>
-      <object class="GtkAlignment" id="options_area">
+      <object class="GtkHBox" id="hbox2">
         <property name="visible">True</property>
-        <property name="top_padding">3</property>
-        <property name="left_padding">12</property>
+        <property name="spacing">6</property>
         <child>
-          <object class="GtkVBox" id="vbox4">
+          <object class="GtkVBox" id="vbox5">
             <property name="visible">True</property>
             <property name="orientation">vertical</property>
             <property name="spacing">6</property>
             <child>
-              <object class="GtkRadioButton" id="lock_logout_choice">
-                <property name="label" translatable="yes">Lock this keyring when I log out.</property>
+              <object class="GtkRadioButton" id="lock_after_choice">
+                <property name="label" translatable="yes">Lock this keyring after</property>
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="receives_default">False</property>
-                <property name="active">True</property>
                 <property name="draw_indicator">True</property>
+                <property name="group">lock_logout_choice</property>
               </object>
               <packing>
+                <property name="expand">False</property>
                 <property name="position">0</property>
               </packing>
             </child>
             <child>
-              <object class="GtkHBox" id="hbox2">
+              <object class="GtkRadioButton" id="lock_idle_choice">
+                <property name="label" translatable="yes">Lock this keyring if idle for</property>
                 <property name="visible">True</property>
-                <property name="spacing">6</property>
-                <child>
-                  <object class="GtkVBox" id="vbox5">
-                    <property name="visible">True</property>
-                    <property name="orientation">vertical</property>
-                    <property name="spacing">6</property>
-                    <child>
-                      <object class="GtkRadioButton" id="lock_after_choice">
-                        <property name="label" translatable="yes">Lock this keyring after</property>
-                        <property name="visible">True</property>
-                        <property name="can_focus">True</property>
-                        <property name="receives_default">False</property>
-                        <property name="draw_indicator">True</property>
-                        <property name="group">lock_logout_choice</property>
-                      </object>
-                      <packing>
-                        <property name="expand">False</property>
-                        <property name="position">0</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkRadioButton" id="lock_idle_choice">
-                        <property name="label" translatable="yes">Lock this keyring if idle for</property>
-                        <property name="visible">True</property>
-                        <property name="can_focus">True</property>
-                        <property name="receives_default">False</property>
-                        <property name="draw_indicator">True</property>
-                        <property name="group">lock_logout_choice</property>
-                      </object>
-                      <packing>
-                        <property name="expand">False</property>
-                        <property name="position">1</property>
-                      </packing>
-                    </child>
-                  </object>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="position">0</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkSpinButton" id="lock_minutes_spin">
-                    <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="invisible_char">&#x2022;</property>
-                    <property name="adjustment">spin_adjustment</property>
-                    <property name="climb_rate">1</property>
-                    <property name="numeric">True</property>
-                  </object>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="position">1</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkLabel" id="label2">
-                    <property name="visible">True</property>
-                    <property name="xalign">0</property>
-                    <property name="label" translatable="yes">minutes.</property>
-                  </object>
-                  <packing>
-                    <property name="position">2</property>
-                  </packing>
-                </child>
+                <property name="can_focus">True</property>
+                <property name="receives_default">False</property>
+                <property name="draw_indicator">True</property>
+                <property name="group">lock_logout_choice</property>
               </object>
               <packing>
+                <property name="expand">False</property>
                 <property name="position">1</property>
               </packing>
             </child>
           </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkSpinButton" id="lock_minutes_spin">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="invisible_char">&#x2022;</property>
+            <property name="adjustment">spin_adjustment</property>
+            <property name="climb_rate">1</property>
+            <property name="numeric">True</property>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="position">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel" id="label2">
+            <property name="visible">True</property>
+            <property name="xalign">0</property>
+            <property name="label" translatable="yes">minutes.</property>
+          </object>
+          <packing>
+            <property name="position">2</property>
+          </packing>
         </child>
       </object>
+      <packing>
+        <property name="position">1</property>
+      </packing>
     </child>
-    <child type="label">
-      <object class="GtkCheckButton" id="auto_unlock_check">
-        <property name="label" translatable="yes">Automatically unlock this keyring whenever I'm logged in.</property>
-        <property name="visible">True</property>
-        <property name="can_focus">True</property>
-        <property name="receives_default">False</property>
-        <property name="draw_indicator">True</property>
-      </object>
-    </child>
-  </object>
-  <object class="GtkAdjustment" id="spin_adjustment">
-    <property name="lower">1</property>
-    <property name="upper">999</property>
-    <property name="step_increment">1</property>
-    <property name="page_increment">10</property>
   </object>
 </interface>