Mercurial > pidgin.yaz
comparison src/savedstatuses.c @ 12080:3b52d94437f3
[gaim-migrate @ 14377]
The rest of sf patch #1354886, from Sadrul Habib Chowdhury, with
an EXTREME amount of changes from me. Come to me, first, if something
doesn't work.
This allows you to edit the substatuses of a saved status.
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Mon, 14 Nov 2005 07:20:22 +0000 |
parents | 6dc48f991b8d |
children | 355c7acbb61d |
comparison
equal
deleted
inserted
replaced
12079:15732b01ea3d | 12080:3b52d94437f3 |
---|---|
63 | 63 |
64 GList *substatuses; /**< A list of GaimSavedStatusSub's. */ | 64 GList *substatuses; /**< A list of GaimSavedStatusSub's. */ |
65 }; | 65 }; |
66 | 66 |
67 /* | 67 /* |
68 * TODO: If an account is deleted, need to also delete any associated | |
69 * GaimSavedStatusSub's. | |
70 * TODO: If a GaimStatusType is deleted, need to also delete any | 68 * TODO: If a GaimStatusType is deleted, need to also delete any |
71 * associated GaimSavedStatusSub's? | 69 * associated GaimSavedStatusSub's? |
72 */ | 70 */ |
73 struct _GaimSavedStatusSub | 71 struct _GaimSavedStatusSub |
74 { | 72 { |
444 | 442 |
445 schedule_save(); | 443 schedule_save(); |
446 } | 444 } |
447 | 445 |
448 void | 446 void |
449 gaim_savedstatus_set_substatus_for_account(GaimSavedStatus *saved_status, | 447 gaim_savedstatus_set_substatus(GaimSavedStatus *saved_status, |
450 const GaimAccount *account, | 448 const GaimAccount *account, |
451 const GaimStatusType *type, | 449 const GaimStatusType *type, |
452 const char *message) | 450 const char *message) |
453 { | 451 { |
454 GaimSavedStatusSub *substatus; | 452 GaimSavedStatusSub *substatus; |
455 | 453 |
456 g_return_if_fail(saved_status != NULL); | 454 g_return_if_fail(saved_status != NULL); |
457 g_return_if_fail(account != NULL); | 455 g_return_if_fail(account != NULL); |
458 g_return_if_fail(type != NULL); | 456 g_return_if_fail(type != NULL); |
459 | 457 |
460 /* Find an existing substatus or create a new one */ | 458 /* Find an existing substatus or create a new one */ |
461 substatus = gaim_savedstatus_get_substatus_for_account(saved_status, account); | 459 substatus = gaim_savedstatus_get_substatus(saved_status, account); |
462 if (substatus == NULL) | 460 if (substatus == NULL) |
463 { | 461 { |
464 substatus = g_new0(GaimSavedStatusSub, 1); | 462 substatus = g_new0(GaimSavedStatusSub, 1); |
465 substatus->account = (GaimAccount *)account; | 463 substatus->account = (GaimAccount *)account; |
466 saved_status->substatuses = g_list_prepend(saved_status->substatuses, substatus); | 464 saved_status->substatuses = g_list_prepend(saved_status->substatuses, substatus); |
472 | 470 |
473 schedule_save(); | 471 schedule_save(); |
474 } | 472 } |
475 | 473 |
476 void | 474 void |
477 gaim_savedstatus_unset_substatus_for_account(GaimSavedStatus *saved_status, | 475 gaim_savedstatus_unset_substatus(GaimSavedStatus *saved_status, |
478 const GaimAccount *account) | 476 const GaimAccount *account) |
479 { | 477 { |
480 GList *iter; | 478 GList *iter; |
481 GaimSavedStatusSub *substatus; | 479 GaimSavedStatusSub *substatus; |
482 | 480 |
483 g_return_if_fail(saved_status != NULL); | 481 g_return_if_fail(saved_status != NULL); |
567 { | 565 { |
568 return (saved_status->substatuses != NULL); | 566 return (saved_status->substatuses != NULL); |
569 } | 567 } |
570 | 568 |
571 GaimSavedStatusSub * | 569 GaimSavedStatusSub * |
572 gaim_savedstatus_get_substatus_for_account(const GaimSavedStatus *saved_status, | 570 gaim_savedstatus_get_substatus(const GaimSavedStatus *saved_status, |
573 const GaimAccount *account) | 571 const GaimAccount *account) |
574 { | 572 { |
575 GList *iter; | 573 GList *iter; |
576 GaimSavedStatusSub *substatus; | 574 GaimSavedStatusSub *substatus; |
577 | 575 |
578 g_return_val_if_fail(saved_status != NULL, NULL); | 576 g_return_val_if_fail(saved_status != NULL, NULL); |
636 const char *message = NULL; | 634 const char *message = NULL; |
637 | 635 |
638 g_return_if_fail(saved_status != NULL); | 636 g_return_if_fail(saved_status != NULL); |
639 g_return_if_fail(account != NULL); | 637 g_return_if_fail(account != NULL); |
640 | 638 |
641 substatus = gaim_savedstatus_get_substatus_for_account(saved_status, account); | 639 substatus = gaim_savedstatus_get_substatus(saved_status, account); |
642 if (substatus != NULL) | 640 if (substatus != NULL) |
643 { | 641 { |
644 status_type = substatus->type; | 642 status_type = substatus->type; |
645 message = substatus->message; | 643 message = substatus->message; |
646 } | 644 } |