Mercurial > pidgin.yaz
comparison 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 |
comparison
equal
deleted
inserted
replaced
5807:11001789cb22 | 5808:133e86584f4b |
---|---|
355 | 355 |
356 field->u.string.default_value = (default_value == NULL | 356 field->u.string.default_value = (default_value == NULL |
357 ? NULL : g_strdup(default_value)); | 357 ? NULL : g_strdup(default_value)); |
358 } | 358 } |
359 | 359 |
360 void | |
361 gaim_request_field_string_set_value(GaimRequestField *field, const char *value) | |
362 { | |
363 g_return_if_fail(field != NULL); | |
364 g_return_if_fail(field->type == GAIM_REQUEST_FIELD_STRING); | |
365 | |
366 if (field->u.string.value != NULL) | |
367 g_free(field->u.string.value); | |
368 | |
369 field->u.string.value = (value == NULL ? NULL : g_strdup(value)); | |
370 } | |
371 | |
360 const char * | 372 const char * |
361 gaim_request_field_string_get_default_value(const GaimRequestField *field) | 373 gaim_request_field_string_get_default_value(const GaimRequestField *field) |
362 { | 374 { |
363 g_return_val_if_fail(field != NULL, NULL); | 375 g_return_val_if_fail(field != NULL, NULL); |
364 g_return_val_if_fail(field->type == GAIM_REQUEST_FIELD_STRING, NULL); | 376 g_return_val_if_fail(field->type == GAIM_REQUEST_FIELD_STRING, NULL); |
408 g_return_if_fail(field->type == GAIM_REQUEST_FIELD_INTEGER); | 420 g_return_if_fail(field->type == GAIM_REQUEST_FIELD_INTEGER); |
409 | 421 |
410 field->u.integer.default_value = default_value; | 422 field->u.integer.default_value = default_value; |
411 } | 423 } |
412 | 424 |
425 void | |
426 gaim_request_field_int_set_value(GaimRequestField *field, int value) | |
427 { | |
428 g_return_if_fail(field != NULL); | |
429 g_return_if_fail(field->type == GAIM_REQUEST_FIELD_INTEGER); | |
430 | |
431 field->u.integer.value = value; | |
432 } | |
433 | |
413 int | 434 int |
414 gaim_request_field_int_get_default_value(const GaimRequestField *field) | 435 gaim_request_field_int_get_default_value(const GaimRequestField *field) |
415 { | 436 { |
416 g_return_val_if_fail(field != NULL, 0); | 437 g_return_val_if_fail(field != NULL, 0); |
417 g_return_val_if_fail(field->type == GAIM_REQUEST_FIELD_INTEGER, 0); | 438 g_return_val_if_fail(field->type == GAIM_REQUEST_FIELD_INTEGER, 0); |
452 g_return_if_fail(field->type == GAIM_REQUEST_FIELD_BOOLEAN); | 473 g_return_if_fail(field->type == GAIM_REQUEST_FIELD_BOOLEAN); |
453 | 474 |
454 field->u.boolean.default_value = default_value; | 475 field->u.boolean.default_value = default_value; |
455 } | 476 } |
456 | 477 |
478 void | |
479 gaim_request_field_bool_set_value(GaimRequestField *field, gboolean value) | |
480 { | |
481 g_return_if_fail(field != NULL); | |
482 g_return_if_fail(field->type == GAIM_REQUEST_FIELD_BOOLEAN); | |
483 | |
484 field->u.boolean.value = value; | |
485 } | |
486 | |
457 gboolean | 487 gboolean |
458 gaim_request_field_bool_get_default_value(const GaimRequestField *field) | 488 gaim_request_field_bool_get_default_value(const GaimRequestField *field) |
459 { | 489 { |
460 g_return_val_if_fail(field != NULL, FALSE); | 490 g_return_val_if_fail(field != NULL, FALSE); |
461 g_return_val_if_fail(field->type == GAIM_REQUEST_FIELD_BOOLEAN, FALSE); | 491 g_return_val_if_fail(field->type == GAIM_REQUEST_FIELD_BOOLEAN, FALSE); |
505 { | 535 { |
506 g_return_if_fail(field != NULL); | 536 g_return_if_fail(field != NULL); |
507 g_return_if_fail(field->type == GAIM_REQUEST_FIELD_CHOICE); | 537 g_return_if_fail(field->type == GAIM_REQUEST_FIELD_CHOICE); |
508 | 538 |
509 field->u.choice.default_value = default_value; | 539 field->u.choice.default_value = default_value; |
540 } | |
541 | |
542 void | |
543 gaim_request_field_choice_set_value(GaimRequestField *field, | |
544 int value) | |
545 { | |
546 g_return_if_fail(field != NULL); | |
547 g_return_if_fail(field->type == GAIM_REQUEST_FIELD_CHOICE); | |
548 | |
549 field->u.choice.value = value; | |
510 } | 550 } |
511 | 551 |
512 int | 552 int |
513 gaim_request_field_choice_get_default_value(const GaimRequestField *field) | 553 gaim_request_field_choice_get_default_value(const GaimRequestField *field) |
514 { | 554 { |