Mercurial > pidgin.yaz
annotate console/libgnt/test/focus.c @ 14693:ae0136b0a3ae
[gaim-migrate @ 17445]
Patch #1569730 from Richard Nelson (wabz):
"This patch adds a "Clear" button, timestamp and pause
options, and stops it scrolling down if it's scrolled up."
and
"Also gives the debug window a name, so window managers
can more easily have their way with it."
These changes make the debug window a whole lot more usable.
committer: Tailor Script <tailor@pidgin.im>
author | Sadrul Habib Chowdhury <imadil@gmail.com> |
---|---|
date | Sun, 08 Oct 2006 03:56:06 +0000 |
parents | 62bb53609a36 |
children |
rev | line source |
---|---|
13883
ab6376814e73
[gaim-migrate @ 16363]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1 #include "gntbutton.h" |
ab6376814e73
[gaim-migrate @ 16363]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
2 #include "gnt.h" |
ab6376814e73
[gaim-migrate @ 16363]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
3 #include "gntkeys.h" |
ab6376814e73
[gaim-migrate @ 16363]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
4 #include "gnttree.h" |
ab6376814e73
[gaim-migrate @ 16363]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
5 #include "gntbox.h" |
ab6376814e73
[gaim-migrate @ 16363]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
6 #include "gntentry.h" |
ab6376814e73
[gaim-migrate @ 16363]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
7 #include "gntlabel.h" |
ab6376814e73
[gaim-migrate @ 16363]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
8 |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13883
diff
changeset
|
9 static void |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13883
diff
changeset
|
10 toggled(GntWidget *tree, gpointer key, gpointer null) |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13883
diff
changeset
|
11 { |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13883
diff
changeset
|
12 GntWidget *w = gnt_box_new(FALSE, FALSE); |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13883
diff
changeset
|
13 |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13883
diff
changeset
|
14 gnt_box_set_toplevel(GNT_BOX(w), TRUE); |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13883
diff
changeset
|
15 |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13883
diff
changeset
|
16 gnt_box_add_widget(GNT_BOX(w), |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13883
diff
changeset
|
17 gnt_label_new(gnt_tree_get_choice(GNT_TREE(tree), key) ? "Selected" : "NOT")); |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13883
diff
changeset
|
18 gnt_widget_show(w); |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13883
diff
changeset
|
19 } |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13883
diff
changeset
|
20 |
13883
ab6376814e73
[gaim-migrate @ 16363]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
21 int main() |
ab6376814e73
[gaim-migrate @ 16363]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
22 { |
13960
a06f7495af6f
[gaim-migrate @ 16513]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
23 #ifdef STANDALONE |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13907
diff
changeset
|
24 freopen(".error", "w", stderr); |
13883
ab6376814e73
[gaim-migrate @ 16363]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
25 gnt_init(); |
13960
a06f7495af6f
[gaim-migrate @ 16513]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
26 #endif |
a06f7495af6f
[gaim-migrate @ 16513]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
27 |
14420
c4a32405af68
[gaim-migrate @ 17128]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14105
diff
changeset
|
28 GntWidget *label = gnt_label_new("So wassup dudes and dudettes!!\u4e0a1\u6d772\u67003\u4f4e4\u67085\nSo this is, like,\nthe third line!! \\o/"); |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13883
diff
changeset
|
29 GntWidget *vbox, *hbox, *tree, *box, *button; |
13883
ab6376814e73
[gaim-migrate @ 16363]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
30 WINDOW *test; |
ab6376814e73
[gaim-migrate @ 16363]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
31 |
ab6376814e73
[gaim-migrate @ 16363]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
32 vbox = gnt_box_new(FALSE, FALSE); |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13907
diff
changeset
|
33 hbox = gnt_box_new(FALSE, TRUE); |
13953
8b2306c64efa
[gaim-migrate @ 16501]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
34 gnt_box_set_alignment(GNT_BOX(hbox), GNT_ALIGN_MID); |
13883
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_widget_set_name(vbox, "vbox"); |
ab6376814e73
[gaim-migrate @ 16363]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
37 gnt_widget_set_name(hbox, "hbox"); |
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_add_widget(GNT_BOX(hbox), label); |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13883
diff
changeset
|
40 |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13883
diff
changeset
|
41 GntWidget *entry = gnt_entry_new("a"); |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13883
diff
changeset
|
42 gnt_widget_set_name(entry, "entry"); |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13883
diff
changeset
|
43 gnt_box_add_widget(GNT_BOX(hbox), entry); |
13883
ab6376814e73
[gaim-migrate @ 16363]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
44 |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13883
diff
changeset
|
45 box = gnt_box_new(FALSE, FALSE); |
13883
ab6376814e73
[gaim-migrate @ 16363]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
46 tree = gnt_tree_new(); |
14105
eaf7f35635bc
[gaim-migrate @ 16739]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
47 gnt_tree_set_compare_func(GNT_TREE(tree), g_utf8_collate); |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13883
diff
changeset
|
48 gnt_widget_set_name(tree, "tree"); |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13883
diff
changeset
|
49 gnt_box_add_widget(GNT_BOX(box), tree); |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13883
diff
changeset
|
50 gnt_box_add_widget(GNT_BOX(hbox), box); |
13883
ab6376814e73
[gaim-migrate @ 16363]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
51 |
14105
eaf7f35635bc
[gaim-migrate @ 16739]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
52 gnt_tree_add_row_after(GNT_TREE(tree), "c", gnt_tree_create_row(GNT_TREE(tree), "c"), NULL, NULL); |
13964
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13960
diff
changeset
|
53 gnt_tree_add_row_after(GNT_TREE(tree), "a", gnt_tree_create_row(GNT_TREE(tree), "a"), NULL, NULL); |
14105
eaf7f35635bc
[gaim-migrate @ 16739]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
54 gnt_tree_add_row_after(GNT_TREE(tree), "z", gnt_tree_create_row(GNT_TREE(tree), "z"), "a", NULL); |
eaf7f35635bc
[gaim-migrate @ 16739]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
55 gnt_tree_add_row_after(GNT_TREE(tree), "y", gnt_tree_create_row(GNT_TREE(tree), "y"), "a", NULL); |
eaf7f35635bc
[gaim-migrate @ 16739]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
56 gnt_tree_add_row_after(GNT_TREE(tree), "g", gnt_tree_create_row(GNT_TREE(tree), "g"), "a", NULL); |
13964
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13960
diff
changeset
|
57 gnt_tree_add_row_after(GNT_TREE(tree), "d", gnt_tree_create_row(GNT_TREE(tree), "d"), NULL, NULL); |
14105
eaf7f35635bc
[gaim-migrate @ 16739]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
58 gnt_tree_add_row_after(GNT_TREE(tree), "x", gnt_tree_create_row(GNT_TREE(tree), "x"), "a", NULL); |
eaf7f35635bc
[gaim-migrate @ 16739]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
59 gnt_tree_add_row_after(GNT_TREE(tree), "k", gnt_tree_create_row(GNT_TREE(tree), "k"), "a", NULL); |
13964
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13960
diff
changeset
|
60 gnt_tree_add_row_after(GNT_TREE(tree), "e", gnt_tree_create_row(GNT_TREE(tree), "e"), "a", NULL); |
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13960
diff
changeset
|
61 gnt_tree_add_choice(GNT_TREE(tree), "b", gnt_tree_create_row(GNT_TREE(tree), "b"), "d", NULL); |
13883
ab6376814e73
[gaim-migrate @ 16363]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
62 |
ab6376814e73
[gaim-migrate @ 16363]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
63 GNT_WIDGET_UNSET_FLAGS(hbox, GNT_WIDGET_NO_BORDER | GNT_WIDGET_NO_SHADOW); |
14613
62bb53609a36
[gaim-migrate @ 17341]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14420
diff
changeset
|
64 gnt_box_set_title(GNT_BOX(hbox), "\u4e0a\u6d77\u6700\u4f4e\u6708\u5de5 \u4e0a\u6d77\u6700\u4f4e\u6708\u5de5 ……\u4e0a\u6d77\u6700\u4f4e\u6708\u5de5 …"); |
13883
ab6376814e73
[gaim-migrate @ 16363]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
65 |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13883
diff
changeset
|
66 g_signal_connect(G_OBJECT(tree), "toggled", G_CALLBACK(toggled), NULL); |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13883
diff
changeset
|
67 |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13883
diff
changeset
|
68 button = gnt_button_new("one"); |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13883
diff
changeset
|
69 gnt_widget_set_name(button, "one"); |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13883
diff
changeset
|
70 gnt_box_add_widget(GNT_BOX(vbox), button); |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13883
diff
changeset
|
71 |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13883
diff
changeset
|
72 button = gnt_button_new("two"); |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13883
diff
changeset
|
73 gnt_widget_set_name(button, "two"); |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13883
diff
changeset
|
74 gnt_box_add_widget(GNT_BOX(vbox), button); |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13883
diff
changeset
|
75 |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13883
diff
changeset
|
76 button = gnt_button_new("three"); |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13883
diff
changeset
|
77 gnt_widget_set_name(button, "three"); |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13883
diff
changeset
|
78 gnt_box_add_widget(GNT_BOX(vbox), button); |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13883
diff
changeset
|
79 |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13883
diff
changeset
|
80 gnt_box_add_widget(GNT_BOX(hbox), vbox); |
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13883
diff
changeset
|
81 |
13883
ab6376814e73
[gaim-migrate @ 16363]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
82 gnt_widget_show(hbox); |
ab6376814e73
[gaim-migrate @ 16363]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
83 |
13960
a06f7495af6f
[gaim-migrate @ 16513]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
84 #ifdef STANDALONE |
13883
ab6376814e73
[gaim-migrate @ 16363]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
85 gnt_main(); |
ab6376814e73
[gaim-migrate @ 16363]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
86 |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13883
diff
changeset
|
87 gnt_quit(); |
13960
a06f7495af6f
[gaim-migrate @ 16513]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13953
diff
changeset
|
88 #endif |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13883
diff
changeset
|
89 |
13883
ab6376814e73
[gaim-migrate @ 16363]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
90 return 0; |
ab6376814e73
[gaim-migrate @ 16363]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
91 } |
ab6376814e73
[gaim-migrate @ 16363]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
92 |