# HG changeset patch # User Christian Hammond # Date 1077071987 0 # Node ID d335cc7bca544a3a7359c401a570d9df26fc1662 # Parent 980b3bd976aee7e96ba00c1e890c17490c64cb76 [gaim-migrate @ 9009] Added a type hint to GaimRequestField. This will be used for neat stuff I'm planning on. committer: Tailor Script diff -r 980b3bd976ae -r d335cc7bca54 src/request.c --- a/src/request.c Tue Feb 17 20:08:45 2004 +0000 +++ b/src/request.c Wed Feb 18 02:39:47 2004 +0000 @@ -273,6 +273,9 @@ if (field->label != NULL) g_free(field->label); + if (field->type_hint != NULL) + g_free(field->type_hint); + if (field->type == GAIM_REQUEST_FIELD_STRING) { if (field->u.string.default_value != NULL) @@ -329,6 +332,18 @@ field->visible = visible; } +void +gaim_request_field_set_type_hint(GaimRequestField *field, + const char *type_hint) +{ + g_return_if_fail(field != NULL); + + if (field->type_hint != NULL) + g_free(field->type_hint); + + field->type_hint = (type_hint == NULL ? NULL : g_strdup(type_hint)); +} + GaimRequestFieldType gaim_request_field_get_type(const GaimRequestField *field) { @@ -361,6 +376,14 @@ return field->visible; } +const char * +gaim_request_field_get_type_hint(const GaimRequestField *field) +{ + g_return_val_if_fail(field != NULL, NULL); + + return field->type_hint; +} + GaimRequestField * gaim_request_field_string_new(const char *id, const char *text, const char *default_value, gboolean multiline) diff -r 980b3bd976ae -r d335cc7bca54 src/request.h --- a/src/request.h Tue Feb 17 20:08:45 2004 +0000 +++ b/src/request.h Wed Feb 18 02:39:47 2004 +0000 @@ -65,6 +65,7 @@ char *id; char *label; + char *type_hint; gboolean visible; @@ -364,12 +365,24 @@ /** * Sets whether or not a field is visible. * - * @param field The field. + * @param field The field. * @param visible TRUE if visible, or FALSE if not. */ void gaim_request_field_set_visible(GaimRequestField *field, gboolean visible); /** + * Sets the type hint for the field. + * + * This is optionally used by the UIs to provide such features as + * auto-completion for type hints like "screenname." + * + * @param field The field. + * @param type_hint The type hint. + */ +void gaim_request_field_set_type_hint(GaimRequestField *field, + const char *type_hint); + +/** * Returns the type of a field. * * @param field The field. @@ -405,6 +418,15 @@ */ gboolean gaim_request_field_is_visible(const GaimRequestField *field); +/** + * Returns the field's type hint. + * + * @param field The field. + * + * @return The field's type hint. + */ +const char *gaim_request_field_get_type_hint(const GaimRequestField *field); + /*@}*/ /**************************************************************************/