Mercurial > pidgin
annotate finch/libgnt/test/menu.c @ 19974:7a118cacd4b0
propagate from branch 'im.pidgin.pidgin' (head 671cfe949215447db0da7081a7e1501693ab4f98)
to branch 'org.maemo.garage.pidgin.pidgin.dialog-transience' (head ec0c632512dfdd332d217cb3173c05338f1feb1c)
author | Gabriel Schulhof <nix@go-nix.ca> |
---|---|
date | Sun, 19 Aug 2007 13:40:34 +0000 |
parents | f104e1d45d85 |
children | 57d350900136 |
rev | line source |
---|---|
15817 | 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 | |
15928
f00f2e283ffb
Some define changes. This helps in generating the python bindings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15817
diff
changeset
|
25 gnt_menu_add_item(GNT_MENU(menu), GNT_MENU_ITEM(item)); |
15817 | 26 |
27 item = gnt_menuitem_new("Edit"); | |
15928
f00f2e283ffb
Some define changes. This helps in generating the python bindings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15817
diff
changeset
|
28 gnt_menu_add_item(GNT_MENU(menu), GNT_MENU_ITEM(item)); |
15817 | 29 |
30 item = gnt_menuitem_new("Help"); | |
15928
f00f2e283ffb
Some define changes. This helps in generating the python bindings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15817
diff
changeset
|
31 gnt_menu_add_item(GNT_MENU(menu), GNT_MENU_ITEM(item)); |
15817 | 32 |
33 GntWidget *sub = gnt_menu_new(GNT_MENU_POPUP); | |
15928
f00f2e283ffb
Some define changes. This helps in generating the python bindings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15817
diff
changeset
|
34 gnt_menuitem_set_submenu(GNT_MENU_ITEM(item), GNT_MENU(sub)); |
15817 | 35 |
18510
f104e1d45d85
Changes to the test apps.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15928
diff
changeset
|
36 item = gnt_menuitem_new("Online Helpasd"); |
f104e1d45d85
Changes to the test apps.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15928
diff
changeset
|
37 gnt_menuitem_set_trigger(GNT_MENU_ITEM(item), 'h'); |
f104e1d45d85
Changes to the test apps.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15928
diff
changeset
|
38 gnt_menu_add_item(GNT_MENU(sub), GNT_MENU_ITEM(item)); |
f104e1d45d85
Changes to the test apps.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15928
diff
changeset
|
39 |
15817 | 40 item = gnt_menuitem_new("Online Help"); |
18510
f104e1d45d85
Changes to the test apps.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15928
diff
changeset
|
41 gnt_menuitem_set_trigger(GNT_MENU_ITEM(item), 'h'); |
15928
f00f2e283ffb
Some define changes. This helps in generating the python bindings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15817
diff
changeset
|
42 gnt_menu_add_item(GNT_MENU(sub), GNT_MENU_ITEM(item)); |
15817 | 43 |
44 item = gnt_menuitem_new("About"); | |
18510
f104e1d45d85
Changes to the test apps.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15928
diff
changeset
|
45 gnt_menuitem_set_trigger(GNT_MENU_ITEM(item), 'a'); |
15928
f00f2e283ffb
Some define changes. This helps in generating the python bindings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15817
diff
changeset
|
46 gnt_menu_add_item(GNT_MENU(sub), GNT_MENU_ITEM(item)); |
15817 | 47 |
48 sub = gnt_menu_new(GNT_MENU_POPUP); | |
15928
f00f2e283ffb
Some define changes. This helps in generating the python bindings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15817
diff
changeset
|
49 gnt_menuitem_set_submenu(GNT_MENU_ITEM(item), GNT_MENU(sub)); |
15817 | 50 |
51 item = gnt_menuitem_new("Online Help"); | |
18510
f104e1d45d85
Changes to the test apps.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15928
diff
changeset
|
52 gnt_menuitem_set_trigger(GNT_MENU_ITEM(item), 'O'); |
15928
f00f2e283ffb
Some define changes. This helps in generating the python bindings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15817
diff
changeset
|
53 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:
15817
diff
changeset
|
54 gnt_menuitem_set_callback(GNT_MENU_ITEM(item), dothis, NULL); |
15817 | 55 |
56 gnt_screen_menu_show(menu); | |
57 | |
58 GntWidget *win = gnt_window_new(); | |
59 gnt_box_add_widget(GNT_BOX(win), | |
60 gnt_label_new("...")); | |
61 gnt_box_set_title(GNT_BOX(win), "Title"); | |
62 gnt_window_set_menu(GNT_WINDOW(win), GNT_MENU(menu)); | |
63 gnt_widget_show(win); | |
64 | |
65 gnt_main(); | |
66 | |
67 gnt_quit(); | |
68 | |
69 return 0; | |
70 } | |
71 |