gvolumemonitor.h 5.86 KB
Newer Older
1 2
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */

3
/* GIO - GLib Input, Output and Streaming Library
4
 *
5 6 7 8 9 10 11 12 13 14 15 16 17
 * Copyright (C) 2006-2007 Red Hat, Inc.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General
18
 * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
19 20
 *
 * Author: Alexander Larsson <alexl@redhat.com>
21
 *         David Zeuthen <davidz@redhat.com>
22 23
 */

24 25 26
#ifndef __G_VOLUME_MONITOR_H__
#define __G_VOLUME_MONITOR_H__

27 28 29 30
#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
#error "Only <gio/gio.h> can be included directly."
#endif

31
#include <gio/giotypes.h>
32 33 34 35 36 37 38 39 40 41

G_BEGIN_DECLS

#define G_TYPE_VOLUME_MONITOR         (g_volume_monitor_get_type ())
#define G_VOLUME_MONITOR(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_VOLUME_MONITOR, GVolumeMonitor))
#define G_VOLUME_MONITOR_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_VOLUME_MONITOR, GVolumeMonitorClass))
#define G_VOLUME_MONITOR_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_VOLUME_MONITOR, GVolumeMonitorClass))
#define G_IS_VOLUME_MONITOR(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_VOLUME_MONITOR))
#define G_IS_VOLUME_MONITOR_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_VOLUME_MONITOR))

Matthias Clasen's avatar
Matthias Clasen committed
42 43 44 45
/**
 * G_VOLUME_MONITOR_EXTENSION_POINT_NAME:
 *
 * Extension point for volume monitor functionality.
46
 * See [Extending GIO][extending-gio].
Matthias Clasen's avatar
Matthias Clasen committed
47
 */
48 49
#define G_VOLUME_MONITOR_EXTENSION_POINT_NAME "gio-volume-monitor"

50 51 52 53 54
/**
 * GVolumeMonitor:
 *
 * A Volume Monitor that watches for volume events.
 **/
55 56
typedef struct _GVolumeMonitorClass GVolumeMonitorClass;

57 58
struct _GVolumeMonitor
{
59
  GObject parent_instance;
60 61

  /*< private >*/
62 63 64
  gpointer priv;
};

65 66
struct _GVolumeMonitorClass
{
67 68 69 70
  GObjectClass parent_class;

  /*< public >*/
  /* signals */
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92
  void      (* volume_added)         (GVolumeMonitor *volume_monitor,
                                      GVolume        *volume);
  void      (* volume_removed)       (GVolumeMonitor *volume_monitor,
                                      GVolume        *volume);
  void      (* volume_changed)       (GVolumeMonitor *volume_monitor,
                                      GVolume        *volume);

  void      (* mount_added)          (GVolumeMonitor *volume_monitor,
                                      GMount         *mount);
  void      (* mount_removed)        (GVolumeMonitor *volume_monitor,
                                      GMount         *mount);
  void      (* mount_pre_unmount)    (GVolumeMonitor *volume_monitor,
                                      GMount         *mount);
  void      (* mount_changed)        (GVolumeMonitor *volume_monitor,
                                      GMount         *mount);

  void      (* drive_connected)      (GVolumeMonitor *volume_monitor,
                                      GDrive	     *drive);
  void      (* drive_disconnected)   (GVolumeMonitor *volume_monitor,
                                      GDrive         *drive);
  void      (* drive_changed)        (GVolumeMonitor *volume_monitor,
                                      GDrive         *drive);
93 94 95

  /* Vtable */

96
  gboolean  (* is_supported)         (void);
97

98 99 100
  GList   * (* get_connected_drives) (GVolumeMonitor *volume_monitor);
  GList   * (* get_volumes)          (GVolumeMonitor *volume_monitor);
  GList   * (* get_mounts)           (GVolumeMonitor *volume_monitor);
101

102 103
  GVolume * (* get_volume_for_uuid)  (GVolumeMonitor *volume_monitor,
                                      const char     *uuid);
104

105 106
  GMount  * (* get_mount_for_uuid)   (GVolumeMonitor *volume_monitor,
                                      const char     *uuid);
107

108

109
  /* These arguments are unfortunately backwards by mistake (bug #520169). Deprecated in 2.20. */
110 111
  GVolume * (* adopt_orphan_mount)   (GMount         *mount,
                                      GVolumeMonitor *volume_monitor);
112 113

  /* signal added in 2.17 */
114 115
  void      (* drive_eject_button)   (GVolumeMonitor *volume_monitor,
                                      GDrive         *drive);
116

117 118 119 120
  /* signal added in 2.21 */
  void      (* drive_stop_button)   (GVolumeMonitor *volume_monitor,
                                     GDrive         *drive);

121
  /*< private >*/
122 123 124 125 126 127 128 129 130
  /* Padding for future expansion */
  void (*_g_reserved1) (void);
  void (*_g_reserved2) (void);
  void (*_g_reserved3) (void);
  void (*_g_reserved4) (void);
  void (*_g_reserved5) (void);
  void (*_g_reserved6) (void);
};

131
GLIB_AVAILABLE_IN_ALL
132
GType           g_volume_monitor_get_type             (void) G_GNUC_CONST;
133

134
GLIB_AVAILABLE_IN_ALL
135
GVolumeMonitor *g_volume_monitor_get                  (void);
136
GLIB_AVAILABLE_IN_ALL
137
GList *         g_volume_monitor_get_connected_drives (GVolumeMonitor *volume_monitor);
138
GLIB_AVAILABLE_IN_ALL
139
GList *         g_volume_monitor_get_volumes          (GVolumeMonitor *volume_monitor);
140
GLIB_AVAILABLE_IN_ALL
141
GList *         g_volume_monitor_get_mounts           (GVolumeMonitor *volume_monitor);
142
GLIB_AVAILABLE_IN_ALL
143 144
GVolume *       g_volume_monitor_get_volume_for_uuid  (GVolumeMonitor *volume_monitor,
                                                       const char     *uuid);
145
GLIB_AVAILABLE_IN_ALL
146 147
GMount *        g_volume_monitor_get_mount_for_uuid   (GVolumeMonitor *volume_monitor,
                                                       const char     *uuid);
148

149
GLIB_DEPRECATED
150
GVolume *       g_volume_monitor_adopt_orphan_mount   (GMount         *mount);
151

152 153 154
G_END_DECLS

#endif /* __G_VOLUME_MONITOR_H__ */