Mercurial > pidgin.yaz
comparison gtk/gtkblist.c @ 14561:3ff55ec8203a
[gaim-migrate @ 17284]
GtkCellRendererExpander draws an expander in a renderer to avoid a large, needless margin.
The approach is a bit hacky, but it's a good job.
- RTL fix in GtkStatusBox
- Drag-and-drop image into the global buddy icon selector to set a buddy icon
committer: Tailor Script <tailor@pidgin.im>
author | Sean Egan <seanegan@gmail.com> |
---|---|
date | Fri, 15 Sep 2006 22:05:34 +0000 |
parents | 16bba6d02c2a |
children | 78d0f3c4c9ff |
comparison
equal
deleted
inserted
replaced
14560:16bba6d02c2a | 14561:3ff55ec8203a |
---|---|
39 #include "gaimstock.h" | 39 #include "gaimstock.h" |
40 #include "util.h" | 40 #include "util.h" |
41 | 41 |
42 #include "gtkaccount.h" | 42 #include "gtkaccount.h" |
43 #include "gtkblist.h" | 43 #include "gtkblist.h" |
44 #include "gtkcellrendererexpander.h" | |
44 #include "gtkconv.h" | 45 #include "gtkconv.h" |
45 #include "gtkdebug.h" | 46 #include "gtkdebug.h" |
46 #include "gtkdialogs.h" | 47 #include "gtkdialogs.h" |
47 #include "gtkft.h" | 48 #include "gtkft.h" |
48 #include "gtklog.h" | 49 #include "gtklog.h" |
808 | 809 |
809 gaim_gtkdialogs_im_with_user(buddy->account, buddy->name); | 810 gaim_gtkdialogs_im_with_user(buddy->account, buddy->name); |
810 } else if (GAIM_BLIST_NODE_IS_CHAT(node)) { | 811 } else if (GAIM_BLIST_NODE_IS_CHAT(node)) { |
811 gtk_blist_join_chat((GaimChat *)node); | 812 gtk_blist_join_chat((GaimChat *)node); |
812 } else if (GAIM_BLIST_NODE_IS_GROUP(node)) { | 813 } else if (GAIM_BLIST_NODE_IS_GROUP(node)) { |
813 if (gtk_tree_view_row_expanded(tv, path)) | 814 /* if (gtk_tree_view_row_expanded(tv, path)) |
814 gtk_tree_view_collapse_row(tv, path); | 815 gtk_tree_view_collapse_row(tv, path); |
815 else | 816 else |
816 gtk_tree_view_expand_row(tv,path,FALSE); | 817 gtk_tree_view_expand_row(tv,path,FALSE);*/ |
817 } | 818 } |
818 } | 819 } |
819 | 820 |
820 static void gaim_gtk_blist_add_chat_cb() | 821 static void gaim_gtk_blist_add_chat_cb() |
821 { | 822 { |
3926 gtk_widget_show(sw); | 3927 gtk_widget_show(sw); |
3927 gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_NONE); | 3928 gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_NONE); |
3928 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); | 3929 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); |
3929 | 3930 |
3930 gtkblist->treemodel = gtk_tree_store_new(BLIST_COLUMNS, | 3931 gtkblist->treemodel = gtk_tree_store_new(BLIST_COLUMNS, |
3931 GDK_TYPE_PIXBUF, G_TYPE_BOOLEAN, G_TYPE_STRING, | 3932 GDK_TYPE_PIXBUF, /* Status icon */ |
3932 G_TYPE_STRING, G_TYPE_BOOLEAN, GDK_TYPE_PIXBUF, G_TYPE_BOOLEAN, | 3933 G_TYPE_BOOLEAN, /* Status icon visible */ |
3933 G_TYPE_POINTER, GDK_TYPE_COLOR, GDK_TYPE_PIXBUF, GDK_TYPE_PIXBUF, | 3934 G_TYPE_STRING, /* Name */ |
3934 G_TYPE_BOOLEAN); | 3935 G_TYPE_STRING, /* Idle */ |
3936 G_TYPE_BOOLEAN, /* Idle visible */ | |
3937 GDK_TYPE_PIXBUF, /* Buddy icon */ | |
3938 G_TYPE_BOOLEAN, /* Buddy icon visible */ | |
3939 G_TYPE_POINTER, /* Node */ | |
3940 GDK_TYPE_COLOR, /* bgcolor */ | |
3941 G_TYPE_BOOLEAN, /* Group expander */ | |
3942 G_TYPE_BOOLEAN, /* Contact expander */ | |
3943 G_TYPE_BOOLEAN); /* Contact expander visible */ | |
3935 | 3944 |
3936 gtkblist->treeview = gtk_tree_view_new_with_model(GTK_TREE_MODEL(gtkblist->treemodel)); | 3945 gtkblist->treeview = gtk_tree_view_new_with_model(GTK_TREE_MODEL(gtkblist->treemodel)); |
3937 | 3946 |
3938 gtk_widget_show(gtkblist->treeview); | 3947 gtk_widget_show(gtkblist->treeview); |
3939 gtk_widget_set_name(gtkblist->treeview, "gaim_gtkblist_treeview"); | 3948 gtk_widget_set_name(gtkblist->treeview, "gaim_gtkblist_treeview"); |
3969 gtk_tree_view_append_column(GTK_TREE_VIEW(gtkblist->treeview), column); | 3978 gtk_tree_view_append_column(GTK_TREE_VIEW(gtkblist->treeview), column); |
3970 gtk_tree_view_column_set_visible(column, FALSE); | 3979 gtk_tree_view_column_set_visible(column, FALSE); |
3971 gtk_tree_view_set_expander_column(GTK_TREE_VIEW(gtkblist->treeview), column); | 3980 gtk_tree_view_set_expander_column(GTK_TREE_VIEW(gtkblist->treeview), column); |
3972 | 3981 |
3973 gtkblist->text_column = column = gtk_tree_view_column_new (); | 3982 gtkblist->text_column = column = gtk_tree_view_column_new (); |
3974 rend = gtk_cell_renderer_pixbuf_new(); | 3983 rend = gaim_gtk_cell_renderer_expander_new(); |
3975 gtk_tree_view_column_pack_start(column, rend, FALSE); | 3984 gtk_tree_view_column_pack_start(column, rend, FALSE); |
3976 gtk_tree_view_column_set_attributes(column, rend, | 3985 gtk_tree_view_column_set_attributes(column, rend, |
3977 "pixbuf", GROUP_EXPANDER_COLUMN, | 3986 "expander-visible", GROUP_EXPANDER_COLUMN, |
3978 "cell-background-gdk", BGCOLOR_COLUMN, | 3987 "cell-background-gdk", BGCOLOR_COLUMN, |
3979 NULL); | 3988 NULL); |
3980 | 3989 |
3981 rend = gtk_cell_renderer_pixbuf_new(); | 3990 rend = gaim_gtk_cell_renderer_expander_new(); |
3982 gtk_tree_view_column_pack_start(column, rend, FALSE); | 3991 gtk_tree_view_column_pack_start(column, rend, FALSE); |
3983 gtk_tree_view_column_set_attributes(column, rend, | 3992 gtk_tree_view_column_set_attributes(column, rend, |
3984 "pixbuf", CONTACT_EXPANDER_COLUMN, | 3993 "expander-visible", CONTACT_EXPANDER_COLUMN, |
3985 "visible", CONTACT_EXPANDER_VISIBLE_COLUMN, | 3994 "visible", CONTACT_EXPANDER_VISIBLE_COLUMN, |
3986 "cell-background-gdk", BGCOLOR_COLUMN, | 3995 "cell-background-gdk", BGCOLOR_COLUMN, |
3987 NULL); | 3996 NULL); |
3988 | 3997 |
3989 rend = gtk_cell_renderer_pixbuf_new(); | 3998 rend = gtk_cell_renderer_pixbuf_new(); |
4023 gtk_tree_view_column_set_attributes(column, rend, "pixbuf", BUDDY_ICON_COLUMN, | 4032 gtk_tree_view_column_set_attributes(column, rend, "pixbuf", BUDDY_ICON_COLUMN, |
4024 "cell-background-gdk", BGCOLOR_COLUMN, | 4033 "cell-background-gdk", BGCOLOR_COLUMN, |
4025 "visible", BUDDY_ICON_VISIBLE_COLUMN, | 4034 "visible", BUDDY_ICON_VISIBLE_COLUMN, |
4026 NULL); | 4035 NULL); |
4027 | 4036 |
4028 | |
4029 gtkblist->expander_expanded = gtk_widget_render_icon(gtkblist->treeview, GAIM_STOCK_EXPANDER_EXPANDED, -1, NULL); | |
4030 gtkblist->expander_collapsed = gtk_widget_render_icon(gtkblist->treeview, GAIM_STOCK_EXPANDER_COLLAPSED, -1, NULL); | |
4031 | 4037 |
4032 g_signal_connect(G_OBJECT(gtkblist->treeview), "row-activated", G_CALLBACK(gtk_blist_row_activated_cb), NULL); | 4038 g_signal_connect(G_OBJECT(gtkblist->treeview), "row-activated", G_CALLBACK(gtk_blist_row_activated_cb), NULL); |
4033 g_signal_connect(G_OBJECT(gtkblist->treeview), "row-expanded", G_CALLBACK(gtk_blist_row_expanded_cb), NULL); | 4039 g_signal_connect(G_OBJECT(gtkblist->treeview), "row-expanded", G_CALLBACK(gtk_blist_row_expanded_cb), NULL); |
4034 g_signal_connect(G_OBJECT(gtkblist->treeview), "row-collapsed", G_CALLBACK(gtk_blist_row_collapsed_cb), NULL); | 4040 g_signal_connect(G_OBJECT(gtkblist->treeview), "row-collapsed", G_CALLBACK(gtk_blist_row_collapsed_cb), NULL); |
4035 g_signal_connect(G_OBJECT(gtkblist->treeview), "button-press-event", G_CALLBACK(gtk_blist_button_press_cb), NULL); | 4041 g_signal_connect(G_OBJECT(gtkblist->treeview), "button-press-event", G_CALLBACK(gtk_blist_button_press_cb), NULL); |
4410 STATUS_ICON_VISIBLE_COLUMN, FALSE, | 4416 STATUS_ICON_VISIBLE_COLUMN, FALSE, |
4411 STATUS_ICON_COLUMN, NULL, | 4417 STATUS_ICON_COLUMN, NULL, |
4412 NAME_COLUMN, mark, | 4418 NAME_COLUMN, mark, |
4413 NODE_COLUMN, gnode, | 4419 NODE_COLUMN, gnode, |
4414 BGCOLOR_COLUMN, &bgcolor, | 4420 BGCOLOR_COLUMN, &bgcolor, |
4415 GROUP_EXPANDER_COLUMN, expanded ? gtkblist->expander_expanded : gtkblist->expander_collapsed, | 4421 GROUP_EXPANDER_COLUMN, TRUE, |
4416 CONTACT_EXPANDER_VISIBLE_COLUMN, FALSE, | 4422 CONTACT_EXPANDER_VISIBLE_COLUMN, FALSE, |
4417 BUDDY_ICON_VISIBLE_COLUMN, FALSE, | 4423 BUDDY_ICON_VISIBLE_COLUMN, FALSE, |
4418 IDLE_VISIBLE_COLUMN, FALSE, | 4424 IDLE_VISIBLE_COLUMN, FALSE, |
4419 -1); | 4425 -1); |
4420 g_free(mark); | 4426 g_free(mark); |
4538 NAME_COLUMN, mark, | 4544 NAME_COLUMN, mark, |
4539 IDLE_COLUMN, NULL, | 4545 IDLE_COLUMN, NULL, |
4540 IDLE_VISIBLE_COLUMN, FALSE, | 4546 IDLE_VISIBLE_COLUMN, FALSE, |
4541 BGCOLOR_COLUMN, NULL, | 4547 BGCOLOR_COLUMN, NULL, |
4542 BUDDY_ICON_COLUMN, NULL, | 4548 BUDDY_ICON_COLUMN, NULL, |
4543 CONTACT_EXPANDER_COLUMN, gtkblist->expander_expanded, | 4549 CONTACT_EXPANDER_COLUMN, TRUE, |
4544 CONTACT_EXPANDER_VISIBLE_COLUMN, TRUE, | 4550 CONTACT_EXPANDER_VISIBLE_COLUMN, TRUE, |
4545 -1); | 4551 -1); |
4546 g_free(mark); | 4552 g_free(mark); |
4547 if(status) | 4553 if(status) |
4548 g_object_unref(status); | 4554 g_object_unref(status); |