[tracker/removable-opticals] libtracker-miner: New tracker_storage_get_type_for_uuid API method
- From: Aleksander Morgado <aleksm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/removable-opticals] libtracker-miner: New tracker_storage_get_type_for_uuid API method
- Date: Wed, 16 Jun 2010 16:30:07 +0000 (UTC)
commit 39f9d3839caa9f172674f713ac0073f0ccb8dc64
Author: Aleksander Morgado <aleksander lanedo com>
Date: Wed Jun 16 18:20:21 2010 +0200
libtracker-miner: New tracker_storage_get_type_for_uuid API method
.../libtracker-miner/libtracker-miner-sections.txt | 1 +
src/libtracker-miner/tracker-storage.c | 38 ++++++++++++++++++++
src/libtracker-miner/tracker-storage.h | 26 +++++++------
3 files changed, 53 insertions(+), 12 deletions(-)
---
diff --git a/docs/reference/libtracker-miner/libtracker-miner-sections.txt b/docs/reference/libtracker-miner/libtracker-miner-sections.txt
index 459ea3b..09afd7b 100644
--- a/docs/reference/libtracker-miner/libtracker-miner-sections.txt
+++ b/docs/reference/libtracker-miner/libtracker-miner-sections.txt
@@ -172,6 +172,7 @@ tracker_storage_new
tracker_storage_get_device_roots
tracker_storage_get_device_uuids
tracker_storage_get_mount_point_for_uuid
+tracker_storage_get_type_for_uuid
tracker_storage_get_uuid_for_file
<SUBSECTION Standard>
TRACKER_STORAGE
diff --git a/src/libtracker-miner/tracker-storage.c b/src/libtracker-miner/tracker-storage.c
index df7f7e8..5eafe42 100644
--- a/src/libtracker-miner/tracker-storage.c
+++ b/src/libtracker-miner/tracker-storage.c
@@ -882,6 +882,44 @@ tracker_storage_get_mount_point_for_uuid (TrackerStorage *storage,
}
/**
+ * tracker_storage_get_type_for_uuid:
+ * @storage: A #TrackerStorage
+ * @uuid: A string pointer to the UUID for the %GVolume.
+ *
+ * Returns: The type flags for @uuid.
+ **/
+TrackerStorageType
+tracker_storage_get_type_for_uuid (TrackerStorage *storage,
+ const gchar *uuid)
+{
+ TrackerStoragePrivate *priv;
+ GNode *node;
+ TrackerStorageType type = 0;
+
+ g_return_val_if_fail (TRACKER_IS_STORAGE (storage), 0);
+ g_return_val_if_fail (uuid != NULL, 0);
+
+ priv = TRACKER_STORAGE_GET_PRIVATE (storage);
+
+ node = g_hash_table_lookup (priv->mounts_by_uuid, uuid);
+
+ if (node) {
+ MountInfo *info;
+
+ info = node->data;
+
+ if (info->removable) {
+ type |= TRACKER_STORAGE_REMOVABLE;
+ }
+ if (info->optical) {
+ type |= TRACKER_STORAGE_OPTICAL;
+ }
+ }
+
+ return type;
+}
+
+/**
* tracker_storage_get_uuid_for_file:
* @storage: A #TrackerStorage
* @file: a file
diff --git a/src/libtracker-miner/tracker-storage.h b/src/libtracker-miner/tracker-storage.h
index a39393c..27d0e28 100644
--- a/src/libtracker-miner/tracker-storage.h
+++ b/src/libtracker-miner/tracker-storage.h
@@ -52,18 +52,20 @@ typedef enum {
TRACKER_STORAGE_OPTICAL = 1 << 1
} TrackerStorageType;
-GType tracker_storage_get_type (void) G_GNUC_CONST;
-TrackerStorage *tracker_storage_new (void);
-GSList * tracker_storage_get_device_roots (TrackerStorage *storage,
- TrackerStorageType type,
- gboolean exact_match);
-GSList * tracker_storage_get_device_uuids (TrackerStorage *storage,
- TrackerStorageType type,
- gboolean exact_match);
-const gchar * tracker_storage_get_mount_point_for_uuid (TrackerStorage *storage,
- const gchar *uuid);
-const gchar* tracker_storage_get_uuid_for_file (TrackerStorage *storage,
- GFile *file);
+GType tracker_storage_get_type (void) G_GNUC_CONST;
+TrackerStorage * tracker_storage_new (void);
+GSList * tracker_storage_get_device_roots (TrackerStorage *storage,
+ TrackerStorageType type,
+ gboolean exact_match);
+GSList * tracker_storage_get_device_uuids (TrackerStorage *storage,
+ TrackerStorageType type,
+ gboolean exact_match);
+const gchar * tracker_storage_get_mount_point_for_uuid (TrackerStorage *storage,
+ const gchar *uuid);
+TrackerStorageType tracker_storage_get_type_for_uuid (TrackerStorage *storage,
+ const gchar *uuid);
+const gchar* tracker_storage_get_uuid_for_file (TrackerStorage *storage,
+ GFile *file);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]