[PATCH] Added support for detecting removable media in ghal-0

Michael Unterkalmsteiner miciu at gmx.de
Thu Aug 6 00:18:17 CEST 2009


Hi, 
I needed this feature from libhal.
Don't know if this is the right channel to submit patches. If not, please 
point me to the docs or give me a short notice.

Regards,
M

---
 ghal/ghal-drive.c |   16 ++++++++++++++++
 ghal/ghal-drive.h |    1 +
 2 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/ghal/ghal-drive.c b/ghal/ghal-drive.c
index ba526bc..db41ef1 100644
--- a/ghal/ghal-drive.c
+++ b/ghal/ghal-drive.c
@@ -228,6 +228,22 @@ ghal_drive_is_hotpluggable(GHalDrive *drive)
 }
 
 /**
+ * ghal_drive_is_media_detected:
+ * @drive: A #GHalDrive
+ *
+ * Determines whether or not @drive has detected a removable medium.
+ *
+ * Returns: %TRUE if @drive contains a removable medium, %FALSE otherwise.
+ **/
+gboolean
+ghal_drive_is_media_detected(GHalDrive *drive)
+{
+  g_return_val_if_fail(ghal_drive_ensure_hal_drive(drive), FALSE);
+  
+  return libhal_drive_is_media_detected(drive->priv->hal_drive);
+}
+
+/**
  * ghal_drive_uses_removable_media:
  * @drive: A #GHalDrive
  *
diff --git a/ghal/ghal-drive.h b/ghal/ghal-drive.h
index 75723ba..d97164b 100644
--- a/ghal/ghal-drive.h
+++ b/ghal/ghal-drive.h
@@ -69,6 +69,7 @@ GList *ghal_drive_get_all(GHalContext *context,
                           GError **error);
 
 gboolean ghal_drive_is_hotpluggable(GHalDrive *drive);
+gboolean ghal_drive_is_media_detected(GHalDrive *drive);
 gboolean ghal_drive_uses_removable_media(GHalDrive *drive);
 gboolean ghal_drive_requires_eject(GHalDrive *drive);
 
-- 
1.6.0.4



More information about the Xfce4-dev mailing list