[]Struct gtk::MessageDialog

pub struct MessageDialog(_, _);

MessageDialog presents a dialog with some message text. It’s simply a convenience widget; you could construct the equivalent of MessageDialog from Dialog without too much effort, but MessageDialog saves typing.

One difference from Dialog is that MessageDialog sets the Window:skip-taskbar-hint property to true, so that the dialog is hidden from the taskbar by default.

The easiest way to do a modal message dialog is to use DialogExt::run, though you can also pass in the DialogFlags::Modal flag, DialogExt::run automatically makes the dialog modal and waits for the user to respond to it. DialogExt::run returns when any dialog button is clicked.

An example for using a modal dialog:

 GtkDialogFlags flags = GTK_DIALOG_DESTROY_WITH_PARENT;
 dialog = gtk_message_dialog_new (parent_window,
                                  flags,
                                  GTK_MESSAGE_ERROR,
                                  GTK_BUTTONS_CLOSE,
                                  "Error reading “%s”: %s",
                                  filename,
                                  g_strerror (errno));
 gtk_dialog_run (GTK_DIALOG (dialog));
 gtk_widget_destroy (dialog);

You might do a non-modal MessageDialog as follows:

An example for a non-modal dialog:

 GtkDialogFlags flags = GTK_DIALOG_DESTROY_WITH_PARENT;
 dialog = gtk_message_dialog_new (parent_window,
                                  flags,
                                  GTK_MESSAGE_ERROR,
                                  GTK_BUTTONS_CLOSE,
                                  "Error reading “%s”: %s",
                                  filename,
                                  g_strerror (errno));

 // Destroy the dialog when the user responds to it
 // (e.g. clicks a button)

 g_signal_connect_swapped (dialog, "response",
                           G_CALLBACK (gtk_widget_destroy),
                           dialog);

MessageDialog as Buildable

The MessageDialog implementation of the Buildable interface exposes the message area as an internal child with the name “message_area”.

Implements

MessageDialogExt, DialogExt, GtkWindowExt, BinExt, ContainerExt, WidgetExt, glib::object::ObjectExt, BuildableExt, DialogExtManual, GtkWindowExtManual, WidgetExtManual, BuildableExtManual

Implementations

impl MessageDialog[src]

pub fn new<T: IsA<Window>>(
    parent: Option<&T>,
    flags: DialogFlags,
    type_: MessageType,
    buttons: ButtonsType,
    message: &str
) -> MessageDialog
[src]

Creates a new message dialog, which is a simple dialog with some text the user may want to see. When the user clicks a button a “response” signal is emitted with response IDs from ResponseType. See Dialog for more details.

parent

transient parent, or None for none

flags

flags

type_

type of message

buttons

set of buttons to use

message_format

printf-style format string, or None

Returns

a new MessageDialog

Trait Implementations

impl Clone for MessageDialog

impl Debug for MessageDialog

impl Display for MessageDialog[src]

impl Eq for MessageDialog

impl Hash for MessageDialog

impl IsA<Bin> for MessageDialog

impl IsA<Buildable> for MessageDialog

impl IsA<Container> for MessageDialog

impl IsA<Dialog> for MessageDialog

impl IsA<Widget> for MessageDialog

impl IsA<Window> for MessageDialog

impl Ord for MessageDialog

impl<T: ObjectType> PartialEq<T> for MessageDialog

impl<T: ObjectType> PartialOrd<T> for MessageDialog

impl StaticType for MessageDialog

Auto Trait Implementations

impl RefUnwindSafe for MessageDialog

impl !Send for MessageDialog

impl !Sync for MessageDialog

impl Unpin for MessageDialog

impl UnwindSafe for MessageDialog

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<Super, Sub> CanDowncast<Sub> for Super where
    Sub: IsA<Super>,
    Super: IsA<Super>, 

impl<T> Cast for T where
    T: ObjectType, 

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ObjectExt for T where
    T: ObjectType, 

impl<'a, T> ToGlibContainerFromSlice<'a, *const GList> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 

type Storage = (Option<List>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)

impl<'a, T> ToGlibContainerFromSlice<'a, *const GPtrArray> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 

type Storage = (Option<PtrArray>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)

impl<'a, T> ToGlibContainerFromSlice<'a, *mut GArray> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 

type Storage = (Option<Array>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)

impl<'a, T> ToGlibContainerFromSlice<'a, *mut GList> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 

type Storage = (Option<List>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)

impl<'a, T> ToGlibContainerFromSlice<'a, *mut GPtrArray> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 

type Storage = (Option<PtrArray>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T> ToValue for T where
    T: SetValue + ?Sized

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.