Mercurial > pidgin
annotate finch/libgnt/test/multiwin.c @ 19186:eef82b050c21
merge of 'bbeac90ad01d5059327da9e2504716614a191cab'
and 'f30bfc6fc7aee19d096dd838aad5a784a7371d6c'
author | Kevin Stange <kevin@simguy.net> |
---|---|
date | Sat, 11 Aug 2007 21:08:27 +0000 |
parents | 5e1412f4e67a |
children |
rev | line source |
---|---|
15817 | 1 #include "gnt.h" |
2 #include "gntbutton.h" | |
3 #include "gntentry.h" | |
4 #include "gntkeys.h" | |
5 #include "gntlabel.h" | |
6 #include "gnttree.h" | |
7 #include "gntbox.h" | |
8 | |
9 gboolean show(GntWidget *w) | |
10 { | |
11 return FALSE; | |
12 } | |
13 | |
14 int main() | |
15 { | |
16 #ifdef STANDALONE | |
17 freopen(".error", "w", stderr); | |
18 gnt_init(); | |
19 #endif | |
20 | |
21 GntWidget *hbox, *tree, *box2; | |
22 | |
23 hbox = gnt_box_new(FALSE, TRUE); | |
24 box2 = gnt_box_new(FALSE, TRUE); | |
25 | |
26 gnt_widget_set_name(hbox, "hbox"); | |
27 gnt_widget_set_name(box2, "box2"); | |
28 | |
29 tree = gnt_tree_new_with_columns(3); | |
18556
5e1412f4e67a
Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18510
diff
changeset
|
30 gnt_tree_set_search_column(GNT_TREE(tree), 1); |
15817 | 31 GNT_WIDGET_SET_FLAGS(tree, GNT_WIDGET_NO_BORDER); |
32 gnt_tree_set_column_titles(GNT_TREE(tree), "12345678901234567890", "column 2", "column3"); | |
33 gnt_tree_set_show_title(GNT_TREE(tree), TRUE); | |
34 gnt_widget_set_name(tree, "tree"); | |
35 gnt_box_add_widget(GNT_BOX(hbox), tree); | |
36 | |
37 gnt_box_set_toplevel(GNT_BOX(hbox), TRUE); | |
38 gnt_box_set_title(GNT_BOX(hbox), "Testing the tree widget"); | |
39 | |
40 gnt_box_set_toplevel(GNT_BOX(box2), TRUE); | |
41 gnt_box_set_title(GNT_BOX(box2), "On top"); | |
42 | |
43 gnt_box_add_widget(GNT_BOX(box2), gnt_label_new("asdasd")); | |
44 gnt_box_add_widget(GNT_BOX(box2), gnt_entry_new(NULL)); | |
45 | |
46 gnt_widget_show(hbox); | |
47 gnt_widget_set_position(box2, 80, 40); | |
48 gnt_widget_show(box2); | |
49 | |
50 gnt_tree_add_row_after(GNT_TREE(tree), "a", | |
51 gnt_tree_create_row(GNT_TREE(tree), "alaskdjfkashfashfah kfalkdhflsiafhlasf", " long text", "a2"), NULL, NULL); | |
52 gnt_tree_add_row_after(GNT_TREE(tree), "c", | |
53 gnt_tree_create_row(GNT_TREE(tree), "casdgertqhyeqgasfeytwfga fg arf agfwa ", " long text", "a2"), NULL, NULL); | |
54 gnt_tree_add_row_after(GNT_TREE(tree), "d", gnt_tree_create_row(GNT_TREE(tree), "d", " long text", "a2"), NULL, NULL); | |
55 gnt_tree_add_row_after(GNT_TREE(tree), "e", gnt_tree_create_row(GNT_TREE(tree), "e", " long text", "a2"), "a", NULL); | |
56 gnt_tree_add_row_after(GNT_TREE(tree), "b", gnt_tree_create_row(GNT_TREE(tree), "b", "this is", "a2"), "d", NULL); | |
57 | |
58 gnt_tree_add_choice(GNT_TREE(tree), "1", gnt_tree_create_row(GNT_TREE(tree), "1", " long text", "a2"), NULL, NULL); | |
59 gnt_tree_add_row_after(GNT_TREE(tree), "2", gnt_tree_create_row(GNT_TREE(tree), "2", " long text", "a2"), NULL, NULL); | |
60 gnt_tree_add_row_after(GNT_TREE(tree), "3", gnt_tree_create_row(GNT_TREE(tree), "3", " long text", "a2"), NULL, NULL); | |
61 gnt_tree_add_row_after(GNT_TREE(tree), "4", gnt_tree_create_row(GNT_TREE(tree), "4", " long text", "a2"), "a", NULL); | |
62 gnt_tree_add_row_after(GNT_TREE(tree), "5", gnt_tree_create_row(GNT_TREE(tree), "5", " long text", "a2"), "d", NULL); | |
63 | |
64 gnt_tree_add_row_after(GNT_TREE(tree), "6", gnt_tree_create_row(GNT_TREE(tree), "6", " long text", "a2"), "4", NULL); | |
65 | |
66 int i; | |
67 for (i = 110; i < 430; i++) | |
68 { | |
69 char *s; | |
70 s = g_strdup_printf("%d", i); /* XXX: yes, leaking */ | |
71 gnt_tree_add_row_after(GNT_TREE(tree), s, gnt_tree_create_row(GNT_TREE(tree), s, " long text", "a2"), "4", NULL); | |
72 } | |
73 | |
74 gnt_tree_set_row_flags(GNT_TREE(tree), "e", GNT_TEXT_FLAG_DIM); | |
75 | |
76 gnt_tree_set_selected(GNT_TREE(tree), "2"); | |
77 | |
78 g_timeout_add(5000, (GSourceFunc)show, box2); | |
79 | |
80 #ifdef STANDALONE | |
81 gnt_main(); | |
82 | |
83 gnt_quit(); | |
84 #endif | |
85 | |
86 return 0; | |
87 } | |
88 |