# HG changeset patch # User Christian Hammond # Date 1064888792 0 # Node ID 7d1909655fd01c40ab50fe72fac0aced1d6af3dd # Parent 4003419d753b12b202cfd55099d2e1b7945190b2 [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 diff -r 4003419d753b -r 7d1909655fd0 src/request.c --- 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) diff -r 4003419d753b -r 7d1909655fd0 src/request.h --- 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); + /*@}*/ /**************************************************************************/