Mercurial > pidgin
changeset 5808:133e86584f4b
[gaim-migrate @ 6238]
Added functions for setting field values.
committer: Tailor Script <tailor@pidgin.im>
author | Christian Hammond <chipx86@chipx86.com> |
---|---|
date | Sun, 08 Jun 2003 04:11:39 +0000 |
parents | 11001789cb22 |
children | 0a661f6d65e3 |
files | src/request.c src/request.h |
diffstat | 2 files changed, 80 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/src/request.c Sun Jun 08 04:06:21 2003 +0000 +++ b/src/request.c Sun Jun 08 04:11:39 2003 +0000 @@ -357,6 +357,18 @@ ? NULL : g_strdup(default_value)); } +void +gaim_request_field_string_set_value(GaimRequestField *field, const char *value) +{ + g_return_if_fail(field != NULL); + g_return_if_fail(field->type == GAIM_REQUEST_FIELD_STRING); + + if (field->u.string.value != NULL) + g_free(field->u.string.value); + + field->u.string.value = (value == NULL ? NULL : g_strdup(value)); +} + const char * gaim_request_field_string_get_default_value(const GaimRequestField *field) { @@ -410,6 +422,15 @@ field->u.integer.default_value = default_value; } +void +gaim_request_field_int_set_value(GaimRequestField *field, int value) +{ + g_return_if_fail(field != NULL); + g_return_if_fail(field->type == GAIM_REQUEST_FIELD_INTEGER); + + field->u.integer.value = value; +} + int gaim_request_field_int_get_default_value(const GaimRequestField *field) { @@ -454,6 +475,15 @@ field->u.boolean.default_value = default_value; } +void +gaim_request_field_bool_set_value(GaimRequestField *field, gboolean value) +{ + g_return_if_fail(field != NULL); + g_return_if_fail(field->type == GAIM_REQUEST_FIELD_BOOLEAN); + + field->u.boolean.value = value; +} + gboolean gaim_request_field_bool_get_default_value(const GaimRequestField *field) { @@ -509,6 +539,16 @@ field->u.choice.default_value = default_value; } +void +gaim_request_field_choice_set_value(GaimRequestField *field, + int value) +{ + g_return_if_fail(field != NULL); + g_return_if_fail(field->type == GAIM_REQUEST_FIELD_CHOICE); + + field->u.choice.value = value; +} + int gaim_request_field_choice_get_default_value(const GaimRequestField *field) {
--- a/src/request.h Sun Jun 08 04:06:21 2003 +0000 +++ b/src/request.h Sun Jun 08 04:11:39 2003 +0000 @@ -388,13 +388,22 @@ /** * Sets the default value in a string field. * - * @param field The field. - * @param value The default value. + * @param field The field. + * @param default_value The default value. */ void gaim_request_field_string_set_default_value(GaimRequestField *field, const char *default_value); /** + * Sets the value in a string field. + * + * @param field The field. + * @param value The value. + */ +void gaim_request_field_string_set_value(GaimRequestField *field, + const char *value); + +/** * Returns the default value in a string field. * * @param field The field. @@ -445,13 +454,21 @@ /** * Sets the default value in an integer field. * - * @param field The field. - * @param value The default value. + * @param field The field. + * @param default_value The default value. */ void gaim_request_field_int_set_default_value(GaimRequestField *field, int default_value); /** + * Sets the value in an integer field. + * + * @param field The field. + * @param value The value. + */ +void gaim_request_field_int_set_value(GaimRequestField *field, int value); + +/** * Returns the default value in an integer field. * * @param field The field. @@ -501,6 +518,15 @@ gboolean default_value); /** + * Sets the value in an boolean field. + * + * @param field The field. + * @param default_value The default value. + */ +void gaim_request_field_bool_set_value(GaimRequestField *field, + gboolean value); + +/** * Returns the default value in an boolean field. * * @param field The field. @@ -553,13 +579,21 @@ /** * Sets the default value in an choice field. * - * @param field The field. - * @param value The default value. + * @param field The field. + * @param default_value The default value. */ void gaim_request_field_choice_set_default_value(GaimRequestField *field, int default_value); /** + * Sets the value in an choice field. + * + * @param field The field. + * @param value The value. + */ +void gaim_request_field_choice_set_value(GaimRequestField *field, int value); + +/** * Returns the default value in an choice field. * * @param field The field.