Mercurial > pidgin
annotate console/libgnt/test/multiwin.c @ 15117:1f0db03dd165
[gaim-migrate @ 17903]
Update the Changelog.API. Thanks to ari for noticing.
committer: Tailor Script <tailor@pidgin.im>
author | Sadrul Habib Chowdhury <imadil@gmail.com> |
---|---|
date | Wed, 06 Dec 2006 23:05:51 +0000 |
parents | 065e7ac30338 |
children |
rev | line source |
---|---|
13916
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13907
diff
changeset
|
1 #include "gnt.h" |
13883
ab6376814e73
[gaim-migrate @ 16363]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
2 #include "gntbutton.h" |
13916
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13907
diff
changeset
|
3 #include "gntentry.h" |
13883
ab6376814e73
[gaim-migrate @ 16363]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
4 #include "gntkeys.h" |
13916
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13907
diff
changeset
|
5 #include "gntlabel.h" |
13883
ab6376814e73
[gaim-migrate @ 16363]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
6 #include "gnttree.h" |
ab6376814e73
[gaim-migrate @ 16363]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
7 #include "gntbox.h" |
ab6376814e73
[gaim-migrate @ 16363]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
8 |
ab6376814e73
[gaim-migrate @ 16363]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
9 gboolean show(GntWidget *w) |
ab6376814e73
[gaim-migrate @ 16363]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
10 { |
13916
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13907
diff
changeset
|
11 return FALSE; |
13883
ab6376814e73
[gaim-migrate @ 16363]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
12 } |
ab6376814e73
[gaim-migrate @ 16363]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
13 |
ab6376814e73
[gaim-migrate @ 16363]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
14 int main() |
ab6376814e73
[gaim-migrate @ 16363]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
15 { |
13960
a06f7495af6f
[gaim-migrate @ 16513]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
16 #ifdef STANDALONE |
13916
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13907
diff
changeset
|
17 freopen(".error", "w", stderr); |
13883
ab6376814e73
[gaim-migrate @ 16363]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
18 gnt_init(); |
13960
a06f7495af6f
[gaim-migrate @ 16513]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
19 #endif |
13883
ab6376814e73
[gaim-migrate @ 16363]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
20 |
ab6376814e73
[gaim-migrate @ 16363]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
21 GntWidget *hbox, *tree, *box2; |
ab6376814e73
[gaim-migrate @ 16363]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
22 |
ab6376814e73
[gaim-migrate @ 16363]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
23 hbox = gnt_box_new(FALSE, TRUE); |
ab6376814e73
[gaim-migrate @ 16363]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
24 box2 = gnt_box_new(FALSE, TRUE); |
ab6376814e73
[gaim-migrate @ 16363]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
25 |
ab6376814e73
[gaim-migrate @ 16363]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
26 gnt_widget_set_name(hbox, "hbox"); |
ab6376814e73
[gaim-migrate @ 16363]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
27 gnt_widget_set_name(box2, "box2"); |
ab6376814e73
[gaim-migrate @ 16363]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
28 |
13971
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
29 tree = gnt_tree_new_with_columns(3); |
14010
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
30 GNT_WIDGET_SET_FLAGS(tree, GNT_WIDGET_NO_BORDER); |
13971
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
31 gnt_tree_set_column_titles(GNT_TREE(tree), "12345678901234567890", "column 2", "column3"); |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
32 gnt_tree_set_show_title(GNT_TREE(tree), TRUE); |
13883
ab6376814e73
[gaim-migrate @ 16363]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
33 gnt_widget_set_name(tree, "tree"); |
ab6376814e73
[gaim-migrate @ 16363]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
34 gnt_box_add_widget(GNT_BOX(hbox), tree); |
ab6376814e73
[gaim-migrate @ 16363]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
35 |
ab6376814e73
[gaim-migrate @ 16363]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
36 gnt_box_set_toplevel(GNT_BOX(hbox), TRUE); |
ab6376814e73
[gaim-migrate @ 16363]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
37 gnt_box_set_title(GNT_BOX(hbox), "Testing the tree widget"); |
ab6376814e73
[gaim-migrate @ 16363]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
38 |
ab6376814e73
[gaim-migrate @ 16363]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
39 gnt_box_set_toplevel(GNT_BOX(box2), TRUE); |
ab6376814e73
[gaim-migrate @ 16363]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
40 gnt_box_set_title(GNT_BOX(box2), "On top"); |
ab6376814e73
[gaim-migrate @ 16363]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
41 |
13916
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13907
diff
changeset
|
42 gnt_box_add_widget(GNT_BOX(box2), gnt_label_new("asdasd")); |
13896
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13883
diff
changeset
|
43 gnt_box_add_widget(GNT_BOX(box2), gnt_entry_new(NULL)); |
13883
ab6376814e73
[gaim-migrate @ 16363]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
44 |
ab6376814e73
[gaim-migrate @ 16363]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
45 gnt_widget_show(hbox); |
14292
c111a7e718d0
[gaim-migrate @ 16982]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14131
diff
changeset
|
46 gnt_widget_set_position(box2, 80, 40); |
13883
ab6376814e73
[gaim-migrate @ 16363]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
47 gnt_widget_show(box2); |
ab6376814e73
[gaim-migrate @ 16363]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
48 |
13971
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
49 gnt_tree_add_row_after(GNT_TREE(tree), "a", |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
50 gnt_tree_create_row(GNT_TREE(tree), "alaskdjfkashfashfah kfalkdhflsiafhlasf", " long text", "a2"), NULL, NULL); |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
51 gnt_tree_add_row_after(GNT_TREE(tree), "c", |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
52 gnt_tree_create_row(GNT_TREE(tree), "casdgertqhyeqgasfeytwfga fg arf agfwa ", " long text", "a2"), NULL, NULL); |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
53 gnt_tree_add_row_after(GNT_TREE(tree), "d", gnt_tree_create_row(GNT_TREE(tree), "d", " long text", "a2"), NULL, NULL); |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
54 gnt_tree_add_row_after(GNT_TREE(tree), "e", gnt_tree_create_row(GNT_TREE(tree), "e", " long text", "a2"), "a", NULL); |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
55 gnt_tree_add_row_after(GNT_TREE(tree), "b", gnt_tree_create_row(GNT_TREE(tree), "b", "this is", "a2"), "d", NULL); |
13883
ab6376814e73
[gaim-migrate @ 16363]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
56 |
13971
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
57 gnt_tree_add_choice(GNT_TREE(tree), "1", gnt_tree_create_row(GNT_TREE(tree), "1", " long text", "a2"), NULL, NULL); |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
58 gnt_tree_add_row_after(GNT_TREE(tree), "2", gnt_tree_create_row(GNT_TREE(tree), "2", " long text", "a2"), NULL, NULL); |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
59 gnt_tree_add_row_after(GNT_TREE(tree), "3", gnt_tree_create_row(GNT_TREE(tree), "3", " long text", "a2"), NULL, NULL); |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
60 gnt_tree_add_row_after(GNT_TREE(tree), "4", gnt_tree_create_row(GNT_TREE(tree), "4", " long text", "a2"), "a", NULL); |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
61 gnt_tree_add_row_after(GNT_TREE(tree), "5", gnt_tree_create_row(GNT_TREE(tree), "5", " long text", "a2"), "d", NULL); |
13883
ab6376814e73
[gaim-migrate @ 16363]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
62 |
13971
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
63 gnt_tree_add_row_after(GNT_TREE(tree), "6", gnt_tree_create_row(GNT_TREE(tree), "6", " long text", "a2"), "4", NULL); |
13916
fdf2dbed6faa
[gaim-migrate @ 16418]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13907
diff
changeset
|
64 |
14123
f8ab496671fa
[gaim-migrate @ 16761]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
65 int i; |
14131
db2311999862
[gaim-migrate @ 16773]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14123
diff
changeset
|
66 for (i = 110; i < 430; i++) |
14123
f8ab496671fa
[gaim-migrate @ 16761]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
67 { |
f8ab496671fa
[gaim-migrate @ 16761]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
68 char *s; |
f8ab496671fa
[gaim-migrate @ 16761]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
69 s = g_strdup_printf("%d", i); /* XXX: yes, leaking */ |
f8ab496671fa
[gaim-migrate @ 16761]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
70 gnt_tree_add_row_after(GNT_TREE(tree), s, gnt_tree_create_row(GNT_TREE(tree), s, " long text", "a2"), "4", NULL); |
f8ab496671fa
[gaim-migrate @ 16761]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
71 } |
f8ab496671fa
[gaim-migrate @ 16761]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
72 |
13931
917a71dd02eb
[gaim-migrate @ 16458]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
73 gnt_tree_set_row_flags(GNT_TREE(tree), "e", GNT_TEXT_FLAG_DIM); |
917a71dd02eb
[gaim-migrate @ 16458]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
74 |
13952
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
75 gnt_tree_set_selected(GNT_TREE(tree), "2"); |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
76 |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13931
diff
changeset
|
77 g_timeout_add(5000, (GSourceFunc)show, box2); |
13883
ab6376814e73
[gaim-migrate @ 16363]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
78 |
13960
a06f7495af6f
[gaim-migrate @ 16513]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
79 #ifdef STANDALONE |
13883
ab6376814e73
[gaim-migrate @ 16363]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
80 gnt_main(); |
ab6376814e73
[gaim-migrate @ 16363]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
81 |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
82 gnt_quit(); |
13960
a06f7495af6f
[gaim-migrate @ 16513]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
83 #endif |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
84 |
13883
ab6376814e73
[gaim-migrate @ 16363]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
85 return 0; |
ab6376814e73
[gaim-migrate @ 16363]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
86 } |
ab6376814e73
[gaim-migrate @ 16363]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
87 |