Example #1
0
void
board_window_init (window_board_t *win)
{
	//win->window = create_window_hand ();
	win->window = get_widget ("window_hand");
	win->statusbar = GTK_STATUSBAR (get_widget ("statusbar1"));
	win->board_menu = get_widget ("board_menu1");
	create_hand_widgets(win);
	create_bidding_widget (win);

	/* set up "recently used" menu */
	GtkWidget *jump_menu = get_widget ("jump_to1");
#if GTK_CHECK_VERSION (2,10,0)
	GtkWidget *recentchooser = gtk_recent_chooser_menu_new ();
	gtk_recent_chooser_set_sort_type (GTK_RECENT_CHOOSER (recentchooser),
			GTK_RECENT_SORT_MRU);
	gtk_menu_item_set_submenu (GTK_MENU_ITEM (jump_menu), recentchooser);
	g_signal_connect (G_OBJECT (recentchooser), "item-activated",
			G_CALLBACK (jump_menu_select), NULL);
	GtkRecentFilter *filter = gtk_recent_filter_new ();
	gtk_recent_filter_add_pattern (filter, "*.lin");
	gtk_recent_filter_add_pattern (filter, "*.pbn");
	gtk_recent_chooser_add_filter (GTK_RECENT_CHOOSER (recentchooser), filter);
#else
	gtk_widget_set_sensitive (jump_menu, FALSE);
#endif

	win->keyfile = g_key_file_new ();
	win->show_played_cards = 0;
	win->show_hands = seat_all;
	win->show_dd_scores = seat_all;
	win->svg = NULL;
	win->card_width = 70;

	win->filename = NULL;
	win->title = win->subtitle = win->team1 = win->team2 = NULL;
	win->boards = NULL;
	win->board_numbers = NULL;
	win->n_boards_alloc = 0;
	win->n_boards = 0;

	win->cutbuf = NULL;

	win->cur = 0;

	GdkColor bg = { 0, HAND_DISPLAY_TABLE_GDK_BG };
	gdk_colormap_alloc_color (gdk_colormap_get_system (), &bg, FALSE, TRUE);
	gtk_widget_modify_bg (win->window, GTK_STATE_NORMAL, &bg);

	gtk_widget_show (win->window);
}
static VALUE
rcm_initialize(int argc, VALUE *argv, VALUE self)
{
    VALUE manager;
    GtkWidget* menu;
    
    rb_scan_args(argc, argv, "01", &manager);

    if (NIL_P(manager)){
        menu = gtk_recent_chooser_menu_new_for_manager(GTK_RECENT_MANAGER(RVAL2GOBJ(manager)));
    } else {
        menu = gtk_recent_chooser_menu_new();
    }
    RBGTK_INITIALIZE(self, menu);
    return Qnil;
}
Example #3
0
void setupRecent(GtkMenuItem *menu)
{
	GtkRecentFilter	*filter;
	GtkWidget		*recent;

	recent=gtk_recent_chooser_menu_new();
	gtk_recent_chooser_set_local_only(GTK_RECENT_CHOOSER(recent),false);
	gtk_recent_chooser_set_sort_type(GTK_RECENT_CHOOSER(recent),GTK_RECENT_SORT_MRU);
	gtk_recent_chooser_set_limit(GTK_RECENT_CHOOSER(recent),10);

	filter=gtk_recent_filter_new();
	gtk_recent_filter_add_mime_type (filter,"application/x-maneditdoc");
	//gtk_recent_filter_add_application(filter,"manpageeditor");
	gtk_recent_chooser_set_filter(GTK_RECENT_CHOOSER(recent),filter);
	g_signal_connect(recent,"item_activated",G_CALLBACK(recentFileMenu),NULL);

	gtk_menu_item_set_submenu(menu,recent);
}
static
GtkWidget *make_recent_documents_list (gboolean images, gchar *command, int limit, int age, gchar *sort_type)
{
	GtkWidget *widget = gtk_recent_chooser_menu_new ();

	if (images)
	{
		gtk_recent_chooser_set_show_icons (GTK_RECENT_CHOOSER(widget), TRUE);
	}
	else
	{
		gtk_recent_chooser_set_show_icons (GTK_RECENT_CHOOSER(widget), FALSE);
	}

	g_signal_connect (G_OBJECT (widget), "item-activated", G_CALLBACK (recent_activated), g_strdup (command));

	if (age)
	{
		GtkRecentFilter *filter = gtk_recent_filter_new ();
		gtk_recent_filter_add_pattern (filter, "*");
		gtk_recent_filter_add_age (filter, age);
		gtk_recent_chooser_add_filter (GTK_RECENT_CHOOSER(widget), filter);
	}

	if (sort_type)
	{
		if (strcmp (sort_type, "most used") == 0)
		{
			gtk_recent_chooser_set_sort_type (GTK_RECENT_CHOOSER(widget), GTK_RECENT_SORT_MRU);
		}
		else
		{
			gtk_recent_chooser_set_sort_type (GTK_RECENT_CHOOSER(widget), GTK_RECENT_SORT_LRU);
		}
	}
	gtk_recent_chooser_set_limit (GTK_RECENT_CHOOSER(widget), limit);

	return widget;
}
Example #5
0
/* need note toolbars when type is note */
static GtkWidget *editor_new(const gchar *title, EDITOR *e)
{
	GtkWidget *window;
	GtkWidget *scrollwindow;
	GtkWidget *statusbar;
	GtkBuilder *builder;
	gchar *gbuilder_file;
	GError *error = NULL;
	GtkMenuItem *item;
	GtkWidget *recent_item;

	buttons_state.nochange = 1;

	gbuilder_file = gui_general_user_file(
#ifdef USE_GTK_3
	    "gtk_webedit.ui"
#else
	    "gtk2_webedit.ui"
#endif
	    ,
	    FALSE);
	builder = gtk_builder_new();

	if (!gtk_builder_add_from_file(builder, gbuilder_file, &error)) {
		g_warning("Couldn't load builder file: %s",
			  error->message);
		g_error_free(error);
	}

	window = GTK_WIDGET(gtk_builder_get_object(builder, "window"));
	e->window = window;
	gtk_window_set_title(GTK_WINDOW(window), title);

	statusbar = GTK_WIDGET(gtk_builder_get_object(builder, "statusbar1"));
	gtk_widget_hide(statusbar);

	e->toolitems.outline_level = 0;
	e->toolitems.bold = GTK_TOGGLE_TOOL_BUTTON(gtk_builder_get_object(builder, "toolbutton_bold"));
	e->toolitems.italic = GTK_TOGGLE_TOOL_BUTTON(gtk_builder_get_object(builder, "toolbutton_italic"));
	e->toolitems.underline = GTK_TOGGLE_TOOL_BUTTON(gtk_builder_get_object(builder, "toolbuttonunderline"));
	e->toolitems.strike = GTK_TOGGLE_TOOL_BUTTON(gtk_builder_get_object(builder, "toolbutton_strikethrough"));
	e->toolitems.open = GTK_TOOL_BUTTON(gtk_builder_get_object(builder, "toolbutton_open"));
	e->toolitems.newdoc = GTK_TOOL_BUTTON(gtk_builder_get_object(builder, "toolbutton_new"));
	e->toolitems.deletedoc = GTK_TOOL_BUTTON(gtk_builder_get_object(builder, "toolbutton_delete"));
	e->toolitems.color = GTK_COLOR_BUTTON(gtk_builder_get_object(builder, "colorbutton1"));
	e->toolitems.cb = GTK_COMBO_BOX_TEXT(gtk_builder_get_object(builder, "comboboxtext1"));

	gtk_combo_box_set_active((GtkComboBox *)e->toolitems.cb, 0);

	item = GTK_MENU_ITEM(gtk_builder_get_object(builder, "menuitem_recent"));

	switch (e->type) {
	case STUDYPAD_EDITOR:
		gtk_widget_hide(GTK_WIDGET(e->toolitems.deletedoc));

		recent_item = gtk_recent_chooser_menu_new();
		g_signal_connect(G_OBJECT(recent_item), "item-activated",
				 G_CALLBACK(recent_item_cb), e);
		gtk_menu_item_set_submenu(item, recent_item);
		break;
	case NOTE_EDITOR:
		gtk_widget_hide(GTK_WIDGET(e->toolitems.open));
		gtk_widget_hide(GTK_WIDGET(e->toolitems.newdoc));
		gtk_widget_hide(GTK_WIDGET(item));
		break;
	case BOOK_EDITOR:
		gtk_widget_hide(GTK_WIDGET(e->toolitems.open));
		gtk_widget_hide(GTK_WIDGET(e->toolitems.newdoc));
		gtk_widget_hide(GTK_WIDGET(item));
		break;
	}

	e->navbar_box = GTK_WIDGET(gtk_builder_get_object(builder, "box_navbar"));
	e->box = GTK_WIDGET(gtk_builder_get_object(builder, "vbox1"));

	scrollwindow = GTK_WIDGET(gtk_builder_get_object(builder, "scrolledwindow1"));
	create_editor_window(scrollwindow, e);
	e->is_changed = FALSE;

	/* This is important */
	gtk_builder_connect_signals(builder, (EDITOR *)e);

	find_dialog.window = GTK_WIDGET(gtk_builder_get_object(builder, "dialog_find_replace"));
	find_dialog.find_entry = GTK_WIDGET(gtk_builder_get_object(builder, "entry1"));
	find_dialog.replace_entry = GTK_WIDGET(gtk_builder_get_object(builder, "entry2"));
	find_dialog.box_replace = GTK_WIDGET(gtk_builder_get_object(builder, "box4"));
	find_dialog.button_replace = GTK_WIDGET(gtk_builder_get_object(builder, "button_replace"));

	g_object_unref(builder);

	return window;
}
Example #6
0
void gtkui_create() {
	// Create the GTK+ Window
	
	gtkui_image_paths();
	GdkPixbuf *icon = gdk_pixbuf_new_from_file(iconpath, NULL);
	
	char title[24];
	snprintf(title, sizeof(title), "Nestopia UE %s", VERSION);
	
	gtkwindow = gtk_window_new(GTK_WINDOW_TOPLEVEL);
	gtk_window_set_icon(GTK_WINDOW(gtkwindow), icon);
	gtk_window_set_title(GTK_WINDOW(gtkwindow), title);
	gtk_window_set_resizable(GTK_WINDOW(gtkwindow), FALSE);
	
	GtkWidget *box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
	gtk_container_add(GTK_CONTAINER(gtkwindow), box);
	
	// Define the menubar and menus
	GtkWidget *menubar = gtk_menu_bar_new();
	
	// Define the File menu
	GtkWidget *filemenu = gtk_menu_new();
	GtkWidget *file = gtk_menu_item_new_with_mnemonic("_File");
	GtkWidget *open = gtk_image_menu_item_new_from_stock(GTK_STOCK_OPEN, NULL);
	GtkWidget *recent = gtk_image_menu_item_new_with_label("Open Recent");
		gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(recent), gtk_image_new_from_stock(GTK_STOCK_OPEN, GTK_ICON_SIZE_MENU));
	GtkWidget *sep_open = gtk_separator_menu_item_new();
	GtkWidget *stateload = gtk_image_menu_item_new_with_mnemonic("_Load State...");
		gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(stateload), gtk_image_new_from_stock(GTK_STOCK_GO_BACK, GTK_ICON_SIZE_MENU));
	GtkWidget *statesave = gtk_image_menu_item_new_with_mnemonic("_Save State...");
		gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(statesave), gtk_image_new_from_stock(GTK_STOCK_SAVE, GTK_ICON_SIZE_MENU));
	
	GtkWidget *quickload = gtk_image_menu_item_new_with_label("Quick Load");
	GtkWidget *qloadmenu = gtk_menu_new();
		GtkWidget *qload0 = gtk_image_menu_item_new_with_label("0");
		GtkWidget *qload1 = gtk_image_menu_item_new_with_label("1");
		GtkWidget *qload2 = gtk_image_menu_item_new_with_label("2");
		GtkWidget *qload3 = gtk_image_menu_item_new_with_label("3");
		GtkWidget *qload4 = gtk_image_menu_item_new_with_label("4");
	
	GtkWidget *quicksave = gtk_image_menu_item_new_with_label("Quick Save");
	GtkWidget *qsavemenu = gtk_menu_new();
		GtkWidget *qsave0 = gtk_image_menu_item_new_with_label("0");
		GtkWidget *qsave1 = gtk_image_menu_item_new_with_label("1");
		GtkWidget *qsave2 = gtk_image_menu_item_new_with_label("2");
		GtkWidget *qsave3 = gtk_image_menu_item_new_with_label("3");
		GtkWidget *qsave4 = gtk_image_menu_item_new_with_label("4");
	
	GtkWidget *sep_state = gtk_separator_menu_item_new();
	GtkWidget *screenshot = gtk_image_menu_item_new_with_mnemonic("S_creenshot...");
		gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(screenshot), gtk_image_new_from_stock(GTK_STOCK_SELECT_COLOR, GTK_ICON_SIZE_MENU));
	GtkWidget *sep_screenshot = gtk_separator_menu_item_new();
	GtkWidget *movieload = gtk_image_menu_item_new_with_label("Load Movie...");
		gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(movieload), gtk_image_new_from_stock(GTK_STOCK_OPEN, GTK_ICON_SIZE_MENU));
	GtkWidget *moviesave = gtk_image_menu_item_new_with_label("Record Movie...");
		gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(moviesave), gtk_image_new_from_stock(GTK_STOCK_MEDIA_RECORD, GTK_ICON_SIZE_MENU));
	GtkWidget *moviestop = gtk_image_menu_item_new_with_label("Stop Movie");
		gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(moviestop), gtk_image_new_from_stock(GTK_STOCK_MEDIA_STOP, GTK_ICON_SIZE_MENU));
	GtkWidget *sep_movie = gtk_separator_menu_item_new();
	GtkWidget *quit = gtk_image_menu_item_new_from_stock(GTK_STOCK_QUIT, NULL);
	
	// Set up the recently used items
	GtkWidget *recent_items = gtk_recent_chooser_menu_new();
	GtkRecentFilter *recent_filter = gtk_recent_filter_new();
		gtk_recent_filter_add_pattern(recent_filter, "*.nes");
		gtk_recent_filter_add_pattern(recent_filter, "*.fds");
		gtk_recent_filter_add_pattern(recent_filter, "*.unf");
		gtk_recent_filter_add_pattern(recent_filter, "*.unif");
		gtk_recent_filter_add_pattern(recent_filter, "*.nsf");
		gtk_recent_filter_add_pattern(recent_filter, "*.zip");
		gtk_recent_filter_add_pattern(recent_filter, "*.7z");
		gtk_recent_filter_add_pattern(recent_filter, "*.txz");
		gtk_recent_filter_add_pattern(recent_filter, "*.tar.xz");
		gtk_recent_filter_add_pattern(recent_filter, "*.xz");
		gtk_recent_filter_add_pattern(recent_filter, "*.tgz");
		gtk_recent_filter_add_pattern(recent_filter, "*.tar.gz");
		gtk_recent_filter_add_pattern(recent_filter, "*.gz");
		gtk_recent_filter_add_pattern(recent_filter, "*.tbz");
		gtk_recent_filter_add_pattern(recent_filter, "*.tar.bz2");
		gtk_recent_filter_add_pattern(recent_filter, "*.bz2");
	gtk_recent_chooser_add_filter(GTK_RECENT_CHOOSER(recent_items), recent_filter);
	
	// Populate the File menu
	gtk_menu_item_set_submenu(GTK_MENU_ITEM(file), filemenu);
	gtk_menu_shell_append(GTK_MENU_SHELL(filemenu), open);
	gtk_menu_shell_append(GTK_MENU_SHELL(filemenu), recent);
		gtk_menu_item_set_submenu(GTK_MENU_ITEM(recent), recent_items);
	gtk_menu_shell_append(GTK_MENU_SHELL(filemenu), sep_open);
	gtk_menu_shell_append(GTK_MENU_SHELL(filemenu), stateload);
	gtk_menu_shell_append(GTK_MENU_SHELL(filemenu), statesave);
	gtk_menu_shell_append(GTK_MENU_SHELL(filemenu), quickload);
		gtk_menu_item_set_submenu(GTK_MENU_ITEM(quickload), qloadmenu);
		gtk_menu_shell_append(GTK_MENU_SHELL(qloadmenu), qload0);
		gtk_menu_shell_append(GTK_MENU_SHELL(qloadmenu), qload1);
		gtk_menu_shell_append(GTK_MENU_SHELL(qloadmenu), qload2);
		gtk_menu_shell_append(GTK_MENU_SHELL(qloadmenu), qload3);
		gtk_menu_shell_append(GTK_MENU_SHELL(qloadmenu), qload4);
	gtk_menu_shell_append(GTK_MENU_SHELL(filemenu), quicksave);
		gtk_menu_item_set_submenu(GTK_MENU_ITEM(quicksave), qsavemenu);
		gtk_menu_shell_append(GTK_MENU_SHELL(qsavemenu), qsave0);
		gtk_menu_shell_append(GTK_MENU_SHELL(qsavemenu), qsave1);
		gtk_menu_shell_append(GTK_MENU_SHELL(qsavemenu), qsave2);
		gtk_menu_shell_append(GTK_MENU_SHELL(qsavemenu), qsave3);
		gtk_menu_shell_append(GTK_MENU_SHELL(qsavemenu), qsave4);
	gtk_menu_shell_append(GTK_MENU_SHELL(filemenu), sep_state);
	gtk_menu_shell_append(GTK_MENU_SHELL(filemenu), screenshot);
	gtk_menu_shell_append(GTK_MENU_SHELL(filemenu), sep_screenshot);
	gtk_menu_shell_append(GTK_MENU_SHELL(filemenu), movieload);
	gtk_menu_shell_append(GTK_MENU_SHELL(filemenu), moviesave);
	gtk_menu_shell_append(GTK_MENU_SHELL(filemenu), moviestop);
	gtk_menu_shell_append(GTK_MENU_SHELL(filemenu), sep_movie);
	gtk_menu_shell_append(GTK_MENU_SHELL(filemenu), quit);
	
	// Define the Emulator menu
	GtkWidget *emulatormenu = gtk_menu_new();
	GtkWidget *emu = gtk_menu_item_new_with_mnemonic("_Emulator");
	GtkWidget *cont = gtk_image_menu_item_new_with_mnemonic("C_ontinue");
		gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(cont), gtk_image_new_from_stock(GTK_STOCK_MEDIA_PLAY, GTK_ICON_SIZE_MENU));
	GtkWidget *pause = gtk_image_menu_item_new_from_stock(GTK_STOCK_MEDIA_PAUSE, NULL);
	GtkWidget *sep_pause = gtk_separator_menu_item_new();
	GtkWidget *resetsoft = gtk_image_menu_item_new_with_mnemonic("_Reset (Soft)");
		gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(resetsoft), gtk_image_new_from_stock(GTK_STOCK_REFRESH, GTK_ICON_SIZE_MENU));
	GtkWidget *resethard = gtk_image_menu_item_new_with_mnemonic("Reset (_Hard)");
		gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(resethard), gtk_image_new_from_stock(GTK_STOCK_REFRESH, GTK_ICON_SIZE_MENU));
	GtkWidget *sep_reset = gtk_separator_menu_item_new();
	GtkWidget *fullscreen = gtk_image_menu_item_new_from_stock(GTK_STOCK_FULLSCREEN, NULL);
	GtkWidget *sep_fullscreen = gtk_separator_menu_item_new();
	GtkWidget *diskflip = gtk_image_menu_item_new_with_mnemonic("Flip FDS _Disk");
		gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(diskflip), gtk_image_new_from_stock(GTK_STOCK_FLOPPY, GTK_ICON_SIZE_MENU));
	GtkWidget *diskswitch = gtk_image_menu_item_new_with_mnemonic("_Switch FDS Disk");
		gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(diskswitch), gtk_image_new_from_stock(GTK_STOCK_FLOPPY, GTK_ICON_SIZE_MENU));
	GtkWidget *sep_disk = gtk_separator_menu_item_new();
	GtkWidget *cheats = gtk_image_menu_item_new_with_mnemonic("Ch_eats...");
		gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(cheats), gtk_image_new_from_stock(GTK_STOCK_DIALOG_WARNING, GTK_ICON_SIZE_MENU));
	GtkWidget *sep_cheats = gtk_separator_menu_item_new();
	GtkWidget *configuration = gtk_image_menu_item_new_with_mnemonic("_Configuration...");
		gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(configuration), gtk_image_new_from_stock(GTK_STOCK_PREFERENCES, GTK_ICON_SIZE_MENU));
	
	// Populate the Emulator menu
	gtk_menu_item_set_submenu(GTK_MENU_ITEM(emu), emulatormenu);
	gtk_menu_shell_append(GTK_MENU_SHELL(emulatormenu), cont);
	gtk_menu_shell_append(GTK_MENU_SHELL(emulatormenu), pause);
	gtk_menu_shell_append(GTK_MENU_SHELL(emulatormenu), sep_pause);
	gtk_menu_shell_append(GTK_MENU_SHELL(emulatormenu), resetsoft);
	gtk_menu_shell_append(GTK_MENU_SHELL(emulatormenu), resethard);
	gtk_menu_shell_append(GTK_MENU_SHELL(emulatormenu), sep_reset);
	gtk_menu_shell_append(GTK_MENU_SHELL(emulatormenu), fullscreen);
	gtk_menu_shell_append(GTK_MENU_SHELL(emulatormenu), sep_fullscreen);
	gtk_menu_shell_append(GTK_MENU_SHELL(emulatormenu), diskflip);
	gtk_menu_shell_append(GTK_MENU_SHELL(emulatormenu), diskswitch);
	gtk_menu_shell_append(GTK_MENU_SHELL(emulatormenu), sep_disk);
	gtk_menu_shell_append(GTK_MENU_SHELL(emulatormenu), cheats);
	gtk_menu_shell_append(GTK_MENU_SHELL(emulatormenu), sep_cheats);
	gtk_menu_shell_append(GTK_MENU_SHELL(emulatormenu), configuration);
	
	// Define the Help menu
	GtkWidget *helpmenu = gtk_menu_new();
	GtkWidget *help = gtk_menu_item_new_with_mnemonic("_Help");
	GtkWidget *about = gtk_image_menu_item_new_from_stock(GTK_STOCK_ABOUT, NULL);
	
	// Populate the Help menu
	gtk_menu_item_set_submenu(GTK_MENU_ITEM(help), helpmenu);
	gtk_menu_shell_append(GTK_MENU_SHELL(helpmenu), about);
	
	// Put the menus into the menubar
	gtk_menu_shell_append(GTK_MENU_SHELL(menubar), file);
	gtk_menu_shell_append(GTK_MENU_SHELL(menubar), emu);
	gtk_menu_shell_append(GTK_MENU_SHELL(menubar), help);
	
	// Create the DrawingArea/OpenGL context
	drawingarea = gtk_drawing_area_new();
	//gtk_widget_set_double_buffered(drawingarea, FALSE);
	
	g_object_set_data(G_OBJECT(gtkwindow), "area", drawingarea);
	
	// Set the Drawing Area to be the size of the game output
	gtk_widget_set_size_request(drawingarea, rendersize.w, rendersize.h);
	
	// Create the statusbar
	GtkWidget *statusbar = gtk_statusbar_new();
	
	// Pack the box with the menubar, drawingarea, and statusbar
	gtk_box_pack_start(GTK_BOX(box), menubar, FALSE, FALSE, 0);
	gtk_box_pack_start(GTK_BOX(box), drawingarea, TRUE, TRUE, 0);
	//gtk_box_pack_start(GTK_BOX(box), statusbar, FALSE, FALSE, 0);
	
	// Make it dark if there's a dark theme
	GtkSettings *gtksettings = gtk_settings_get_default();
	g_object_set(G_OBJECT(gtksettings), "gtk-application-prefer-dark-theme", TRUE, NULL);
	
	// Set up the Drag and Drop target
	GtkTargetEntry target_entry[1];

	target_entry[0].target = (gchar*)"text/uri-list";
	target_entry[0].flags = 0;
	target_entry[0].info = 0;
	
	gtk_drag_dest_set(drawingarea, (GtkDestDefaults)(GTK_DEST_DEFAULT_MOTION | GTK_DEST_DEFAULT_HIGHLIGHT | GTK_DEST_DEFAULT_DROP), 
		target_entry, sizeof(target_entry) / sizeof(GtkTargetEntry), (GdkDragAction)(GDK_ACTION_MOVE | GDK_ACTION_COPY));
	
	// Connect the signals
	
	g_signal_connect(G_OBJECT(drawingarea), "drag-data-received",
		G_CALLBACK(gtkui_drag_data), NULL);
	
	g_signal_connect(G_OBJECT(gtkwindow), "delete_event",
		G_CALLBACK(nst_schedule_quit), NULL);
	
	// File menu
	g_signal_connect(G_OBJECT(open), "activate",
		G_CALLBACK(gtkui_file_open), NULL);
	
	g_signal_connect(G_OBJECT(recent_items), "item-activated",
		G_CALLBACK(gtkui_open_recent), NULL);
	
	g_signal_connect(G_OBJECT(stateload), "activate",
		G_CALLBACK(gtkui_state_load), NULL);
	
	g_signal_connect(G_OBJECT(statesave), "activate",
		G_CALLBACK(gtkui_state_save), NULL);
	
	g_signal_connect(G_OBJECT(qload0), "activate",
		G_CALLBACK(gtkui_state_quickload), gpointer(0));
	
	g_signal_connect(G_OBJECT(qload1), "activate",
		G_CALLBACK(gtkui_state_quickload), gpointer(1));
	
	g_signal_connect(G_OBJECT(qload2), "activate",
		G_CALLBACK(gtkui_state_quickload), gpointer(2));
	
	g_signal_connect(G_OBJECT(qload3), "activate",
		G_CALLBACK(gtkui_state_quickload), gpointer(3));
	
	g_signal_connect(G_OBJECT(qload4), "activate",
		G_CALLBACK(gtkui_state_quickload), gpointer(4));
	
	g_signal_connect(G_OBJECT(qsave0), "activate",
		G_CALLBACK(gtkui_state_quicksave), gpointer(0));
	
	g_signal_connect(G_OBJECT(qsave1), "activate",
		G_CALLBACK(gtkui_state_quicksave), gpointer(1));
	
	g_signal_connect(G_OBJECT(qsave2), "activate",
		G_CALLBACK(gtkui_state_quicksave), gpointer(2));
	
	g_signal_connect(G_OBJECT(qsave3), "activate",
		G_CALLBACK(gtkui_state_quicksave), gpointer(3));
	
	g_signal_connect(G_OBJECT(qsave4), "activate",
		G_CALLBACK(gtkui_state_quicksave), gpointer(4));
	
	g_signal_connect(G_OBJECT(statesave), "activate",
		G_CALLBACK(gtkui_state_save), NULL);
	
	g_signal_connect(G_OBJECT(screenshot), "activate",
		G_CALLBACK(gtkui_screenshot_save), NULL);
	
	g_signal_connect(G_OBJECT(moviesave), "activate",
		G_CALLBACK(gtkui_movie_save), NULL);
	
	g_signal_connect(G_OBJECT(movieload), "activate",
		G_CALLBACK(gtkui_movie_load), NULL);
	
	g_signal_connect(G_OBJECT(moviestop), "activate",
		G_CALLBACK(gtkui_movie_stop), NULL);
	
	g_signal_connect(G_OBJECT(quit), "activate",
		G_CALLBACK(nst_schedule_quit), NULL);
	
	// Emulator menu
	g_signal_connect(G_OBJECT(cont), "activate",
		G_CALLBACK(nst_play), NULL);
	
	g_signal_connect(G_OBJECT(pause), "activate",
		G_CALLBACK(nst_pause), NULL);
	
	g_signal_connect(G_OBJECT(resetsoft), "activate",
		G_CALLBACK(gtkui_cb_reset), gpointer(0));
	
	g_signal_connect(G_OBJECT(resethard), "activate",
		G_CALLBACK(gtkui_cb_reset), gpointer(1));
	
	g_signal_connect(G_OBJECT(fullscreen), "activate",
		G_CALLBACK(video_toggle_fullscreen), NULL);
	
	g_signal_connect(G_OBJECT(diskflip), "activate",
		G_CALLBACK(nst_flip_disk), NULL);
	
	g_signal_connect(G_OBJECT(diskswitch), "activate",
		G_CALLBACK(nst_switch_disk), NULL);
	
	g_signal_connect(G_OBJECT(cheats), "activate",
		G_CALLBACK(gtkui_cheats), NULL);
	
	g_signal_connect(G_OBJECT(configuration), "activate",
		G_CALLBACK(gtkui_config), NULL);
	
	// Help menu
	g_signal_connect(G_OBJECT(about), "activate",
		G_CALLBACK(gtkui_about), NULL);
	
	// Key translation
	g_signal_connect(G_OBJECT(gtkwindow), "key-press-event",
		G_CALLBACK(gtkui_cb_convert_key), NULL);
	
	g_signal_connect(G_OBJECT(gtkwindow), "key-release-event",
		G_CALLBACK(gtkui_cb_convert_key), NULL);
	
	// Mouse translation
	gtk_widget_add_events(GTK_WIDGET(drawingarea), GDK_BUTTON_PRESS_MASK);
	gtk_widget_add_events(GTK_WIDGET(drawingarea), GDK_BUTTON_RELEASE_MASK);
	
	g_signal_connect(G_OBJECT(drawingarea), "button-press-event",
		G_CALLBACK(gtkui_cb_convert_mouse), NULL);
	
	g_signal_connect(G_OBJECT(drawingarea), "button-release-event",
		G_CALLBACK(gtkui_cb_convert_mouse), NULL);
	
	gtk_widget_show_all(gtkwindow);
}