Mercurial > pidgin
diff src/request.c @ 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 |
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) {