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