Mercurial > pidgin.yaz
comparison libpurple/notify.c @ 32369:0ee025d8686e
user_info->user_info_entries is redundant. Let's call it
user_info->entries, instead.
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Mon, 22 Aug 2011 04:16:28 +0000 |
parents | 6283c0f2b02f |
children | 0cc718e10344 |
comparison
equal
deleted
inserted
replaced
32368:6283c0f2b02f | 32369:0ee025d8686e |
---|---|
51 PurpleNotifyUserInfoEntryType type; | 51 PurpleNotifyUserInfoEntryType type; |
52 }; | 52 }; |
53 | 53 |
54 struct _PurpleNotifyUserInfo | 54 struct _PurpleNotifyUserInfo |
55 { | 55 { |
56 GQueue user_info_entries; | 56 GQueue entries; |
57 }; | 57 }; |
58 | 58 |
59 void * | 59 void * |
60 purple_notify_message(void *handle, PurpleNotifyMsgType type, | 60 purple_notify_message(void *handle, PurpleNotifyMsgType type, |
61 const char *title, const char *primary, | 61 const char *title, const char *primary, |
452 { | 452 { |
453 PurpleNotifyUserInfo *user_info; | 453 PurpleNotifyUserInfo *user_info; |
454 | 454 |
455 user_info = g_new0(PurpleNotifyUserInfo, 1); | 455 user_info = g_new0(PurpleNotifyUserInfo, 1); |
456 PURPLE_DBUS_REGISTER_POINTER(user_info, PurpleNotifyUserInfo); | 456 PURPLE_DBUS_REGISTER_POINTER(user_info, PurpleNotifyUserInfo); |
457 g_queue_init(&user_info->user_info_entries); | 457 g_queue_init(&user_info->entries); |
458 | 458 |
459 return user_info; | 459 return user_info; |
460 } | 460 } |
461 | 461 |
462 void | 462 void |
463 purple_notify_user_info_destroy(PurpleNotifyUserInfo *user_info) | 463 purple_notify_user_info_destroy(PurpleNotifyUserInfo *user_info) |
464 { | 464 { |
465 GList *l; | 465 GList *l; |
466 | 466 |
467 for (l = user_info->user_info_entries.head; l != NULL; l = l->next) { | 467 for (l = user_info->entries.head; l != NULL; l = l->next) { |
468 PurpleNotifyUserInfoEntry *user_info_entry = l->data; | 468 PurpleNotifyUserInfoEntry *user_info_entry = l->data; |
469 | 469 |
470 purple_notify_user_info_entry_destroy(user_info_entry); | 470 purple_notify_user_info_entry_destroy(user_info_entry); |
471 } | 471 } |
472 | 472 |
473 g_queue_clear(&user_info->user_info_entries); | 473 g_queue_clear(&user_info->entries); |
474 PURPLE_DBUS_UNREGISTER_POINTER(user_info); | 474 PURPLE_DBUS_UNREGISTER_POINTER(user_info); |
475 g_free(user_info); | 475 g_free(user_info); |
476 } | 476 } |
477 | 477 |
478 GQueue * | 478 GQueue * |
479 purple_notify_user_info_get_entries(PurpleNotifyUserInfo *user_info) | 479 purple_notify_user_info_get_entries(PurpleNotifyUserInfo *user_info) |
480 { | 480 { |
481 g_return_val_if_fail(user_info != NULL, NULL); | 481 g_return_val_if_fail(user_info != NULL, NULL); |
482 | 482 |
483 return &user_info->user_info_entries; | 483 return &user_info->entries; |
484 } | 484 } |
485 | 485 |
486 char * | 486 char * |
487 purple_notify_user_info_get_text_with_newline(PurpleNotifyUserInfo *user_info, const char *newline) | 487 purple_notify_user_info_get_text_with_newline(PurpleNotifyUserInfo *user_info, const char *newline) |
488 { | 488 { |
489 GList *l; | 489 GList *l; |
490 GString *text; | 490 GString *text; |
491 | 491 |
492 text = g_string_new(""); | 492 text = g_string_new(""); |
493 | 493 |
494 for (l = user_info->user_info_entries.head; l != NULL; l = l->next) { | 494 for (l = user_info->entries.head; l != NULL; l = l->next) { |
495 PurpleNotifyUserInfoEntry *user_info_entry = l->data; | 495 PurpleNotifyUserInfoEntry *user_info_entry = l->data; |
496 /* Add a newline before a section header */ | 496 /* Add a newline before a section header */ |
497 if (user_info_entry->type == PURPLE_NOTIFY_USER_INFO_ENTRY_SECTION_HEADER) | 497 if (user_info_entry->type == PURPLE_NOTIFY_USER_INFO_ENTRY_SECTION_HEADER) |
498 g_string_append(text, newline); | 498 g_string_append(text, newline); |
499 | 499 |
578 purple_notify_user_info_add_pair_html(PurpleNotifyUserInfo *user_info, const char *label, const char *value) | 578 purple_notify_user_info_add_pair_html(PurpleNotifyUserInfo *user_info, const char *label, const char *value) |
579 { | 579 { |
580 PurpleNotifyUserInfoEntry *entry; | 580 PurpleNotifyUserInfoEntry *entry; |
581 | 581 |
582 entry = purple_notify_user_info_entry_new(label, value); | 582 entry = purple_notify_user_info_entry_new(label, value); |
583 g_queue_push_tail(&user_info->user_info_entries, entry); | 583 g_queue_push_tail(&user_info->entries, entry); |
584 } | 584 } |
585 | 585 |
586 void | 586 void |
587 purple_notify_user_info_add_pair_plaintext(PurpleNotifyUserInfo *user_info, const char *label, const char *value) | 587 purple_notify_user_info_add_pair_plaintext(PurpleNotifyUserInfo *user_info, const char *label, const char *value) |
588 { | 588 { |
597 purple_notify_user_info_prepend_pair(PurpleNotifyUserInfo *user_info, const char *label, const char *value) | 597 purple_notify_user_info_prepend_pair(PurpleNotifyUserInfo *user_info, const char *label, const char *value) |
598 { | 598 { |
599 PurpleNotifyUserInfoEntry *entry; | 599 PurpleNotifyUserInfoEntry *entry; |
600 | 600 |
601 entry = purple_notify_user_info_entry_new(label, value); | 601 entry = purple_notify_user_info_entry_new(label, value); |
602 g_queue_push_head(&user_info->user_info_entries, entry); | 602 g_queue_push_head(&user_info->entries, entry); |
603 } | 603 } |
604 | 604 |
605 void | 605 void |
606 purple_notify_user_info_remove_entry(PurpleNotifyUserInfo *user_info, PurpleNotifyUserInfoEntry *entry) | 606 purple_notify_user_info_remove_entry(PurpleNotifyUserInfo *user_info, PurpleNotifyUserInfoEntry *entry) |
607 { | 607 { |
608 g_return_if_fail(user_info != NULL); | 608 g_return_if_fail(user_info != NULL); |
609 g_return_if_fail(entry != NULL); | 609 g_return_if_fail(entry != NULL); |
610 | 610 |
611 g_queue_remove(&user_info->user_info_entries, entry); | 611 g_queue_remove(&user_info->entries, entry); |
612 } | 612 } |
613 | 613 |
614 void | 614 void |
615 purple_notify_user_info_add_section_header(PurpleNotifyUserInfo *user_info, const char *label) | 615 purple_notify_user_info_add_section_header(PurpleNotifyUserInfo *user_info, const char *label) |
616 { | 616 { |
617 PurpleNotifyUserInfoEntry *entry; | 617 PurpleNotifyUserInfoEntry *entry; |
618 | 618 |
619 entry = purple_notify_user_info_entry_new(label, NULL); | 619 entry = purple_notify_user_info_entry_new(label, NULL); |
620 entry->type = PURPLE_NOTIFY_USER_INFO_ENTRY_SECTION_HEADER; | 620 entry->type = PURPLE_NOTIFY_USER_INFO_ENTRY_SECTION_HEADER; |
621 | 621 |
622 g_queue_push_tail(&user_info->user_info_entries, entry); | 622 g_queue_push_tail(&user_info->entries, entry); |
623 } | 623 } |
624 | 624 |
625 void | 625 void |
626 purple_notify_user_info_prepend_section_header(PurpleNotifyUserInfo *user_info, const char *label) | 626 purple_notify_user_info_prepend_section_header(PurpleNotifyUserInfo *user_info, const char *label) |
627 { | 627 { |
628 PurpleNotifyUserInfoEntry *entry; | 628 PurpleNotifyUserInfoEntry *entry; |
629 | 629 |
630 entry = purple_notify_user_info_entry_new(label, NULL); | 630 entry = purple_notify_user_info_entry_new(label, NULL); |
631 entry->type = PURPLE_NOTIFY_USER_INFO_ENTRY_SECTION_HEADER; | 631 entry->type = PURPLE_NOTIFY_USER_INFO_ENTRY_SECTION_HEADER; |
632 | 632 |
633 g_queue_push_head(&user_info->user_info_entries, entry); | 633 g_queue_push_head(&user_info->entries, entry); |
634 } | 634 } |
635 | 635 |
636 void | 636 void |
637 purple_notify_user_info_add_section_break(PurpleNotifyUserInfo *user_info) | 637 purple_notify_user_info_add_section_break(PurpleNotifyUserInfo *user_info) |
638 { | 638 { |
639 PurpleNotifyUserInfoEntry *entry; | 639 PurpleNotifyUserInfoEntry *entry; |
640 | 640 |
641 entry = purple_notify_user_info_entry_new(NULL, NULL); | 641 entry = purple_notify_user_info_entry_new(NULL, NULL); |
642 entry->type = PURPLE_NOTIFY_USER_INFO_ENTRY_SECTION_BREAK; | 642 entry->type = PURPLE_NOTIFY_USER_INFO_ENTRY_SECTION_BREAK; |
643 | 643 |
644 g_queue_push_tail(&user_info->user_info_entries, entry); | 644 g_queue_push_tail(&user_info->entries, entry); |
645 } | 645 } |
646 | 646 |
647 void | 647 void |
648 purple_notify_user_info_prepend_section_break(PurpleNotifyUserInfo *user_info) | 648 purple_notify_user_info_prepend_section_break(PurpleNotifyUserInfo *user_info) |
649 { | 649 { |
650 PurpleNotifyUserInfoEntry *entry; | 650 PurpleNotifyUserInfoEntry *entry; |
651 | 651 |
652 entry = purple_notify_user_info_entry_new(NULL, NULL); | 652 entry = purple_notify_user_info_entry_new(NULL, NULL); |
653 entry->type = PURPLE_NOTIFY_USER_INFO_ENTRY_SECTION_BREAK; | 653 entry->type = PURPLE_NOTIFY_USER_INFO_ENTRY_SECTION_BREAK; |
654 | 654 |
655 g_queue_push_head(&user_info->user_info_entries, entry); | 655 g_queue_push_head(&user_info->entries, entry); |
656 } | 656 } |
657 | 657 |
658 void | 658 void |
659 purple_notify_user_info_remove_last_item(PurpleNotifyUserInfo *user_info) | 659 purple_notify_user_info_remove_last_item(PurpleNotifyUserInfo *user_info) |
660 { | 660 { |
661 PurpleNotifyUserInfoEntry *entry; | 661 PurpleNotifyUserInfoEntry *entry; |
662 | 662 |
663 entry = g_queue_pop_tail(&user_info->user_info_entries); | 663 entry = g_queue_pop_tail(&user_info->entries); |
664 if (entry) | 664 if (entry) |
665 purple_notify_user_info_entry_destroy(entry); | 665 purple_notify_user_info_entry_destroy(entry); |
666 } | 666 } |
667 | 667 |
668 void * | 668 void * |