Home | History | Annotate | Download | only in gio
      1 /* GIO - GLib Input, Output and Streaming Library
      2  *
      3  * Copyright (C) 2006-2008 Red Hat, Inc.
      4  *
      5  * This library is free software; you can redistribute it and/or
      6  * modify it under the terms of the GNU Lesser General Public
      7  * License as published by the Free Software Foundation; either
      8  * version 2 of the License, or (at your option) any later version.
      9  *
     10  * This library is distributed in the hope that it will be useful,
     11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
     12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     13  * Lesser General Public License for more details.
     14  *
     15  * You should have received a copy of the GNU Lesser General
     16  * Public License along with this library; if not, write to the
     17  * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
     18  * Boston, MA 02111-1307, USA.
     19  *
     20  * Author: Alexander Larsson <alexl (at) redhat.com>
     21  *         David Zeuthen <davidz (at) redhat.com>
     22  */
     23 
     24 #if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
     25 #error "Only <gio/gio.h> can be included directly."
     26 #endif
     27 
     28 #ifndef __G_MOUNT_H__
     29 #define __G_MOUNT_H__
     30 
     31 #include <gio/giotypes.h>
     32 
     33 G_BEGIN_DECLS
     34 
     35 #define G_TYPE_MOUNT            (g_mount_get_type ())
     36 #define G_MOUNT(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), G_TYPE_MOUNT, GMount))
     37 #define G_IS_MOUNT(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G_TYPE_MOUNT))
     38 #define G_MOUNT_GET_IFACE(obj)  (G_TYPE_INSTANCE_GET_INTERFACE ((obj), G_TYPE_MOUNT, GMountIface))
     39 
     40 typedef struct _GMountIface    GMountIface;
     41 
     42 /**
     43  * GMountIface:
     44  * @g_iface: The parent interface.
     45  * @changed: Changed signal that is emitted when the mount's state has changed.
     46  * @unmounted: The unmounted signal that is emitted when the #GMount have been unmounted. If the recipient is holding references to the object they should release them so the object can be finalized.
     47  * @get_root: Gets a #GFile to the root directory of the #GMount.
     48  * @get_name: Gets a string containing the name of the #GMount.
     49  * @get_icon: Gets a #GIcon for the #GMount.
     50  * @get_uuid: Gets the UUID for the #GMount. The reference is typically based on the file system UUID for the mount in question and should be considered an opaque string. Returns %NULL if there is no UUID available.
     51  * @get_volume: Gets a #GVolume the mount is located on. Returns %NULL if the #GMount is not associated with a #GVolume.
     52  * @get_drive: Gets a #GDrive the volume of the mount is located on. Returns %NULL if the #GMount is not associated with a #GDrive or a #GVolume. This is convenience method for getting the #GVolume and using that to get the #GDrive.
     53  * @can_unmount: Checks if a #GMount can be unmounted.
     54  * @can_eject: Checks if a #GMount can be ejected.
     55  * @unmount: Starts unmounting a #GMount.
     56  * @unmount_finish: Finishes an unmounting operation.
     57  * @eject: Starts ejecting a #GMount.
     58  * @eject_finish: Finishes an eject operation.
     59  * @remount: Starts remounting a #GMount.
     60  * @remount_finish: Finishes a remounting operation.
     61  * @guess_content_type: Starts guessing the type of the content of a #GMount.
     62  *     See g_mount_guess_content_type() for more information on content
     63  *     type guessing. This operation was added in 2.18.
     64  * @guess_content_type_finish: Finishes a contenet type guessing operation. Added in 2.18.
     65  * @guess_content_type_sync: Synchronous variant of @guess_content_type. Added in 2.18
     66  *
     67  * Interface for implementing operations for mounts.
     68  **/
     69 struct _GMountIface
     70 {
     71   GTypeInterface g_iface;
     72 
     73   /* signals */
     74 
     75   void        (* changed)                   (GMount              *mount);
     76   void        (* unmounted)                 (GMount              *mount);
     77 
     78   /* Virtual Table */
     79 
     80   GFile     * (* get_root)                  (GMount              *mount);
     81   char      * (* get_name)                  (GMount              *mount);
     82   GIcon     * (* get_icon)                  (GMount              *mount);
     83   char      * (* get_uuid)                  (GMount              *mount);
     84   GVolume   * (* get_volume)                (GMount              *mount);
     85   GDrive    * (* get_drive)                 (GMount              *mount);
     86   gboolean    (* can_unmount)               (GMount              *mount);
     87   gboolean    (* can_eject)                 (GMount              *mount);
     88 
     89   void        (* unmount)                   (GMount              *mount,
     90                                              GMountUnmountFlags   flags,
     91                                              GCancellable        *cancellable,
     92                                              GAsyncReadyCallback  callback,
     93                                              gpointer             user_data);
     94   gboolean    (* unmount_finish)            (GMount              *mount,
     95                                              GAsyncResult        *result,
     96                                              GError             **error);
     97 
     98   void        (* eject)                     (GMount              *mount,
     99                                              GMountUnmountFlags   flags,
    100                                              GCancellable        *cancellable,
    101                                              GAsyncReadyCallback  callback,
    102                                              gpointer             user_data);
    103   gboolean    (* eject_finish)              (GMount              *mount,
    104                                              GAsyncResult        *result,
    105                                              GError             **error);
    106 
    107   void        (* remount)                   (GMount              *mount,
    108                                              GMountMountFlags     flags,
    109                                              GMountOperation     *mount_operation,
    110                                              GCancellable        *cancellable,
    111                                              GAsyncReadyCallback  callback,
    112                                              gpointer             user_data);
    113   gboolean    (* remount_finish)            (GMount              *mount,
    114                                              GAsyncResult        *result,
    115                                              GError             **error);
    116 
    117   void        (* guess_content_type)        (GMount              *mount,
    118                                              gboolean             force_rescan,
    119                                              GCancellable        *cancellable,
    120                                              GAsyncReadyCallback  callback,
    121                                              gpointer             user_data);
    122   gchar    ** (* guess_content_type_finish) (GMount              *mount,
    123                                              GAsyncResult        *result,
    124                                              GError             **error);
    125   gchar    ** (* guess_content_type_sync)   (GMount              *mount,
    126                                              gboolean             force_rescan,
    127                                              GCancellable        *cancellable,
    128                                              GError             **error);
    129 };
    130 
    131 GType       g_mount_get_type                  (void) G_GNUC_CONST;
    132 
    133 GFile     * g_mount_get_root                  (GMount              *mount);
    134 char      * g_mount_get_name                  (GMount              *mount);
    135 GIcon     * g_mount_get_icon                  (GMount              *mount);
    136 char      * g_mount_get_uuid                  (GMount              *mount);
    137 GVolume   * g_mount_get_volume                (GMount              *mount);
    138 GDrive    * g_mount_get_drive                 (GMount              *mount);
    139 gboolean    g_mount_can_unmount               (GMount              *mount);
    140 gboolean    g_mount_can_eject                 (GMount              *mount);
    141 
    142 void        g_mount_unmount                   (GMount              *mount,
    143                                                GMountUnmountFlags   flags,
    144                                                GCancellable        *cancellable,
    145                                                GAsyncReadyCallback  callback,
    146                                                gpointer             user_data);
    147 gboolean    g_mount_unmount_finish            (GMount              *mount,
    148                                                GAsyncResult        *result,
    149                                                GError             **error);
    150 
    151 void        g_mount_eject                     (GMount              *mount,
    152                                                GMountUnmountFlags   flags,
    153                                                GCancellable        *cancellable,
    154                                                GAsyncReadyCallback  callback,
    155                                                gpointer             user_data);
    156 gboolean    g_mount_eject_finish              (GMount              *mount,
    157                                                GAsyncResult        *result,
    158                                                GError             **error);
    159 
    160 void        g_mount_remount                   (GMount              *mount,
    161                                                GMountMountFlags     flags,
    162                                                GMountOperation     *mount_operation,
    163                                                GCancellable        *cancellable,
    164                                                GAsyncReadyCallback  callback,
    165                                                gpointer             user_data);
    166 gboolean    g_mount_remount_finish            (GMount              *mount,
    167                                                GAsyncResult        *result,
    168                                                GError             **error);
    169 
    170 void        g_mount_guess_content_type        (GMount              *mount,
    171                                                gboolean             force_rescan,
    172                                                GCancellable        *cancellable,
    173                                                GAsyncReadyCallback  callback,
    174                                                gpointer             user_data);
    175 gchar    ** g_mount_guess_content_type_finish (GMount              *mount,
    176                                                GAsyncResult        *result,
    177                                                GError             **error);
    178 gchar    ** g_mount_guess_content_type_sync   (GMount              *mount,
    179                                                gboolean             force_rescan,
    180                                                GCancellable        *cancellable,
    181                                                GError             **error);
    182 
    183 gboolean    g_mount_is_shadowed               (GMount              *mount);
    184 void        g_mount_shadow                    (GMount              *mount);
    185 void        g_mount_unshadow                  (GMount              *mount);
    186 
    187 G_END_DECLS
    188 
    189 #endif /* __G_MOUNT_H__ */
    190