Mercurial > pidgin
comparison src/buddy.c @ 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 | 751c37a940dd |
comparison
equal
deleted
inserted
replaced
4724:b9e7ccf21f9c | 4725:fd44726a527f |
---|---|
872 column = gtk_tree_view_column_new_with_attributes("Name", rend, "markup", NAME_COLUMN, NULL); | 872 column = gtk_tree_view_column_new_with_attributes("Name", rend, "markup", NAME_COLUMN, NULL); |
873 gtk_tree_view_append_column(GTK_TREE_VIEW(gtkblist->treeview), column); | 873 gtk_tree_view_append_column(GTK_TREE_VIEW(gtkblist->treeview), column); |
874 g_object_set(rend, "ypad", 0.0, NULL); | 874 g_object_set(rend, "ypad", 0.0, NULL); |
875 | 875 |
876 rend = gtk_cell_renderer_text_new(); | 876 rend = gtk_cell_renderer_text_new(); |
877 column = gtk_tree_view_column_new_with_attributes("Warning", rend, "markup", WARNING_COLUMN, NULL); | 877 gtkblist->warning_column = gtk_tree_view_column_new_with_attributes("Warning", rend, "markup", WARNING_COLUMN, NULL); |
878 gtk_tree_view_append_column(GTK_TREE_VIEW(gtkblist->treeview), column); | 878 gtk_tree_view_append_column(GTK_TREE_VIEW(gtkblist->treeview), gtkblist->warning_column); |
879 g_object_set(rend, "xalign", 1.0, "ypad", 0.0, NULL); | 879 g_object_set(rend, "xalign", 1.0, "ypad", 0.0, NULL); |
880 | 880 |
881 rend = gtk_cell_renderer_text_new(); | 881 rend = gtk_cell_renderer_text_new(); |
882 column = gtk_tree_view_column_new_with_attributes("Idle", rend, "markup", IDLE_COLUMN, NULL); | 882 gtkblist->idle_column = gtk_tree_view_column_new_with_attributes("Idle", rend, "markup", IDLE_COLUMN, NULL); |
883 gtk_tree_view_append_column(GTK_TREE_VIEW(gtkblist->treeview), column); | 883 gtk_tree_view_append_column(GTK_TREE_VIEW(gtkblist->treeview), gtkblist->idle_column); |
884 g_object_set(rend, "xalign", 1.0, "ypad", 0.0, NULL); | 884 g_object_set(rend, "xalign", 1.0, "ypad", 0.0, NULL); |
885 | 885 |
886 rend = gtk_cell_renderer_pixbuf_new(); | 886 rend = gtk_cell_renderer_pixbuf_new(); |
887 column = gtk_tree_view_column_new_with_attributes("Buddy Icon", rend, "pixbuf", BUDDY_ICON_COLUMN, NULL); | 887 gtkblist->buddy_icon_column = gtk_tree_view_column_new_with_attributes("Buddy Icon", rend, "pixbuf", BUDDY_ICON_COLUMN, NULL); |
888 g_object_set(rend, "xalign", 1.0, "ypad", 0.0, NULL); | 888 g_object_set(rend, "xalign", 1.0, "ypad", 0.0, NULL); |
889 gtk_tree_view_append_column(GTK_TREE_VIEW(gtkblist->treeview), column); | 889 gtk_tree_view_append_column(GTK_TREE_VIEW(gtkblist->treeview), gtkblist->buddy_icon_column); |
890 | 890 |
891 g_signal_connect(G_OBJECT(gtkblist->treeview), "row-activated", G_CALLBACK(gtk_blist_row_activated_cb), NULL); | 891 g_signal_connect(G_OBJECT(gtkblist->treeview), "row-activated", G_CALLBACK(gtk_blist_row_activated_cb), NULL); |
892 g_signal_connect(G_OBJECT(gtkblist->treeview), "button-press-event", G_CALLBACK(gtk_blist_button_press_cb), NULL); | 892 g_signal_connect(G_OBJECT(gtkblist->treeview), "button-press-event", G_CALLBACK(gtk_blist_button_press_cb), NULL); |
893 | 893 |
894 gtk_box_pack_start(GTK_BOX(gtkblist->vbox), sw, TRUE, TRUE, 0); | 894 gtk_box_pack_start(GTK_BOX(gtkblist->vbox), sw, TRUE, TRUE, 0); |
895 gtk_container_add(GTK_CONTAINER(sw), gtkblist->treeview); | 895 gtk_container_add(GTK_CONTAINER(sw), gtkblist->treeview); |
896 | 896 gaim_gtk_blist_update_columns(); |
897 /**************************** Button Box **************************************/ | 897 /**************************** Button Box **************************************/ |
898 | 898 |
899 sg = gtk_size_group_new(GTK_SIZE_GROUP_BOTH); | 899 sg = gtk_size_group_new(GTK_SIZE_GROUP_BOTH); |
900 gtkblist->bbox = gtk_hbox_new(TRUE, 0); | 900 gtkblist->bbox = gtk_hbox_new(TRUE, 0); |
901 gtk_box_pack_start(GTK_BOX(gtkblist->vbox), gtkblist->bbox, FALSE, FALSE, 0); | 901 gtk_box_pack_start(GTK_BOX(gtkblist->vbox), gtkblist->bbox, FALSE, FALSE, 0); |
991 gtk_widget_hide(gtkblist->bbox); | 991 gtk_widget_hide(gtkblist->bbox); |
992 else | 992 else |
993 gtk_widget_show_all(gtkblist->bbox); | 993 gtk_widget_show_all(gtkblist->bbox); |
994 } | 994 } |
995 | 995 |
996 void gaim_gtk_blist_update_columns() | |
997 { | |
998 if (blist_options & OPT_BLIST_SHOW_ICONS) { | |
999 gtk_tree_view_column_set_visible(gtkblist->buddy_icon_column, TRUE); | |
1000 gtk_tree_view_column_set_visible(gtkblist->idle_column, FALSE); | |
1001 gtk_tree_view_column_set_visible(gtkblist->warning_column, FALSE); | |
1002 } else { | |
1003 gtk_tree_view_column_set_visible(gtkblist->idle_column, blist_options & OPT_BLIST_SHOW_IDLETIME); | |
1004 gtk_tree_view_column_set_visible(gtkblist->warning_column, blist_options & OPT_BLIST_SHOW_WARN); | |
1005 gtk_tree_view_column_set_visible(gtkblist->buddy_icon_column, FALSE); | |
1006 } | |
1007 } | |
1008 | |
996 static void gaim_gtk_blist_remove(struct gaim_buddy_list *list, GaimBlistNode *node) | 1009 static void gaim_gtk_blist_remove(struct gaim_buddy_list *list, GaimBlistNode *node) |
997 { | 1010 { |
998 struct gaim_gtk_blist_node *gtknode; | 1011 struct gaim_gtk_blist_node *gtknode; |
999 GtkTreeIter iter; | 1012 GtkTreeIter iter; |
1000 | 1013 |
1085 status = gaim_gtk_blist_get_status_icon((struct buddy*)node, | 1098 status = gaim_gtk_blist_get_status_icon((struct buddy*)node, |
1086 blist_options & OPT_BLIST_SHOW_ICONS ? GAIM_STATUS_ICON_LARGE : GAIM_STATUS_ICON_SMALL); | 1099 blist_options & OPT_BLIST_SHOW_ICONS ? GAIM_STATUS_ICON_LARGE : GAIM_STATUS_ICON_SMALL); |
1087 avatar = gaim_gtk_blist_get_buddy_icon((struct buddy*)node); | 1100 avatar = gaim_gtk_blist_get_buddy_icon((struct buddy*)node); |
1088 mark = gaim_gtk_blist_get_name_markup((struct buddy*)node); | 1101 mark = gaim_gtk_blist_get_name_markup((struct buddy*)node); |
1089 | 1102 |
1090 if ((((struct buddy*)node)->idle > 0) && | 1103 if (((struct buddy*)node)->idle > 0) { |
1091 (!(blist_options & OPT_BLIST_SHOW_ICONS) && (blist_options & OPT_BLIST_SHOW_IDLETIME))) { | |
1092 time_t t; | 1104 time_t t; |
1093 int ihrs, imin; | 1105 int ihrs, imin; |
1094 time(&t); | 1106 time(&t); |
1095 ihrs = (t - ((struct buddy *)node)->idle) / 3600; | 1107 ihrs = (t - ((struct buddy *)node)->idle) / 3600; |
1096 imin = ((t - ((struct buddy*)node)->idle) / 60) % 60; | 1108 imin = ((t - ((struct buddy*)node)->idle) / 60) % 60; |
1098 idle = g_strdup_printf("(%d:%02d)", ihrs, imin); | 1110 idle = g_strdup_printf("(%d:%02d)", ihrs, imin); |
1099 else | 1111 else |
1100 idle = g_strdup_printf("(%d)", imin); | 1112 idle = g_strdup_printf("(%d)", imin); |
1101 } | 1113 } |
1102 | 1114 |
1103 if ((((struct buddy*)node)->evil > 0) && | 1115 if (((struct buddy*)node)->evil > 0) |
1104 (!(blist_options & OPT_BLIST_SHOW_ICONS) && (blist_options & OPT_BLIST_SHOW_WARN))) { | |
1105 warning = g_strdup_printf("%d%%", ((struct buddy*)node)->evil); | 1116 warning = g_strdup_printf("%d%%", ((struct buddy*)node)->evil); |
1106 } | 1117 |
1107 | 1118 |
1108 if((blist_options & OPT_BLIST_GREY_IDLERS) | 1119 if((blist_options & OPT_BLIST_GREY_IDLERS) |
1109 && ((struct buddy *)node)->idle) { | 1120 && ((struct buddy *)node)->idle) { |
1110 if(warning) { | 1121 if(warning) { |
1111 char *w2 = g_strdup_printf("<span color='dim grey'>%s</span>", | 1122 char *w2 = g_strdup_printf("<span color='dim grey'>%s</span>", |