settings: Add password-hint-time property
authorEmmanuele Bassi <ebassi@linux.intel.com>
Mon, 19 Sep 2011 15:43:05 +0000 (16:43 +0100)
committerEmmanuele Bassi <ebassi@linux.intel.com>
Mon, 19 Sep 2011 19:26:37 +0000 (20:26 +0100)
Add a setting that controls whether ClutterText actors in password mode
should display the last input character for a defined time. This helps
on touch-based interfaces.

https://bugzilla.gnome.org/show_bug.cgi?id=652588

clutter/clutter-settings.c

index 403fbea..e6187b9 100644 (file)
@@ -69,6 +69,8 @@ struct _ClutterSettings
   gint long_press_duration;
 
   guint last_fontconfig_timestamp;
+
+  guint password_hint_time;
 };
 
 struct _ClutterSettingsClass
@@ -99,6 +101,8 @@ enum
 
   PROP_FONTCONFIG_TIMESTAMP,
 
+  PROP_PASSWORD_HINT_TIME,
+
   PROP_LAST
 };
 
@@ -304,6 +308,10 @@ clutter_settings_set_property (GObject      *gobject,
       settings_update_fontmap (self, g_value_get_uint (value));
       break;
 
+    case PROP_PASSWORD_HINT_TIME:
+      self->password_hint_time = g_value_get_uint (value);
+      break;
+
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
       break;
@@ -360,6 +368,10 @@ clutter_settings_get_property (GObject    *gobject,
       g_value_set_int (value, self->long_press_duration);
       break;
 
+    case PROP_PASSWORD_HINT_TIME:
+      g_value_set_uint (value, self->password_hint_time);
+      break;
+
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
       break;
@@ -584,6 +596,24 @@ clutter_settings_class_init (ClutterSettingsClass *klass)
                        0,
                        CLUTTER_PARAM_WRITABLE);
 
+  /**
+   * ClutterText:password-hint-time:
+   *
+   * How long should Clutter show the last input character in editable
+   * ClutterText actors. The value is in milliseconds. A value of 0
+   * disables showing the password hint. 600 is a good value for
+   * enabling the hint.
+   *
+   * Since: 1.10
+   */
+  obj_props[PROP_PASSWORD_HINT_TIME] =
+    g_param_spec_uint ("password-hint-time",
+                       P_("Password Hint Time"),
+                       P_("THow low to show the last input character in hidden entries"),
+                       0, G_MAXUINT,
+                       0,
+                       CLUTTER_PARAM_READWRITE);
+
   gobject_class->set_property = clutter_settings_set_property;
   gobject_class->get_property = clutter_settings_get_property;
   gobject_class->dispatch_properties_changed =