comparison src/blist.c @ 9030:7ab20f829190

[gaim-migrate @ 9806] Siege updated the code for creating right-click menu's for buddies, chats, groups, etc. It uses more stuff from the blist API and less stuff from multi.h. It also combines the code for right-click menus for chats, buddies, etc. (all types of blist nodes). So PRPLs and plugins can easily add right-click menu options to anything in the buddy list in a clean way. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Sun, 23 May 2004 17:27:45 +0000
parents 84640caaacbf
children 9f21659ecf11
comparison
equal deleted inserted replaced
9029:697e169dac12 9030:7ab20f829190
2718 } 2718 }
2719 2719
2720 /* XXX: end compat crap */ 2720 /* XXX: end compat crap */
2721 2721
2722 2722
2723 GList *gaim_buddy_get_extended_menu(GaimBuddy *b) { 2723 GList *gaim_blist_node_get_extended_menu(GaimBlistNode *n) {
2724 GList *menu = NULL; 2724 GList *menu = NULL;
2725 gaim_signal_emit(gaim_blist_get_handle(), "buddy-extended-menu", 2725
2726 b, &menu); 2726 g_return_val_if_fail(n, NULL);
2727
2728 gaim_signal_emit(gaim_blist_get_handle(),
2729 "blist-node-extended-menu",
2730 n, &menu);
2727 return menu; 2731 return menu;
2728 } 2732 }
2729 2733
2730 GList *gaim_chat_get_extended_menu(GaimChat *c) { 2734
2731 GList *menu = NULL; 2735 GaimBlistNodeAction *
2732 gaim_signal_emit(gaim_blist_get_handle(), "chat-extended-menu", 2736 gaim_blist_node_action_new(char *label,
2733 c, &menu); 2737 void (*callback)(GaimBlistNode *, gpointer),
2734 return menu; 2738 gpointer data)
2735 } 2739 {
2736 2740 GaimBlistNodeAction *act = g_new0(GaimBlistNodeAction, 1);
2737 GList *gaim_group_get_extended_menu(GaimGroup *g) { 2741 act->label = label;
2738 GList *menu = NULL; 2742 act->callback = callback;
2739 gaim_signal_emit(gaim_blist_get_handle(), "group-extended-menu", 2743 act->data = data;
2740 g, &menu); 2744 return act;
2741 return menu;
2742 } 2745 }
2743 2746
2744 2747
2745 int gaim_blist_get_group_size(GaimGroup *group, gboolean offline) { 2748 int gaim_blist_get_group_size(GaimGroup *group, gboolean offline) {
2746 if(!group) 2749 if(!group)
2810 gaim_marshal_VOID__POINTER, NULL, 1, 2813 gaim_marshal_VOID__POINTER, NULL, 1,
2811 gaim_value_new(GAIM_TYPE_SUBTYPE, 2814 gaim_value_new(GAIM_TYPE_SUBTYPE,
2812 GAIM_SUBTYPE_BLIST_BUDDY)); 2815 GAIM_SUBTYPE_BLIST_BUDDY));
2813 2816
2814 gaim_signal_register(handle, "update-idle", gaim_marshal_VOID, NULL, 0); 2817 gaim_signal_register(handle, "update-idle", gaim_marshal_VOID, NULL, 0);
2815 gaim_signal_register(handle, "buddy-extended-menu", 2818
2819 gaim_signal_register(handle, "blist-node-extended-menu",
2816 gaim_marshal_VOID__POINTER_POINTER, NULL, 2, 2820 gaim_marshal_VOID__POINTER_POINTER, NULL, 2,
2817 gaim_value_new(GAIM_TYPE_SUBTYPE, 2821 gaim_value_new(GAIM_TYPE_SUBTYPE,
2818 GAIM_SUBTYPE_BLIST_BUDDY), 2822 GAIM_SUBTYPE_BLIST_NODE),
2819 gaim_value_new(GAIM_TYPE_BOXED, "GList **"));
2820 gaim_signal_register(handle, "chat-extended-menu",
2821 gaim_marshal_VOID__POINTER_POINTER, NULL, 2,
2822 gaim_value_new(GAIM_TYPE_SUBTYPE,
2823 GAIM_SUBTYPE_BLIST_CHAT),
2824 gaim_value_new(GAIM_TYPE_BOXED, "GList **"));
2825 gaim_signal_register(handle, "group-extended-menu",
2826 gaim_marshal_VOID__POINTER_POINTER, NULL, 2,
2827 gaim_value_new(GAIM_TYPE_SUBTYPE,
2828 GAIM_SUBTYPE_BLIST_GROUP),
2829 gaim_value_new(GAIM_TYPE_BOXED, "GList **")); 2823 gaim_value_new(GAIM_TYPE_BOXED, "GList **"));
2830 } 2824 }
2831 2825
2832 void 2826 void
2833 gaim_blist_uninit(void) 2827 gaim_blist_uninit(void)
2834 { 2828 {
2835 gaim_signals_unregister_by_instance(gaim_blist_get_handle()); 2829 gaim_signals_unregister_by_instance(gaim_blist_get_handle());
2836 } 2830 }
2831