Mercurial > pidgin
annotate finch/libgnt/test/menu.c @ 16030:00a4de6880da
I think I'm committing the more recent version of this translation
| author | Luke Schierer <lschiere@pidgin.im> |
|---|---|
| date | Mon, 09 Apr 2007 13:02:46 +0000 |
| parents | f00f2e283ffb |
| children | f104e1d45d85 |
| 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 |
| 36 item = gnt_menuitem_new("Online Help"); | |
|
15928
f00f2e283ffb
Some define changes. This helps in generating the python bindings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15817
diff
changeset
|
37 gnt_menu_add_item(GNT_MENU(sub), GNT_MENU_ITEM(item)); |
| 15817 | 38 |
| 39 item = gnt_menuitem_new("About"); | |
|
15928
f00f2e283ffb
Some define changes. This helps in generating the python bindings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15817
diff
changeset
|
40 gnt_menu_add_item(GNT_MENU(sub), GNT_MENU_ITEM(item)); |
| 15817 | 41 |
| 42 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
|
43 gnt_menuitem_set_submenu(GNT_MENU_ITEM(item), GNT_MENU(sub)); |
| 15817 | 44 |
| 45 item = gnt_menuitem_new("Online Help"); | |
|
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)); |
|
f00f2e283ffb
Some define changes. This helps in generating the python bindings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15817
diff
changeset
|
47 gnt_menuitem_set_callback(GNT_MENU_ITEM(item), dothis, NULL); |
| 15817 | 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 |
