Mercurial > pidgin
comparison console/gntblist.c @ 13931:917a71dd02eb
[gaim-migrate @ 16458]
Add text-attributes for rows in a GntTree. Use this feature to dim
idle buddies in the buddylist.
committer: Tailor Script <tailor@pidgin.im>
author | Sadrul Habib Chowdhury <imadil@gmail.com> |
---|---|
date | Sat, 08 Jul 2006 07:13:29 +0000 |
parents | 9309d27d780c |
children | 25be562aaca8 |
comparison
equal
deleted
inserted
replaced
13930:3dbcbc5e57e1 | 13931:917a71dd02eb |
---|---|
201 group = gaim_buddy_get_group(buddy); | 201 group = gaim_buddy_get_group(buddy); |
202 add_node((GaimBlistNode*)group, ggblist); | 202 add_node((GaimBlistNode*)group, ggblist); |
203 | 203 |
204 node->ui_data = gnt_tree_add_row_after(GNT_TREE(ggblist->tree), buddy, | 204 node->ui_data = gnt_tree_add_row_after(GNT_TREE(ggblist->tree), buddy, |
205 get_display_name(node), group, NULL); | 205 get_display_name(node), group, NULL); |
206 if (gaim_presence_is_idle(gaim_buddy_get_presence(buddy))) | |
207 gnt_tree_set_row_flags(GNT_TREE(ggblist->tree), buddy, GNT_TEXT_FLAG_DIM); | |
208 else | |
209 gnt_tree_set_row_flags(GNT_TREE(ggblist->tree), buddy, 0); | |
206 } | 210 } |
207 | 211 |
208 #if 0 | 212 #if 0 |
209 static void | 213 static void |
210 buddy_signed_on(GaimBuddy *buddy, GGBlist *ggblist) | 214 buddy_signed_on(GaimBuddy *buddy, GGBlist *ggblist) |
356 selection_changed(GntWidget *widget, gpointer old, gpointer current, GGBlist *ggblist) | 360 selection_changed(GntWidget *widget, gpointer old, gpointer current, GGBlist *ggblist) |
357 { | 361 { |
358 draw_tooltip(ggblist); | 362 draw_tooltip(ggblist); |
359 } | 363 } |
360 | 364 |
361 | |
362 static gboolean | 365 static gboolean |
363 key_pressed(GntWidget *widget, const char *text, GGBlist *ggblist) | 366 key_pressed(GntWidget *widget, const char *text, GGBlist *ggblist) |
364 { | 367 { |
365 if (text[0] == 27 && text[1] == 0) | 368 if (text[0] == 27 && text[1] == 0) |
366 { | 369 { |
375 | 378 |
376 return FALSE; | 379 return FALSE; |
377 } | 380 } |
378 | 381 |
379 static void | 382 static void |
380 buddy_status_changed(GaimBuddy *buddy, GaimStatus *old, GaimStatus *now, GGBlist *ggblist) | 383 update_buddy_display(GaimBuddy *buddy, GGBlist *ggblist) |
381 { | 384 { |
382 gnt_tree_change_text(GNT_TREE(ggblist->tree), buddy, get_display_name((GaimBlistNode*)buddy)); | 385 gnt_tree_change_text(GNT_TREE(ggblist->tree), buddy, get_display_name((GaimBlistNode*)buddy)); |
383 if (ggblist->tnode == (GaimBlistNode*)buddy) | 386 if (ggblist->tnode == (GaimBlistNode*)buddy) |
384 draw_tooltip(ggblist); | 387 draw_tooltip(ggblist); |
388 | |
389 if (gaim_presence_is_idle(gaim_buddy_get_presence(buddy))) | |
390 gnt_tree_set_row_flags(GNT_TREE(ggblist->tree), buddy, GNT_TEXT_FLAG_DIM); | |
391 else | |
392 gnt_tree_set_row_flags(GNT_TREE(ggblist->tree), buddy, 0); | |
393 } | |
394 | |
395 static void | |
396 buddy_status_changed(GaimBuddy *buddy, GaimStatus *old, GaimStatus *now, GGBlist *ggblist) | |
397 { | |
398 update_buddy_display(buddy, ggblist); | |
399 } | |
400 | |
401 static void | |
402 buddy_idle_changed(GaimBuddy *buddy, int old, int new, GGBlist *ggblist) | |
403 { | |
404 update_buddy_display(buddy, ggblist); | |
385 } | 405 } |
386 | 406 |
387 void gg_blist_init() | 407 void gg_blist_init() |
388 { | 408 { |
389 ggblist = g_new0(GGBlist, 1); | 409 ggblist = g_new0(GGBlist, 1); |
403 gnt_box_add_widget(GNT_BOX(ggblist->window), ggblist->tree); | 423 gnt_box_add_widget(GNT_BOX(ggblist->window), ggblist->tree); |
404 gnt_widget_show(ggblist->window); | 424 gnt_widget_show(ggblist->window); |
405 | 425 |
406 gaim_signal_connect(gaim_blist_get_handle(), "buddy-status-changed", gg_blist_get_handle(), | 426 gaim_signal_connect(gaim_blist_get_handle(), "buddy-status-changed", gg_blist_get_handle(), |
407 GAIM_CALLBACK(buddy_status_changed), ggblist); | 427 GAIM_CALLBACK(buddy_status_changed), ggblist); |
428 gaim_signal_connect(gaim_blist_get_handle(), "buddy-idle-changed", gg_blist_get_handle(), | |
429 GAIM_CALLBACK(buddy_idle_changed), ggblist); | |
408 | 430 |
409 #if 0 | 431 #if 0 |
410 gaim_signal_connect(gaim_blist_get_handle(), "buddy-signed-on", gg_blist_get_handle(), | 432 gaim_signal_connect(gaim_blist_get_handle(), "buddy-signed-on", gg_blist_get_handle(), |
411 GAIM_CALLBACK(buddy_signed_on), ggblist); | 433 GAIM_CALLBACK(buddy_signed_on), ggblist); |
412 gaim_signal_connect(gaim_blist_get_handle(), "buddy-signed-off", gg_blist_get_handle(), | 434 gaim_signal_connect(gaim_blist_get_handle(), "buddy-signed-off", gg_blist_get_handle(), |