Mercurial > pidgin.yaz
annotate finch/libgnt/test/menu.c @ 22217:ad357ca94de9
We will probably eventually use purple_object_[get|set]_ui_data. Until then, this will do.
| author | Sadrul Habib Chowdhury <imadil@gmail.com> |
|---|---|
| date | Sat, 26 Jan 2008 22:33:08 +0000 |
| parents | f104e1d45d85 |
| children | 57d350900136 |
| 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 |
|
18510
f104e1d45d85
Changes to the test apps.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15931
diff
changeset
|
36 item = gnt_menuitem_new("Online Helpasd"); |
|
f104e1d45d85
Changes to the test apps.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15931
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:
15931
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:
15931
diff
changeset
|
39 |
| 15818 | 40 item = gnt_menuitem_new("Online Help"); |
|
18510
f104e1d45d85
Changes to the test apps.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15931
diff
changeset
|
41 gnt_menuitem_set_trigger(GNT_MENU_ITEM(item), 'h'); |
|
15931
f00f2e283ffb
Some define changes. This helps in generating the python bindings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15818
diff
changeset
|
42 gnt_menu_add_item(GNT_MENU(sub), GNT_MENU_ITEM(item)); |
| 15818 | 43 |
| 44 item = gnt_menuitem_new("About"); | |
|
18510
f104e1d45d85
Changes to the test apps.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15931
diff
changeset
|
45 gnt_menuitem_set_trigger(GNT_MENU_ITEM(item), 'a'); |
|
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)); |
| 15818 | 47 |
| 48 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
|
49 gnt_menuitem_set_submenu(GNT_MENU_ITEM(item), GNT_MENU(sub)); |
| 15818 | 50 |
| 51 item = gnt_menuitem_new("Online Help"); | |
|
18510
f104e1d45d85
Changes to the test apps.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15931
diff
changeset
|
52 gnt_menuitem_set_trigger(GNT_MENU_ITEM(item), 'O'); |
|
15931
f00f2e283ffb
Some define changes. This helps in generating the python bindings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15818
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:
15818
diff
changeset
|
54 gnt_menuitem_set_callback(GNT_MENU_ITEM(item), dothis, NULL); |
| 15818 | 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 |
