Revert "GIOScheduler: Avoid constant iteration over pending job list"
[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 <gio/giotypes.h>
34
35 G_BEGIN_DECLS
36
37 #define G_TYPE_VOLUME_MONITOR         (g_volume_monitor_get_type ())
38 #define G_VOLUME_MONITOR(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_VOLUME_MONITOR, GVolumeMonitor))
39 #define G_VOLUME_MONITOR_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_VOLUME_MONITOR, GVolumeMonitorClass))
40 #define G_VOLUME_MONITOR_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_VOLUME_MONITOR, GVolumeMonitorClass))
41 #define G_IS_VOLUME_MONITOR(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_VOLUME_MONITOR))
42 #define G_IS_VOLUME_MONITOR_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_VOLUME_MONITOR))
43
44 /**
45  * G_VOLUME_MONITOR_EXTENSION_POINT_NAME:
46  *
47  * Extension point for volume monitor functionality.
48  * See <link linkend="extending-gio">Extending GIO</link>.
49  */
50 #define G_VOLUME_MONITOR_EXTENSION_POINT_NAME "gio-volume-monitor"
51
52 /**
53  * GVolumeMonitor:
54  *
55  * A Volume Monitor that watches for volume events.
56  **/
57 typedef struct _GVolumeMonitorClass GVolumeMonitorClass;
58
59 struct _GVolumeMonitor
60 {
61   GObject parent_instance;
62
63   /*< private >*/
64   gpointer priv;
65 };
66
67 struct _GVolumeMonitorClass
68 {
69   GObjectClass parent_class;
70
71   /*< public >*/
72   /* signals */
73   void      (* volume_added)         (GVolumeMonitor *volume_monitor,
74                                       GVolume        *volume);
75   void      (* volume_removed)       (GVolumeMonitor *volume_monitor,
76                                       GVolume        *volume);
77   void      (* volume_changed)       (GVolumeMonitor *volume_monitor,
78                                       GVolume        *volume);
79
80   void      (* mount_added)          (GVolumeMonitor *volume_monitor,
81                                       GMount         *mount);
82   void      (* mount_removed)        (GVolumeMonitor *volume_monitor,
83                                       GMount         *mount);
84   void      (* mount_pre_unmount)    (GVolumeMonitor *volume_monitor,
85                                       GMount         *mount);
86   void      (* mount_changed)        (GVolumeMonitor *volume_monitor,
87                                       GMount         *mount);
88
89   void      (* drive_connected)      (GVolumeMonitor *volume_monitor,
90                                       GDrive         *drive);
91   void      (* drive_disconnected)   (GVolumeMonitor *volume_monitor,
92                                       GDrive         *drive);
93   void      (* drive_changed)        (GVolumeMonitor *volume_monitor,
94                                       GDrive         *drive);
95
96   /* Vtable */
97
98   gboolean  (* is_supported)         (void);
99
100   GList   * (* get_connected_drives) (GVolumeMonitor *volume_monitor);
101   GList   * (* get_volumes)          (GVolumeMonitor *volume_monitor);
102   GList   * (* get_mounts)           (GVolumeMonitor *volume_monitor);
103
104   GVolume * (* get_volume_for_uuid)  (GVolumeMonitor *volume_monitor,
105                                       const char     *uuid);
106
107   GMount  * (* get_mount_for_uuid)   (GVolumeMonitor *volume_monitor,
108                                       const char     *uuid);
109
110
111   /* These arguments are unfortunately backwards by mistake (bug #520169). Deprecated in 2.20. */
112   GVolume * (* adopt_orphan_mount)   (GMount         *mount,
113                                       GVolumeMonitor *volume_monitor);
114
115   /* signal added in 2.17 */
116   void      (* drive_eject_button)   (GVolumeMonitor *volume_monitor,
117                                       GDrive         *drive);
118
119   /* signal added in 2.21 */
120   void      (* drive_stop_button)   (GVolumeMonitor *volume_monitor,
121                                      GDrive         *drive);
122
123   /*< private >*/
124   /* Padding for future expansion */
125   void (*_g_reserved1) (void);
126   void (*_g_reserved2) (void);
127   void (*_g_reserved3) (void);
128   void (*_g_reserved4) (void);
129   void (*_g_reserved5) (void);
130   void (*_g_reserved6) (void);
131 };
132
133 GType           g_volume_monitor_get_type             (void) G_GNUC_CONST;
134
135 GVolumeMonitor *g_volume_monitor_get                  (void);
136 GList *         g_volume_monitor_get_connected_drives (GVolumeMonitor *volume_monitor);
137 GList *         g_volume_monitor_get_volumes          (GVolumeMonitor *volume_monitor);
138 GList *         g_volume_monitor_get_mounts           (GVolumeMonitor *volume_monitor);
139 GVolume *       g_volume_monitor_get_volume_for_uuid  (GVolumeMonitor *volume_monitor,
140                                                        const char     *uuid);
141 GMount *        g_volume_monitor_get_mount_for_uuid   (GVolumeMonitor *volume_monitor,
142                                                        const char     *uuid);
143
144 GLIB_DEPRECATED
145 GVolume *       g_volume_monitor_adopt_orphan_mount   (GMount         *mount);
146
147 G_END_DECLS
148
149 #endif /* __G_VOLUME_MONITOR_H__ */