using Gtk;

public class TextCase : Window {

    public TextCase () {
        this.title = "Test Case";
        this.window_position = WindowPosition.CENTER;
        set_default_size (330, 60);
	this.destroy.connect (Gtk.main_quit);
	
	var button = new Button.with_label ("Open file");
	button.clicked.connect (open_clicked);

	this.add (button);
	this.show_all ();
    }

    private void open_clicked () {
 	 var file_chooser = new FileChooserDialog ("Open File", this,
                                      FileChooserAction.OPEN,
                                      Stock.CANCEL, ResponseType.CANCEL,
                                      Stock.OPEN, ResponseType.ACCEPT);


        file_chooser.show_hidden = false;
        file_chooser.local_only = true;
        file_chooser.filter = new Gtk.FileFilter ();
        file_chooser.filter.add_mime_type ("application/x-cd-image");

        if (file_chooser.run () == ResponseType.ACCEPT) {
            //do something
        }
        file_chooser.destroy ();
    }


    public static int main (string[] args) {
        Gtk.init (ref args);

        var window = new TextCase ();
        window.destroy.connect (Gtk.main_quit);
        window.show_all ();

        Gtk.main ();
        return 0;
    }
}

/*
Almost similar to the boxes function

    private bool launch_file_selection_dialog () {
        var dialog = new Gtk.FileChooserDialog (_("Select a device or ISO file"),
                                                App.app.window,
                                                Gtk.FileChooserAction.OPEN,
                                                Gtk.Stock.CANCEL, Gtk.ResponseType.CANCEL,
                                                Gtk.Stock.OPEN, Gtk.ResponseType.ACCEPT);
        dialog.show_hidden = false;
        dialog.local_only = true;
        dialog.filter = new Gtk.FileFilter ();
        dialog.filter.add_mime_type ("application/x-cd-image");
        var ret = false;
        if (dialog.run () == Gtk.ResponseType.ACCEPT) {
            uri = dialog.get_uri ();
            // clean install_media as this may be set already when going back in the wizard
            install_media = null;
            url_entry.activate ();

            ret = true;
        }

        dialog.hide ();

        return ret;
    }

*/


