示例#1
0
static void ok_cb(Fl_Widget*, void* w) {
	LaunchWindow* win = (LaunchWindow*)w;
	const char* cmd = dialog_input->value();
	bool started = false;

	win->hide();

	/* do not block dialog when program is starting */
	Fl::check();

	/* TODO: is 'cmd' safe after hide? */
	if(in_term->value()) {
		char buf[128];
		char* term = getenv("TERM");
		if(!term)
			term = "xterm";

		snprintf(buf, sizeof(buf), "%s -e %s", term, cmd);
		started = start_child(buf);
	} else {
		started = start_child(cmd);
	}

	if(!started) {
		/* show dialog again */
		win->show();

		if(cmd) 
			dialog_input->position(0, dialog_input->size());
	} else {
		Resource rc;
		rc.set("History", "open", cmd);
		rc.save("ede-launch-history");
	}
}
示例#2
0
static void cancel_cb(Fl_Widget*, void* w) {
	LaunchWindow* win = (LaunchWindow*)w;
	win->hide();
}