Mercurial > pidgin
comparison console/gntblist.c @ 13865:d78ab363e02d
[gaim-migrate @ 16331]
Make the tooltips move to the right place when the selected item goes up/down when someone signs on/off.
committer: Tailor Script <tailor@pidgin.im>
author | Sadrul Habib Chowdhury <imadil@gmail.com> |
---|---|
date | Sat, 24 Jun 2006 20:06:37 +0000 |
parents | c7d84d4c5afa |
children | 5642f4658b59 |
comparison
equal
deleted
inserted
replaced
13864:c7d84d4c5afa | 13865:d78ab363e02d |
---|---|
22 | 22 |
23 GGBlist *ggblist; | 23 GGBlist *ggblist; |
24 | 24 |
25 static void add_buddy(GaimBuddy *buddy, GGBlist *ggblist); | 25 static void add_buddy(GaimBuddy *buddy, GGBlist *ggblist); |
26 static void add_group(GaimGroup *group, GGBlist *ggblist); | 26 static void add_group(GaimGroup *group, GGBlist *ggblist); |
27 static void add_node(GaimBlistNode *node, GGBlist *ggblist); | |
27 static void draw_tooltip(GGBlist *ggblist); | 28 static void draw_tooltip(GGBlist *ggblist); |
28 | 29 |
29 static void | 30 static void |
30 new_node(GaimBlistNode *node) | 31 new_node(GaimBlistNode *node) |
31 { | 32 { |
33 } | |
34 | |
35 static void add_node(GaimBlistNode *node, GGBlist *ggblist) | |
36 { | |
37 if (GAIM_BLIST_NODE_IS_BUDDY(node)) | |
38 add_buddy((GaimBuddy*)node, ggblist); | |
39 else if (GAIM_BLIST_NODE_IS_GROUP(node)) | |
40 add_group((GaimGroup*)node, ggblist); | |
41 draw_tooltip(ggblist); | |
32 } | 42 } |
33 | 43 |
34 static void | 44 static void |
35 remove_tooltip(GGBlist *ggblist) | 45 remove_tooltip(GGBlist *ggblist) |
36 { | 46 { |
54 if (GAIM_BLIST_NODE_IS_BUDDY(node)) | 64 if (GAIM_BLIST_NODE_IS_BUDDY(node)) |
55 { | 65 { |
56 GaimGroup *group = gaim_buddy_get_group((GaimBuddy*)node); | 66 GaimGroup *group = gaim_buddy_get_group((GaimBuddy*)node); |
57 if (gaim_blist_get_group_online_count(group) == 0) | 67 if (gaim_blist_get_group_online_count(group) == 0) |
58 node_remove(list, (GaimBlistNode*)group); | 68 node_remove(list, (GaimBlistNode*)group); |
59 else if (ggblist->tnode == (GaimBlistNode *)group) /* Need to update the counts */ | 69 } |
60 draw_tooltip(ggblist); | 70 draw_tooltip(ggblist); |
61 } | |
62 | |
63 if (ggblist->tnode == node) | |
64 { | |
65 remove_tooltip(ggblist); | |
66 } | |
67 } | 71 } |
68 | 72 |
69 static void | 73 static void |
70 node_update(GaimBuddyList *list, GaimBlistNode *node) | 74 node_update(GaimBuddyList *list, GaimBlistNode *node) |
71 { | 75 { |
72 if (GAIM_BLIST_NODE_IS_BUDDY(node)) | 76 if (GAIM_BLIST_NODE_IS_BUDDY(node)) |
73 { | 77 { |
74 GaimBuddy *buddy = (GaimBuddy*)node; | 78 GaimBuddy *buddy = (GaimBuddy*)node; |
75 if (gaim_presence_is_online(gaim_buddy_get_presence(buddy))) | 79 if (gaim_presence_is_online(gaim_buddy_get_presence(buddy))) |
76 add_buddy(buddy, list->ui_data); | 80 add_node((GaimBlistNode*)buddy, list->ui_data); |
77 else | 81 else |
78 node_remove(gaim_get_blist(), node); | 82 node_remove(gaim_get_blist(), node); |
79 } | 83 } |
80 } | 84 } |
81 | 85 |
169 GaimBlistNode *node = (GaimBlistNode *)buddy; | 173 GaimBlistNode *node = (GaimBlistNode *)buddy; |
170 if (node->ui_data) | 174 if (node->ui_data) |
171 return; | 175 return; |
172 | 176 |
173 group = gaim_buddy_get_group(buddy); | 177 group = gaim_buddy_get_group(buddy); |
174 add_group(group, ggblist); | 178 add_node((GaimBlistNode*)group, ggblist); |
175 | 179 |
176 node->ui_data = gnt_tree_add_row_after(GNT_TREE(ggblist->tree), buddy, | 180 node->ui_data = gnt_tree_add_row_after(GNT_TREE(ggblist->tree), buddy, |
177 get_buddy_display_name(buddy), group, NULL); | 181 get_buddy_display_name(buddy), group, NULL); |
178 | |
179 if (ggblist->tnode == (GaimBlistNode*)group) | |
180 draw_tooltip(ggblist); | |
181 } | 182 } |
182 | 183 |
183 static void | 184 static void |
184 buddy_signed_on(GaimBuddy *buddy, GGBlist *ggblist) | 185 buddy_signed_on(GaimBuddy *buddy, GGBlist *ggblist) |
185 { | 186 { |
186 add_buddy(buddy, ggblist); | 187 add_node((GaimBlistNode*)buddy, ggblist); |
187 } | 188 } |
188 | 189 |
189 static void | 190 static void |
190 buddy_signed_off(GaimBuddy *buddy, GGBlist *ggblist) | 191 buddy_signed_off(GaimBuddy *buddy, GGBlist *ggblist) |
191 { | 192 { |