Add more docs
[platform/upstream/glib.git] / gio / gvolumemonitor.h
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 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@redhat.com>
21  *         David Zeuthen <davidz@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_VOLUME_MONITOR_H__
29 #define __G_VOLUME_MONITOR_H__
30
31 #include <glib-object.h>
32 #include <gio/gmount.h>
33 #include <gio/gvolume.h>
34 #include <gio/gdrive.h>
35
36 G_BEGIN_DECLS
37
38 #define G_TYPE_VOLUME_MONITOR         (g_volume_monitor_get_type ())
39 #define G_VOLUME_MONITOR(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_VOLUME_MONITOR, GVolumeMonitor))
40 #define G_VOLUME_MONITOR_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_VOLUME_MONITOR, GVolumeMonitorClass))
41 #define G_VOLUME_MONITOR_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_VOLUME_MONITOR, GVolumeMonitorClass))
42 #define G_IS_VOLUME_MONITOR(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_VOLUME_MONITOR))
43 #define G_IS_VOLUME_MONITOR_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_VOLUME_MONITOR))
44
45 /**
46  * G_VOLUME_MONITOR_EXTENSION_POINT_NAME:
47  *
48  * Extension point for volume monitor functionality.
49  * See <link linkend="gio-extension-points">Extending GIO</link>.
50  */
51 #define G_VOLUME_MONITOR_EXTENSION_POINT_NAME "gio-volume-monitor"
52
53 /**
54  * GVolumeMonitor:
55  * @parent_instance: The parent instance.
56  *
57  * A Volume Monitor that watches for volume events.
58  **/
59 typedef struct _GVolumeMonitor GVolumeMonitor;
60 typedef struct _GVolumeMonitorClass GVolumeMonitorClass;
61
62 struct _GVolumeMonitor {
63   GObject parent_instance;
64
65   /*< private >*/
66   gpointer priv;
67 };
68
69 struct _GVolumeMonitorClass {
70   GObjectClass parent_class;
71
72   /*< public >*/
73   /* signals */
74   void (* volume_added)     (GVolumeMonitor   *volume_monitor,
75                              GVolume          *volume);
76   void (* volume_removed)   (GVolumeMonitor   *volume_monitor,
77                              GVolume          *volume);
78   void (* volume_changed)   (GVolumeMonitor   *volume_monitor,
79                              GVolume          *volume);
80
81   void (* mount_added)       (GVolumeMonitor *volume_monitor,
82                               GMount         *mount);
83   void (* mount_removed)     (GVolumeMonitor *volume_monitor,
84                               GMount         *mount);
85   void (* mount_pre_unmount) (GVolumeMonitor *volume_monitor,
86                               GMount         *mount);
87   void (* mount_changed)     (GVolumeMonitor *volume_monitor,
88                               GMount         *mount);
89
90   void (* drive_connected)      (GVolumeMonitor *volume_monitor,
91                                  GDrive         *drive);
92   void (* drive_disconnected)   (GVolumeMonitor *volume_monitor,
93                                  GDrive         *drive);
94   void (* drive_changed)        (GVolumeMonitor *volume_monitor,
95                                  GDrive         *drive);
96
97   /* Vtable */
98
99   gboolean (*is_supported)          (void);
100
101   GList * (*get_connected_drives)   (GVolumeMonitor *volume_monitor);
102   GList * (*get_volumes)            (GVolumeMonitor *volume_monitor);
103   GList * (*get_mounts)             (GVolumeMonitor *volume_monitor);
104
105   GVolume * (*get_volume_for_uuid)  (GVolumeMonitor  *volume_monitor, 
106                                      const char      *uuid);
107
108   GMount *  (*get_mount_for_uuid)   (GVolumeMonitor  *volume_monitor, 
109                                      const char      *uuid);
110
111
112   GVolume * (*adopt_orphan_mount)   (GMount          *mount);
113
114   
115   /*< private >*/
116   /* Padding for future expansion */
117   void (*_g_reserved1) (void);
118   void (*_g_reserved2) (void);
119   void (*_g_reserved3) (void);
120   void (*_g_reserved4) (void);
121   void (*_g_reserved5) (void);
122   void (*_g_reserved6) (void);
123   void (*_g_reserved7) (void);
124   void (*_g_reserved8) (void);
125 };
126
127 GType g_volume_monitor_get_type (void) G_GNUC_CONST;
128
129 GVolumeMonitor *g_volume_monitor_get                     (void);
130 GList *         g_volume_monitor_get_connected_drives    (GVolumeMonitor  *volume_monitor);
131 GList *         g_volume_monitor_get_volumes             (GVolumeMonitor  *volume_monitor);
132 GList *         g_volume_monitor_get_mounts              (GVolumeMonitor  *volume_monitor);
133 GVolume *       g_volume_monitor_get_volume_for_uuid     (GVolumeMonitor  *volume_monitor,
134                                                           const char      *uuid);
135 GMount *        g_volume_monitor_get_mount_for_uuid      (GVolumeMonitor  *volume_monitor,
136                                                           const char      *uuid);
137
138 GVolume *       g_volume_monitor_adopt_orphan_mount      (GMount *mount);
139
140 G_END_DECLS
141
142 #endif /* __G_VOLUME_MONITOR_H__ */