gvolumemonitor.h 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. /* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
  2. /* GIO - GLib Input, Output and Streaming Library
  3. *
  4. * Copyright (C) 2006-2007 Red Hat, Inc.
  5. *
  6. * This library is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU Lesser General Public
  8. * License as published by the Free Software Foundation; either
  9. * version 2 of the License, or (at your option) any later version.
  10. *
  11. * This library is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * Lesser General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Lesser General
  17. * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
  18. *
  19. * Author: Alexander Larsson <[email protected]>
  20. * David Zeuthen <[email protected]>
  21. */
  22. #ifndef __G_VOLUME_MONITOR_H__
  23. #define __G_VOLUME_MONITOR_H__
  24. #if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
  25. #error "Only <gio/gio.h> can be included directly."
  26. #endif
  27. #include <gio/giotypes.h>
  28. G_BEGIN_DECLS
  29. #define G_TYPE_VOLUME_MONITOR (g_volume_monitor_get_type ())
  30. #define G_VOLUME_MONITOR(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_VOLUME_MONITOR, GVolumeMonitor))
  31. #define G_VOLUME_MONITOR_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_VOLUME_MONITOR, GVolumeMonitorClass))
  32. #define G_VOLUME_MONITOR_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_VOLUME_MONITOR, GVolumeMonitorClass))
  33. #define G_IS_VOLUME_MONITOR(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_VOLUME_MONITOR))
  34. #define G_IS_VOLUME_MONITOR_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_VOLUME_MONITOR))
  35. /**
  36. * G_VOLUME_MONITOR_EXTENSION_POINT_NAME:
  37. *
  38. * Extension point for volume monitor functionality.
  39. * See <link linkend="extending-gio">Extending GIO</link>.
  40. */
  41. #define G_VOLUME_MONITOR_EXTENSION_POINT_NAME "gio-volume-monitor"
  42. /**
  43. * GVolumeMonitor:
  44. *
  45. * A Volume Monitor that watches for volume events.
  46. **/
  47. typedef struct _GVolumeMonitorClass GVolumeMonitorClass;
  48. struct _GVolumeMonitor
  49. {
  50. GObject parent_instance;
  51. /*< private >*/
  52. gpointer priv;
  53. };
  54. struct _GVolumeMonitorClass
  55. {
  56. GObjectClass parent_class;
  57. /*< public >*/
  58. /* signals */
  59. void (* volume_added) (GVolumeMonitor *volume_monitor,
  60. GVolume *volume);
  61. void (* volume_removed) (GVolumeMonitor *volume_monitor,
  62. GVolume *volume);
  63. void (* volume_changed) (GVolumeMonitor *volume_monitor,
  64. GVolume *volume);
  65. void (* mount_added) (GVolumeMonitor *volume_monitor,
  66. GMount *mount);
  67. void (* mount_removed) (GVolumeMonitor *volume_monitor,
  68. GMount *mount);
  69. void (* mount_pre_unmount) (GVolumeMonitor *volume_monitor,
  70. GMount *mount);
  71. void (* mount_changed) (GVolumeMonitor *volume_monitor,
  72. GMount *mount);
  73. void (* drive_connected) (GVolumeMonitor *volume_monitor,
  74. GDrive *drive);
  75. void (* drive_disconnected) (GVolumeMonitor *volume_monitor,
  76. GDrive *drive);
  77. void (* drive_changed) (GVolumeMonitor *volume_monitor,
  78. GDrive *drive);
  79. /* Vtable */
  80. gboolean (* is_supported) (void);
  81. GList * (* get_connected_drives) (GVolumeMonitor *volume_monitor);
  82. GList * (* get_volumes) (GVolumeMonitor *volume_monitor);
  83. GList * (* get_mounts) (GVolumeMonitor *volume_monitor);
  84. GVolume * (* get_volume_for_uuid) (GVolumeMonitor *volume_monitor,
  85. const char *uuid);
  86. GMount * (* get_mount_for_uuid) (GVolumeMonitor *volume_monitor,
  87. const char *uuid);
  88. /* These arguments are unfortunately backwards by mistake (bug #520169). Deprecated in 2.20. */
  89. GVolume * (* adopt_orphan_mount) (GMount *mount,
  90. GVolumeMonitor *volume_monitor);
  91. /* signal added in 2.17 */
  92. void (* drive_eject_button) (GVolumeMonitor *volume_monitor,
  93. GDrive *drive);
  94. /* signal added in 2.21 */
  95. void (* drive_stop_button) (GVolumeMonitor *volume_monitor,
  96. GDrive *drive);
  97. /*< private >*/
  98. /* Padding for future expansion */
  99. void (*_g_reserved1) (void);
  100. void (*_g_reserved2) (void);
  101. void (*_g_reserved3) (void);
  102. void (*_g_reserved4) (void);
  103. void (*_g_reserved5) (void);
  104. void (*_g_reserved6) (void);
  105. };
  106. GLIB_AVAILABLE_IN_ALL
  107. GType g_volume_monitor_get_type (void) G_GNUC_CONST;
  108. GLIB_AVAILABLE_IN_ALL
  109. GVolumeMonitor *g_volume_monitor_get (void);
  110. GLIB_AVAILABLE_IN_ALL
  111. GList * g_volume_monitor_get_connected_drives (GVolumeMonitor *volume_monitor);
  112. GLIB_AVAILABLE_IN_ALL
  113. GList * g_volume_monitor_get_volumes (GVolumeMonitor *volume_monitor);
  114. GLIB_AVAILABLE_IN_ALL
  115. GList * g_volume_monitor_get_mounts (GVolumeMonitor *volume_monitor);
  116. GLIB_AVAILABLE_IN_ALL
  117. GVolume * g_volume_monitor_get_volume_for_uuid (GVolumeMonitor *volume_monitor,
  118. const char *uuid);
  119. GLIB_AVAILABLE_IN_ALL
  120. GMount * g_volume_monitor_get_mount_for_uuid (GVolumeMonitor *volume_monitor,
  121. const char *uuid);
  122. GLIB_DEPRECATED
  123. GVolume * g_volume_monitor_adopt_orphan_mount (GMount *mount);
  124. G_END_DECLS
  125. #endif /* __G_VOLUME_MONITOR_H__ */