How do I get response from window?

So, I want to create a window from another window to ask user to view a list and select one of three buttons (actions/responses). I’ve created a markup of the window and it looks good.

The problem is getting the response out of the window. I see that documentation Dialog in gtk4 - Rust mentions that Dialog is deprecated and Window should be used instead. But unfortunately I didn’t find and have not figured out how to emit a response (there’s no “response” in the keywords of what IDE suggests me and (almost) nothing in the documentation). I can provide more details if needed.

Basically I want something like (this is a working example using AdwAlertDialog)

let alert = adw::AlertDialog::new();
alert.connect_response(None, move |_, response| {
            match response {
                "no" => do_this(),
                "yes" => do_that(),
                _ => {}
            }
        });

but with a Window. Is this possible? If not, what are workarounds?

Crates info (built with gvsbuild):

adw = { version = "0.8", package = "libadwaita", features = ["v1_5"] }
gtk = { version = "0.10.0", package = "gtk4", features = ["v4_14"] }

Adw.Dialog (and by extension Adw.AlertDialog) is separate from Gtk.Dialog and not deprecated.

Yeah, turns out that you can set the markup for the dialog as you want (loosing the default response buttons and header) but it’s possible.

Code for future reference:

let cancel_button = gtk::Button::builder()
            .label("Cancel Installation")
            .width_request(128)
            .height_request(64)
            .build();
        cancel_button.connect_clicked(clone!(
            #[weak]
            dialog,
            move |_| {
                dialog.close();
                dialog.emit_by_name("response", &[&"cancel".to_string()])
            }
        ));

root.insert_child_after(&cancel_button, None::<&Widget>);

dialog.set_child(Some(&root));
dialog.present(None::<&Widget>);

let closure = clone!(
            #[weak (rename_to = this)]
            self,
            move |response: &str| {
                // your code
            }
        );

dialog.connect_response(None, move |_, response| closure(&response));

That will do, thanks.