[grilo-plugins] tracker: reorganize files before add metadata support



commit 84f82e3c7708e02e3372fe212e94f31b4ca58e06
Author: Lionel Landwerlin <lionel g landwerlin linux intel com>
Date:   Wed Mar 9 11:47:16 2011 +0000

    tracker: reorganize files before add metadata support
    
    Signed-off-by: Lionel Landwerlin <lionel g landwerlin linux intel com>

 src/media/tracker/Makefile.am                      |   21 ++--
 src/media/tracker/grl-tracker-api.h                |   56 -------
 .../{grl-tracker-api.c => grl-tracker-media-api.c} |  109 +++++++-------
 src/media/tracker/grl-tracker-media-api.h          |   56 +++++++
 ...l-tracker-cache.c => grl-tracker-media-cache.c} |   34 +++---
 ...l-tracker-cache.h => grl-tracker-media-cache.h} |   26 ++--
 ...l-tracker-notif.c => grl-tracker-media-notif.c} |   92 ++++++------
 ...l-tracker-notif.h => grl-tracker-media-notif.h} |   12 +-
 ...grl-tracker-priv.h => grl-tracker-media-priv.h} |   36 +++---
 .../tracker/{grl-tracker.c => grl-tracker-media.c} |  151 ++++++++++----------
 src/media/tracker/grl-tracker-media.h              |   88 ++++++++++++
 src/media/tracker/grl-tracker-utils.c              |   17 +--
 src/media/tracker/grl-tracker-utils.h              |   16 +-
 src/media/tracker/grl-tracker.h                    |   88 ------------
 14 files changed, 402 insertions(+), 400 deletions(-)
---
diff --git a/src/media/tracker/Makefile.am b/src/media/tracker/Makefile.am
index 537aaa4..accacfe 100644
--- a/src/media/tracker/Makefile.am
+++ b/src/media/tracker/Makefile.am
@@ -19,16 +19,17 @@ libgrltracker_la_LDFLAGS = \
 	-module		   \
 	-avoid-version
 
-libgrltracker_la_SOURCES = 	\
-	grl-tracker.c 		\
-	grl-tracker.h		\
-	grl-tracker-api.c	\
-	grl-tracker-api.h	\
-	grl-tracker-cache.c	\
-	grl-tracker-cache.h	\
-	grl-tracker-notif.c	\
-	grl-tracker-notif.h	\
-	grl-tracker-utils.c	\
+libgrltracker_la_SOURCES = 		\
+	grl-tracker-media.c		\
+	grl-tracker-media.h		\
+	grl-tracker-media-api.c		\
+	grl-tracker-media-api.h		\
+	grl-tracker-media-cache.c	\
+	grl-tracker-media-cache.h	\
+	grl-tracker-media-notif.c	\
+	grl-tracker-media-notif.h	\
+	\
+	grl-tracker-utils.c		\
 	grl-tracker-utils.h
 
 libdir = $(GRL_PLUGINS_DIR)
diff --git a/src/media/tracker/grl-tracker-api.c b/src/media/tracker/grl-tracker-media-api.c
similarity index 88%
rename from src/media/tracker/grl-tracker-api.c
rename to src/media/tracker/grl-tracker-media-api.c
index a85f564..7b803ec 100644
--- a/src/media/tracker/grl-tracker-api.c
+++ b/src/media/tracker/grl-tracker-media-api.c
@@ -25,9 +25,9 @@
 #include <gio/gio.h>
 #include <tracker-sparql.h>
 
-#include "grl-tracker-api.h"
-#include "grl-tracker-cache.h"
-#include "grl-tracker-priv.h"
+#include "grl-tracker-media-api.h"
+#include "grl-tracker-media-cache.h"
+#include "grl-tracker-media-priv.h"
 #include "grl-tracker-utils.h"
 
 /* --------- Logging  -------- */
@@ -38,13 +38,13 @@ GRL_LOG_DOMAIN_STATIC(tracker_request_log_domain);
 GRL_LOG_DOMAIN_STATIC(tracker_result_log_domain);
 
 /* Inputs/requests */
-#define GRL_IDEBUG(args...)            \
-  GRL_LOG (tracker_request_log_domain, \
+#define GRL_IDEBUG(args...)                     \
+  GRL_LOG (tracker_request_log_domain,          \
            GRL_LOG_LEVEL_DEBUG, args)
 
 /* Outputs/results */
-#define GRL_ODEBUG(args...)           \
-  GRL_LOG (tracker_result_log_domain, \
+#define GRL_ODEBUG(args...)                     \
+  GRL_LOG (tracker_result_log_domain,           \
            GRL_LOG_LEVEL_DEBUG, args)
 
 /* ------- Definitions ------- */
@@ -137,7 +137,7 @@ GRL_LOG_DOMAIN_STATIC(tracker_result_log_domain);
 
 struct OperationSpec {
   GrlMediaSource         *source;
-  GrlTrackerSourcePriv   *priv;
+  GrlTrackerMediaPriv    *priv;
   guint                   operation_id;
   GCancellable           *cancel_op;
   const GList            *keys;
@@ -157,7 +157,7 @@ static GrlKeyID grl_metadata_key_tracker_category;
 
 static struct OperationSpec *
 tracker_operation_initiate (GrlMediaSource *source,
-                            GrlTrackerSourcePriv *priv,
+                            GrlTrackerMediaPriv *priv,
                             guint operation_id)
 {
   struct OperationSpec *os = g_slice_new0 (struct OperationSpec);
@@ -187,7 +187,7 @@ tracker_operation_terminate (struct OperationSpec *os)
 }
 
 static void
-fill_grilo_media_from_sparql (GrlTrackerSource    *source,
+fill_grilo_media_from_sparql (GrlTrackerMedia    *source,
                               GrlMedia            *media,
                               TrackerSparqlCursor *cursor,
                               gint                 column)
@@ -225,9 +225,10 @@ fill_grilo_media_from_sparql (GrlTrackerSource    *source,
   case G_TYPE_STRING:
     /* Cache the source associated to this result. */
     if (assoc->grl_key == GRL_METADATA_KEY_ID) {
-      grl_tracker_cache_add_item (grl_tracker_item_cache,
-                                  tracker_sparql_cursor_get_integer (cursor, column),
-                                  source);
+      grl_tracker_media_cache_add_item (grl_tracker_item_cache,
+                                        tracker_sparql_cursor_get_integer (cursor,
+                                                                           column),
+                                        source);
     }
     val.str_val = tracker_sparql_cursor_get_string (cursor, column, NULL);
     if (val.str_val != NULL)
@@ -317,7 +318,7 @@ tracker_query_result_cb (GObject              *source_object,
     for (col = 1 ;
          col < tracker_sparql_cursor_get_n_columns (operation->cursor) ;
          col++) {
-      fill_grilo_media_from_sparql (GRL_TRACKER_SOURCE (operation->source),
+      fill_grilo_media_from_sparql (GRL_TRACKER_MEDIA (operation->source),
                                     media, operation->cursor, col);
     }
 
@@ -383,7 +384,7 @@ tracker_metadata_cb (GObject                    *source_object,
                      GAsyncResult               *result,
                      GrlMediaSourceMetadataSpec *ms)
 {
-  GrlTrackerSourcePriv *priv = GRL_TRACKER_SOURCE_GET_PRIVATE (ms->source);
+  GrlTrackerMediaPriv *priv = GRL_TRACKER_MEDIA_GET_PRIVATE (ms->source);
   gint                  col;
   GError               *tracker_error = NULL, *error = NULL;
   TrackerSparqlCursor  *cursor;
@@ -415,7 +416,7 @@ tracker_metadata_cb (GObject                    *source_object,
 
   /* Translate Sparql result into Grilo result */
   for (col = 0 ; col < tracker_sparql_cursor_get_n_columns (cursor) ; col++) {
-    fill_grilo_media_from_sparql (GRL_TRACKER_SOURCE (ms->source),
+    fill_grilo_media_from_sparql (GRL_TRACKER_MEDIA (ms->source),
                                   ms->media, cursor, col);
   }
 
@@ -429,7 +430,7 @@ tracker_metadata_cb (GObject                    *source_object,
 /**/
 
 const GList *
-grl_tracker_source_supported_keys (GrlMetadataSource *source)
+grl_tracker_media_supported_keys (GrlMetadataSource *source)
 {
   return
     grl_plugin_registry_get_metadata_keys (grl_plugin_registry_get_default ());
@@ -506,11 +507,11 @@ grl_tracker_source_supported_keys (GrlMetadataSource *source)
  * the query spec.
  */
 void
-grl_tracker_source_query (GrlMediaSource *source,
-                          GrlMediaSourceQuerySpec *qs)
+grl_tracker_media_query (GrlMediaSource *source,
+                         GrlMediaSourceQuerySpec *qs)
 {
   GError               *error = NULL;
-  GrlTrackerSourcePriv *priv  = GRL_TRACKER_SOURCE_GET_PRIVATE (source);
+  GrlTrackerMediaPriv *priv  = GRL_TRACKER_MEDIA_GET_PRIVATE (source);
   gchar                *constraint;
   gchar                *sparql_final;
   gchar                *sparql_select;
@@ -527,8 +528,8 @@ grl_tracker_source_query (GrlMediaSource *source,
 
   /* Check if it is a full sparql query */
   if (g_ascii_strncasecmp (qs->query, "select ", 7) != 0) {
-    constraint = grl_tracker_source_get_device_constraint (priv);
-    sparql_select = grl_tracker_source_get_select_string (source, qs->keys);
+    constraint = grl_tracker_media_get_device_constraint (priv);
+    sparql_select = grl_tracker_media_get_select_string (source, qs->keys);
     sparql_final = g_strdup_printf (TRACKER_QUERY_REQUEST,
                                     sparql_select,
                                     qs->query,
@@ -539,7 +540,7 @@ grl_tracker_source_query (GrlMediaSource *source,
     g_free (qs->query);
     g_free (sparql_select);
     qs->query = sparql_final;
-    grl_tracker_source_query (source, qs);
+    grl_tracker_media_query (source, qs);
     return;
   }
 
@@ -566,18 +567,18 @@ grl_tracker_source_query (GrlMediaSource *source,
 }
 
 void
-grl_tracker_source_metadata (GrlMediaSource *source,
-                             GrlMediaSourceMetadataSpec *ms)
+grl_tracker_media_metadata (GrlMediaSource *source,
+                            GrlMediaSourceMetadataSpec *ms)
 {
-  GrlTrackerSourcePriv *priv = GRL_TRACKER_SOURCE_GET_PRIVATE (source);
+  GrlTrackerMediaPriv *priv = GRL_TRACKER_MEDIA_GET_PRIVATE (source);
   gchar                *constraint = NULL, *sparql_select, *sparql_final;
 
   GRL_IDEBUG ("%s: id=%i", __FUNCTION__, ms->metadata_id);
 
   if (grl_media_get_id (ms->media) == NULL) {
     if (grl_tracker_per_device_source) {
-      constraint = grl_tracker_source_get_device_constraint (priv);
-      sparql_select = grl_tracker_source_get_select_string (source, ms->keys);
+      constraint = grl_tracker_media_get_device_constraint (priv);
+      sparql_select = grl_tracker_media_get_select_string (source, ms->keys);
       sparql_final = g_strdup_printf (TRACKER_BROWSE_FILESYSTEM_ROOT_REQUEST,
                                       sparql_select, constraint, 0, 1);
     } else {
@@ -585,7 +586,7 @@ grl_tracker_source_metadata (GrlMediaSource *source,
       return;
     }
   } else {
-    sparql_select = grl_tracker_source_get_select_string (source, ms->keys);
+    sparql_select = grl_tracker_media_get_select_string (source, ms->keys);
     sparql_final = g_strdup_printf (TRACKER_METADATA_REQUEST, sparql_select,
                                     grl_media_get_id (ms->media));
   }
@@ -607,9 +608,9 @@ grl_tracker_source_metadata (GrlMediaSource *source,
 }
 
 void
-grl_tracker_source_search (GrlMediaSource *source, GrlMediaSourceSearchSpec *ss)
+grl_tracker_media_search (GrlMediaSource *source, GrlMediaSourceSearchSpec *ss)
 {
-  GrlTrackerSourcePriv *priv  = GRL_TRACKER_SOURCE_GET_PRIVATE (source);
+  GrlTrackerMediaPriv *priv  = GRL_TRACKER_MEDIA_GET_PRIVATE (source);
   gchar                *constraint;
   gchar                *sparql_select;
   gchar                *sparql_final;
@@ -617,8 +618,8 @@ grl_tracker_source_search (GrlMediaSource *source, GrlMediaSourceSearchSpec *ss)
 
   GRL_IDEBUG ("%s: id=%u", __FUNCTION__, ss->search_id);
 
-  constraint = grl_tracker_source_get_device_constraint (priv);
-  sparql_select = grl_tracker_source_get_select_string (source, ss->keys);
+  constraint = grl_tracker_media_get_device_constraint (priv);
+  sparql_select = grl_tracker_media_get_select_string (source, ss->keys);
   if (!ss->text || ss->text[0] == '\0') {
     /* Search all */
     sparql_final = g_strdup_printf (TRACKER_SEARCH_ALL_REQUEST, sparql_select,
@@ -649,10 +650,10 @@ grl_tracker_source_search (GrlMediaSource *source, GrlMediaSourceSearchSpec *ss)
 }
 
 static void
-grl_tracker_source_browse_category (GrlMediaSource *source,
-                                    GrlMediaSourceBrowseSpec *bs)
+grl_tracker_media_browse_category (GrlMediaSource *source,
+                                   GrlMediaSourceBrowseSpec *bs)
 {
-  GrlTrackerSourcePriv *priv  = GRL_TRACKER_SOURCE_GET_PRIVATE (source);
+  GrlTrackerMediaPriv *priv  = GRL_TRACKER_MEDIA_GET_PRIVATE (source);
   gchar                *constraint;
   gchar                *sparql_select;
   gchar                *sparql_final;
@@ -699,8 +700,8 @@ grl_tracker_source_browse_category (GrlMediaSource *source,
   category = grl_data_get_string (GRL_DATA (bs->container),
                                   grl_metadata_key_tracker_category);
 
-  constraint = grl_tracker_source_get_device_constraint (priv);
-  sparql_select = grl_tracker_source_get_select_string (bs->source, bs->keys);
+  constraint = grl_tracker_media_get_device_constraint (priv);
+  sparql_select = grl_tracker_media_get_select_string (bs->source, bs->keys);
   sparql_final = g_strdup_printf (TRACKER_BROWSE_CATEGORY_REQUEST,
                                   sparql_select,
                                   category,
@@ -728,10 +729,10 @@ grl_tracker_source_browse_category (GrlMediaSource *source,
 }
 
 static void
-grl_tracker_source_browse_filesystem (GrlMediaSource *source,
-                                      GrlMediaSourceBrowseSpec *bs)
+grl_tracker_media_browse_filesystem (GrlMediaSource *source,
+                                     GrlMediaSourceBrowseSpec *bs)
 {
-  GrlTrackerSourcePriv *priv  = GRL_TRACKER_SOURCE_GET_PRIVATE (source);
+  GrlTrackerMediaPriv *priv  = GRL_TRACKER_MEDIA_GET_PRIVATE (source);
   gchar                *constraint;
   gchar                *sparql_select;
   gchar                *sparql_final;
@@ -739,8 +740,8 @@ grl_tracker_source_browse_filesystem (GrlMediaSource *source,
 
   GRL_IDEBUG ("%s: id=%u", __FUNCTION__, bs->browse_id);
 
-  sparql_select = grl_tracker_source_get_select_string (bs->source, bs->keys);
-  constraint = grl_tracker_source_get_device_constraint (priv);
+  sparql_select = grl_tracker_media_get_select_string (bs->source, bs->keys);
+  constraint = grl_tracker_media_get_device_constraint (priv);
 
   if (bs->container == NULL ||
       !grl_media_get_id (bs->container)) {
@@ -778,19 +779,19 @@ grl_tracker_source_browse_filesystem (GrlMediaSource *source,
 }
 
 void
-grl_tracker_source_browse (GrlMediaSource *source,
-                           GrlMediaSourceBrowseSpec *bs)
+grl_tracker_media_browse (GrlMediaSource *source,
+                          GrlMediaSourceBrowseSpec *bs)
 {
   if (grl_tracker_browse_filesystem)
-    grl_tracker_source_browse_filesystem (source, bs);
+    grl_tracker_media_browse_filesystem (source, bs);
   else
-    grl_tracker_source_browse_category (source, bs);
+    grl_tracker_media_browse_category (source, bs);
 }
 
 void
-grl_tracker_source_cancel (GrlMediaSource *source, guint operation_id)
+grl_tracker_media_cancel (GrlMediaSource *source, guint operation_id)
 {
-  GrlTrackerSourcePriv *priv = GRL_TRACKER_SOURCE_GET_PRIVATE (source);
+  GrlTrackerMediaPriv *priv = GRL_TRACKER_MEDIA_GET_PRIVATE (source);
   struct OperationSpec *os;
 
   GRL_IDEBUG ("%s: id=%u", __FUNCTION__, operation_id);
@@ -802,9 +803,9 @@ grl_tracker_source_cancel (GrlMediaSource *source, guint operation_id)
 }
 
 gboolean
-grl_tracker_source_change_start (GrlMediaSource *source, GError **error)
+grl_tracker_media_change_start (GrlMediaSource *source, GError **error)
 {
-  GrlTrackerSourcePriv *priv = GRL_TRACKER_SOURCE_GET_PRIVATE (source);
+  GrlTrackerMediaPriv *priv = GRL_TRACKER_MEDIA_GET_PRIVATE (source);
 
   priv->notify_changes = TRUE;
 
@@ -812,9 +813,9 @@ grl_tracker_source_change_start (GrlMediaSource *source, GError **error)
 }
 
 gboolean
-grl_tracker_source_change_stop (GrlMediaSource *source, GError **error)
+grl_tracker_media_change_stop (GrlMediaSource *source, GError **error)
 {
-  GrlTrackerSourcePriv *priv = GRL_TRACKER_SOURCE_GET_PRIVATE (source);
+  GrlTrackerMediaPriv *priv = GRL_TRACKER_MEDIA_GET_PRIVATE (source);
 
   priv->notify_changes = FALSE;
 
@@ -822,7 +823,7 @@ grl_tracker_source_change_stop (GrlMediaSource *source, GError **error)
 }
 
 void
-grl_tracker_init_requests (void)
+grl_tracker_media_init_requests (void)
 {
   grl_metadata_key_tracker_category =
     grl_plugin_registry_register_metadata_key (grl_plugin_registry_get_default (),
diff --git a/src/media/tracker/grl-tracker-media-api.h b/src/media/tracker/grl-tracker-media-api.h
new file mode 100644
index 0000000..30589e0
--- /dev/null
+++ b/src/media/tracker/grl-tracker-media-api.h
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2011 Intel Corporation.
+ *
+ * Contact: Iago Toral Quiroga <itoral igalia com>
+ *
+ * Authors: Lionel Landwerlin <lionel g landwerlin linux intel com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * 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., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+
+#ifndef _GRL_TRACKER_MEDIA_API_H_
+#define _GRL_TRACKER_MEDIA_API_H_
+
+#include "grl-tracker-media.h"
+
+/**/
+
+void grl_tracker_media_init_requests (void);
+
+const GList *grl_tracker_media_supported_keys (GrlMetadataSource *source);
+
+void grl_tracker_media_query (GrlMediaSource *source,
+                              GrlMediaSourceQuerySpec *qs);
+
+void grl_tracker_media_metadata (GrlMediaSource *source,
+                                 GrlMediaSourceMetadataSpec *ms);
+
+void grl_tracker_media_search (GrlMediaSource *source,
+                               GrlMediaSourceSearchSpec *ss);
+
+void grl_tracker_media_browse (GrlMediaSource *source,
+                               GrlMediaSourceBrowseSpec *bs);
+
+void grl_tracker_media_cancel (GrlMediaSource *source, guint operation_id);
+
+gboolean grl_tracker_media_change_start (GrlMediaSource *source,
+                                         GError **error);
+
+gboolean grl_tracker_media_change_stop (GrlMediaSource *source,
+                                        GError **error);
+
+#endif /* _GRL_TRACKER_MEDIA_API_H_ */
diff --git a/src/media/tracker/grl-tracker-cache.c b/src/media/tracker/grl-tracker-media-cache.c
similarity index 82%
rename from src/media/tracker/grl-tracker-cache.c
rename to src/media/tracker/grl-tracker-media-cache.c
index e5801e7..057c3ca 100644
--- a/src/media/tracker/grl-tracker-cache.c
+++ b/src/media/tracker/grl-tracker-media-cache.c
@@ -24,10 +24,10 @@
 
 #include <glib.h>
 
-#include "grl-tracker-cache.h"
+#include "grl-tracker-media-cache.h"
 
 typedef struct {
-  GrlTrackerSource *source;
+  GrlTrackerMedia *source;
 
   GHashTable *id_table;
 } GrlTrackerCacheSource;
@@ -42,7 +42,7 @@ struct _GrlTrackerCache {
 };
 
 static GrlTrackerCacheSource *
-grl_tracker_cache_source_new (GrlTrackerSource *source)
+grl_tracker_cache_media_new (GrlTrackerMedia *source)
 {
   GrlTrackerCacheSource *csource = g_slice_new0 (GrlTrackerCacheSource);
 
@@ -53,7 +53,7 @@ grl_tracker_cache_source_new (GrlTrackerSource *source)
 }
 
 static void
-grl_tracker_cache_source_free (GrlTrackerCacheSource *csource)
+grl_tracker_cache_media_free (GrlTrackerCacheSource *csource)
 {
   g_hash_table_destroy (csource->id_table);
 
@@ -63,7 +63,7 @@ grl_tracker_cache_source_free (GrlTrackerCacheSource *csource)
 /**/
 
 GrlTrackerCache *
-grl_tracker_cache_new (gsize size)
+grl_tracker_media_cache_new (gsize size)
 {
   GrlTrackerCache *cache;
 
@@ -82,7 +82,7 @@ grl_tracker_cache_new (gsize size)
 }
 
 void
-grl_tracker_cache_free (GrlTrackerCache *cache)
+grl_tracker_media_cache_free (GrlTrackerCache *cache)
 {
   GHashTableIter iter;
   gpointer key, value;
@@ -91,7 +91,7 @@ grl_tracker_cache_free (GrlTrackerCache *cache)
 
   g_hash_table_iter_init (&iter, cache->source_table);
   while (g_hash_table_iter_next (&iter, &key, &value)) {
-    grl_tracker_cache_del_source (cache, key);
+    grl_tracker_media_cache_del_source (cache, key);
   }
 
   if (cache->id_list) {
@@ -105,9 +105,9 @@ grl_tracker_cache_free (GrlTrackerCache *cache)
 }
 
 void
-grl_tracker_cache_add_item (GrlTrackerCache *cache,
-                            guint id,
-                            GrlTrackerSource *source)
+grl_tracker_media_cache_add_item (GrlTrackerCache *cache,
+                                  guint id,
+                                  GrlTrackerMedia *source)
 {
   GList *lid;
   GrlTrackerCacheSource *csource;
@@ -120,7 +120,7 @@ grl_tracker_cache_add_item (GrlTrackerCache *cache,
   csource = g_hash_table_lookup (cache->source_table, source);
 
   if (!csource) {
-    csource = grl_tracker_cache_source_new (source);
+    csource = grl_tracker_cache_media_new (source);
     g_hash_table_insert (cache->source_table, source, csource);
   }
 
@@ -144,8 +144,8 @@ grl_tracker_cache_add_item (GrlTrackerCache *cache,
 }
 
 void
-grl_tracker_cache_del_source (GrlTrackerCache *cache,
-                              GrlTrackerSource *source)
+grl_tracker_media_cache_del_source (GrlTrackerCache *cache,
+                                    GrlTrackerMedia *source)
 {
   GrlTrackerCacheSource *csource;
   GHashTableIter iter;
@@ -167,18 +167,18 @@ grl_tracker_cache_del_source (GrlTrackerCache *cache,
   }
 
   g_hash_table_remove (cache->source_table, source);
-  grl_tracker_cache_source_free (csource);
+  grl_tracker_cache_media_free (csource);
 }
 
-GrlTrackerSource *
-grl_tracker_cache_get_source (GrlTrackerCache *cache, guint id)
+GrlTrackerMedia *
+grl_tracker_media_cache_get_source (GrlTrackerCache *cache, guint id)
 {
   GrlTrackerCacheSource *csource;
 
   g_return_val_if_fail (cache != NULL, NULL);
 
   csource = (GrlTrackerCacheSource *) g_hash_table_lookup (cache->id_table,
-                                                      GSIZE_TO_POINTER (id));
+                                                           GSIZE_TO_POINTER (id));
 
   if (csource) {
     return csource->source;
diff --git a/src/media/tracker/grl-tracker-cache.h b/src/media/tracker/grl-tracker-media-cache.h
similarity index 57%
rename from src/media/tracker/grl-tracker-cache.h
rename to src/media/tracker/grl-tracker-media-cache.h
index ad07865..1b5329e 100644
--- a/src/media/tracker/grl-tracker-cache.h
+++ b/src/media/tracker/grl-tracker-media-cache.h
@@ -22,24 +22,24 @@
  *
  */
 
-#ifndef _GRL_TRACKER_CACHE_H_
-#define _GRL_TRACKER_CACHE_H_
+#ifndef _GRL_TRACKER_MEDIA_CACHE_H_
+#define _GRL_TRACKER_MEDIA_CACHE_H_
 
-#include "grl-tracker.h"
+#include "grl-tracker-media.h"
 
 typedef struct _GrlTrackerCache GrlTrackerCache;
 
-GrlTrackerCache *grl_tracker_cache_new (gsize size);
+GrlTrackerCache *grl_tracker_media_cache_new (gsize size);
 
-void grl_tracker_cache_free (GrlTrackerCache *cache);
+void grl_tracker_media_cache_free (GrlTrackerCache *cache);
 
-void grl_tracker_cache_add_item (GrlTrackerCache *cache,
-                                 guint id,
-                                 GrlTrackerSource *source);
-void grl_tracker_cache_del_source (GrlTrackerCache *cache,
-                                   GrlTrackerSource *source);
+void grl_tracker_media_cache_add_item (GrlTrackerCache *cache,
+                                       guint id,
+                                       GrlTrackerMedia *source);
+void grl_tracker_media_cache_del_source (GrlTrackerCache *cache,
+                                         GrlTrackerMedia *source);
 
-GrlTrackerSource *grl_tracker_cache_get_source (GrlTrackerCache *cache,
-                                                guint id);
+GrlTrackerMedia *grl_tracker_media_cache_get_source (GrlTrackerCache *cache,
+                                                     guint id);
 
-#endif /* _GRL_TRACKER_CACHE_H_ */
+#endif /* _GRL_TRACKER_MEDIA_CACHE_H_ */
diff --git a/src/media/tracker/grl-tracker-notif.c b/src/media/tracker/grl-tracker-media-notif.c
similarity index 88%
rename from src/media/tracker/grl-tracker-notif.c
rename to src/media/tracker/grl-tracker-media-notif.c
index df70d10..409d977 100644
--- a/src/media/tracker/grl-tracker-notif.c
+++ b/src/media/tracker/grl-tracker-media-notif.c
@@ -24,8 +24,8 @@
 
 #include <tracker-sparql.h>
 
-#include "grl-tracker-notif.h"
-#include "grl-tracker-priv.h"
+#include "grl-tracker-media-notif.h"
+#include "grl-tracker-media-priv.h"
 #include "grl-tracker-utils.h"
 
 /* --------- Logging  -------- */
@@ -35,12 +35,12 @@ GRL_LOG_DOMAIN_STATIC(tracker_notif_log_domain);
 
 /* ------- Definitions ------- */
 
-#define TRACKER_SOURCE_ITEM_START                                       \
+#define TRACKER_MEDIA_ITEM_START                                        \
   "SELECT rdf:type(?urn) tracker:id(?urn) nie:dataSource(?urn) "	\
   "WHERE { ?urn a nfo:FileDataObject . "                                \
   "FILTER (tracker:id(?urn) IN ("
 
-#define TRACKER_SOURCE_ITEM_END ")) }"
+#define TRACKER_MEDIA_ITEM_END ")) }"
 
 /**/
 
@@ -104,19 +104,19 @@ tracker_evt_update_free (tracker_evt_update_t *evt)
 }
 
 static void
-tracker_evt_update_source_add (tracker_evt_update_t *evt,
-			       const gchar *id,
-			       const gchar *source_name)
+tracker_evt_update_media_add (tracker_evt_update_t *evt,
+                              const gchar *id,
+                              const gchar *source_name)
 {
-  GrlTrackerSource *source;
-  GrlTrackerSourcePriv *priv;
+  GrlTrackerMedia *source;
+  GrlTrackerMediaPriv *priv;
 
   source = g_hash_table_lookup (grl_tracker_modified_sources, id);
   if (!source) {
-    source = g_object_new (GRL_TRACKER_SOURCE_TYPE,
+    source = g_object_new (GRL_TRACKER_MEDIA_TYPE,
 			   "source-id", id,
 			   "source-name", source_name,
-			   "source-desc", GRL_TRACKER_SOURCE_DESC,
+			   "source-desc", GRL_TRACKER_MEDIA_DESC,
 			   "tracker-connection", grl_tracker_connection,
 			   NULL);
     g_hash_table_insert (grl_tracker_modified_sources,
@@ -124,8 +124,8 @@ tracker_evt_update_source_add (tracker_evt_update_t *evt,
 			 source);
   }
 
-  priv = GRL_TRACKER_SOURCE_GET_PRIVATE (source);
-  priv->state = GRL_TRACKER_SOURCE_STATE_INSERTING;
+  priv = GRL_TRACKER_MEDIA_GET_PRIVATE (source);
+  priv->state = GRL_TRACKER_MEDIA_STATE_INSERTING;
   priv->notification_ref++;
 
   evt->new_sources = g_list_append (evt->new_sources, source);
@@ -135,13 +135,13 @@ tracker_evt_update_source_add (tracker_evt_update_t *evt,
 }
 
 static void
-tracker_evt_update_source_del (tracker_evt_update_t *evt,
-			       GrlTrackerSource *source)
+tracker_evt_update_media_del (tracker_evt_update_t *evt,
+                              GrlTrackerMedia *source)
 {
-  GrlTrackerSourcePriv *priv = GRL_TRACKER_SOURCE_GET_PRIVATE (source);
+  GrlTrackerMediaPriv *priv = GRL_TRACKER_MEDIA_GET_PRIVATE (source);
 
   priv->notification_ref++;
-  priv->state = GRL_TRACKER_SOURCE_STATE_DELETING;
+  priv->state = GRL_TRACKER_MEDIA_STATE_DELETING;
 
   evt->old_sources = g_list_append (evt->old_sources, source);
 
@@ -160,13 +160,13 @@ tracker_evt_postupdate_sources (tracker_evt_update_t *evt)
 
   source = evt->old_sources;
   while (source != NULL) {
-    grl_tracker_del_source (GRL_TRACKER_SOURCE (source->data));
+    grl_tracker_del_source (GRL_TRACKER_MEDIA (source->data));
     source = source->next;
   }
 
   source = evt->new_sources;
   while (source != NULL) {
-    grl_tracker_add_source (GRL_TRACKER_SOURCE (source->data));
+    grl_tracker_add_source (GRL_TRACKER_MEDIA (source->data));
     source = source->next;
   }
 
@@ -180,7 +180,7 @@ tracker_evt_update_orphan_item_cb (GObject              *object,
 {
   guint id;
   const gchar *type, *datasource;
-  GrlTrackerSource *source = NULL;
+  GrlTrackerMedia *source = NULL;
   GError *error = NULL;
 
   GRL_DEBUG ("%s: evt=%p", __FUNCTION__, evt);
@@ -209,15 +209,15 @@ tracker_evt_update_orphan_item_cb (GObject              *object,
   GRL_DEBUG ("\tOrphan item: id=%u datasource=%s", id, datasource);
 
   if (datasource)
-    source = grl_tracker_source_find (datasource);
+    source = grl_tracker_media_find (datasource);
 
-  if (source && GRL_IS_TRACKER_SOURCE (source)) {
+  if (source && GRL_IS_TRACKER_MEDIA (source)) {
     GrlMedia *media;
 
     GRL_DEBUG (" \tAdding to cache id=%u", id);
-    grl_tracker_cache_add_item (grl_tracker_item_cache, id, source);
+    grl_tracker_media_cache_add_item (grl_tracker_item_cache, id, source);
 
-    if (grl_tracker_source_can_notify (source)) {
+    if (grl_tracker_media_can_notify (source)) {
       media = grl_tracker_build_grilo_media (type);
       if (media) {
         gchar *str_id = g_strdup_printf ("%i", id);
@@ -291,7 +291,7 @@ tracker_evt_update_orphans (tracker_evt_update_t *evt)
   sources = grl_plugin_registry_get_sources (grl_plugin_registry_get_default (),
 					     FALSE);
 
-  request_str = g_string_new (TRACKER_SOURCE_ITEM_START);
+  request_str = g_string_new (TRACKER_MEDIA_ITEM_START);
   subjects = g_hash_table_get_keys (evt->orphan_items);
 
   subject = subjects;
@@ -310,13 +310,13 @@ tracker_evt_update_orphans (tracker_evt_update_t *evt)
 
       source = sources;
       while (source != NULL) {
-	if (GRL_IS_TRACKER_SOURCE (source->data)) {
+	if (GRL_IS_TRACKER_MEDIA (source->data)) {
 	  GRL_DEBUG ("\tNotify id=%u source=%s p=%p", id,
                      grl_metadata_source_get_name (GRL_METADATA_SOURCE (source->data)),
                      source->data);
-	  if (grl_tracker_source_can_notify (GRL_TRACKER_SOURCE (source->data)))
+	  if (grl_tracker_media_can_notify (GRL_TRACKER_MEDIA (source->data)))
 	    grl_media_source_notify_change (GRL_MEDIA_SOURCE (source->data),
-					    media, GRL_CONTENT_REMOVED, FALSE);
+                                            media, GRL_CONTENT_REMOVED, FALSE);
 	}
 	source = source->next;
       }
@@ -341,11 +341,11 @@ tracker_evt_update_orphans (tracker_evt_update_t *evt)
 
 	source = sources;
 	while (source != NULL) {
-	  if (GRL_IS_TRACKER_SOURCE (source->data)) {
+	  if (GRL_IS_TRACKER_MEDIA (source->data)) {
 	    GRL_DEBUG ("\tNotify id=%u source=%s p=%p", id,
                        grl_metadata_source_get_name (GRL_METADATA_SOURCE (source->data)),
                        source->data);
-	    if (grl_tracker_source_can_notify (GRL_TRACKER_SOURCE (source->data)))
+	    if (grl_tracker_media_can_notify (GRL_TRACKER_MEDIA (source->data)))
               grl_media_source_notify_change (GRL_MEDIA_SOURCE (source->data),
                                               media, GRL_CONTENT_REMOVED, FALSE);
 	  }
@@ -357,7 +357,7 @@ tracker_evt_update_orphans (tracker_evt_update_t *evt)
     }
     g_list_free (subjects);
 
-    g_string_append (request_str, TRACKER_SOURCE_ITEM_END);
+    g_string_append (request_str, TRACKER_MEDIA_ITEM_END);
 
     GRL_DEBUG ("\trequest : '%s'", request_str->str);
 
@@ -380,7 +380,7 @@ tracker_evt_update_items_cb (gpointer              key,
 {
   guint id = GPOINTER_TO_INT (key);
   gchar *str_id;
-  GrlTrackerSource *source = (GrlTrackerSource *) value;
+  GrlTrackerMedia *source = (GrlTrackerMedia *) value;
   GrlMedia *media;
 
   GRL_DEBUG ("%s: evt=%p", __FUNCTION__, evt);
@@ -390,7 +390,7 @@ tracker_evt_update_items_cb (gpointer              key,
     return;
   }
 
-  if (!grl_tracker_source_can_notify (source)) {
+  if (!grl_tracker_media_can_notify (source)) {
     GRL_DEBUG ("\tno notification for source %s...",
 	       grl_metadata_source_get_name (GRL_METADATA_SOURCE (source)));
     return;
@@ -430,7 +430,7 @@ tracker_evt_preupdate_sources_item_cb (GObject              *object,
 {
   const gchar *type, *datasource, *uri, *datasource_name;
   gboolean source_available;
-  GrlTrackerSource *source;
+  GrlTrackerMedia *source;
   GError *error = NULL;
 
   GRL_DEBUG ("%s: evt=%p", __FUNCTION__, evt);
@@ -457,23 +457,23 @@ tracker_evt_preupdate_sources_item_cb (GObject              *object,
   uri = tracker_sparql_cursor_get_string (evt->cursor, 3, NULL);
   source_available = tracker_sparql_cursor_get_boolean (evt->cursor, 4);
 
-  source = grl_tracker_source_find (datasource);
+  source = grl_tracker_media_find (datasource);
 
   GRL_DEBUG ("\tdatasource=%s uri=%s available=%i source=%p",
              datasource, uri, source_available, source);
 
   if (source_available) {
     if (source == NULL) {
-      gchar *source_name = grl_tracker_get_source_name (type, uri, datasource,
-                                                        datasource_name);
+      gchar *source_name = grl_tracker_get_media_name (type, uri, datasource,
+                                                       datasource_name);
       /* Defer source creation until we have processed all sources */
-      tracker_evt_update_source_add (evt, datasource, source_name);
+      tracker_evt_update_media_add (evt, datasource, source_name);
       g_free (source_name);
     } else {
       GRL_DEBUG ("\tChanges on source %p / %s", source, datasource);
     }
   } else if (!source_available && source != NULL) {
-    tracker_evt_update_source_del (evt, GRL_TRACKER_SOURCE (source));
+    tracker_evt_update_media_del (evt, GRL_TRACKER_MEDIA (source));
   }
 
   tracker_sparql_cursor_next_async (evt->cursor, NULL,
@@ -551,8 +551,8 @@ tracker_dbus_signal_cb (GDBusConnection *connection,
     while (g_variant_iter_loop (iter1, "(iiii)", &graph,
                                 &subject, &predicate, &object)) {
       gpointer psubject = GSIZE_TO_POINTER (subject);
-      GrlTrackerSource *source =
-        grl_tracker_cache_get_source (grl_tracker_item_cache, subject);
+      GrlTrackerMedia *source =
+        grl_tracker_media_cache_get_source (grl_tracker_item_cache, subject);
 
       /* GRL_DEBUG ("\tdelete=> subject=%i", subject); */
 
@@ -567,10 +567,10 @@ tracker_dbus_signal_cb (GDBusConnection *connection,
 
     /* Process inserted items */
     while (g_variant_iter_loop (iter2, "(iiii)", &graph,
-                              &subject, &predicate, &object)) {
+                                &subject, &predicate, &object)) {
       gpointer psubject = GSIZE_TO_POINTER (subject);
-      GrlTrackerSource *source =
-        grl_tracker_cache_get_source (grl_tracker_item_cache, subject);
+      GrlTrackerMedia *source =
+        grl_tracker_media_cache_get_source (grl_tracker_item_cache, subject);
 
       /* GRL_DEBUG ("\tinsert=> subject=%i", subject); */
 
@@ -618,7 +618,7 @@ tracker_dbus_signal_cb (GDBusConnection *connection,
 }
 
 void
-grl_tracker_dbus_start_watch (void)
+grl_tracker_media_dbus_start_watch (void)
 {
   GDBusConnection *connection = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, NULL);
 
@@ -635,7 +635,7 @@ grl_tracker_dbus_start_watch (void)
 }
 
 void
-grl_tracker_init_notifs (void)
+grl_tracker_media_init_notifs (void)
 {
   GRL_LOG_DOMAIN_INIT (tracker_notif_log_domain, "tracker-notif");
 }
diff --git a/src/media/tracker/grl-tracker-notif.h b/src/media/tracker/grl-tracker-media-notif.h
similarity index 89%
rename from src/media/tracker/grl-tracker-notif.h
rename to src/media/tracker/grl-tracker-media-notif.h
index a288fc3..67eeba8 100644
--- a/src/media/tracker/grl-tracker-notif.h
+++ b/src/media/tracker/grl-tracker-media-notif.h
@@ -22,10 +22,10 @@
  *
  */
 
-#ifndef _GRL_TRACKER_NOTIF_H_
-#define _GRL_TRACKER_NOTIF_H_
+#ifndef _GRL_TRACKER_MEDIA_NOTIF_H_
+#define _GRL_TRACKER_MEDIA_NOTIF_H_
 
-#include "grl-tracker.h"
+#include "grl-tracker-media.h"
 
 /* ------- Definitions ------- */
 
@@ -47,8 +47,8 @@
 
 /**/
 
-void grl_tracker_dbus_start_watch (void);
+void grl_tracker_media_dbus_start_watch (void);
 
-void grl_tracker_init_notifs (void);
+void grl_tracker_media_init_notifs (void);
 
-#endif /* _GRL_TRACKER_NOTIF_H_ */
+#endif /* _GRL_TRACKER_MEDIA_NOTIF_H_ */
diff --git a/src/media/tracker/grl-tracker-priv.h b/src/media/tracker/grl-tracker-media-priv.h
similarity index 72%
rename from src/media/tracker/grl-tracker-priv.h
rename to src/media/tracker/grl-tracker-media-priv.h
index 8b9bbe0..0446de2 100644
--- a/src/media/tracker/grl-tracker-priv.h
+++ b/src/media/tracker/grl-tracker-media-priv.h
@@ -22,11 +22,11 @@
  *
  */
 
-#ifndef _GRL_TRACKER_PRIV_H_
-#define _GRL_TRACKER_PRIV_H_
+#ifndef _GRL_TRACKER_MEDIA_PRIV_H_
+#define _GRL_TRACKER_MEDIA_PRIV_H_
 
-#include "grl-tracker.h"
-#include "grl-tracker-cache.h"
+#include "grl-tracker-media.h"
+#include "grl-tracker-media-cache.h"
 
 #include <tracker-sparql.h>
 
@@ -34,9 +34,9 @@
 
 #define GRL_TRACKER_PLUGIN_ID   TRACKER_PLUGIN_ID
 
-#define GRL_TRACKER_SOURCE_ID   "grl-tracker"
-#define GRL_TRACKER_SOURCE_NAME "Tracker"
-#define GRL_TRACKER_SOURCE_DESC                 \
+#define GRL_TRACKER_MEDIA_ID   "grl-tracker"
+#define GRL_TRACKER_MEDIA_NAME "Tracker"
+#define GRL_TRACKER_MEDIA_DESC                 \
   "A plugin for searching multimedia "          \
   "content using Tracker"
 
@@ -46,19 +46,19 @@
 
 /**/
 
-#define GRL_TRACKER_SOURCE_GET_PRIVATE(object)		\
+#define GRL_TRACKER_MEDIA_GET_PRIVATE(object)		\
   (G_TYPE_INSTANCE_GET_PRIVATE((object),                \
-                               GRL_TRACKER_SOURCE_TYPE,	\
-                               GrlTrackerSourcePriv))
+                               GRL_TRACKER_MEDIA_TYPE,	\
+                               GrlTrackerMediaPriv))
 
 typedef enum {
-  GRL_TRACKER_SOURCE_STATE_INSERTING,
-  GRL_TRACKER_SOURCE_STATE_RUNNING,
-  GRL_TRACKER_SOURCE_STATE_DELETING,
-  GRL_TRACKER_SOURCE_STATE_DELETED,
-} GrlTrackerSourceState;
+  GRL_TRACKER_MEDIA_STATE_INSERTING,
+  GRL_TRACKER_MEDIA_STATE_RUNNING,
+  GRL_TRACKER_MEDIA_STATE_DELETING,
+  GRL_TRACKER_MEDIA_STATE_DELETED,
+} GrlTrackerMediaState;
 
-struct _GrlTrackerSourcePriv {
+struct _GrlTrackerMediaPriv {
   TrackerSparqlConnection *tracker_connection;
 
   GHashTable *operations;
@@ -66,7 +66,7 @@ struct _GrlTrackerSourcePriv {
   gchar *tracker_datasource;
   gboolean notify_changes;
 
-  GrlTrackerSourceState state;
+  GrlTrackerMediaState state;
   guint notification_ref;
 };
 
@@ -83,4 +83,4 @@ extern GHashTable *grl_tracker_modified_sources;
 extern gboolean grl_tracker_per_device_source;
 extern gboolean grl_tracker_browse_filesystem;
 
-#endif /* _GRL_TRACKER_PRIV_H_ */
+#endif /* _GRL_TRACKER_MEDIA_PRIV_H_ */
diff --git a/src/media/tracker/grl-tracker.c b/src/media/tracker/grl-tracker-media.c
similarity index 71%
rename from src/media/tracker/grl-tracker.c
rename to src/media/tracker/grl-tracker-media.c
index f862e9b..1ac906f 100644
--- a/src/media/tracker/grl-tracker.c
+++ b/src/media/tracker/grl-tracker-media.c
@@ -31,11 +31,11 @@
 #include <string.h>
 #include <tracker-sparql.h>
 
-#include "grl-tracker.h"
-#include "grl-tracker-priv.h"
-#include "grl-tracker-api.h"
-#include "grl-tracker-cache.h"
-#include "grl-tracker-notif.h"
+#include "grl-tracker-media.h"
+#include "grl-tracker-media-priv.h"
+#include "grl-tracker-media-api.h"
+#include "grl-tracker-media-cache.h"
+#include "grl-tracker-media-notif.h"
 #include "grl-tracker-utils.h"
 
 /* --------- Logging  -------- */
@@ -56,16 +56,16 @@ enum {
   PROP_TRACKER_CONNECTION,
 };
 
-static GrlTrackerSource *grl_tracker_source_new (TrackerSparqlConnection *connection);
+static GrlTrackerMedia *grl_tracker_media_new (TrackerSparqlConnection *connection);
 
-static void grl_tracker_source_set_property (GObject      *object,
+static void grl_tracker_media_set_property (GObject      *object,
                                              guint         propid,
                                              const GValue *value,
                                              GParamSpec   *pspec);
 
-static void grl_tracker_source_constructed (GObject *object);
+static void grl_tracker_media_constructed (GObject *object);
 
-static void grl_tracker_source_finalize (GObject *object);
+static void grl_tracker_media_finalize (GObject *object);
 
 gboolean grl_tracker_plugin_init (GrlPluginRegistry *registry,
                                   const GrlPluginInfo *plugin,
@@ -87,9 +87,9 @@ gboolean grl_tracker_browse_filesystem = FALSE;
 /* =================== Tracker Plugin  =============== */
 
 void
-grl_tracker_add_source (GrlTrackerSource *source)
+grl_tracker_add_source (GrlTrackerMedia *source)
 {
-  GrlTrackerSourcePriv *priv = GRL_TRACKER_SOURCE_GET_PRIVATE (source);
+  GrlTrackerMediaPriv *priv = GRL_TRACKER_MEDIA_GET_PRIVATE (source);
 
   GRL_DEBUG ("====================>add source '%s' count=%u",
              grl_metadata_source_get_name (GRL_METADATA_SOURCE (source)),
@@ -101,7 +101,7 @@ grl_tracker_add_source (GrlTrackerSource *source)
   if (priv->notification_ref == 0) {
     g_hash_table_remove (grl_tracker_modified_sources,
                          grl_metadata_source_get_id (GRL_METADATA_SOURCE (source)));
-    priv->state = GRL_TRACKER_SOURCE_STATE_RUNNING;
+    priv->state = GRL_TRACKER_MEDIA_STATE_RUNNING;
     grl_plugin_registry_register_source (grl_plugin_registry_get_default (),
                                          grl_tracker_plugin,
                                          GRL_MEDIA_PLUGIN (source),
@@ -110,9 +110,9 @@ grl_tracker_add_source (GrlTrackerSource *source)
 }
 
 void
-grl_tracker_del_source (GrlTrackerSource *source)
+grl_tracker_del_source (GrlTrackerMedia *source)
 {
-  GrlTrackerSourcePriv *priv = GRL_TRACKER_SOURCE_GET_PRIVATE (source);
+  GrlTrackerMediaPriv *priv = GRL_TRACKER_MEDIA_GET_PRIVATE (source);
 
   GRL_DEBUG ("==================>del source '%s' count=%u",
              grl_metadata_source_get_name (GRL_METADATA_SOURCE (source)),
@@ -123,8 +123,8 @@ grl_tracker_del_source (GrlTrackerSource *source)
   if (priv->notification_ref == 0) {
     g_hash_table_remove (grl_tracker_modified_sources,
                          grl_metadata_source_get_id (GRL_METADATA_SOURCE (source)));
-    grl_tracker_cache_del_source (grl_tracker_item_cache, source);
-    priv->state = GRL_TRACKER_SOURCE_STATE_DELETED;
+    grl_tracker_media_cache_del_source (grl_tracker_item_cache, source);
+    priv->state = GRL_TRACKER_MEDIA_STATE_DELETED;
     grl_plugin_registry_unregister_source (grl_plugin_registry_get_default (),
                                            GRL_MEDIA_PLUGIN (source),
                                            NULL);
@@ -132,31 +132,31 @@ grl_tracker_del_source (GrlTrackerSource *source)
 }
 
 gboolean
-grl_tracker_source_can_notify (GrlTrackerSource *source)
+grl_tracker_media_can_notify (GrlTrackerMedia *source)
 {
-  GrlTrackerSourcePriv *priv = GRL_TRACKER_SOURCE_GET_PRIVATE (source);
+  GrlTrackerMediaPriv *priv = GRL_TRACKER_MEDIA_GET_PRIVATE (source);
 
-  if (priv->state == GRL_TRACKER_SOURCE_STATE_RUNNING)
+  if (priv->state == GRL_TRACKER_MEDIA_STATE_RUNNING)
     return priv->notify_changes;
 
   return FALSE;
 }
 
-GrlTrackerSource *
-grl_tracker_source_find (const gchar *id)
+GrlTrackerMedia *
+grl_tracker_media_find (const gchar *id)
 {
   GrlMediaPlugin *source;
 
   source = grl_plugin_registry_lookup_source (grl_plugin_registry_get_default (),
 					      id);
 
-  if (source && GRL_IS_TRACKER_SOURCE (source)) {
-    return (GrlTrackerSource *) source;
+  if (source && GRL_IS_TRACKER_MEDIA (source)) {
+    return (GrlTrackerMedia *) source;
   }
 
   return
-    (GrlTrackerSource *) g_hash_table_lookup (grl_tracker_modified_sources,
-                                              id);
+    (GrlTrackerMedia *) g_hash_table_lookup (grl_tracker_modified_sources,
+                                             id);
 }
 
 static void
@@ -167,7 +167,7 @@ tracker_get_datasource_cb (GObject             *object,
   const gchar *type, *datasource, *datasource_name, *uri;
   gboolean source_available;
   GError *error = NULL;
-  GrlTrackerSource *source;
+  GrlTrackerMedia *source;
 
   GRL_DEBUG ("%s", __FUNCTION__);
 
@@ -188,17 +188,17 @@ tracker_get_datasource_cb (GObject             *object,
   uri = tracker_sparql_cursor_get_string (cursor, 3, NULL);
   source_available = tracker_sparql_cursor_get_boolean (cursor, 4);
 
-  source = grl_tracker_source_find (datasource);
+  source = grl_tracker_media_find (datasource);
 
   if ((source == NULL) && source_available) {
-    gchar *source_name = grl_tracker_get_source_name (type, uri, datasource,
-                                                      datasource_name);
+    gchar *source_name = grl_tracker_get_media_name (type, uri, datasource,
+                                                     datasource_name);
     GRL_DEBUG ("\tnew datasource: urn=%s name=%s uri=%s\n",
 	       datasource, datasource_name, uri);
-    source = g_object_new (GRL_TRACKER_SOURCE_TYPE,
+    source = g_object_new (GRL_TRACKER_MEDIA_TYPE,
                            "source-id", datasource,
                            "source-name", source_name,
-                           "source-desc", GRL_TRACKER_SOURCE_DESC,
+                           "source-desc", GRL_TRACKER_MEDIA_DESC,
                            "tracker-connection", grl_tracker_connection,
                            NULL);
     grl_tracker_add_source (source);
@@ -239,14 +239,14 @@ tracker_get_connection_cb (GObject             *object,
                            GAsyncResult        *res,
                            const GrlPluginInfo *plugin)
 {
-  /* GrlTrackerSource *source; */
+  /* GrlTrackerMedia *source; */
 
   GRL_DEBUG ("%s", __FUNCTION__);
 
   grl_tracker_connection = tracker_sparql_connection_get_finish (res, NULL);
 
   if (grl_tracker_connection != NULL) {
-    grl_tracker_dbus_start_watch ();
+    grl_tracker_media_dbus_start_watch ();
 
     if (grl_tracker_per_device_source == TRUE) {
       /* Let's discover available data sources. */
@@ -260,7 +260,7 @@ tracker_get_connection_cb (GObject             *object,
                                              NULL);
     } else {
       /* One source to rule them all. */
-      grl_tracker_add_source (grl_tracker_source_new (grl_tracker_connection));
+      grl_tracker_add_source (grl_tracker_media_new (grl_tracker_connection));
     }
   }
 }
@@ -276,11 +276,12 @@ grl_tracker_plugin_init (GrlPluginRegistry *registry,
   GRL_DEBUG ("%s", __FUNCTION__);
 
   GRL_LOG_DOMAIN_INIT (tracker_general_log_domain, "tracker-general");
-  grl_tracker_init_notifs ();
-  grl_tracker_init_requests ();
+  grl_tracker_media_init_notifs ();
+  grl_tracker_media_init_requests ();
 
   grl_tracker_plugin = plugin;
-  grl_tracker_item_cache = grl_tracker_cache_new (TRACKER_ITEM_CACHE_SIZE);
+  grl_tracker_item_cache =
+    grl_tracker_media_cache_new (TRACKER_ITEM_CACHE_SIZE);
   grl_tracker_modified_sources = g_hash_table_new (g_str_hash, g_str_equal);
 
   if (!configs) {
@@ -311,41 +312,41 @@ GRL_PLUGIN_REGISTER (grl_tracker_plugin_init,
 
 /* ================== Tracker GObject ================ */
 
-static GrlTrackerSource *
-grl_tracker_source_new (TrackerSparqlConnection *connection)
+static GrlTrackerMedia *
+grl_tracker_media_new (TrackerSparqlConnection *connection)
 {
   GRL_DEBUG ("%s", __FUNCTION__);
 
-  return g_object_new (GRL_TRACKER_SOURCE_TYPE,
-                       "source-id", GRL_TRACKER_SOURCE_ID,
-                       "source-name", GRL_TRACKER_SOURCE_NAME,
-                       "source-desc", GRL_TRACKER_SOURCE_DESC,
+  return g_object_new (GRL_TRACKER_MEDIA_TYPE,
+                       "source-id", GRL_TRACKER_MEDIA_ID,
+                       "source-name", GRL_TRACKER_MEDIA_NAME,
+                       "source-desc", GRL_TRACKER_MEDIA_DESC,
                        "tracker-connection", connection,
                        NULL);
 }
 
-G_DEFINE_TYPE (GrlTrackerSource, grl_tracker_source, GRL_TYPE_MEDIA_SOURCE);
+G_DEFINE_TYPE (GrlTrackerMedia, grl_tracker_media, GRL_TYPE_MEDIA_SOURCE);
 
 static void
-grl_tracker_source_class_init (GrlTrackerSourceClass * klass)
+grl_tracker_media_class_init (GrlTrackerMediaClass * klass)
 {
   GrlMediaSourceClass    *source_class   = GRL_MEDIA_SOURCE_CLASS (klass);
   GrlMetadataSourceClass *metadata_class = GRL_METADATA_SOURCE_CLASS (klass);
   GObjectClass           *g_class        = G_OBJECT_CLASS (klass);
 
-  source_class->query               = grl_tracker_source_query;
-  source_class->metadata            = grl_tracker_source_metadata;
-  source_class->search              = grl_tracker_source_search;
-  source_class->browse              = grl_tracker_source_browse;
-  source_class->cancel              = grl_tracker_source_cancel;
-  source_class->notify_change_start = grl_tracker_source_change_start;
-  source_class->notify_change_stop  = grl_tracker_source_change_stop;
+  source_class->query               = grl_tracker_media_query;
+  source_class->metadata            = grl_tracker_media_metadata;
+  source_class->search              = grl_tracker_media_search;
+  source_class->browse              = grl_tracker_media_browse;
+  source_class->cancel              = grl_tracker_media_cancel;
+  source_class->notify_change_start = grl_tracker_media_change_start;
+  source_class->notify_change_stop  = grl_tracker_media_change_stop;
 
-  metadata_class->supported_keys = grl_tracker_source_supported_keys;
+  metadata_class->supported_keys = grl_tracker_media_supported_keys;
 
-  g_class->finalize     = grl_tracker_source_finalize;
-  g_class->set_property = grl_tracker_source_set_property;
-  g_class->constructed  = grl_tracker_source_constructed;
+  g_class->finalize     = grl_tracker_media_finalize;
+  g_class->set_property = grl_tracker_media_set_property;
+  g_class->constructed  = grl_tracker_media_constructed;
 
   g_object_class_install_property (g_class,
                                    PROP_TRACKER_CONNECTION,
@@ -357,15 +358,15 @@ grl_tracker_source_class_init (GrlTrackerSourceClass * klass)
                                                         | G_PARAM_CONSTRUCT_ONLY
                                                         | G_PARAM_STATIC_NAME));
 
-  g_type_class_add_private (klass, sizeof (GrlTrackerSourcePriv));
+  g_type_class_add_private (klass, sizeof (GrlTrackerMediaPriv));
 
   grl_tracker_setup_key_mappings ();
 }
 
 static void
-grl_tracker_source_init (GrlTrackerSource *source)
+grl_tracker_media_init (GrlTrackerMedia *source)
 {
-  GrlTrackerSourcePriv *priv = GRL_TRACKER_SOURCE_GET_PRIVATE (source);
+  GrlTrackerMediaPriv *priv = GRL_TRACKER_MEDIA_GET_PRIVATE (source);
 
   source->priv = priv;
 
@@ -373,44 +374,44 @@ grl_tracker_source_init (GrlTrackerSource *source)
 }
 
 static void
-grl_tracker_source_constructed (GObject *object)
+grl_tracker_media_constructed (GObject *object)
 {
-  GrlTrackerSourcePriv *priv = GRL_TRACKER_SOURCE_GET_PRIVATE (object);
+  GrlTrackerMediaPriv *priv = GRL_TRACKER_MEDIA_GET_PRIVATE (object);
 
   if (grl_tracker_per_device_source)
     g_object_get (object, "source-id", &priv->tracker_datasource, NULL);
 }
 
 static void
-grl_tracker_source_finalize (GObject *object)
+grl_tracker_media_finalize (GObject *object)
 {
-  GrlTrackerSource *self;
+  GrlTrackerMedia *self;
 
-  self = GRL_TRACKER_SOURCE (object);
+  self = GRL_TRACKER_MEDIA (object);
   if (self->priv->tracker_connection)
     g_object_unref (self->priv->tracker_connection);
 
-  G_OBJECT_CLASS (grl_tracker_source_parent_class)->finalize (object);
+  G_OBJECT_CLASS (grl_tracker_media_parent_class)->finalize (object);
 }
 
 static void
-grl_tracker_source_set_property (GObject      *object,
+grl_tracker_media_set_property (GObject      *object,
                                  guint         propid,
                                  const GValue *value,
                                  GParamSpec   *pspec)
 
 {
-  GrlTrackerSourcePriv *priv = GRL_TRACKER_SOURCE_GET_PRIVATE (object);
+  GrlTrackerMediaPriv *priv = GRL_TRACKER_MEDIA_GET_PRIVATE (object);
 
   switch (propid) {
-  case PROP_TRACKER_CONNECTION:
-    if (priv->tracker_connection != NULL)
-      g_object_unref (G_OBJECT (priv->tracker_connection));
-    priv->tracker_connection = g_object_ref (g_value_get_object (value));
-    break;
-
-  default:
-    G_OBJECT_WARN_INVALID_PROPERTY_ID (object, propid, pspec);
+    case PROP_TRACKER_CONNECTION:
+      if (priv->tracker_connection != NULL)
+        g_object_unref (G_OBJECT (priv->tracker_connection));
+      priv->tracker_connection = g_object_ref (g_value_get_object (value));
+      break;
+
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, propid, pspec);
   }
 }
 
diff --git a/src/media/tracker/grl-tracker-media.h b/src/media/tracker/grl-tracker-media.h
new file mode 100644
index 0000000..6b484c2
--- /dev/null
+++ b/src/media/tracker/grl-tracker-media.h
@@ -0,0 +1,88 @@
+/*
+ * Copyright (C) 2011 Igalia S.L.
+ *
+ * Contact: Iago Toral Quiroga <itoral igalia com>
+ *
+ * Authors: Juan A. Suarez Romero <jasuarez igalia com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * 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., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+
+#ifndef _GRL_TRACKER_MEDIA_H_
+#define _GRL_TRACKER_MEDIA_H_
+
+#include <grilo.h>
+
+#define GRL_TRACKER_MEDIA_TYPE                  \
+  (grl_tracker_media_get_type ())
+
+#define GRL_TRACKER_MEDIA(obj)                          \
+  (G_TYPE_CHECK_INSTANCE_CAST ((obj),                   \
+                               GRL_TRACKER_MEDIA_TYPE,  \
+                               GrlTrackerMedia))
+
+#define GRL_IS_TRACKER_MEDIA(obj)                       \
+  (G_TYPE_CHECK_INSTANCE_TYPE ((obj),                   \
+                               GRL_TRACKER_MEDIA_TYPE))
+
+#define GRL_TRACKER_MEDIA_CLASS(klass)                  \
+  (G_TYPE_CHECK_CLASS_CAST((klass),                     \
+                           GRL_TRACKER_MEDIA_TYPE,      \
+                           GrlTrackerMediaClass))
+
+#define GRL_IS_TRACKER_MEDIA_CLASS(klass)               \
+  (G_TYPE_CHECK_CLASS_TYPE((klass),                     \
+                           GRL_TRACKER_MEDIA_TYPE))
+
+#define GRL_TRACKER_MEDIA_GET_CLASS(obj)                \
+  (G_TYPE_INSTANCE_GET_CLASS ((obj),                    \
+                              GRL_TRACKER_MEDIA_TYPE,   \
+                              GrlTrackerMediaClass))
+
+typedef struct _GrlTrackerMedia GrlTrackerMedia;
+typedef struct _GrlTrackerMediaPriv GrlTrackerMediaPriv;
+
+struct _GrlTrackerMedia {
+
+  GrlMediaSource parent;
+
+  /*< private >*/
+  GrlTrackerMediaPriv *priv;
+
+};
+
+typedef struct _GrlTrackerMediaClass GrlTrackerMediaClass;
+
+struct _GrlTrackerMediaClass {
+
+  GrlMediaSourceClass parent_class;
+
+};
+
+GType grl_tracker_media_get_type (void);
+
+gboolean grl_tracker_media_can_notify (GrlTrackerMedia *source);
+
+/**/
+void grl_tracker_add_source (GrlTrackerMedia *source);
+
+void grl_tracker_del_source (GrlTrackerMedia *source);
+
+GrlTrackerMedia *grl_tracker_media_find (const gchar *id);
+
+
+#endif /* _GRL_TRACKER_MEDIA_H_ */
diff --git a/src/media/tracker/grl-tracker-utils.c b/src/media/tracker/grl-tracker-utils.c
index ef06b5b..bc77ed1 100644
--- a/src/media/tracker/grl-tracker-utils.c
+++ b/src/media/tracker/grl-tracker-utils.c
@@ -23,7 +23,6 @@
  */
 
 #include "grl-tracker-utils.h"
-#include "grl-tracker-priv.h"
 
 /**/
 
@@ -165,7 +164,7 @@ get_mapping_from_grl (const GrlKeyID key)
 /**/
 
 gchar *
-grl_tracker_source_get_device_constraint (GrlTrackerSourcePriv *priv)
+grl_tracker_media_get_device_constraint (GrlTrackerMediaPriv *priv)
 {
   if (priv->tracker_datasource == NULL)
     return g_strdup ("");
@@ -175,8 +174,8 @@ grl_tracker_source_get_device_constraint (GrlTrackerSourcePriv *priv)
 }
 
 gchar *
-grl_tracker_source_get_select_string (GrlMediaSource *source,
-                                      const GList *keys)
+grl_tracker_media_get_select_string (GrlMediaSource *source,
+                                     const GList *keys)
 {
   const GList *key = keys;
   GString *gstr = g_string_new ("");
@@ -295,10 +294,10 @@ get_tracker_upnp_name (const gchar *datasource_name)
 }
 
 gchar *
-grl_tracker_get_source_name (const gchar *rdf_type,
-                             const gchar *uri,
-                             const gchar *datasource,
-                             const gchar *datasource_name)
+grl_tracker_get_media_name (const gchar *rdf_type,
+                            const gchar *uri,
+                            const gchar *datasource,
+                            const gchar *datasource_name)
 {
   gchar *source_name = NULL;
   gchar **rdf_single_type;
@@ -323,7 +322,7 @@ grl_tracker_get_source_name (const gchar *rdf_type,
 
   if (!source_name)
     source_name = g_strdup_printf  ("%s %s",
-                                    GRL_TRACKER_SOURCE_NAME,
+                                    GRL_TRACKER_MEDIA_NAME,
                                     datasource);
 
   return source_name;
diff --git a/src/media/tracker/grl-tracker-utils.h b/src/media/tracker/grl-tracker-utils.h
index 09cc679..881828e 100644
--- a/src/media/tracker/grl-tracker-utils.h
+++ b/src/media/tracker/grl-tracker-utils.h
@@ -25,7 +25,7 @@
 #ifndef _GRL_TRACKER_UTILS_H_
 #define _GRL_TRACKER_UTILS_H_
 
-#include "grl-tracker.h"
+#include "grl-tracker-media-priv.h"
 
 /* ------- Definitions ------- */
 
@@ -57,14 +57,14 @@ tracker_grl_sparql_t *grl_tracker_get_mapping_from_sparql (const gchar *key);
 
 GrlMedia *grl_tracker_build_grilo_media (const gchar *rdf_type);
 
-gchar *grl_tracker_source_get_device_constraint (GrlTrackerSourcePriv *priv);
+gchar *grl_tracker_media_get_device_constraint (GrlTrackerMediaPriv *priv);
 
-gchar *grl_tracker_source_get_select_string (GrlMediaSource *source,
-                                             const GList *keys);
+gchar *grl_tracker_media_get_select_string (GrlMediaSource *source,
+                                            const GList *keys);
 
-gchar *grl_tracker_get_source_name (const gchar *rdf_type,
-                                    const gchar *uri,
-                                    const gchar *datasource,
-                                    const gchar *datasource_name);
+gchar *grl_tracker_get_media_name (const gchar *rdf_type,
+                                   const gchar *uri,
+                                   const gchar *datasource,
+                                   const gchar *datasource_name);
 
 #endif /* _GRL_TRACKER_UTILS_H_ */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]