X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=gio%2Fgvolumemonitor.c;h=441afc66719237284bff8cb1961c9fe2e2e04a63;hb=7fd6f07d498063470903a886b4805a13bd333908;hp=d17438bbd92c008afb2ac37a30a05d4a68bbc71e;hpb=826d8c5b41de02387dbfd5b815765c94d6128eac;p=platform%2Fupstream%2Fglib.git
diff --git a/gio/gvolumemonitor.c b/gio/gvolumemonitor.c
index d17438b..441afc6 100644
--- a/gio/gvolumemonitor.c
+++ b/gio/gvolumemonitor.c
@@ -1,3 +1,5 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
+
/* GIO - GLib Input, Output and Streaming Library
*
* Copyright (C) 2006-2007 Red Hat, Inc.
@@ -13,30 +15,35 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General
- * Public License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
- * Boston, MA 02111-1307, USA.
+ * Public License along with this library; if not, see .
*
* Author: Alexander Larsson
* David Zeuthen
*/
-#include
+#include "config.h"
#include "gvolumemonitor.h"
+#include "gvolume.h"
+#include "gmount.h"
+#include "gdrive.h"
#include "glibintl.h"
-#include "gioalias.h"
/**
* SECTION:gvolumemonitor
* @short_description: Volume Monitor
- * @include: gio.h
+ * @include: gio/gio.h
* @see_also: #GFileMonitor
*
* #GVolumeMonitor is for listing the user interesting devices and volumes
* on the computer. In other words, what a file selector or file manager
* would show in a sidebar.
-**/
+ *
+ * #GVolumeMonitor is not
+ * [thread-default-context aware][g-main-context-push-thread-default],
+ * and so should not be used other than from the main thread, with no
+ * thread-default-context active.
+ **/
G_DEFINE_TYPE (GVolumeMonitor, g_volume_monitor, G_TYPE_OBJECT);
@@ -51,6 +58,8 @@ enum {
DRIVE_CONNECTED,
DRIVE_DISCONNECTED,
DRIVE_CHANGED,
+ DRIVE_EJECT_BUTTON,
+ DRIVE_STOP_BUTTON,
LAST_SIGNAL
};
@@ -60,12 +69,7 @@ static guint signals[LAST_SIGNAL] = { 0 };
static void
g_volume_monitor_finalize (GObject *object)
{
- GVolumeMonitor *monitor;
-
- monitor = G_VOLUME_MONITOR (object);
-
- if (G_OBJECT_CLASS (g_volume_monitor_parent_class)->finalize)
- (*G_OBJECT_CLASS (g_volume_monitor_parent_class)->finalize) (object);
+ G_OBJECT_CLASS (g_volume_monitor_parent_class)->finalize (object);
}
static void
@@ -82,7 +86,7 @@ g_volume_monitor_class_init (GVolumeMonitorClass *klass)
*
* Emitted when a mountable volume is added to the system.
**/
- signals[VOLUME_ADDED] = g_signal_new (I_("volume_added"),
+ signals[VOLUME_ADDED] = g_signal_new (I_("volume-added"),
G_TYPE_VOLUME_MONITOR,
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GVolumeMonitorClass, volume_added),
@@ -97,7 +101,7 @@ g_volume_monitor_class_init (GVolumeMonitorClass *klass)
*
* Emitted when a mountable volume is removed from the system.
**/
- signals[VOLUME_REMOVED] = g_signal_new (I_("volume_removed"),
+ signals[VOLUME_REMOVED] = g_signal_new (I_("volume-removed"),
G_TYPE_VOLUME_MONITOR,
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GVolumeMonitorClass, volume_removed),
@@ -112,7 +116,7 @@ g_volume_monitor_class_init (GVolumeMonitorClass *klass)
*
* Emitted when mountable volume is changed.
**/
- signals[VOLUME_CHANGED] = g_signal_new (I_("volume_changed"),
+ signals[VOLUME_CHANGED] = g_signal_new (I_("volume-changed"),
G_TYPE_VOLUME_MONITOR,
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GVolumeMonitorClass, volume_changed),
@@ -127,7 +131,7 @@ g_volume_monitor_class_init (GVolumeMonitorClass *klass)
*
* Emitted when a mount is added.
**/
- signals[MOUNT_ADDED] = g_signal_new (I_("mount_added"),
+ signals[MOUNT_ADDED] = g_signal_new (I_("mount-added"),
G_TYPE_VOLUME_MONITOR,
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GVolumeMonitorClass, mount_added),
@@ -142,7 +146,7 @@ g_volume_monitor_class_init (GVolumeMonitorClass *klass)
*
* Emitted when a mount is removed.
**/
- signals[MOUNT_REMOVED] = g_signal_new (I_("mount_removed"),
+ signals[MOUNT_REMOVED] = g_signal_new (I_("mount-removed"),
G_TYPE_VOLUME_MONITOR,
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GVolumeMonitorClass, mount_removed),
@@ -157,7 +161,7 @@ g_volume_monitor_class_init (GVolumeMonitorClass *klass)
*
* Emitted when a mount is about to be removed.
**/
- signals[MOUNT_PRE_UNMOUNT] = g_signal_new (I_("mount_pre_unmount"),
+ signals[MOUNT_PRE_UNMOUNT] = g_signal_new (I_("mount-pre-unmount"),
G_TYPE_VOLUME_MONITOR,
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GVolumeMonitorClass, mount_pre_unmount),
@@ -172,7 +176,7 @@ g_volume_monitor_class_init (GVolumeMonitorClass *klass)
*
* Emitted when a mount changes.
**/
- signals[MOUNT_CHANGED] = g_signal_new (I_("mount_changed"),
+ signals[MOUNT_CHANGED] = g_signal_new (I_("mount-changed"),
G_TYPE_VOLUME_MONITOR,
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GVolumeMonitorClass, mount_changed),
@@ -187,7 +191,7 @@ g_volume_monitor_class_init (GVolumeMonitorClass *klass)
*
* Emitted when a drive is connected to the system.
**/
- signals[DRIVE_CONNECTED] = g_signal_new (I_("drive_connected"),
+ signals[DRIVE_CONNECTED] = g_signal_new (I_("drive-connected"),
G_TYPE_VOLUME_MONITOR,
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GVolumeMonitorClass, drive_connected),
@@ -202,7 +206,7 @@ g_volume_monitor_class_init (GVolumeMonitorClass *klass)
*
* Emitted when a drive is disconnected from the system.
**/
- signals[DRIVE_DISCONNECTED] = g_signal_new (I_("drive_disconnected"),
+ signals[DRIVE_DISCONNECTED] = g_signal_new (I_("drive-disconnected"),
G_TYPE_VOLUME_MONITOR,
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GVolumeMonitorClass, drive_disconnected),
@@ -217,7 +221,7 @@ g_volume_monitor_class_init (GVolumeMonitorClass *klass)
*
* Emitted when a drive changes.
**/
- signals[DRIVE_CHANGED] = g_signal_new (I_("drive_changed"),
+ signals[DRIVE_CHANGED] = g_signal_new (I_("drive-changed"),
G_TYPE_VOLUME_MONITOR,
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GVolumeMonitorClass, drive_changed),
@@ -225,6 +229,40 @@ g_volume_monitor_class_init (GVolumeMonitorClass *klass)
g_cclosure_marshal_VOID__OBJECT,
G_TYPE_NONE, 1, G_TYPE_DRIVE);
+ /**
+ * GVolumeMonitor::drive-eject-button:
+ * @volume_monitor: The volume monitor emitting the signal.
+ * @drive: the drive where the eject button was pressed
+ *
+ * Emitted when the eject button is pressed on @drive.
+ *
+ * Since: 2.18
+ **/
+ signals[DRIVE_EJECT_BUTTON] = g_signal_new (I_("drive-eject-button"),
+ G_TYPE_VOLUME_MONITOR,
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (GVolumeMonitorClass, drive_eject_button),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__OBJECT,
+ G_TYPE_NONE, 1, G_TYPE_DRIVE);
+
+ /**
+ * GVolumeMonitor::drive-stop-button:
+ * @volume_monitor: The volume monitor emitting the signal.
+ * @drive: the drive where the stop button was pressed
+ *
+ * Emitted when the stop button is pressed on @drive.
+ *
+ * Since: 2.22
+ **/
+ signals[DRIVE_STOP_BUTTON] = g_signal_new (I_("drive-stop-button"),
+ G_TYPE_VOLUME_MONITOR,
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (GVolumeMonitorClass, drive_stop_button),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__OBJECT,
+ G_TYPE_NONE, 1, G_TYPE_DRIVE);
+
}
static void
@@ -242,7 +280,7 @@ g_volume_monitor_init (GVolumeMonitor *monitor)
* The returned list should be freed with g_list_free(), after
* its elements have been unreffed with g_object_unref().
*
- * Returns: a #GList of connected #GDrives
+ * Returns: (element-type GDrive) (transfer full): a #GList of connected #GDrive objects.
**/
GList *
g_volume_monitor_get_connected_drives (GVolumeMonitor *volume_monitor)
@@ -265,7 +303,7 @@ g_volume_monitor_get_connected_drives (GVolumeMonitor *volume_monitor)
* The returned list should be freed with g_list_free(), after
* its elements have been unreffed with g_object_unref().
*
- * Returns: a #GList of #GVolumes.
+ * Returns: (element-type GVolume) (transfer full): a #GList of #GVolume objects.
**/
GList *
g_volume_monitor_get_volumes (GVolumeMonitor *volume_monitor)
@@ -288,7 +326,7 @@ g_volume_monitor_get_volumes (GVolumeMonitor *volume_monitor)
* The returned list should be freed with g_list_free(), after
* its elements have been unreffed with g_object_unref().
*
- * Returns: a #GList of #GMounts
+ * Returns: (element-type GMount) (transfer full): a #GList of #GMount objects.
**/
GList *
g_volume_monitor_get_mounts (GVolumeMonitor *volume_monitor)
@@ -307,9 +345,10 @@ g_volume_monitor_get_mounts (GVolumeMonitor *volume_monitor)
* @volume_monitor: a #GVolumeMonitor.
* @uuid: the UUID to look for
*
- * Finds a #GVolume object by it's UUID (see g_volume_get_uuid())
+ * Finds a #GVolume object by its UUID (see g_volume_get_uuid())
*
- * Returns: a #GVolume or %NULL if no such volume is available.
+ * Returns: (transfer full): a #GVolume or %NULL if no such volume is available.
+ * Free the returned object with g_object_unref().
**/
GVolume *
g_volume_monitor_get_volume_for_uuid (GVolumeMonitor *volume_monitor,
@@ -330,9 +369,10 @@ g_volume_monitor_get_volume_for_uuid (GVolumeMonitor *volume_monitor,
* @volume_monitor: a #GVolumeMonitor.
* @uuid: the UUID to look for
*
- * Finds a #GMount object by it's UUID (see g_mount_get_uuid())
+ * Finds a #GMount object by its UUID (see g_mount_get_uuid())
*
- * Returns: a #GMount or %NULL if no such mount is available.
+ * Returns: (transfer full): a #GMount or %NULL if no such mount is available.
+ * Free the returned object with g_object_unref().
**/
GMount *
g_volume_monitor_get_mount_for_uuid (GVolumeMonitor *volume_monitor,
@@ -347,7 +387,3 @@ g_volume_monitor_get_mount_for_uuid (GVolumeMonitor *volume_monitor,
return class->get_mount_for_uuid (volume_monitor, uuid);
}
-
-
-#define __G_VOLUME_MONITOR_C__
-#include "gioaliasdef.c"