Add registration hooks for extension points. Register the gio extension
[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 #define G_VOLUME_MONITOR_EXTENSION_POINT_NAME "gio-volume-monitor"
46
47 /**
48  * GVolumeMonitor:
49  * @parent_instance: The parent instance.
50  *
51  * A Volume Monitor that watches for volume events.
52  **/
53 typedef struct _GVolumeMonitor GVolumeMonitor;
54 typedef struct _GVolumeMonitorClass GVolumeMonitorClass;
55
56 struct _GVolumeMonitor {
57   GObject parent_instance;
58
59   /*< private >*/
60   gpointer priv;
61 };
62
63 struct _GVolumeMonitorClass {
64   GObjectClass parent_class;
65
66   /*< public >*/
67   /* signals */
68   void (* volume_added)     (GVolumeMonitor   *volume_monitor,
69                              GVolume          *volume);
70   void (* volume_removed)   (GVolumeMonitor   *volume_monitor,
71                              GVolume          *volume);
72   void (* volume_changed)   (GVolumeMonitor   *volume_monitor,
73                              GVolume          *volume);
74
75   void (* mount_added)       (GVolumeMonitor *volume_monitor,
76                               GMount         *mount);
77   void (* mount_removed)     (GVolumeMonitor *volume_monitor,
78                               GMount         *mount);
79   void (* mount_pre_unmount) (GVolumeMonitor *volume_monitor,
80                               GMount         *mount);
81   void (* mount_changed)     (GVolumeMonitor *volume_monitor,
82                               GMount         *mount);
83
84   void (* drive_connected)      (GVolumeMonitor *volume_monitor,
85                                  GDrive         *drive);
86   void (* drive_disconnected)   (GVolumeMonitor *volume_monitor,
87                                  GDrive         *drive);
88   void (* drive_changed)        (GVolumeMonitor *volume_monitor,
89                                  GDrive         *drive);
90
91   /* Vtable */
92
93   gboolean (*is_supported)          (void);
94
95   GList * (*get_connected_drives)   (GVolumeMonitor *volume_monitor);
96   GList * (*get_volumes)            (GVolumeMonitor *volume_monitor);
97   GList * (*get_mounts)             (GVolumeMonitor *volume_monitor);
98
99   GVolume * (*get_volume_for_uuid)  (GVolumeMonitor  *volume_monitor, 
100                                      const char      *uuid);
101
102   GMount *  (*get_mount_for_uuid)   (GVolumeMonitor  *volume_monitor, 
103                                      const char      *uuid);
104
105
106   GVolume * (*adopt_orphan_mount)   (GMount          *mount);
107
108   
109   /*< private >*/
110   /* Padding for future expansion */
111   void (*_g_reserved1) (void);
112   void (*_g_reserved2) (void);
113   void (*_g_reserved3) (void);
114   void (*_g_reserved4) (void);
115   void (*_g_reserved5) (void);
116   void (*_g_reserved6) (void);
117   void (*_g_reserved7) (void);
118   void (*_g_reserved8) (void);
119 };
120
121 GType g_volume_monitor_get_type (void) G_GNUC_CONST;
122
123 GVolumeMonitor *g_volume_monitor_get                     (void);
124 GList *         g_volume_monitor_get_connected_drives    (GVolumeMonitor  *volume_monitor);
125 GList *         g_volume_monitor_get_volumes             (GVolumeMonitor  *volume_monitor);
126 GList *         g_volume_monitor_get_mounts              (GVolumeMonitor  *volume_monitor);
127 GVolume *       g_volume_monitor_get_volume_for_uuid     (GVolumeMonitor  *volume_monitor,
128                                                           const char      *uuid);
129 GMount *        g_volume_monitor_get_mount_for_uuid      (GVolumeMonitor  *volume_monitor,
130                                                           const char      *uuid);
131
132 GVolume *       g_volume_monitor_adopt_orphan_mount      (GMount *mount);
133
134 G_END_DECLS
135
136 #endif /* __G_VOLUME_MONITOR_H__ */