Mercurial > pidgin.yaz
annotate finch/libgnt/test/menu.c @ 17272:b409b5c3063a
fixes #1200
committer: Luke Schierer <lschiere@pidgin.im>
author | Arangel Angov <arangel@linux.net.mk> |
---|---|
date | Thu, 24 May 2007 03:11:24 +0000 |
parents | f00f2e283ffb |
children | f104e1d45d85 |
rev | line source |
---|---|
15818 | 1 #include "gnt.h" |
2 #include "gntbox.h" | |
3 #include "gntlabel.h" | |
4 #include "gntmenu.h" | |
5 #include "gntmenuitem.h" | |
6 #include "gntwindow.h" | |
7 | |
8 void dothis(GntMenuItem *item, gpointer null) | |
9 { | |
10 GntWidget *w = gnt_vbox_new(FALSE); | |
11 gnt_box_set_toplevel(GNT_BOX(w), TRUE); | |
12 gnt_box_add_widget(GNT_BOX(w), | |
13 gnt_label_new("Callback to a menuitem")); | |
14 gnt_widget_show(w); | |
15 } | |
16 | |
17 int main() | |
18 { | |
19 freopen(".error", "w", stderr); | |
20 gnt_init(); | |
21 | |
22 GntWidget *menu = gnt_menu_new(GNT_MENU_TOPLEVEL); | |
23 GObject *item = gnt_menuitem_new("File"); | |
24 | |
15931
f00f2e283ffb
Some define changes. This helps in generating the python bindings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15818
diff
changeset
|
25 gnt_menu_add_item(GNT_MENU(menu), GNT_MENU_ITEM(item)); |
15818 | 26 |
27 item = gnt_menuitem_new("Edit"); | |
15931
f00f2e283ffb
Some define changes. This helps in generating the python bindings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15818
diff
changeset
|
28 gnt_menu_add_item(GNT_MENU(menu), GNT_MENU_ITEM(item)); |
15818 | 29 |
30 item = gnt_menuitem_new("Help"); | |
15931
f00f2e283ffb
Some define changes. This helps in generating the python bindings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15818
diff
changeset
|
31 gnt_menu_add_item(GNT_MENU(menu), GNT_MENU_ITEM(item)); |
15818 | 32 |
33 GntWidget *sub = gnt_menu_new(GNT_MENU_POPUP); | |
15931
f00f2e283ffb
Some define changes. This helps in generating the python bindings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15818
diff
changeset
|
34 gnt_menuitem_set_submenu(GNT_MENU_ITEM(item), GNT_MENU(sub)); |
15818 | 35 |
36 item = gnt_menuitem_new("Online Help"); | |
15931
f00f2e283ffb
Some define changes. This helps in generating the python bindings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15818
diff
changeset
|
37 gnt_menu_add_item(GNT_MENU(sub), GNT_MENU_ITEM(item)); |
15818 | 38 |
39 item = gnt_menuitem_new("About"); | |
15931
f00f2e283ffb
Some define changes. This helps in generating the python bindings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15818
diff
changeset
|
40 gnt_menu_add_item(GNT_MENU(sub), GNT_MENU_ITEM(item)); |
15818 | 41 |
42 sub = gnt_menu_new(GNT_MENU_POPUP); | |
15931
f00f2e283ffb
Some define changes. This helps in generating the python bindings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15818
diff
changeset
|
43 gnt_menuitem_set_submenu(GNT_MENU_ITEM(item), GNT_MENU(sub)); |
15818 | 44 |
45 item = gnt_menuitem_new("Online Help"); | |
15931
f00f2e283ffb
Some define changes. This helps in generating the python bindings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15818
diff
changeset
|
46 gnt_menu_add_item(GNT_MENU(sub), GNT_MENU_ITEM(item)); |
f00f2e283ffb
Some define changes. This helps in generating the python bindings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15818
diff
changeset
|
47 gnt_menuitem_set_callback(GNT_MENU_ITEM(item), dothis, NULL); |
15818 | 48 |
49 gnt_screen_menu_show(menu); | |
50 | |
51 GntWidget *win = gnt_window_new(); | |
52 gnt_box_add_widget(GNT_BOX(win), | |
53 gnt_label_new("...")); | |
54 gnt_box_set_title(GNT_BOX(win), "Title"); | |
55 gnt_window_set_menu(GNT_WINDOW(win), GNT_MENU(menu)); | |
56 gnt_widget_show(win); | |
57 | |
58 gnt_main(); | |
59 | |
60 gnt_quit(); | |
61 | |
62 return 0; | |
63 } | |
64 |