| Top |
| void | ctk_native_dialog_show () |
| void | ctk_native_dialog_hide () |
| void | ctk_native_dialog_destroy () |
| gboolean | ctk_native_dialog_get_visible () |
| void | ctk_native_dialog_set_modal () |
| gboolean | ctk_native_dialog_get_modal () |
| void | ctk_native_dialog_set_title () |
| const char * | ctk_native_dialog_get_title () |
| void | ctk_native_dialog_set_transient_for () |
| CtkWindow * | ctk_native_dialog_get_transient_for () |
| gint | ctk_native_dialog_run () |
Native dialogs are platform dialogs that don't use CtkDialog or CtkWindow. They are used in order to integrate better with a platform, by looking the same as other native applications and supporting platform specific features.
The CtkDialog functions cannot be used on such objects, but we need a similar API in order to drive them. The CtkNativeDialog object is an API that allows you to do this. It allows you to set various common properties on the dialog, as well as show and hide it and get a “response” signal when the user finished with the dialog.
There is also a ctk_native_dialog_run() helper that makes it easy
to run any native dialog in a modal way with a recursive mainloop,
similar to ctk_dialog_run().
void
ctk_native_dialog_show (CtkNativeDialog *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 “response” signal will be emitted.
Multiple calls while the dialog is visible will be ignored.
Since: 3.20
void
ctk_native_dialog_hide (CtkNativeDialog *self);
Hides the dialog if it is visilbe, aborting any interaction. Once this
is called the “response” signal will not be emitted
until after the next call to ctk_native_dialog_show().
If the dialog is not visible this does nothing.
Since: 3.20
void
ctk_native_dialog_destroy (CtkNativeDialog *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 CtkWindow) because there is no reference from the windowing system to the CtkNativeDialog.
Since: 3.20
gboolean
ctk_native_dialog_get_visible (CtkNativeDialog *self);
Determines whether the dialog is visible.
Since: 3.20
void ctk_native_dialog_set_modal (CtkNativeDialog *self,gboolean modal);
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
ctk_native_dialog_set_transient_for() to make the dialog transient for the
parent; most window managers
will then disallow lowering the dialog below the parent.
Since: 3.20
gboolean
ctk_native_dialog_get_modal (CtkNativeDialog *self);
Returns whether the dialog is modal. See ctk_native_dialog_set_modal().
Since: 3.20
void ctk_native_dialog_set_title (CtkNativeDialog *self,const char *title);
Sets the title of the CtkNativeDialog.
Since: 3.20
const char *
ctk_native_dialog_get_title (CtkNativeDialog *self);
Gets the title of the CtkNativeDialog.
the title of the dialog, or NULL if none has
been set explicitly. The returned string is owned by the widget
and must not be modified or freed.
[nullable]
Since: 3.20
void ctk_native_dialog_set_transient_for (CtkNativeDialog *self,CtkWindow *parent);
Dialog windows should be set transient for the main application window they were spawned from. This allows window managers to e.g. keep the dialog on top of the main window, or center the dialog over the main window.
Passing NULL for parent
unsets the current transient window.
Since: 3.20
CtkWindow *
ctk_native_dialog_get_transient_for (CtkNativeDialog *self);
Fetches the transient parent for this window. See
ctk_native_dialog_set_transient_for().
the transient parent for this window,
or NULL if no transient parent has been set.
[nullable][transfer none]
Since: 3.20
gint
ctk_native_dialog_run (CtkNativeDialog *self);
Blocks in a recursive main loop until self
emits the
“response” signal. It then returns the response ID
from the ::response signal emission.
Before entering the recursive main loop, ctk_native_dialog_run()
calls ctk_native_dialog_show() on the dialog for you.
After ctk_native_dialog_run() returns, then dialog will be hidden.
Typical usage of this function might be:
1 2 3 4 5 6 7 8 9 10 11 |
gint result = ctk_native_dialog_run (CTK_NATIVE_DIALOG (dialog)); switch (result) { case CTK_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 ctk_nautilus_dialog_run() call.
Since: 3.20