public class Application : Gtk.Application {

    Gtk.ToggleButton toggle;
    Gtk.Popover popover;

    public Application () {
        Object(application_id: "my.application",
               flags: ApplicationFlags.FLAGS_NONE);
    }

    protected override void activate () {
        // create the window of this application and show it
        Gtk.ApplicationWindow window = new Gtk.ApplicationWindow (this);
        window.set_default_size (300, 200);
        window.set_border_width (10);

        // add headerbar with button
        Gtk.HeaderBar headerbar = new Gtk.HeaderBar();
        headerbar.show_close_button = true;
        headerbar.title = "Window";
        window.set_titlebar (headerbar);


        toggle = new Gtk.ToggleButton.with_label ("About");
        toggle.show ();

        popover = new Gtk.Popover(toggle);
        popover.height_request = 100;
        popover.width_request = 100;
    
        Gtk.FileChooserButton chooser = new Gtk.FileChooserButton ("Select folder", Gtk.FileChooserAction.SELECT_FOLDER);
        chooser.show();
        popover.add (chooser);

        toggle.bind_property ("active", popover, "visible", BindingFlags.BIDIRECTIONAL);

        // add button to headerbar
        headerbar.pack_end (toggle);

        window.show_all ();
    }

    public static int main (string[] args) {
        Application app = new Application ();
        return app.run (args);
    }
}
