view finch/libgnt/test/menu.c @ 29244:50256289be74

*** Plucked rev 1cd91846f484f7d7090d25b0e65d851a0dadcb90 (e894e488d2219b69664de488ee1af7f275f8817d): Improved handling of the 0x00d charset in AIM, which is sent by mobile devices speaking ISO-8859-1. Try UTF-8 first (the encoding sent by iChat in a Direct IM with non-ASCII characters), then fall back to ISO-8859-1. Fixes #a13544, a bug created with the fix for iChat DIM encoding new in libpurple 2.6.4 applied changes from 6f3a1b3c52803e11d4cda1e0537c1270599e8d8e through ed0a2a35c7e22519df27c50069c22b03e01c027a *** Plucked rev e8ba4281669ae86859fd4e29f5d8ea0286af3903 (f05c54b03e6bbfdbff38c01697fbd353a969e05e): Changelog the AIM/ICQ issue. Refs #10900.
author Daniel Atallah <daniel.atallah@gmail.com>
date Thu, 07 Jan 2010 23:43:26 +0000
parents f104e1d45d85
children 57d350900136
line wrap: on
line source

#include "gnt.h"
#include "gntbox.h"
#include "gntlabel.h"
#include "gntmenu.h"
#include "gntmenuitem.h"
#include "gntwindow.h"

void dothis(GntMenuItem *item, gpointer null)
{
	GntWidget *w = gnt_vbox_new(FALSE);
	gnt_box_set_toplevel(GNT_BOX(w), TRUE);
	gnt_box_add_widget(GNT_BOX(w),
			gnt_label_new("Callback to a menuitem"));
	gnt_widget_show(w);
}

int main()
{
	freopen(".error", "w", stderr);
	gnt_init();

	GntWidget *menu = gnt_menu_new(GNT_MENU_TOPLEVEL);
	GObject *item = gnt_menuitem_new("File");

	gnt_menu_add_item(GNT_MENU(menu), GNT_MENU_ITEM(item));

	item = gnt_menuitem_new("Edit");
	gnt_menu_add_item(GNT_MENU(menu), GNT_MENU_ITEM(item));

	item = gnt_menuitem_new("Help");
	gnt_menu_add_item(GNT_MENU(menu), GNT_MENU_ITEM(item));

	GntWidget *sub = gnt_menu_new(GNT_MENU_POPUP);
	gnt_menuitem_set_submenu(GNT_MENU_ITEM(item), GNT_MENU(sub));

	item = gnt_menuitem_new("Online Helpasd");
	gnt_menuitem_set_trigger(GNT_MENU_ITEM(item), 'h');
	gnt_menu_add_item(GNT_MENU(sub), GNT_MENU_ITEM(item));

	item = gnt_menuitem_new("Online Help");
	gnt_menuitem_set_trigger(GNT_MENU_ITEM(item), 'h');
	gnt_menu_add_item(GNT_MENU(sub), GNT_MENU_ITEM(item));

	item = gnt_menuitem_new("About");
	gnt_menuitem_set_trigger(GNT_MENU_ITEM(item), 'a');
	gnt_menu_add_item(GNT_MENU(sub), GNT_MENU_ITEM(item));

	sub = gnt_menu_new(GNT_MENU_POPUP);
	gnt_menuitem_set_submenu(GNT_MENU_ITEM(item), GNT_MENU(sub));

	item = gnt_menuitem_new("Online Help");
	gnt_menuitem_set_trigger(GNT_MENU_ITEM(item), 'O');
	gnt_menu_add_item(GNT_MENU(sub), GNT_MENU_ITEM(item));
	gnt_menuitem_set_callback(GNT_MENU_ITEM(item), dothis, NULL);

	gnt_screen_menu_show(menu);

	GntWidget *win = gnt_window_new();
	gnt_box_add_widget(GNT_BOX(win),
		gnt_label_new("..."));
	gnt_box_set_title(GNT_BOX(win), "Title");
	gnt_window_set_menu(GNT_WINDOW(win), GNT_MENU(menu));
	gnt_widget_show(win);

	gnt_main();

	gnt_quit();

	return  0;
}