Mercurial > pidgin
annotate console/libgnt/test/combo.c @ 14004:06f75fb84a78
[gaim-migrate @ 16589]
Add a configure file (~/.gntrc) for gnt to configure its looks. This
is available only for GLib 2.6 and above. Currently, it only allows
changing the colors (r;g;b -- each in [0, 1000]) and color-groups. I
have added gntrc.sample as an example.
committer: Tailor Script <tailor@pidgin.im>
author | Sadrul Habib Chowdhury <imadil@gmail.com> |
---|---|
date | Fri, 28 Jul 2006 04:47:19 +0000 |
parents | a71678d2da16 |
children | c5bfede33622 |
rev | line source |
---|---|
13935
cd2da4b079cf
[gaim-migrate @ 16466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1 #include <gnt.h> |
cd2da4b079cf
[gaim-migrate @ 16466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
2 #include <gntbox.h> |
13939
5d5c84239eea
[gaim-migrate @ 16470]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13936
diff
changeset
|
3 #include <gntbutton.h> |
13979
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13960
diff
changeset
|
4 #include <gntcheckbox.h> |
13935
cd2da4b079cf
[gaim-migrate @ 16466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
5 #include <gntcombobox.h> |
cd2da4b079cf
[gaim-migrate @ 16466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
6 #include <gntlabel.h> |
cd2da4b079cf
[gaim-migrate @ 16466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
7 |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
8 static void |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
9 button_activated(GntWidget *b, GntComboBox *combo) |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
10 { |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
11 GntWidget *w = b->parent; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
12 |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
13 gnt_box_add_widget(GNT_BOX(w), |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
14 gnt_label_new(gnt_combo_box_get_selected_data(GNT_COMBO_BOX(combo)))); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
15 fprintf(stderr, "%s\n", gnt_combo_box_get_selected_data(GNT_COMBO_BOX(combo))); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
16 gnt_box_readjust(GNT_BOX(w->parent)); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
17 } |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
18 |
13935
cd2da4b079cf
[gaim-migrate @ 16466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
19 int main() |
cd2da4b079cf
[gaim-migrate @ 16466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
20 { |
cd2da4b079cf
[gaim-migrate @ 16466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
21 GntWidget *box, *combo, *button; |
13939
5d5c84239eea
[gaim-migrate @ 16470]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13936
diff
changeset
|
22 GntWidget *hbox; |
13935
cd2da4b079cf
[gaim-migrate @ 16466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
23 |
13960
a06f7495af6f
[gaim-migrate @ 16513]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
24 #ifdef STANDALONE |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
25 freopen(".error", "w", stderr); |
13935
cd2da4b079cf
[gaim-migrate @ 16466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
26 gnt_init(); |
13960
a06f7495af6f
[gaim-migrate @ 16513]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
27 #endif |
13935
cd2da4b079cf
[gaim-migrate @ 16466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
28 |
13939
5d5c84239eea
[gaim-migrate @ 16470]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13936
diff
changeset
|
29 box = gnt_box_new(FALSE, TRUE); |
5d5c84239eea
[gaim-migrate @ 16470]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13936
diff
changeset
|
30 gnt_widget_set_name(box, "box"); |
5d5c84239eea
[gaim-migrate @ 16470]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13936
diff
changeset
|
31 gnt_box_set_alignment(GNT_BOX(box), GNT_ALIGN_MID); |
5d5c84239eea
[gaim-migrate @ 16470]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13936
diff
changeset
|
32 gnt_box_set_pad(GNT_BOX(box), 0); |
13935
cd2da4b079cf
[gaim-migrate @ 16466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
33 |
cd2da4b079cf
[gaim-migrate @ 16466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
34 gnt_box_set_toplevel(GNT_BOX(box), TRUE); |
cd2da4b079cf
[gaim-migrate @ 16466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
35 gnt_box_set_title(GNT_BOX(box), "Checkbox"); |
cd2da4b079cf
[gaim-migrate @ 16466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
36 |
13939
5d5c84239eea
[gaim-migrate @ 16470]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13936
diff
changeset
|
37 hbox = gnt_box_new(FALSE, FALSE); |
5d5c84239eea
[gaim-migrate @ 16470]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13936
diff
changeset
|
38 gnt_box_set_pad(GNT_BOX(hbox), 0); |
5d5c84239eea
[gaim-migrate @ 16470]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13936
diff
changeset
|
39 gnt_box_set_alignment(GNT_BOX(hbox), GNT_ALIGN_MID); |
5d5c84239eea
[gaim-migrate @ 16470]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13936
diff
changeset
|
40 gnt_widget_set_name(hbox, "upper"); |
5d5c84239eea
[gaim-migrate @ 16470]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13936
diff
changeset
|
41 |
13935
cd2da4b079cf
[gaim-migrate @ 16466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
42 combo = gnt_combo_box_new(); |
cd2da4b079cf
[gaim-migrate @ 16466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
43 gnt_combo_box_add_data(GNT_COMBO_BOX(combo), "1", "1"); |
cd2da4b079cf
[gaim-migrate @ 16466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
44 gnt_combo_box_add_data(GNT_COMBO_BOX(combo), "2", "2"); |
13936
669898e6aa11
[gaim-migrate @ 16467]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13935
diff
changeset
|
45 gnt_combo_box_add_data(GNT_COMBO_BOX(combo), "3", "3abcdefghijklmnopqrstuvwxyz"); |
13935
cd2da4b079cf
[gaim-migrate @ 16466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
46 gnt_combo_box_add_data(GNT_COMBO_BOX(combo), "4", "4"); |
cd2da4b079cf
[gaim-migrate @ 16466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
47 gnt_combo_box_add_data(GNT_COMBO_BOX(combo), "5", "5"); |
cd2da4b079cf
[gaim-migrate @ 16466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
48 gnt_combo_box_add_data(GNT_COMBO_BOX(combo), "6", "6"); |
cd2da4b079cf
[gaim-migrate @ 16466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
49 |
13939
5d5c84239eea
[gaim-migrate @ 16470]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13936
diff
changeset
|
50 gnt_box_add_widget(GNT_BOX(hbox), gnt_label_new("Select")); |
5d5c84239eea
[gaim-migrate @ 16470]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13936
diff
changeset
|
51 gnt_box_add_widget(GNT_BOX(hbox), combo); |
5d5c84239eea
[gaim-migrate @ 16470]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13936
diff
changeset
|
52 |
5d5c84239eea
[gaim-migrate @ 16470]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13936
diff
changeset
|
53 gnt_box_add_widget(GNT_BOX(box), hbox); |
5d5c84239eea
[gaim-migrate @ 16470]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13936
diff
changeset
|
54 |
5d5c84239eea
[gaim-migrate @ 16470]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13936
diff
changeset
|
55 hbox = gnt_box_new(TRUE, FALSE); |
5d5c84239eea
[gaim-migrate @ 16470]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13936
diff
changeset
|
56 gnt_box_set_alignment(GNT_BOX(hbox), GNT_ALIGN_MID); |
5d5c84239eea
[gaim-migrate @ 16470]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13936
diff
changeset
|
57 gnt_widget_set_name(hbox, "lower"); |
13935
cd2da4b079cf
[gaim-migrate @ 16466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
58 |
cd2da4b079cf
[gaim-migrate @ 16466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
59 button = gnt_button_new("OK"); |
13939
5d5c84239eea
[gaim-migrate @ 16470]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13936
diff
changeset
|
60 gnt_box_add_widget(GNT_BOX(hbox), button); |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13939
diff
changeset
|
61 g_signal_connect(G_OBJECT(button), "activate", G_CALLBACK(button_activated), combo); |
13939
5d5c84239eea
[gaim-migrate @ 16470]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13936
diff
changeset
|
62 |
5d5c84239eea
[gaim-migrate @ 16470]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13936
diff
changeset
|
63 gnt_box_add_widget(GNT_BOX(box), hbox); |
13935
cd2da4b079cf
[gaim-migrate @ 16466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
64 |
13979
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13960
diff
changeset
|
65 gnt_box_add_widget(GNT_BOX(box), gnt_check_box_new("check box")); |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13960
diff
changeset
|
66 |
13935
cd2da4b079cf
[gaim-migrate @ 16466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
67 gnt_widget_show(box); |
cd2da4b079cf
[gaim-migrate @ 16466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
68 |
13960
a06f7495af6f
[gaim-migrate @ 16513]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
69 #ifdef STANDALONE |
13935
cd2da4b079cf
[gaim-migrate @ 16466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
70 gnt_main(); |
cd2da4b079cf
[gaim-migrate @ 16466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
71 |
cd2da4b079cf
[gaim-migrate @ 16466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
72 gnt_quit(); |
13960
a06f7495af6f
[gaim-migrate @ 16513]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
73 #endif |
13935
cd2da4b079cf
[gaim-migrate @ 16466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
74 |
cd2da4b079cf
[gaim-migrate @ 16466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
75 return 0; |
cd2da4b079cf
[gaim-migrate @ 16466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
76 } |
cd2da4b079cf
[gaim-migrate @ 16466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
77 |