changeset 7047:7d1909655fd0

[gaim-migrate @ 7610] Add core support for masking string fields in multi-request dialogs, and setting string fields so that they can't be modified. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Tue, 30 Sep 2003 02:26:32 +0000
parents 4003419d753b
children 3f9e106dfeef
files src/request.c src/request.h
diffstat 2 files changed, 77 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/request.c	Tue Sep 30 01:50:39 2003 +0000
+++ b/src/request.c	Tue Sep 30 02:26:32 2003 +0000
@@ -369,6 +369,25 @@
 	field->u.string.value = (value == NULL ? NULL : g_strdup(value));
 }
 
+void
+gaim_request_field_string_set_masked(GaimRequestField *field, gboolean masked)
+{
+	g_return_if_fail(field != NULL);
+	g_return_if_fail(field->type == GAIM_REQUEST_FIELD_STRING);
+
+	field->u.string.masked = masked;
+}
+
+void
+gaim_request_field_string_set_editable(GaimRequestField *field,
+									   gboolean editable)
+{
+	g_return_if_fail(field != NULL);
+	g_return_if_fail(field->type == GAIM_REQUEST_FIELD_STRING);
+
+	field->u.string.editable = editable;
+}
+
 const char *
 gaim_request_field_string_get_default_value(const GaimRequestField *field)
 {
@@ -385,7 +404,7 @@
 	g_return_val_if_fail(field->type == GAIM_REQUEST_FIELD_STRING, NULL);
 
 	return field->u.string.value;
-}   
+}
 
 gboolean
 gaim_request_field_string_is_multiline(const GaimRequestField *field)
@@ -396,6 +415,24 @@
 	return field->u.string.multiline;
 }
 
+gboolean
+gaim_request_field_string_is_masked(const GaimRequestField *field)
+{
+	g_return_val_if_fail(field != NULL, FALSE);
+	g_return_val_if_fail(field->type == GAIM_REQUEST_FIELD_STRING, FALSE);
+
+	return field->u.string.masked;
+}
+
+gboolean
+gaim_request_field_string_is_editable(const GaimRequestField *field)
+{
+	g_return_val_if_fail(field != NULL, FALSE);
+	g_return_val_if_fail(field->type == GAIM_REQUEST_FIELD_STRING, FALSE);
+
+	return field->u.string.editable;
+}
+
 GaimRequestField *
 gaim_request_field_int_new(const char *id, const char *text,
 						   int default_value)
--- a/src/request.h	Tue Sep 30 01:50:39 2003 +0000
+++ b/src/request.h	Tue Sep 30 02:26:32 2003 +0000
@@ -67,6 +67,8 @@
 		struct
 		{
 			gboolean multiline;
+			gboolean masked;
+			gboolean editable;
 			char *default_value;
 			char *value;
 
@@ -410,6 +412,25 @@
 										 const char *value);
 
 /**
+ * Sets whether or not a string field is masked
+ * (commonly used for password fields).
+ *
+ * @param field  The field.
+ * @param masked The masked value.
+ */
+void gaim_request_field_string_set_masked(GaimRequestField *field,
+										  gboolean masked);
+
+/**
+ * Sets whether or not a string field is editable.
+ *
+ * @param field    The field.
+ * @param editable The editable value.
+ */
+void gaim_request_field_string_set_editable(GaimRequestField *field,
+											gboolean editable);
+
+/**
  * Returns the default value in a string field.
  *
  * @param field The field.
@@ -437,6 +458,24 @@
  */
 gboolean gaim_request_field_string_is_multiline(const GaimRequestField *field);
 
+/**
+ * Returns whether or not a string field is masked.
+ *
+ * @param field The field.
+ *
+ * @return @c TRUE if the field is masked, or @c FALSE otherwise.
+ */
+gboolean gaim_request_field_string_is_masked(const GaimRequestField *field);
+
+/**
+ * Returns whether or not a string field is editable.
+ *
+ * @param field The field.
+ *
+ * @return @c TRUE if the field is editable, or @c FALSE otherwise.
+ */
+gboolean gaim_request_field_string_is_editable(const GaimRequestField *field);
+
 /*@}*/
 
 /**************************************************************************/