pub trait NativeDialogExtManual: Sealed + IsA<NativeDialog> {
    // Provided methods
    fn run_future<'a>(
        &'a self
    ) -> Pin<Box<dyn Future<Output = ResponseType> + 'a>> { ... }
    fn run_async<F: FnOnce(&Self, ResponseType) + 'static>(&self, f: F) { ... }
}
👎Deprecated: Since 4.10
Expand description

Trait containing manually implemented methods of NativeDialog.

Provided Methods§

source

fn run_future<'a>(&'a self) -> Pin<Box<dyn Future<Output = ResponseType> + 'a>>

👎Deprecated: Since 4.10

Shows the dialog and returns a Future that resolves to the ResponseType on response.

use gtk::prelude::*;

let dialog = gtk::FileChooserNative::builder()
   .title("Select a File")
   .build();

dialog.run_future().await;
println!("Selected file: {:?}", dialog.file());
dialog.destroy();
source

fn run_async<F: FnOnce(&Self, ResponseType) + 'static>(&self, f: F)

👎Deprecated: Since 4.10

Shows the dialog and calls the callback when a response has been received.

Important: this function isn’t blocking.

use gtk::prelude::*;

let dialog = gtk::FileChooserNative::builder()
   .title("Select a File")
   .build();

dialog.run_async(move |obj, answer| {
    obj.destroy();
    println!("Selected file: {:?}", obj.file());
});

Implementors§