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