summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@lanedo.com>2010-06-16 18:20:21 +0200
committerArnel A. Borja <arnelborja@src.gnome.org>2013-08-31 00:56:44 +0800
commit50f955526d60ef05a21f92dec9a8fb7941befca6 (patch)
treec7ccf8b0275269a506e3b2836c445b8af0313065
parent10cefbfb276b8a50572f3775d3840444a6269f75 (diff)
downloadlibmediaart-50f955526d60ef05a21f92dec9a8fb7941befca6.tar.gz
libtracker-miner: New tracker_storage_get_type_for_uuid API method
-rw-r--r--src/libtracker-miner/tracker-storage.c38
-rw-r--r--src/libtracker-miner/tracker-storage.h26
2 files changed, 52 insertions, 12 deletions
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