| 1 | /* GIO - GLib Input, Output and Streaming Library | 
| 2 |  * | 
| 3 |  * Copyright (C) 2006-2007 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.1 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, see <http://www.gnu.org/licenses/>. | 
| 17 |  * | 
| 18 |  * Author: Alexander Larsson <alexl@redhat.com> | 
| 19 |  *         David Zeuthen <davidz@redhat.com> | 
| 20 |  */ | 
| 21 |  | 
| 22 | #ifndef __G_DRIVE_H__ | 
| 23 | #define __G_DRIVE_H__ | 
| 24 |  | 
| 25 | #if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) | 
| 26 | #error "Only <gio/gio.h> can be included directly." | 
| 27 | #endif | 
| 28 |  | 
| 29 | #include <gio/giotypes.h> | 
| 30 |  | 
| 31 | G_BEGIN_DECLS | 
| 32 |  | 
| 33 | /** | 
| 34 |  * G_DRIVE_IDENTIFIER_KIND_UNIX_DEVICE: | 
| 35 |  * | 
| 36 |  * The string used to obtain a Unix device path with g_drive_get_identifier(). | 
| 37 |  * | 
| 38 |  * Since: 2.58 | 
| 39 |  */ | 
| 40 | #define G_DRIVE_IDENTIFIER_KIND_UNIX_DEVICE "unix-device" | 
| 41 |  | 
| 42 | #define G_TYPE_DRIVE           (g_drive_get_type ()) | 
| 43 | #define G_DRIVE(obj)           (G_TYPE_CHECK_INSTANCE_CAST ((obj), G_TYPE_DRIVE, GDrive)) | 
| 44 | #define G_IS_DRIVE(obj)        (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G_TYPE_DRIVE)) | 
| 45 | #define G_DRIVE_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), G_TYPE_DRIVE, GDriveIface)) | 
| 46 |  | 
| 47 | /** | 
| 48 |  * GDriveIface: | 
| 49 |  * @g_iface: The parent interface. | 
| 50 |  * @changed: Signal emitted when the drive is changed. | 
| 51 |  * @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. | 
| 52 |  * @eject_button: Signal emitted when the physical eject button (if any) of a drive have been pressed. | 
| 53 |  * @get_name: Returns the name for the given #GDrive. | 
| 54 |  * @get_icon: Returns a #GIcon for the given #GDrive. | 
| 55 |  * @has_volumes: Returns %TRUE if the #GDrive has mountable volumes. | 
| 56 |  * @get_volumes: Returns a list #GList of #GVolume for the #GDrive. | 
| 57 |  * @is_removable: Returns %TRUE if the #GDrive and/or its media is considered removable by the user. Since 2.50. | 
| 58 |  * @is_media_removable: Returns %TRUE if the #GDrive supports removal and insertion of media. | 
| 59 |  * @has_media: Returns %TRUE if the #GDrive has media inserted. | 
| 60 |  * @is_media_check_automatic: Returns %TRUE if the #GDrive is capable of automatically detecting media changes. | 
| 61 |  * @can_poll_for_media: Returns %TRUE if the #GDrive is capable of manually polling for media change. | 
| 62 |  * @can_eject: Returns %TRUE if the #GDrive can eject media. | 
| 63 |  * @eject: Ejects a #GDrive. | 
| 64 |  * @eject_finish: Finishes an eject operation. | 
| 65 |  * @poll_for_media: Poll for media insertion/removal on a #GDrive. | 
| 66 |  * @poll_for_media_finish: Finishes a media poll operation. | 
| 67 |  * @get_identifier: Returns the identifier of the given kind, or %NULL if | 
| 68 |  *    the #GDrive doesn't have one. | 
| 69 |  * @enumerate_identifiers: Returns an array strings listing the kinds | 
| 70 |  *    of identifiers which the #GDrive has. | 
| 71 |  * @get_start_stop_type: Gets a #GDriveStartStopType with details about starting/stopping the drive. Since 2.22. | 
| 72 |  * @can_stop: Returns %TRUE if a #GDrive can be stopped. Since 2.22. | 
| 73 |  * @stop: Stops a #GDrive. Since 2.22. | 
| 74 |  * @stop_finish: Finishes a stop operation. Since 2.22. | 
| 75 |  * @can_start: Returns %TRUE if a #GDrive can be started. Since 2.22. | 
| 76 |  * @can_start_degraded: Returns %TRUE if a #GDrive can be started degraded. Since 2.22. | 
| 77 |  * @start: Starts a #GDrive. Since 2.22. | 
| 78 |  * @start_finish: Finishes a start operation. Since 2.22. | 
| 79 |  * @stop_button: Signal emitted when the physical stop button (if any) of a drive have been pressed. Since 2.22. | 
| 80 |  * @eject_with_operation: Starts ejecting a #GDrive using a #GMountOperation. Since 2.22. | 
| 81 |  * @eject_with_operation_finish: Finishes an eject operation using a #GMountOperation. Since 2.22. | 
| 82 |  * @get_sort_key: Gets a key used for sorting #GDrive instances or %NULL if no such key exists. Since 2.32. | 
| 83 |  * @get_symbolic_icon: Returns a symbolic #GIcon for the given #GDrive. Since 2.34. | 
| 84 |  * | 
| 85 |  * Interface for creating #GDrive implementations. | 
| 86 |  */ | 
| 87 | typedef struct _GDriveIface    GDriveIface; | 
| 88 |  | 
| 89 | struct _GDriveIface | 
| 90 | { | 
| 91 |   GTypeInterface g_iface; | 
| 92 |  | 
| 93 |   /* signals */ | 
| 94 |   void     (* changed)                  (GDrive              *drive); | 
| 95 |   void     (* disconnected)             (GDrive              *drive); | 
| 96 |   void     (* eject_button)             (GDrive              *drive); | 
| 97 |  | 
| 98 |   /* Virtual Table */ | 
| 99 |   char *   (* get_name)                 (GDrive              *drive); | 
| 100 |   GIcon *  (* get_icon)                 (GDrive              *drive); | 
| 101 |   gboolean (* has_volumes)              (GDrive              *drive); | 
| 102 |   GList *  (* get_volumes)              (GDrive              *drive); | 
| 103 |   gboolean (* is_media_removable)       (GDrive              *drive); | 
| 104 |   gboolean (* has_media)                (GDrive              *drive); | 
| 105 |   gboolean (* is_media_check_automatic) (GDrive              *drive); | 
| 106 |   gboolean (* can_eject)                (GDrive              *drive); | 
| 107 |   gboolean (* can_poll_for_media)       (GDrive              *drive); | 
| 108 |   void     (* eject)                    (GDrive              *drive, | 
| 109 |                                          GMountUnmountFlags   flags, | 
| 110 |                                          GCancellable        *cancellable, | 
| 111 |                                          GAsyncReadyCallback  callback, | 
| 112 |                                          gpointer             user_data); | 
| 113 |   gboolean (* eject_finish)             (GDrive              *drive, | 
| 114 |                                          GAsyncResult        *result, | 
| 115 |                                          GError             **error); | 
| 116 |   void     (* poll_for_media)           (GDrive              *drive, | 
| 117 |                                          GCancellable        *cancellable, | 
| 118 |                                          GAsyncReadyCallback  callback, | 
| 119 |                                          gpointer             user_data); | 
| 120 |   gboolean (* poll_for_media_finish)    (GDrive              *drive, | 
| 121 |                                          GAsyncResult        *result, | 
| 122 |                                          GError             **error); | 
| 123 |  | 
| 124 |   char *   (* get_identifier)           (GDrive              *drive, | 
| 125 |                                          const char          *kind); | 
| 126 |   char **  (* enumerate_identifiers)    (GDrive              *drive); | 
| 127 |  | 
| 128 |   GDriveStartStopType (* get_start_stop_type) (GDrive        *drive); | 
| 129 |  | 
| 130 |   gboolean (* can_start)                (GDrive              *drive); | 
| 131 |   gboolean (* can_start_degraded)       (GDrive              *drive); | 
| 132 |   void     (* start)                    (GDrive              *drive, | 
| 133 |                                          GDriveStartFlags     flags, | 
| 134 |                                          GMountOperation     *mount_operation, | 
| 135 |                                          GCancellable        *cancellable, | 
| 136 |                                          GAsyncReadyCallback  callback, | 
| 137 |                                          gpointer             user_data); | 
| 138 |   gboolean (* start_finish)             (GDrive              *drive, | 
| 139 |                                          GAsyncResult        *result, | 
| 140 |                                          GError             **error); | 
| 141 |  | 
| 142 |   gboolean (* can_stop)                 (GDrive              *drive); | 
| 143 |   void     (* stop)                     (GDrive              *drive, | 
| 144 |                                          GMountUnmountFlags   flags, | 
| 145 |                                          GMountOperation     *mount_operation, | 
| 146 |                                          GCancellable        *cancellable, | 
| 147 |                                          GAsyncReadyCallback  callback, | 
| 148 |                                          gpointer             user_data); | 
| 149 |   gboolean (* stop_finish)              (GDrive              *drive, | 
| 150 |                                          GAsyncResult        *result, | 
| 151 |                                          GError             **error); | 
| 152 |   /* signal, not VFunc */ | 
| 153 |   void     (* stop_button)              (GDrive              *drive); | 
| 154 |  | 
| 155 |   void        (* eject_with_operation)      (GDrive              *drive, | 
| 156 |                                              GMountUnmountFlags   flags, | 
| 157 |                                              GMountOperation     *mount_operation, | 
| 158 |                                              GCancellable        *cancellable, | 
| 159 |                                              GAsyncReadyCallback  callback, | 
| 160 |                                              gpointer             user_data); | 
| 161 |   gboolean    (* eject_with_operation_finish) (GDrive            *drive, | 
| 162 |                                              GAsyncResult        *result, | 
| 163 |                                              GError             **error); | 
| 164 |  | 
| 165 |   const gchar * (* get_sort_key)        (GDrive              *drive); | 
| 166 |   GIcon *       (* get_symbolic_icon)   (GDrive              *drive); | 
| 167 |   gboolean      (* is_removable)        (GDrive              *drive); | 
| 168 |  | 
| 169 | }; | 
| 170 |  | 
| 171 | GLIB_AVAILABLE_IN_ALL | 
| 172 | GType    g_drive_get_type                 (void) G_GNUC_CONST; | 
| 173 |  | 
| 174 | GLIB_AVAILABLE_IN_ALL | 
| 175 | char *   g_drive_get_name                 (GDrive               *drive); | 
| 176 | GLIB_AVAILABLE_IN_ALL | 
| 177 | GIcon *  g_drive_get_icon                 (GDrive               *drive); | 
| 178 | GLIB_AVAILABLE_IN_ALL | 
| 179 | GIcon *  g_drive_get_symbolic_icon        (GDrive               *drive); | 
| 180 | GLIB_AVAILABLE_IN_ALL | 
| 181 | gboolean g_drive_has_volumes              (GDrive               *drive); | 
| 182 | GLIB_AVAILABLE_IN_ALL | 
| 183 | GList *  g_drive_get_volumes              (GDrive               *drive); | 
| 184 | GLIB_AVAILABLE_IN_2_50 | 
| 185 | gboolean g_drive_is_removable             (GDrive               *drive); | 
| 186 | GLIB_AVAILABLE_IN_ALL | 
| 187 | gboolean g_drive_is_media_removable       (GDrive               *drive); | 
| 188 | GLIB_AVAILABLE_IN_ALL | 
| 189 | gboolean g_drive_has_media                (GDrive               *drive); | 
| 190 | GLIB_AVAILABLE_IN_ALL | 
| 191 | gboolean g_drive_is_media_check_automatic (GDrive               *drive); | 
| 192 | GLIB_AVAILABLE_IN_ALL | 
| 193 | gboolean g_drive_can_poll_for_media       (GDrive               *drive); | 
| 194 | GLIB_AVAILABLE_IN_ALL | 
| 195 | gboolean g_drive_can_eject                (GDrive               *drive); | 
| 196 | GLIB_DEPRECATED_FOR(g_drive_eject_with_operation) | 
| 197 | void     g_drive_eject                    (GDrive               *drive, | 
| 198 |                                            GMountUnmountFlags    flags, | 
| 199 |                                            GCancellable         *cancellable, | 
| 200 |                                            GAsyncReadyCallback   callback, | 
| 201 |                                            gpointer              user_data); | 
| 202 |  | 
| 203 | GLIB_DEPRECATED_FOR(g_drive_eject_with_operation_finish) | 
| 204 | gboolean g_drive_eject_finish             (GDrive               *drive, | 
| 205 |                                            GAsyncResult         *result, | 
| 206 |                                            GError              **error); | 
| 207 | GLIB_AVAILABLE_IN_ALL | 
| 208 | void     g_drive_poll_for_media           (GDrive               *drive, | 
| 209 |                                            GCancellable         *cancellable, | 
| 210 |                                            GAsyncReadyCallback   callback, | 
| 211 |                                            gpointer              user_data); | 
| 212 | GLIB_AVAILABLE_IN_ALL | 
| 213 | gboolean g_drive_poll_for_media_finish    (GDrive               *drive, | 
| 214 |                                            GAsyncResult         *result, | 
| 215 |                                            GError              **error); | 
| 216 | GLIB_AVAILABLE_IN_ALL | 
| 217 | char *   g_drive_get_identifier           (GDrive              *drive, | 
| 218 |                                            const char          *kind); | 
| 219 | GLIB_AVAILABLE_IN_ALL | 
| 220 | char **  g_drive_enumerate_identifiers    (GDrive              *drive); | 
| 221 |  | 
| 222 | GLIB_AVAILABLE_IN_ALL | 
| 223 | GDriveStartStopType g_drive_get_start_stop_type (GDrive        *drive); | 
| 224 |  | 
| 225 | GLIB_AVAILABLE_IN_ALL | 
| 226 | gboolean g_drive_can_start                (GDrive              *drive); | 
| 227 | GLIB_AVAILABLE_IN_ALL | 
| 228 | gboolean g_drive_can_start_degraded       (GDrive              *drive); | 
| 229 | GLIB_AVAILABLE_IN_ALL | 
| 230 | void     g_drive_start                    (GDrive              *drive, | 
| 231 |                                            GDriveStartFlags     flags, | 
| 232 |                                            GMountOperation     *mount_operation, | 
| 233 |                                            GCancellable        *cancellable, | 
| 234 |                                            GAsyncReadyCallback  callback, | 
| 235 |                                            gpointer             user_data); | 
| 236 | GLIB_AVAILABLE_IN_ALL | 
| 237 | gboolean g_drive_start_finish             (GDrive               *drive, | 
| 238 |                                            GAsyncResult         *result, | 
| 239 |                                            GError              **error); | 
| 240 |  | 
| 241 | GLIB_AVAILABLE_IN_ALL | 
| 242 | gboolean g_drive_can_stop                 (GDrive               *drive); | 
| 243 | GLIB_AVAILABLE_IN_ALL | 
| 244 | void     g_drive_stop                     (GDrive               *drive, | 
| 245 |                                            GMountUnmountFlags    flags, | 
| 246 |                                            GMountOperation      *mount_operation, | 
| 247 |                                            GCancellable         *cancellable, | 
| 248 |                                            GAsyncReadyCallback   callback, | 
| 249 |                                            gpointer              user_data); | 
| 250 | GLIB_AVAILABLE_IN_ALL | 
| 251 | gboolean g_drive_stop_finish              (GDrive               *drive, | 
| 252 |                                            GAsyncResult         *result, | 
| 253 |                                            GError              **error); | 
| 254 |  | 
| 255 | GLIB_AVAILABLE_IN_ALL | 
| 256 | void        g_drive_eject_with_operation      (GDrive              *drive, | 
| 257 |                                                GMountUnmountFlags   flags, | 
| 258 |                                                GMountOperation     *mount_operation, | 
| 259 |                                                GCancellable        *cancellable, | 
| 260 |                                                GAsyncReadyCallback  callback, | 
| 261 |                                                gpointer             user_data); | 
| 262 | GLIB_AVAILABLE_IN_ALL | 
| 263 | gboolean    g_drive_eject_with_operation_finish (GDrive            *drive, | 
| 264 |                                                GAsyncResult        *result, | 
| 265 |                                                GError             **error); | 
| 266 |  | 
| 267 | GLIB_AVAILABLE_IN_2_32 | 
| 268 | const gchar *g_drive_get_sort_key         (GDrive               *drive); | 
| 269 |  | 
| 270 | G_END_DECLS | 
| 271 |  | 
| 272 | #endif /* __G_DRIVE_H__ */ | 
| 273 |  |