Filesystem utilities

Filesystem utilities — Functions for working with GIO

Properties

GdkDisplay * display Read / Write
gboolean is-showing Read
GtkWindow * parent Read / Write

Types and Values

Object Hierarchy

    GObject
    ╰── GMountOperation
        ╰── GtkMountOperation

Includes

#include <gtk/gtk.h>

Description

The functions and objects described here make working with GTK and GIO more convenient.

GtkMountOperation is needed when mounting volumes: It is an implementation of GMountOperation that can be used with GIO functions for mounting volumes such as g_file_mount_enclosing_volume(), g_file_mount_mountable(), g_volume_mount(), g_mount_unmount_with_operation() and others.

When necessary, GtkMountOperation shows dialogs to ask for passwords, questions or show processes blocking unmount.

gtk_show_uri_on_window() is a convenient way to launch applications for URIs.

Another object that is worth mentioning in this context is GdkAppLaunchContext, which provides visual feedback when launching applications.

Functions

gtk_mount_operation_new ()

GMountOperation *
gtk_mount_operation_new (GtkWindow *parent);

Creates a new GtkMountOperation

Parameters

parent

transient parent of the window, or NULL.

[allow-none]

Returns

a new GtkMountOperation


gtk_mount_operation_is_showing ()

gboolean
gtk_mount_operation_is_showing (GtkMountOperation *op);

Returns whether the GtkMountOperation is currently displaying a window.

Parameters

Returns

TRUE if op is currently displaying a window


gtk_mount_operation_set_parent ()

void
gtk_mount_operation_set_parent (GtkMountOperation *op,
                                GtkWindow *parent);

Sets the transient parent for windows shown by the GtkMountOperation.

Parameters

op

a GtkMountOperation

 

parent

transient parent of the window, or NULL.

[allow-none]

gtk_mount_operation_get_parent ()

GtkWindow *
gtk_mount_operation_get_parent (GtkMountOperation *op);

Gets the transient parent used by the GtkMountOperation

Parameters

Returns

the transient parent for windows shown by op .

[transfer none]


gtk_mount_operation_set_display ()

void
gtk_mount_operation_set_display (GtkMountOperation *op,
                                 GdkDisplay *display);

Sets the display to show windows of the GtkMountOperation on.

Parameters

op

a GtkMountOperation

 

display

a GdkDisplay

 

gtk_mount_operation_get_display ()

GdkDisplay *
gtk_mount_operation_get_display (GtkMountOperation *op);

Gets the display on which windows of the GtkMountOperation will be shown.

Parameters

Returns

the display on which windows of op are shown.

[transfer none]


gtk_show_uri_full ()

void
gtk_show_uri_full (GtkWindow *parent,
                   const char *uri,
                   guint32 timestamp,
                   GCancellable *cancellable,
                   GAsyncReadyCallback callback,
                   gpointer user_data);

This function launches the default application for showing a given uri.

The callback will be called when the launch is completed. It should call gtk_show_uri_full_finish() to obtain the result.

This is the recommended call to be used as it passes information necessary for sandbox helpers to parent their dialogs properly.

Parameters

parent

parent window.

[nullable]

uri

the uri to show

 

timestamp

timestamp from the event that triggered this call, or GDK_CURRENT_TIME

 

cancellable

a GCancellable to cancel the launch.

[nullable]

callback

a callback to call when the action is complete.

[scope async]

user_data

data to pass to callback .

[closure callback]

gtk_show_uri_full_finish ()

gboolean
gtk_show_uri_full_finish (GtkWindow *parent,
                          GAsyncResult *result,
                          GError **error);

Finishes the gtk_show_uri() call and returns the result of the operation.

Parameters

parent

the GtkWindow passed to gtk_show_uri()

 

result

GAsyncResult that was passed to callback

 

error

return location for an error

 

Returns

TRUE if the URI was shown successfully. Otherwise, FALSE is returned and error is set


gtk_show_uri ()

void
gtk_show_uri (GtkWindow *parent,
              const char *uri,
              guint32 timestamp);

This function launches the default application for showing a given uri, or shows an error dialog if that fails.

Parameters

parent

parent window.

[allow-none]

uri

the uri to show

 

timestamp

timestamp from the event that triggered this call, or GDK_CURRENT_TIME

 

Types and Values

struct GtkMountOperation

struct GtkMountOperation;

This should not be accessed directly. Use the accessor functions below.


struct GtkMountOperationClass

struct GtkMountOperationClass {
  GMountOperationClass parent_class;
};

Members

Property Details

The “display” property

  “display”                  GdkDisplay *

The display where this window will be displayed.

Owner: GtkMountOperation

Flags: Read / Write


The “is-showing” property

  “is-showing”               gboolean

Are we showing a dialog.

Owner: GtkMountOperation

Flags: Read

Default value: FALSE


The “parent” property

  “parent”                   GtkWindow *

The parent window.

Owner: GtkMountOperation

Flags: Read / Write