Mercurial > pidgin
changeset 4725:fd44726a527f
[gaim-migrate @ 5038]
Hiding/showing columns instead of just putting stuff in them or not. This is
more good than before and it will be faster and the idle time will be on the
right.
i go to sleep now bed.
committer: Tailor Script <tailor@pidgin.im>
author | Sean Egan <seanegan@gmail.com> |
---|---|
date | Wed, 12 Mar 2003 12:35:02 +0000 |
parents | b9e7ccf21f9c |
children | 0b1c01fd68f1 |
files | src/buddy.c src/gtklist.h src/prefs.c |
diffstat | 3 files changed, 39 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/src/buddy.c Wed Mar 12 11:37:31 2003 +0000 +++ b/src/buddy.c Wed Mar 12 12:35:02 2003 +0000 @@ -874,26 +874,26 @@ g_object_set(rend, "ypad", 0.0, NULL); rend = gtk_cell_renderer_text_new(); - column = gtk_tree_view_column_new_with_attributes("Warning", rend, "markup", WARNING_COLUMN, NULL); - gtk_tree_view_append_column(GTK_TREE_VIEW(gtkblist->treeview), column); + gtkblist->warning_column = gtk_tree_view_column_new_with_attributes("Warning", rend, "markup", WARNING_COLUMN, NULL); + gtk_tree_view_append_column(GTK_TREE_VIEW(gtkblist->treeview), gtkblist->warning_column); g_object_set(rend, "xalign", 1.0, "ypad", 0.0, NULL); rend = gtk_cell_renderer_text_new(); - column = gtk_tree_view_column_new_with_attributes("Idle", rend, "markup", IDLE_COLUMN, NULL); - gtk_tree_view_append_column(GTK_TREE_VIEW(gtkblist->treeview), column); + gtkblist->idle_column = gtk_tree_view_column_new_with_attributes("Idle", rend, "markup", IDLE_COLUMN, NULL); + gtk_tree_view_append_column(GTK_TREE_VIEW(gtkblist->treeview), gtkblist->idle_column); g_object_set(rend, "xalign", 1.0, "ypad", 0.0, NULL); rend = gtk_cell_renderer_pixbuf_new(); - column = gtk_tree_view_column_new_with_attributes("Buddy Icon", rend, "pixbuf", BUDDY_ICON_COLUMN, NULL); + gtkblist->buddy_icon_column = gtk_tree_view_column_new_with_attributes("Buddy Icon", rend, "pixbuf", BUDDY_ICON_COLUMN, NULL); g_object_set(rend, "xalign", 1.0, "ypad", 0.0, NULL); - gtk_tree_view_append_column(GTK_TREE_VIEW(gtkblist->treeview), column); + gtk_tree_view_append_column(GTK_TREE_VIEW(gtkblist->treeview), gtkblist->buddy_icon_column); g_signal_connect(G_OBJECT(gtkblist->treeview), "row-activated", G_CALLBACK(gtk_blist_row_activated_cb), NULL); g_signal_connect(G_OBJECT(gtkblist->treeview), "button-press-event", G_CALLBACK(gtk_blist_button_press_cb), NULL); gtk_box_pack_start(GTK_BOX(gtkblist->vbox), sw, TRUE, TRUE, 0); gtk_container_add(GTK_CONTAINER(sw), gtkblist->treeview); - + gaim_gtk_blist_update_columns(); /**************************** Button Box **************************************/ sg = gtk_size_group_new(GTK_SIZE_GROUP_BOTH); @@ -993,6 +993,19 @@ gtk_widget_show_all(gtkblist->bbox); } +void gaim_gtk_blist_update_columns() +{ + if (blist_options & OPT_BLIST_SHOW_ICONS) { + gtk_tree_view_column_set_visible(gtkblist->buddy_icon_column, TRUE); + gtk_tree_view_column_set_visible(gtkblist->idle_column, FALSE); + gtk_tree_view_column_set_visible(gtkblist->warning_column, FALSE); + } else { + gtk_tree_view_column_set_visible(gtkblist->idle_column, blist_options & OPT_BLIST_SHOW_IDLETIME); + gtk_tree_view_column_set_visible(gtkblist->warning_column, blist_options & OPT_BLIST_SHOW_WARN); + gtk_tree_view_column_set_visible(gtkblist->buddy_icon_column, FALSE); + } +} + static void gaim_gtk_blist_remove(struct gaim_buddy_list *list, GaimBlistNode *node) { struct gaim_gtk_blist_node *gtknode; @@ -1087,8 +1100,7 @@ avatar = gaim_gtk_blist_get_buddy_icon((struct buddy*)node); mark = gaim_gtk_blist_get_name_markup((struct buddy*)node); - if ((((struct buddy*)node)->idle > 0) && - (!(blist_options & OPT_BLIST_SHOW_ICONS) && (blist_options & OPT_BLIST_SHOW_IDLETIME))) { + if (((struct buddy*)node)->idle > 0) { time_t t; int ihrs, imin; time(&t); @@ -1100,10 +1112,9 @@ idle = g_strdup_printf("(%d)", imin); } - if ((((struct buddy*)node)->evil > 0) && - (!(blist_options & OPT_BLIST_SHOW_ICONS) && (blist_options & OPT_BLIST_SHOW_WARN))) { + if (((struct buddy*)node)->evil > 0) warning = g_strdup_printf("%d%%", ((struct buddy*)node)->evil); - } + if((blist_options & OPT_BLIST_GREY_IDLERS) && ((struct buddy *)node)->idle) {
--- a/src/gtklist.h Wed Mar 12 11:37:31 2003 +0000 +++ b/src/gtklist.h Wed Mar 12 12:35:02 2003 +0000 @@ -51,7 +51,11 @@ GtkWidget *treeview; /**< It's a treeview... d'uh. */ GtkTreeStore *treemodel; /**< This is the treemodel. */ - + + GtkTreeViewColumn *idle_column, + *warning_column, + *buddy_icon_column; + GtkWidget *bbox; /**< A Button Box. */ guint timeout; /**< The timeout for the tooltip. */ @@ -113,4 +117,6 @@ void gaim_gtk_blist_docklet_toggle(); void gaim_gtk_blist_docklet_add(); void gaim_gtk_blist_docklet_remove(); +void gaim_gtk_blist_update_colums(); + #endif /* _GAIM_GTK_LIST_H_ */
--- a/src/prefs.c Wed Mar 12 11:37:31 2003 +0000 +++ b/src/prefs.c Wed Mar 12 12:35:02 2003 +0000 @@ -1977,8 +1977,16 @@ if (option == OPT_BLIST_NO_BUTTONS || option == OPT_BLIST_NO_BUTTONS) gaim_gtk_blist_update_toolbar(); - else + else if (option == OPT_BLIST_SHOW_WARN || + option == OPT_BLIST_SHOW_IDLETIME) + gaim_gtk_blist_update_columns(); + else if (option == OPT_BLIST_SHOW_ICONS) { gaim_gtk_blist_refresh(gaim_get_blist()); + gaim_gtk_blist_update_columns(); + } else + gaim_gtk_blist_refresh(gaim_get_blist()); + + }