Ejemplo n.º 1
0
int main(int argc, char** argv) {
    Session* session = new Session("Ifc", argc, argv, options, props);
    Style* s = session->style();
    String sep;
    s->find_attribute("separator", sep);
    DialogKit& dialogs = *DialogKit::instance();
    FileChooser* fc = dialogs.file_chooser(((argc == 2) ? argv[1] : "."), s);
    ApplicationWindow* w = new ApplicationWindow(fc);
    w->style(s);
    w->map();
    int status = 1;
    for (;;) {
	if (!fc->run()) {
	    status = 1;
	    break;
	}
	const String* name = fc->selected();
	if (name != nil) {
	    if (sep == "") {
		printf("%.*s%c", name->length(), name->string(), '\0');
	    } else {
		printf(
		    "%.*s%.*s", name->length(), name->string(),
		    sep.length(), sep.string()
		);
	    }
	    fflush(stdout);
	    status = 0;
	}
	if (!s->value_is_on("static")) {
	    break;
	}
    }
    w->unmap();
    delete w;
    delete session;
    return status;
}