Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:00:00

0001 /* GIO - GLib Input, Output and Streaming Library
0002  *
0003  * Copyright (C) 2006-2007 Red Hat, Inc.
0004  *
0005  * SPDX-License-Identifier: LGPL-2.1-or-later
0006  *
0007  * This library is free software; you can redistribute it and/or
0008  * modify it under the terms of the GNU Lesser General Public
0009  * License as published by the Free Software Foundation; either
0010  * version 2.1 of the License, or (at your option) any later version.
0011  *
0012  * This library is distributed in the hope that it will be useful,
0013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0015  * Lesser General Public License for more details.
0016  *
0017  * You should have received a copy of the GNU Lesser General
0018  * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
0019  *
0020  * Author: Alexander Larsson <alexl@redhat.com>
0021  *         David Zeuthen <davidz@redhat.com>
0022  */
0023 
0024 #ifndef __G_VOLUME_H__
0025 #define __G_VOLUME_H__
0026 
0027 #if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
0028 #error "Only <gio/gio.h> can be included directly."
0029 #endif
0030 
0031 #include <gio/giotypes.h>
0032 
0033 G_BEGIN_DECLS
0034 
0035 /**
0036  * G_VOLUME_IDENTIFIER_KIND_HAL_UDI:
0037  *
0038  * The string used to obtain a Hal UDI with g_volume_get_identifier().
0039  *
0040  * Deprecated: 2.58: Do not use, HAL is deprecated.
0041  */
0042 #define G_VOLUME_IDENTIFIER_KIND_HAL_UDI "hal-udi" GIO_DEPRECATED_MACRO_IN_2_58
0043 
0044 /**
0045  * G_VOLUME_IDENTIFIER_KIND_UNIX_DEVICE:
0046  *
0047  * The string used to obtain a Unix device path with g_volume_get_identifier().
0048  */
0049 #define G_VOLUME_IDENTIFIER_KIND_UNIX_DEVICE "unix-device"
0050 
0051 /**
0052  * G_VOLUME_IDENTIFIER_KIND_LABEL:
0053  *
0054  * The string used to obtain a filesystem label with g_volume_get_identifier().
0055  */
0056 #define G_VOLUME_IDENTIFIER_KIND_LABEL "label"
0057 
0058 /**
0059  * G_VOLUME_IDENTIFIER_KIND_UUID:
0060  *
0061  * The string used to obtain a UUID with g_volume_get_identifier().
0062  */
0063 #define G_VOLUME_IDENTIFIER_KIND_UUID "uuid"
0064 
0065 /**
0066  * G_VOLUME_IDENTIFIER_KIND_NFS_MOUNT:
0067  *
0068  * The string used to obtain a NFS mount with g_volume_get_identifier().
0069  */
0070 #define G_VOLUME_IDENTIFIER_KIND_NFS_MOUNT "nfs-mount"
0071 
0072 /**
0073  * G_VOLUME_IDENTIFIER_KIND_CLASS:
0074  *
0075  * The string used to obtain the volume class with g_volume_get_identifier().
0076  *
0077  * Known volume classes include `device`, `network`, and `loop`. Other
0078  * classes may be added in the future.
0079  *
0080  * This is intended to be used by applications to classify #GVolume
0081  * instances into different sections - for example a file manager or
0082  * file chooser can use this information to show `network` volumes under
0083  * a "Network" heading and `device` volumes under a "Devices" heading.
0084  */
0085 #define G_VOLUME_IDENTIFIER_KIND_CLASS "class"
0086 
0087 
0088 #define G_TYPE_VOLUME            (g_volume_get_type ())
0089 #define G_VOLUME(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), G_TYPE_VOLUME, GVolume))
0090 #define G_IS_VOLUME(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G_TYPE_VOLUME))
0091 #define G_VOLUME_GET_IFACE(obj)  (G_TYPE_INSTANCE_GET_INTERFACE ((obj), G_TYPE_VOLUME, GVolumeIface))
0092 
0093 /**
0094  * GVolumeIface:
0095  * @g_iface: The parent interface.
0096  * @changed: Changed signal that is emitted when the volume's state has changed.
0097  * @removed: The removed signal that is emitted when the #GVolume have been removed. If the recipient is holding references to the object they should release them so the object can be finalized.
0098  * @get_name: Gets a string containing the name of the #GVolume.
0099  * @get_icon: Gets a #GIcon for the #GVolume.
0100  * @get_uuid: Gets the UUID for the #GVolume. 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.
0101  * @get_drive: Gets a #GDrive the volume is located on. Returns %NULL if the #GVolume is not associated with a #GDrive.
0102  * @get_mount: Gets a #GMount representing the mounted volume. Returns %NULL if the #GVolume is not mounted.
0103  * @can_mount: Returns %TRUE if the #GVolume can be mounted.
0104  * @can_eject: Checks if a #GVolume can be ejected.
0105  * @mount_fn: Mounts a given #GVolume. 
0106  *     #GVolume implementations must emit the #GMountOperation::aborted 
0107  *     signal before completing a mount operation that is aborted while 
0108  *     awaiting input from the user through a #GMountOperation instance.
0109  * @mount_finish: Finishes a mount operation.
0110  * @eject: Ejects a given #GVolume.
0111  * @eject_finish: Finishes an eject operation.
0112  * @get_identifier: Returns the [identifier](#volume-identifiers) of the given kind, or %NULL if
0113  *    the #GVolume doesn't have one.
0114  * @enumerate_identifiers: Returns an array strings listing the kinds
0115  *    of [identifiers](#volume-identifiers) which the #GVolume has.
0116  * @should_automount: Returns %TRUE if the #GVolume should be automatically mounted.
0117  * @get_activation_root: Returns the activation root for the #GVolume if it is known in advance or %NULL if
0118  *   it is not known.
0119  * @eject_with_operation: Starts ejecting a #GVolume using a #GMountOperation. Since 2.22.
0120  * @eject_with_operation_finish: Finishes an eject operation using a #GMountOperation. Since 2.22.
0121  * @get_sort_key: Gets a key used for sorting #GVolume instance or %NULL if no such key exists. Since 2.32.
0122  * @get_symbolic_icon: Gets a symbolic #GIcon for the #GVolume. Since 2.34.
0123  *
0124  * Interface for implementing operations for mountable volumes.
0125  **/
0126 typedef struct _GVolumeIface    GVolumeIface;
0127 
0128 struct _GVolumeIface
0129 {
0130   GTypeInterface g_iface;
0131 
0132   /* signals */
0133 
0134   void        (* changed)               (GVolume             *volume);
0135   void        (* removed)               (GVolume             *volume);
0136 
0137   /* Virtual Table */
0138 
0139   char      * (* get_name)              (GVolume             *volume);
0140   GIcon     * (* get_icon)              (GVolume             *volume);
0141   char      * (* get_uuid)              (GVolume             *volume);
0142   GDrive    * (* get_drive)             (GVolume             *volume);
0143   GMount    * (* get_mount)             (GVolume             *volume);
0144   gboolean    (* can_mount)             (GVolume             *volume);
0145   gboolean    (* can_eject)             (GVolume             *volume);
0146   void        (* mount_fn)              (GVolume             *volume,
0147                                          GMountMountFlags     flags,
0148                                          GMountOperation     *mount_operation,
0149                                          GCancellable        *cancellable,
0150                                          GAsyncReadyCallback  callback,
0151                                          gpointer             user_data);
0152   gboolean    (* mount_finish)          (GVolume             *volume,
0153                                          GAsyncResult        *result,
0154                                          GError             **error);
0155   void        (* eject)                 (GVolume             *volume,
0156                                          GMountUnmountFlags   flags,
0157                                          GCancellable        *cancellable,
0158                                          GAsyncReadyCallback  callback,
0159                                          gpointer             user_data);
0160   gboolean    (* eject_finish)          (GVolume             *volume,
0161                                          GAsyncResult        *result,
0162                                          GError             **error);
0163 
0164   char      * (* get_identifier)        (GVolume             *volume,
0165                                          const char          *kind);
0166   char     ** (* enumerate_identifiers) (GVolume             *volume);
0167 
0168   gboolean    (* should_automount)      (GVolume             *volume);
0169 
0170   GFile     * (* get_activation_root)   (GVolume             *volume);
0171 
0172   void        (* eject_with_operation)      (GVolume             *volume,
0173                                              GMountUnmountFlags   flags,
0174                                              GMountOperation     *mount_operation,
0175                                              GCancellable        *cancellable,
0176                                              GAsyncReadyCallback  callback,
0177                                              gpointer             user_data);
0178   gboolean    (* eject_with_operation_finish) (GVolume           *volume,
0179                                              GAsyncResult        *result,
0180                                              GError             **error);
0181 
0182   const gchar * (* get_sort_key)        (GVolume             *volume);
0183   GIcon       * (* get_symbolic_icon)   (GVolume             *volume);
0184 };
0185 
0186 GIO_AVAILABLE_IN_ALL
0187 GType    g_volume_get_type              (void) G_GNUC_CONST;
0188 
0189 GIO_AVAILABLE_IN_ALL
0190 char *   g_volume_get_name              (GVolume              *volume);
0191 GIO_AVAILABLE_IN_ALL
0192 GIcon *  g_volume_get_icon              (GVolume              *volume);
0193 GIO_AVAILABLE_IN_ALL
0194 GIcon *  g_volume_get_symbolic_icon     (GVolume              *volume);
0195 GIO_AVAILABLE_IN_ALL
0196 char *   g_volume_get_uuid              (GVolume              *volume);
0197 GIO_AVAILABLE_IN_ALL
0198 GDrive * g_volume_get_drive             (GVolume              *volume);
0199 GIO_AVAILABLE_IN_ALL
0200 GMount * g_volume_get_mount             (GVolume              *volume);
0201 GIO_AVAILABLE_IN_ALL
0202 gboolean g_volume_can_mount             (GVolume              *volume);
0203 GIO_AVAILABLE_IN_ALL
0204 gboolean g_volume_can_eject             (GVolume              *volume);
0205 GIO_AVAILABLE_IN_ALL
0206 gboolean g_volume_should_automount      (GVolume              *volume);
0207 GIO_AVAILABLE_IN_ALL
0208 void     g_volume_mount                 (GVolume              *volume,
0209                      GMountMountFlags      flags,
0210                      GMountOperation      *mount_operation,
0211                      GCancellable         *cancellable,
0212                      GAsyncReadyCallback   callback,
0213                      gpointer              user_data);
0214 GIO_AVAILABLE_IN_ALL
0215 gboolean g_volume_mount_finish          (GVolume              *volume,
0216                      GAsyncResult         *result,
0217                      GError              **error);
0218 GIO_DEPRECATED_FOR(g_volume_eject_with_operation)
0219 void     g_volume_eject                 (GVolume              *volume,
0220                                          GMountUnmountFlags    flags,
0221                                          GCancellable         *cancellable,
0222                                          GAsyncReadyCallback   callback,
0223                                          gpointer              user_data);
0224 
0225 GIO_DEPRECATED_FOR(g_volume_eject_with_operation_finish)
0226 gboolean g_volume_eject_finish          (GVolume              *volume,
0227                                          GAsyncResult         *result,
0228                                          GError              **error);
0229 GIO_AVAILABLE_IN_ALL
0230 char *   g_volume_get_identifier        (GVolume              *volume,
0231                      const char           *kind);
0232 GIO_AVAILABLE_IN_ALL
0233 char **  g_volume_enumerate_identifiers (GVolume              *volume);
0234 
0235 GIO_AVAILABLE_IN_ALL
0236 GFile *  g_volume_get_activation_root   (GVolume              *volume);
0237 
0238 GIO_AVAILABLE_IN_ALL
0239 void        g_volume_eject_with_operation     (GVolume             *volume,
0240                                                GMountUnmountFlags   flags,
0241                                                GMountOperation     *mount_operation,
0242                                                GCancellable        *cancellable,
0243                                                GAsyncReadyCallback  callback,
0244                                                gpointer             user_data);
0245 GIO_AVAILABLE_IN_ALL
0246 gboolean    g_volume_eject_with_operation_finish (GVolume          *volume,
0247                                                GAsyncResult        *result,
0248                                                GError             **error);
0249 
0250 GIO_AVAILABLE_IN_2_32
0251 const gchar *g_volume_get_sort_key            (GVolume              *volume);
0252 
0253 G_END_DECLS
0254 
0255 #endif /* __G_VOLUME_H__ */