Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:59:55

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_DRIVE_H__
0025 #define __G_DRIVE_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_DRIVE_IDENTIFIER_KIND_UNIX_DEVICE:
0037  *
0038  * The string used to obtain a Unix device path with g_drive_get_identifier().
0039  *
0040  * Since: 2.58
0041  */
0042 #define G_DRIVE_IDENTIFIER_KIND_UNIX_DEVICE "unix-device"
0043 
0044 #define G_TYPE_DRIVE           (g_drive_get_type ())
0045 #define G_DRIVE(obj)           (G_TYPE_CHECK_INSTANCE_CAST ((obj), G_TYPE_DRIVE, GDrive))
0046 #define G_IS_DRIVE(obj)        (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G_TYPE_DRIVE))
0047 #define G_DRIVE_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), G_TYPE_DRIVE, GDriveIface))
0048 
0049 /**
0050  * GDriveIface:
0051  * @g_iface: The parent interface.
0052  * @changed: Signal emitted when the drive is changed.
0053  * @disconnected: The removed signal that is emitted when the #GDrive have been disconnected. If the recipient is holding references to the object they should release them so the object can be finalized.
0054  * @eject_button: Signal emitted when the physical eject button (if any) of a drive have been pressed.
0055  * @get_name: Returns the name for the given #GDrive.
0056  * @get_icon: Returns a #GIcon for the given #GDrive.
0057  * @has_volumes: Returns %TRUE if the #GDrive has mountable volumes.
0058  * @get_volumes: Returns a list #GList of #GVolume for the #GDrive.
0059  * @is_removable: Returns %TRUE if the #GDrive and/or its media is considered removable by the user. Since 2.50.
0060  * @is_media_removable: Returns %TRUE if the #GDrive supports removal and insertion of media.
0061  * @has_media: Returns %TRUE if the #GDrive has media inserted.
0062  * @is_media_check_automatic: Returns %TRUE if the #GDrive is capable of automatically detecting media changes.
0063  * @can_poll_for_media: Returns %TRUE if the #GDrive is capable of manually polling for media change.
0064  * @can_eject: Returns %TRUE if the #GDrive can eject media.
0065  * @eject: Ejects a #GDrive.
0066  * @eject_finish: Finishes an eject operation.
0067  * @poll_for_media: Poll for media insertion/removal on a #GDrive.
0068  * @poll_for_media_finish: Finishes a media poll operation.
0069  * @get_identifier: Returns the identifier of the given kind, or %NULL if
0070  *    the #GDrive doesn't have one.
0071  * @enumerate_identifiers: Returns an array strings listing the kinds
0072  *    of identifiers which the #GDrive has.
0073  * @get_start_stop_type: Gets a #GDriveStartStopType with details about starting/stopping the drive. Since 2.22.
0074  * @can_stop: Returns %TRUE if a #GDrive can be stopped. Since 2.22.
0075  * @stop: Stops a #GDrive. Since 2.22.
0076  * @stop_finish: Finishes a stop operation. Since 2.22.
0077  * @can_start: Returns %TRUE if a #GDrive can be started. Since 2.22.
0078  * @can_start_degraded: Returns %TRUE if a #GDrive can be started degraded. Since 2.22.
0079  * @start: Starts a #GDrive. Since 2.22.
0080  * @start_finish: Finishes a start operation. Since 2.22.
0081  * @stop_button: Signal emitted when the physical stop button (if any) of a drive have been pressed. Since 2.22.
0082  * @eject_with_operation: Starts ejecting a #GDrive using a #GMountOperation. Since 2.22.
0083  * @eject_with_operation_finish: Finishes an eject operation using a #GMountOperation. Since 2.22.
0084  * @get_sort_key: Gets a key used for sorting #GDrive instances or %NULL if no such key exists. Since 2.32.
0085  * @get_symbolic_icon: Returns a symbolic #GIcon for the given #GDrive. Since 2.34.
0086  *
0087  * Interface for creating #GDrive implementations.
0088  */
0089 typedef struct _GDriveIface    GDriveIface;
0090 
0091 struct _GDriveIface
0092 {
0093   GTypeInterface g_iface;
0094 
0095   /* signals */
0096   void     (* changed)                  (GDrive              *drive);
0097   void     (* disconnected)             (GDrive              *drive);
0098   void     (* eject_button)             (GDrive              *drive);
0099 
0100   /* Virtual Table */
0101   char *   (* get_name)                 (GDrive              *drive);
0102   GIcon *  (* get_icon)                 (GDrive              *drive);
0103   gboolean (* has_volumes)              (GDrive              *drive);
0104   GList *  (* get_volumes)              (GDrive              *drive);
0105   gboolean (* is_media_removable)       (GDrive              *drive);
0106   gboolean (* has_media)                (GDrive              *drive);
0107   gboolean (* is_media_check_automatic) (GDrive              *drive);
0108   gboolean (* can_eject)                (GDrive              *drive);
0109   gboolean (* can_poll_for_media)       (GDrive              *drive);
0110   void     (* eject)                    (GDrive              *drive,
0111                                          GMountUnmountFlags   flags,
0112                                          GCancellable        *cancellable,
0113                                          GAsyncReadyCallback  callback,
0114                                          gpointer             user_data);
0115   gboolean (* eject_finish)             (GDrive              *drive,
0116                                          GAsyncResult        *result,
0117                                          GError             **error);
0118   void     (* poll_for_media)           (GDrive              *drive,
0119                                          GCancellable        *cancellable,
0120                                          GAsyncReadyCallback  callback,
0121                                          gpointer             user_data);
0122   gboolean (* poll_for_media_finish)    (GDrive              *drive,
0123                                          GAsyncResult        *result,
0124                                          GError             **error);
0125 
0126   char *   (* get_identifier)           (GDrive              *drive,
0127                                          const char          *kind);
0128   char **  (* enumerate_identifiers)    (GDrive              *drive);
0129 
0130   GDriveStartStopType (* get_start_stop_type) (GDrive        *drive);
0131 
0132   gboolean (* can_start)                (GDrive              *drive);
0133   gboolean (* can_start_degraded)       (GDrive              *drive);
0134   void     (* start)                    (GDrive              *drive,
0135                                          GDriveStartFlags     flags,
0136                                          GMountOperation     *mount_operation,
0137                                          GCancellable        *cancellable,
0138                                          GAsyncReadyCallback  callback,
0139                                          gpointer             user_data);
0140   gboolean (* start_finish)             (GDrive              *drive,
0141                                          GAsyncResult        *result,
0142                                          GError             **error);
0143 
0144   gboolean (* can_stop)                 (GDrive              *drive);
0145   void     (* stop)                     (GDrive              *drive,
0146                                          GMountUnmountFlags   flags,
0147                                          GMountOperation     *mount_operation,
0148                                          GCancellable        *cancellable,
0149                                          GAsyncReadyCallback  callback,
0150                                          gpointer             user_data);
0151   gboolean (* stop_finish)              (GDrive              *drive,
0152                                          GAsyncResult        *result,
0153                                          GError             **error);
0154   /* signal, not VFunc */
0155   void     (* stop_button)              (GDrive              *drive);
0156 
0157   void        (* eject_with_operation)      (GDrive              *drive,
0158                                              GMountUnmountFlags   flags,
0159                                              GMountOperation     *mount_operation,
0160                                              GCancellable        *cancellable,
0161                                              GAsyncReadyCallback  callback,
0162                                              gpointer             user_data);
0163   gboolean    (* eject_with_operation_finish) (GDrive            *drive,
0164                                              GAsyncResult        *result,
0165                                              GError             **error);
0166 
0167   const gchar * (* get_sort_key)        (GDrive              *drive);
0168   GIcon *       (* get_symbolic_icon)   (GDrive              *drive);
0169   gboolean      (* is_removable)        (GDrive              *drive);
0170 
0171 };
0172 
0173 GIO_AVAILABLE_IN_ALL
0174 GType    g_drive_get_type                 (void) G_GNUC_CONST;
0175 
0176 GIO_AVAILABLE_IN_ALL
0177 char *   g_drive_get_name                 (GDrive               *drive);
0178 GIO_AVAILABLE_IN_ALL
0179 GIcon *  g_drive_get_icon                 (GDrive               *drive);
0180 GIO_AVAILABLE_IN_ALL
0181 GIcon *  g_drive_get_symbolic_icon        (GDrive               *drive);
0182 GIO_AVAILABLE_IN_ALL
0183 gboolean g_drive_has_volumes              (GDrive               *drive);
0184 GIO_AVAILABLE_IN_ALL
0185 GList *  g_drive_get_volumes              (GDrive               *drive);
0186 GIO_AVAILABLE_IN_2_50
0187 gboolean g_drive_is_removable             (GDrive               *drive);
0188 GIO_AVAILABLE_IN_ALL
0189 gboolean g_drive_is_media_removable       (GDrive               *drive);
0190 GIO_AVAILABLE_IN_ALL
0191 gboolean g_drive_has_media                (GDrive               *drive);
0192 GIO_AVAILABLE_IN_ALL
0193 gboolean g_drive_is_media_check_automatic (GDrive               *drive);
0194 GIO_AVAILABLE_IN_ALL
0195 gboolean g_drive_can_poll_for_media       (GDrive               *drive);
0196 GIO_AVAILABLE_IN_ALL
0197 gboolean g_drive_can_eject                (GDrive               *drive);
0198 GIO_DEPRECATED_FOR(g_drive_eject_with_operation)
0199 void     g_drive_eject                    (GDrive               *drive,
0200                                            GMountUnmountFlags    flags,
0201                                            GCancellable         *cancellable,
0202                                            GAsyncReadyCallback   callback,
0203                                            gpointer              user_data);
0204 
0205 GIO_DEPRECATED_FOR(g_drive_eject_with_operation_finish)
0206 gboolean g_drive_eject_finish             (GDrive               *drive,
0207                                            GAsyncResult         *result,
0208                                            GError              **error);
0209 GIO_AVAILABLE_IN_ALL
0210 void     g_drive_poll_for_media           (GDrive               *drive,
0211                                            GCancellable         *cancellable,
0212                                            GAsyncReadyCallback   callback,
0213                                            gpointer              user_data);
0214 GIO_AVAILABLE_IN_ALL
0215 gboolean g_drive_poll_for_media_finish    (GDrive               *drive,
0216                                            GAsyncResult         *result,
0217                                            GError              **error);
0218 GIO_AVAILABLE_IN_ALL
0219 char *   g_drive_get_identifier           (GDrive              *drive,
0220                                            const char          *kind);
0221 GIO_AVAILABLE_IN_ALL
0222 char **  g_drive_enumerate_identifiers    (GDrive              *drive);
0223 
0224 GIO_AVAILABLE_IN_ALL
0225 GDriveStartStopType g_drive_get_start_stop_type (GDrive        *drive);
0226 
0227 GIO_AVAILABLE_IN_ALL
0228 gboolean g_drive_can_start                (GDrive              *drive);
0229 GIO_AVAILABLE_IN_ALL
0230 gboolean g_drive_can_start_degraded       (GDrive              *drive);
0231 GIO_AVAILABLE_IN_ALL
0232 void     g_drive_start                    (GDrive              *drive,
0233                                            GDriveStartFlags     flags,
0234                                            GMountOperation     *mount_operation,
0235                                            GCancellable        *cancellable,
0236                                            GAsyncReadyCallback  callback,
0237                                            gpointer             user_data);
0238 GIO_AVAILABLE_IN_ALL
0239 gboolean g_drive_start_finish             (GDrive               *drive,
0240                                            GAsyncResult         *result,
0241                                            GError              **error);
0242 
0243 GIO_AVAILABLE_IN_ALL
0244 gboolean g_drive_can_stop                 (GDrive               *drive);
0245 GIO_AVAILABLE_IN_ALL
0246 void     g_drive_stop                     (GDrive               *drive,
0247                                            GMountUnmountFlags    flags,
0248                                            GMountOperation      *mount_operation,
0249                                            GCancellable         *cancellable,
0250                                            GAsyncReadyCallback   callback,
0251                                            gpointer              user_data);
0252 GIO_AVAILABLE_IN_ALL
0253 gboolean g_drive_stop_finish              (GDrive               *drive,
0254                                            GAsyncResult         *result,
0255                                            GError              **error);
0256 
0257 GIO_AVAILABLE_IN_ALL
0258 void        g_drive_eject_with_operation      (GDrive              *drive,
0259                                                GMountUnmountFlags   flags,
0260                                                GMountOperation     *mount_operation,
0261                                                GCancellable        *cancellable,
0262                                                GAsyncReadyCallback  callback,
0263                                                gpointer             user_data);
0264 GIO_AVAILABLE_IN_ALL
0265 gboolean    g_drive_eject_with_operation_finish (GDrive            *drive,
0266                                                GAsyncResult        *result,
0267                                                GError             **error);
0268 
0269 GIO_AVAILABLE_IN_2_32
0270 const gchar *g_drive_get_sort_key         (GDrive               *drive);
0271 
0272 G_END_DECLS
0273 
0274 #endif /* __G_DRIVE_H__ */