GTK+ 3 Reference Manual: Filesystem utilities

## Filesystem utilities Filesystem utilities — Functions for working with GIO |

## Synopsis

    #include <gtk/gtk.h>

    struct              GtkMountOperation;
    GMountOperation *   gtk_mount_operation_new             (GtkWindow *parent);
    gboolean            gtk_mount_operation_is_showing      (GtkMountOperation *op);
    void                gtk_mount_operation_set_parent      (GtkMountOperation *op,
                                                             GtkWindow *parent);
    GtkWindow *         gtk_mount_operation_get_parent      (GtkMountOperation *op);
    void                gtk_mount_operation_set_screen      (GtkMountOperation *op,
                                                             GdkScreen *screen);
    GdkScreen *         gtk_mount_operation_get_screen      (GtkMountOperation *op);
    gboolean            gtk_show_uri                        (GdkScreen *screen,
                                                             const gchar *uri,
                                                             guint32 timestamp,
                                                             GError **error);

## Object Hierarchy

      GObject
       +----GMountOperation
             +----GtkMountOperation

## Properties

      "is-showing"               gboolean              : Read
      "parent"                   GtkWindow*            : Read / Write
      "screen"                   GdkScreen*            : Read / Write

## 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()` 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 lauching applications.

## Details

### struct GtkMountOperation

    struct GtkMountOperation;

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

### gtk_mount_operation_new ()

    GMountOperation *   gtk_mount_operation_new             (GtkWindow *parent);

Creates a new GtkMountOperation

`parent` : | transient parent of the window, or `NULL`. [allow-none]
Returns : | a new GtkMountOperation

Since 2.14

### gtk_mount_operation_is_showing ()

    gboolean            gtk_mount_operation_is_showing      (GtkMountOperation *op);

Returns whether the GtkMountOperation is currently displaying a window.

`op` : | a GtkMountOperation
Returns : | `TRUE` if `op` is currently displaying a window

Since 2.14

### 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.

`op` : | a GtkMountOperation
`parent` : | transient parent of the window, or `NULL`. [allow-none]

Since 2.14

### gtk_mount_operation_get_parent ()

    GtkWindow *         gtk_mount_operation_get_parent      (GtkMountOperation *op);

Gets the transient parent used by the GtkMountOperation

`op` : | a GtkMountOperation
Returns : | the transient parent for windows shown by `op`. [transfer none]

Since 2.14

### gtk_mount_operation_set_screen ()

    void                gtk_mount_operation_set_screen      (GtkMountOperation *op,
                                                             GdkScreen *screen);

Sets the screen to show windows of the GtkMountOperation on.

`op` : | a GtkMountOperation
`screen` : | a GdkScreen

Since 2.14

### gtk_mount_operation_get_screen ()

    GdkScreen *         gtk_mount_operation_get_screen      (GtkMountOperation *op);

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

`op` : | a GtkMountOperation
Returns : | the screen on which windows of `op` are shown. [transfer none]

Since 2.14

### gtk_show_uri ()

    gboolean            gtk_show_uri                        (GdkScreen *screen,
                                                             const gchar *uri,
                                                             guint32 timestamp,
                                                             GError **error);

This is a convenience function for launching the default application to show the uri. The uri must be of a form understood by GIO (i.e. you need to install gvfs to get support for uri schemes such as http:// or ftp://, as only local files are handled by GIO itself). Typical examples are

`file:///home/gnome/pict.jpg`
`http://www.gnome.org`
`mailto:me@gnome.org`

Ideally the timestamp is taken from the event triggering the `gtk_show_uri()` call. If timestamp is not known you can take `GDK_CURRENT_TIME`.

This function can be used as a replacement for `gnome_vfs_url_show()` and `gnome_url_show()`.

`screen` : | screen to show the uri on or `NULL` for the default screen. [allow-none]
`uri` : | the uri to show
`timestamp` : | a timestamp to prevent focus stealing
`error` : | a GError that is returned in case of errors
Returns : | `TRUE` on success, `FALSE` on error

Since 2.14

## Property Details

### The `"is-showing"` property

      "is-showing"               gboolean              : Read

Are we showing a dialog.

Default value: FALSE

### The `"parent"` property

      "parent"                   GtkWindow*            : Read / Write

The parent window.

### The `"screen"` property

      "screen"                   GdkScreen*            : Read / Write

The screen where this window will be displayed.