console/gntblist.c

changeset 14026
ad91ce0effe2
parent 14021
a633de85f90e
child 14072
4e64a4f18686
equal deleted inserted replaced
14025:98bb9921edfa 14026:ad91ce0effe2
127 add_group(GaimGroup *group, GGBlist *ggblist) 127 add_group(GaimGroup *group, GGBlist *ggblist)
128 { 128 {
129 GaimBlistNode *node = (GaimBlistNode *)group; 129 GaimBlistNode *node = (GaimBlistNode *)group;
130 if (node->ui_data) 130 if (node->ui_data)
131 return; 131 return;
132 gnt_tree_remove(GNT_TREE(ggblist->tree), group);
132 node->ui_data = gnt_tree_add_row_after(GNT_TREE(ggblist->tree), group, 133 node->ui_data = gnt_tree_add_row_after(GNT_TREE(ggblist->tree), group,
133 group->name, NULL, NULL); 134 gnt_tree_create_row(GNT_TREE(ggblist->tree), group->name), NULL, NULL);
134 } 135 }
135 136
136 static const char * 137 static const char *
137 get_display_name(GaimBlistNode *node) 138 get_display_name(GaimBlistNode *node)
138 { 139 {
189 return; 190 return;
190 191
191 group = gaim_chat_get_group(chat); 192 group = gaim_chat_get_group(chat);
192 add_node((GaimBlistNode*)group, ggblist); 193 add_node((GaimBlistNode*)group, ggblist);
193 194
195 gnt_tree_remove(GNT_TREE(ggblist->tree), chat);
194 node->ui_data = gnt_tree_add_row_after(GNT_TREE(ggblist->tree), chat, 196 node->ui_data = gnt_tree_add_row_after(GNT_TREE(ggblist->tree), chat,
195 get_display_name(node), group, NULL); 197 gnt_tree_create_row(GNT_TREE(ggblist->tree), get_display_name(node)),
198 group, NULL);
196 } 199 }
197 200
198 static void 201 static void
199 add_buddy(GaimBuddy *buddy, GGBlist *ggblist) 202 add_buddy(GaimBuddy *buddy, GGBlist *ggblist)
200 { 203 {
204 return; 207 return;
205 208
206 group = gaim_buddy_get_group(buddy); 209 group = gaim_buddy_get_group(buddy);
207 add_node((GaimBlistNode*)group, ggblist); 210 add_node((GaimBlistNode*)group, ggblist);
208 211
212 gnt_tree_remove(GNT_TREE(ggblist->tree), buddy);
209 node->ui_data = gnt_tree_add_row_after(GNT_TREE(ggblist->tree), buddy, 213 node->ui_data = gnt_tree_add_row_after(GNT_TREE(ggblist->tree), buddy,
210 get_display_name(node), group, NULL); 214 gnt_tree_create_row(GNT_TREE(ggblist->tree), get_display_name(node)),
215 group, NULL);
211 if (gaim_presence_is_idle(gaim_buddy_get_presence(buddy))) 216 if (gaim_presence_is_idle(gaim_buddy_get_presence(buddy)))
212 gnt_tree_set_row_flags(GNT_TREE(ggblist->tree), buddy, GNT_TEXT_FLAG_DIM); 217 gnt_tree_set_row_flags(GNT_TREE(ggblist->tree), buddy, GNT_TEXT_FLAG_DIM);
213 else 218 else
214 gnt_tree_set_row_flags(GNT_TREE(ggblist->tree), buddy, 0); 219 gnt_tree_set_row_flags(GNT_TREE(ggblist->tree), buddy, 0);
215 } 220 }
268 static void 273 static void
269 gnt_append_menu_action(GntTree *tree, GaimMenuAction *action, gpointer parent) 274 gnt_append_menu_action(GntTree *tree, GaimMenuAction *action, gpointer parent)
270 { 275 {
271 GList *list; 276 GList *list;
272 277
273 gnt_tree_add_row_after(tree, action, action->label, parent, NULL); 278 gnt_tree_add_row_after(tree, action,
279 gnt_tree_create_row(tree, action->label), parent, NULL);
274 for (list = action->children; list; list = list->next) 280 for (list = action->children; list; list = list->next)
275 gnt_append_menu_action(tree, list->data, action); 281 gnt_append_menu_action(tree, list->data, action);
276 } 282 }
277 283
278 static void 284 static void
638 } 644 }
639 645
640 static void 646 static void
641 update_buddy_display(GaimBuddy *buddy, GGBlist *ggblist) 647 update_buddy_display(GaimBuddy *buddy, GGBlist *ggblist)
642 { 648 {
643 gnt_tree_change_text(GNT_TREE(ggblist->tree), buddy, get_display_name((GaimBlistNode*)buddy)); 649 gnt_tree_change_text(GNT_TREE(ggblist->tree), buddy, 0, get_display_name((GaimBlistNode*)buddy));
644 if (ggblist->tnode == (GaimBlistNode*)buddy) 650 if (ggblist->tnode == (GaimBlistNode*)buddy)
645 draw_tooltip(ggblist); 651 draw_tooltip(ggblist);
646 652
647 if (gaim_presence_is_idle(gaim_buddy_get_presence(buddy))) 653 if (gaim_presence_is_idle(gaim_buddy_get_presence(buddy)))
648 gnt_tree_set_row_flags(GNT_TREE(ggblist->tree), buddy, GNT_TEXT_FLAG_DIM); 654 gnt_tree_set_row_flags(GNT_TREE(ggblist->tree), buddy, GNT_TEXT_FLAG_DIM);
683 gnt_box_set_title(GNT_BOX(ggblist->window), _("Buddy List")); 689 gnt_box_set_title(GNT_BOX(ggblist->window), _("Buddy List"));
684 gnt_box_set_pad(GNT_BOX(ggblist->window), 0); 690 gnt_box_set_pad(GNT_BOX(ggblist->window), 0);
685 691
686 ggblist->tree = gnt_tree_new(); 692 ggblist->tree = gnt_tree_new();
687 GNT_WIDGET_SET_FLAGS(ggblist->tree, GNT_WIDGET_NO_BORDER); 693 GNT_WIDGET_SET_FLAGS(ggblist->tree, GNT_WIDGET_NO_BORDER);
688 gnt_widget_set_size(ggblist->tree, 25, getmaxy(stdscr) - 4); 694 gnt_tree_set_col_width(GNT_TREE(ggblist->tree), 0, 25);
695 gnt_widget_set_size(ggblist->tree, 0, getmaxy(stdscr) - 4);
689 696
690 gnt_box_add_widget(GNT_BOX(ggblist->window), ggblist->tree); 697 gnt_box_add_widget(GNT_BOX(ggblist->window), ggblist->tree);
691 gnt_widget_show(ggblist->window); 698 gnt_widget_show(ggblist->window);
692 699
693 gaim_signal_connect(gaim_blist_get_handle(), "buddy-status-changed", gg_blist_get_handle(), 700 gaim_signal_connect(gaim_blist_get_handle(), "buddy-status-changed", gg_blist_get_handle(),

mercurial