[][src]Trait gtk::NativeDialogExt

pub trait NativeDialogExt: 'static {
    fn destroy(&self);
fn get_modal(&self) -> bool;
fn get_title(&self) -> Option<GString>;
fn get_transient_for(&self) -> Option<Window>;
fn get_visible(&self) -> bool;
fn hide(&self);
fn run(&self) -> ResponseType;
fn set_modal(&self, modal: bool);
fn set_title(&self, title: &str);
fn set_transient_for<P: IsA<Window>>(&self, parent: Option<&P>);
fn show(&self);
fn set_property_visible(&self, visible: bool);
fn connect_response<F: Fn(&Self, ResponseType) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_property_modal_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_property_title_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_property_transient_for_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_property_visible_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId; }

Trait containing all NativeDialog methods.

Feature: v3_20

Implementors

FileChooserNative, NativeDialog

Required methods

fn destroy(&self)

Destroys a dialog.

When a dialog is destroyed, it will break any references it holds to other objects. If it is visible it will be hidden and any underlying window system resources will be destroyed.

Note that this does not release any reference to the object (as opposed to destroying a Window) because there is no reference from the windowing system to the NativeDialog.

Feature: v3_20

fn get_modal(&self) -> bool

Returns whether the dialog is modal. See NativeDialogExt::set_modal.

Feature: v3_20

Returns

true if the dialog is set to be modal

fn get_title(&self) -> Option<GString>

Gets the title of the NativeDialog.

Feature: v3_20

Returns

the title of the dialog, or None if none has been set explicitly. The returned string is owned by the widget and must not be modified or freed.

fn get_transient_for(&self) -> Option<Window>

Fetches the transient parent for this window. See NativeDialogExt::set_transient_for.

Feature: v3_20

Returns

the transient parent for this window, or None if no transient parent has been set.

fn get_visible(&self) -> bool

Determines whether the dialog is visible.

Feature: v3_20

Returns

true if the dialog is visible

fn hide(&self)

Hides the dialog if it is visilbe, aborting any interaction. Once this is called the NativeDialog::response signal will not be emitted until after the next call to NativeDialogExt::show.

If the dialog is not visible this does nothing.

Feature: v3_20

fn run(&self) -> ResponseType

Blocks in a recursive main loop until self emits the NativeDialog::response signal. It then returns the response ID from the ::response signal emission.

Before entering the recursive main loop, NativeDialogExt::run calls NativeDialogExt::show on the dialog for you.

After NativeDialogExt::run returns, then dialog will be hidden.

Typical usage of this function might be:

  gint result = gtk_native_dialog_run (GTK_NATIVE_DIALOG (dialog));
  switch (result)
    {
      case GTK_RESPONSE_ACCEPT:
         do_application_specific_something ();
         break;
      default:
         do_nothing_since_dialog_was_cancelled ();
         break;
    }
  g_object_unref (dialog);

Note that even though the recursive main loop gives the effect of a modal dialog (it prevents the user from interacting with other windows in the same window group while the dialog is run), callbacks such as timeouts, IO channel watches, DND drops, etc, will be triggered during a gtk_nautilus_dialog_run call.

Feature: v3_20

Returns

response ID

fn set_modal(&self, modal: bool)

Sets a dialog modal or non-modal. Modal dialogs prevent interaction with other windows in the same application. To keep modal dialogs on top of main application windows, use NativeDialogExt::set_transient_for to make the dialog transient for the parent; most [window managers][gtk-X11-arch] will then disallow lowering the dialog below the parent.

Feature: v3_20

whether the window is modal

fn set_title(&self, title: &str)

Sets the title of the NativeDialog.

Feature: v3_20

title

title of the dialog

fn set_transient_for<P: IsA<Window>>(&self, parent: Option<&P>)

Dialog windows should be set transient for the main application window they were spawned from. This allows [window managers][gtk-X11-arch] to e.g. keep the dialog on top of the main window, or center the dialog over the main window.

Passing None for parent unsets the current transient window.

Feature: v3_20

parent

parent window, or None

fn show(&self)

Shows the dialog on the display, allowing the user to interact with it. When the user accepts the state of the dialog the dialog will be automatically hidden and the NativeDialog::response signal will be emitted.

Multiple calls while the dialog is visible will be ignored.

Feature: v3_20

fn set_property_visible(&self, visible: bool)

Whether the window is currenlty visible.

Feature: v3_20

fn connect_response<F: Fn(&Self, ResponseType) + 'static>(
    &self,
    f: F
) -> SignalHandlerId

Emitted when the user responds to the dialog.

When this is called the dialog has been hidden.

If you call NativeDialogExt::hide before the user responds to the dialog this signal will not be emitted.

Feature: v3_20

response_id

the response ID

fn connect_property_modal_notify<F: Fn(&Self) + 'static>(
    &self,
    f: F
) -> SignalHandlerId

fn connect_property_title_notify<F: Fn(&Self) + 'static>(
    &self,
    f: F
) -> SignalHandlerId

fn connect_property_transient_for_notify<F: Fn(&Self) + 'static>(
    &self,
    f: F
) -> SignalHandlerId

fn connect_property_visible_notify<F: Fn(&Self) + 'static>(
    &self,
    f: F
) -> SignalHandlerId

Loading content...

Implementors

impl<O: IsA<NativeDialog>> NativeDialogExt for O[src]

Loading content...