[kdbus] KDBUS_ITEM_PAYLOAD_OFF items are (once again) relative to msg header
[platform/upstream/glib.git] / gio / gvolumemonitor.h
1 /* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
2
3 /* GIO - GLib Input, Output and Streaming Library
4  *
5  * Copyright (C) 2006-2007 Red Hat, Inc.
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General
18  * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
19  *
20  * Author: Alexander Larsson <alexl@redhat.com>
21  *         David Zeuthen <davidz@redhat.com>
22  */
23
24 #ifndef __G_VOLUME_MONITOR_H__
25 #define __G_VOLUME_MONITOR_H__
26
27 #if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
28 #error "Only <gio/gio.h> can be included directly."
29 #endif
30
31 #include <gio/giotypes.h>
32
33 G_BEGIN_DECLS
34
35 #define G_TYPE_VOLUME_MONITOR         (g_volume_monitor_get_type ())
36 #define G_VOLUME_MONITOR(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_VOLUME_MONITOR, GVolumeMonitor))
37 #define G_VOLUME_MONITOR_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_VOLUME_MONITOR, GVolumeMonitorClass))
38 #define G_VOLUME_MONITOR_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_VOLUME_MONITOR, GVolumeMonitorClass))
39 #define G_IS_VOLUME_MONITOR(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_VOLUME_MONITOR))
40 #define G_IS_VOLUME_MONITOR_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_VOLUME_MONITOR))
41
42 /**
43  * G_VOLUME_MONITOR_EXTENSION_POINT_NAME:
44  *
45  * Extension point for volume monitor functionality.
46  * See [Extending GIO][extending-gio].
47  */
48 #define G_VOLUME_MONITOR_EXTENSION_POINT_NAME "gio-volume-monitor"
49
50 /**
51  * GVolumeMonitor:
52  *
53  * A Volume Monitor that watches for volume events.
54  **/
55 typedef struct _GVolumeMonitorClass GVolumeMonitorClass;
56
57 struct _GVolumeMonitor
58 {
59   GObject parent_instance;
60
61   /*< private >*/
62   gpointer priv;
63 };
64
65 struct _GVolumeMonitorClass
66 {
67   GObjectClass parent_class;
68
69   /*< public >*/
70   /* signals */
71   void      (* volume_added)         (GVolumeMonitor *volume_monitor,
72                                       GVolume        *volume);
73   void      (* volume_removed)       (GVolumeMonitor *volume_monitor,
74                                       GVolume        *volume);
75   void      (* volume_changed)       (GVolumeMonitor *volume_monitor,
76                                       GVolume        *volume);
77
78   void      (* mount_added)          (GVolumeMonitor *volume_monitor,
79                                       GMount         *mount);
80   void      (* mount_removed)        (GVolumeMonitor *volume_monitor,
81                                       GMount         *mount);
82   void      (* mount_pre_unmount)    (GVolumeMonitor *volume_monitor,
83                                       GMount         *mount);
84   void      (* mount_changed)        (GVolumeMonitor *volume_monitor,
85                                       GMount         *mount);
86
87   void      (* drive_connected)      (GVolumeMonitor *volume_monitor,
88                                       GDrive         *drive);
89   void      (* drive_disconnected)   (GVolumeMonitor *volume_monitor,
90                                       GDrive         *drive);
91   void      (* drive_changed)        (GVolumeMonitor *volume_monitor,
92                                       GDrive         *drive);
93
94   /* Vtable */
95
96   gboolean  (* is_supported)         (void);
97
98   GList   * (* get_connected_drives) (GVolumeMonitor *volume_monitor);
99   GList   * (* get_volumes)          (GVolumeMonitor *volume_monitor);
100   GList   * (* get_mounts)           (GVolumeMonitor *volume_monitor);
101
102   GVolume * (* get_volume_for_uuid)  (GVolumeMonitor *volume_monitor,
103                                       const char     *uuid);
104
105   GMount  * (* get_mount_for_uuid)   (GVolumeMonitor *volume_monitor,
106                                       const char     *uuid);
107
108
109   /* These arguments are unfortunately backwards by mistake (bug #520169). Deprecated in 2.20. */
110   GVolume * (* adopt_orphan_mount)   (GMount         *mount,
111                                       GVolumeMonitor *volume_monitor);
112
113   /* signal added in 2.17 */
114   void      (* drive_eject_button)   (GVolumeMonitor *volume_monitor,
115                                       GDrive         *drive);
116
117   /* signal added in 2.21 */
118   void      (* drive_stop_button)   (GVolumeMonitor *volume_monitor,
119                                      GDrive         *drive);
120
121   /*< private >*/
122   /* Padding for future expansion */
123   void (*_g_reserved1) (void);
124   void (*_g_reserved2) (void);
125   void (*_g_reserved3) (void);
126   void (*_g_reserved4) (void);
127   void (*_g_reserved5) (void);
128   void (*_g_reserved6) (void);
129 };
130
131 GLIB_AVAILABLE_IN_ALL
132 GType           g_volume_monitor_get_type             (void) G_GNUC_CONST;
133
134 GLIB_AVAILABLE_IN_ALL
135 GVolumeMonitor *g_volume_monitor_get                  (void);
136 GLIB_AVAILABLE_IN_ALL
137 GList *         g_volume_monitor_get_connected_drives (GVolumeMonitor *volume_monitor);
138 GLIB_AVAILABLE_IN_ALL
139 GList *         g_volume_monitor_get_volumes          (GVolumeMonitor *volume_monitor);
140 GLIB_AVAILABLE_IN_ALL
141 GList *         g_volume_monitor_get_mounts           (GVolumeMonitor *volume_monitor);
142 GLIB_AVAILABLE_IN_ALL
143 GVolume *       g_volume_monitor_get_volume_for_uuid  (GVolumeMonitor *volume_monitor,
144                                                        const char     *uuid);
145 GLIB_AVAILABLE_IN_ALL
146 GMount *        g_volume_monitor_get_mount_for_uuid   (GVolumeMonitor *volume_monitor,
147                                                        const char     *uuid);
148
149 GLIB_DEPRECATED
150 GVolume *       g_volume_monitor_adopt_orphan_mount   (GMount         *mount);
151
152 G_END_DECLS
153
154 #endif /* __G_VOLUME_MONITOR_H__ */