[rygel] tracker: Make use of nested namespaces
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rygel] tracker: Make use of nested namespaces
- Date: Fri, 9 Jul 2010 14:44:29 +0000 (UTC)
commit 6b832021cba292efd1c1539b837bbffd233bccdf
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date: Fri Jul 9 04:01:47 2010 +0300
tracker: Make use of nested namespaces
.../rygel-tracker-category-all-container.vala | 6 +-
.../tracker/rygel-tracker-category-container.vala | 14 ++--
.../tracker/rygel-tracker-content-directory.vala | 4 +-
.../tracker/rygel-tracker-insertion-query.vala | 35 ++++------
src/plugins/tracker/rygel-tracker-interfaces.vala | 8 +-
.../tracker/rygel-tracker-item-creation.vala | 29 ++++----
.../tracker/rygel-tracker-item-factory.vala | 18 +++---
.../tracker/rygel-tracker-metadata-values.vala | 73 +++++++++-----------
.../tracker/rygel-tracker-music-item-factory.vala | 10 ++--
src/plugins/tracker/rygel-tracker-music.vala | 30 ++++----
.../rygel-tracker-picture-item-factory.vala | 12 ++--
src/plugins/tracker/rygel-tracker-pictures.vala | 12 ++--
.../tracker/rygel-tracker-plugin-factory.vala | 17 ++---
src/plugins/tracker/rygel-tracker-plugin.vala | 6 +-
.../tracker/rygel-tracker-query-triplet.vala | 19 ++---
.../tracker/rygel-tracker-query-triplets.vala | 14 ++--
src/plugins/tracker/rygel-tracker-query.vala | 8 +-
.../tracker/rygel-tracker-root-container.vala | 10 ++--
.../tracker/rygel-tracker-search-container.vala | 66 +++++++++---------
.../tracker/rygel-tracker-selection-query.vala | 20 +++---
src/plugins/tracker/rygel-tracker-tags.vala | 5 +-
.../tracker/rygel-tracker-video-item-factory.vala | 12 ++--
src/plugins/tracker/rygel-tracker-videos.vala | 12 ++--
src/plugins/tracker/rygel-tracker-years.vala | 5 +-
24 files changed, 208 insertions(+), 237 deletions(-)
---
diff --git a/src/plugins/tracker/rygel-tracker-category-all-container.vala b/src/plugins/tracker/rygel-tracker-category-all-container.vala
index 87d5408..021f872 100644
--- a/src/plugins/tracker/rygel-tracker-category-all-container.vala
+++ b/src/plugins/tracker/rygel-tracker-category-all-container.vala
@@ -27,8 +27,8 @@ using Gee;
/**
* A simple search container that contains all the items in a category.
*/
-public class Rygel.TrackerCategoryAllContainer : Rygel.TrackerSearchContainer {
- public TrackerCategoryAllContainer (TrackerCategoryContainer parent) {
+public class Rygel.Tracker.CategoryAllContainer : SearchContainer {
+ public CategoryAllContainer (CategoryContainer parent) {
base ("All" + parent.id, parent, "All", parent.item_factory);
try {
@@ -49,7 +49,7 @@ public class Rygel.TrackerCategoryAllContainer : Rygel.TrackerSearchContainer {
throws Error {
assert (this.uris.size > 0);
- var creation = new TrackerItemCreation (item, this, cancellable);
+ var creation = new ItemCreation (item, this, cancellable);
yield creation.run ();
if (creation.error != null) {
throw creation.error;
diff --git a/src/plugins/tracker/rygel-tracker-category-container.vala b/src/plugins/tracker/rygel-tracker-category-container.vala
index 30920ac..1be01b7 100644
--- a/src/plugins/tracker/rygel-tracker-category-container.vala
+++ b/src/plugins/tracker/rygel-tracker-category-container.vala
@@ -26,18 +26,18 @@ using Gee;
/**
* Container listing content hierarchy for a specific category.
*/
-public class Rygel.TrackerCategoryContainer : Rygel.SimpleContainer {
- public TrackerItemFactory item_factory;
+public class Rygel.Tracker.CategoryContainer : Rygel.SimpleContainer {
+ public ItemFactory item_factory;
- public TrackerCategoryContainer (string id,
- MediaContainer parent,
- string title,
- TrackerItemFactory item_factory) {
+ public CategoryContainer (string id,
+ MediaContainer parent,
+ string title,
+ ItemFactory item_factory) {
base (id, parent, title);
this.item_factory = item_factory;
- this.add_child (new TrackerCategoryAllContainer (this));
+ this.add_child (new CategoryAllContainer (this));
}
}
diff --git a/src/plugins/tracker/rygel-tracker-content-directory.vala b/src/plugins/tracker/rygel-tracker-content-directory.vala
index 53c85f2..5520f49 100644
--- a/src/plugins/tracker/rygel-tracker-content-directory.vala
+++ b/src/plugins/tracker/rygel-tracker-content-directory.vala
@@ -28,11 +28,11 @@ using Gee;
/**
* Implementation of Tracker-based ContentDirectory service.
*/
-public class Rygel.TrackerContentDirectory : Rygel.ContentDirectory {
+public class Rygel.Tracker.ContentDirectory : Rygel.ContentDirectory {
/* Pubic methods */
public override MediaContainer? create_root_container () {
string friendly_name = this.root_device.get_friendly_name ();
- return new TrackerRootContainer (friendly_name);
+ return new RootContainer (friendly_name);
}
}
diff --git a/src/plugins/tracker/rygel-tracker-insertion-query.vala b/src/plugins/tracker/rygel-tracker-insertion-query.vala
index cafd506..9a20981 100644
--- a/src/plugins/tracker/rygel-tracker-insertion-query.vala
+++ b/src/plugins/tracker/rygel-tracker-insertion-query.vala
@@ -25,40 +25,33 @@ using Gee;
/**
* Represents Tracker SPARQL Insertion query
*/
-public class Rygel.TrackerInsertionQuery : Rygel.TrackerQuery {
+public class Rygel.Tracker.InsertionQuery : Query {
private const string TEMP_ID = "x";
private const string QUERY_ID = "_:" + TEMP_ID;
public string id;
- public TrackerInsertionQuery (MediaItem item, string category) {
- var triplets = new TrackerQueryTriplets ();
- triplets.add (new TrackerQueryTriplet (QUERY_ID,
- "a",
- category));
- triplets.add (new TrackerQueryTriplet (QUERY_ID,
- "a",
- "nie:DataObject"));
- triplets.add (new TrackerQueryTriplet (QUERY_ID,
- "a",
- "nfo:FileDataObject"));
- triplets.add (new TrackerQueryTriplet (QUERY_ID,
- "nie:mimeType",
- "\"" + item.mime_type + "\""));
- triplets.add (new TrackerQueryTriplet (QUERY_ID,
- "nie:url",
- "\"" + item.uris[0] + "\""));
+ public InsertionQuery (MediaItem item, string category) {
+ var triplets = new QueryTriplets ();
+ triplets.add (new QueryTriplet (QUERY_ID, "a", category));
+ triplets.add (new QueryTriplet (QUERY_ID, "a", "nie:DataObject"));
+ triplets.add (new QueryTriplet (QUERY_ID, "a", "nfo:FileDataObject"));
+ triplets.add (new QueryTriplet (QUERY_ID,
+ "nie:mimeType",
+ "\"" + item.mime_type + "\""));
+ triplets.add (new QueryTriplet (QUERY_ID,
+ "nie:url",
+ "\"" + item.uris[0] + "\""));
var now = TimeVal ();
- triplets.add (new TrackerQueryTriplet (
- QUERY_ID,
+ triplets.add (new QueryTriplet (QUERY_ID,
"nfo:fileLastModified",
"\"" + now.to_iso8601 () + "\""));
base (triplets);
}
- public override async void execute (TrackerResourcesIface resources)
+ public override async void execute (ResourcesIface resources)
throws DBus.Error {
var str = this.to_string ();
diff --git a/src/plugins/tracker/rygel-tracker-interfaces.vala b/src/plugins/tracker/rygel-tracker-interfaces.vala
index 7f6436f..dfc7fcc 100644
--- a/src/plugins/tracker/rygel-tracker-interfaces.vala
+++ b/src/plugins/tracker/rygel-tracker-interfaces.vala
@@ -24,12 +24,12 @@
using DBus;
[DBus (name = "org.freedesktop.Tracker1.Statistics")]
-public interface Rygel.TrackerStatsIface : DBus.Object {
+public interface Rygel.Tracker.StatsIface : DBus.Object {
public abstract async string[,] get_statistics () throws DBus.Error;
}
[DBus (name = "org.freedesktop.Tracker1.Resources")]
-public interface Rygel.TrackerResourcesIface: DBus.Object {
+public interface Rygel.Tracker.ResourcesIface: DBus.Object {
public abstract async string[,] sparql_query (string query)
throws DBus.Error;
public abstract async HashTable<string,string>[,] sparql_update_blank (
@@ -37,7 +37,7 @@ public interface Rygel.TrackerResourcesIface: DBus.Object {
}
[DBus (name = "org.freedesktop.Tracker1.Resources.Class")]
-public interface Rygel.TrackerResourcesClassIface: DBus.Object {
+public interface Rygel.Tracker.ResourcesClassIface: DBus.Object {
public abstract signal void subjects_added (string[] subjects);
public abstract signal void subjects_removed (string[] subjects);
public abstract signal void subjects_changed (string[] before,
@@ -45,7 +45,7 @@ public interface Rygel.TrackerResourcesClassIface: DBus.Object {
}
[DBus (name = "org.freedesktop.Tracker1.Miner")]
-public interface Rygel.TrackerMinerIface : DBus.Object {
+public interface Rygel.Tracker.MinerIface : DBus.Object {
public abstract async void ignore_next_update (string[] urls)
throws DBus.Error;
}
diff --git a/src/plugins/tracker/rygel-tracker-item-creation.vala b/src/plugins/tracker/rygel-tracker-item-creation.vala
index da84049..267855a 100644
--- a/src/plugins/tracker/rygel-tracker-item-creation.vala
+++ b/src/plugins/tracker/rygel-tracker-item-creation.vala
@@ -26,7 +26,7 @@ using GUPnP;
/**
* StateMachine interface.
*/
-public class Rygel.TrackerItemCreation : GLib.Object, Rygel.StateMachine {
+public class Rygel.Tracker.ItemCreation : GLib.Object, Rygel.StateMachine {
/* class-wide constants */
private const string TRACKER_SERVICE = "org.freedesktop.Tracker1";
private const string RESOURCES_PATH = "/org/freedesktop/Tracker1/Resources";
@@ -37,14 +37,13 @@ public class Rygel.TrackerItemCreation : GLib.Object, Rygel.StateMachine {
public Error error { get; set; }
private MediaItem item;
- private TrackerCategoryAllContainer container;
- private TrackerResourcesIface resources;
- private TrackerMinerIface miner;
-
- public TrackerItemCreation (MediaItem item,
- TrackerCategoryAllContainer container,
- Cancellable? cancellable)
- throws Error {
+ private CategoryAllContainer container;
+ private ResourcesIface resources;
+ private MinerIface miner;
+
+ public ItemCreation (MediaItem item,
+ CategoryAllContainer container,
+ Cancellable? cancellable) throws Error {
this.item = item;
this.container = container;
this.cancellable = cancellable;
@@ -87,7 +86,7 @@ public class Rygel.TrackerItemCreation : GLib.Object, Rygel.StateMachine {
private async string create_entry_in_store () throws Error {
var category = this.container.item_factory.category;
- var query = new TrackerInsertionQuery (this.item, category);
+ var query = new InsertionQuery (this.item, category);
yield query.execute (this.resources);
@@ -97,12 +96,10 @@ public class Rygel.TrackerItemCreation : GLib.Object, Rygel.StateMachine {
private void create_proxies () throws DBus.Error {
DBus.Connection connection = DBus.Bus.get (DBus.BusType.SESSION);
- this.resources = connection.get_object (TRACKER_SERVICE,
- RESOURCES_PATH)
- as TrackerResourcesIface;
- this.miner = connection.get_object (MINER_SERVICE,
- MINER_PATH)
- as TrackerMinerIface;
+ this.resources = connection.get_object (TRACKER_SERVICE, RESOURCES_PATH)
+ as ResourcesIface;
+ this.miner = connection.get_object (MINER_SERVICE, MINER_PATH)
+ as MinerIface;
}
}
diff --git a/src/plugins/tracker/rygel-tracker-item-factory.vala b/src/plugins/tracker/rygel-tracker-item-factory.vala
index 11ee397..46761fd 100644
--- a/src/plugins/tracker/rygel-tracker-item-factory.vala
+++ b/src/plugins/tracker/rygel-tracker-item-factory.vala
@@ -26,7 +26,7 @@ using Gee;
/**
* Abstract Tracker item factory.
*/
-public abstract class Rygel.TrackerItemFactory {
+public abstract class Rygel.Tracker.ItemFactory {
protected enum Metadata {
FILE_NAME,
TITLE,
@@ -44,10 +44,10 @@ public abstract class Rygel.TrackerItemFactory {
public ArrayList<ArrayList<string>> key_chains;
- public TrackerItemFactory (string category,
- string upnp_class,
- string resources_class_path,
- string? upload_dir) {
+ public ItemFactory (string category,
+ string upnp_class,
+ string resources_class_path,
+ string? upload_dir) {
this.category = category;
this.upnp_class = upnp_class;
this.resources_class_path = resources_class_path;
@@ -66,10 +66,10 @@ public abstract class Rygel.TrackerItemFactory {
this.key_chains[Metadata.DATE].add ("nie:contentCreated");
}
- public virtual MediaItem create (string id,
- string uri,
- TrackerSearchContainer parent,
- string[] metadata)
+ public virtual MediaItem create (string id,
+ string uri,
+ SearchContainer parent,
+ string[] metadata)
throws GLib.Error {
var item = new MediaItem (id, parent, "", this.upnp_class);
diff --git a/src/plugins/tracker/rygel-tracker-metadata-values.vala b/src/plugins/tracker/rygel-tracker-metadata-values.vala
index e5457b8..2c319e9 100644
--- a/src/plugins/tracker/rygel-tracker-metadata-values.vala
+++ b/src/plugins/tracker/rygel-tracker-metadata-values.vala
@@ -28,7 +28,7 @@ using Gee;
/**
* Container listing possible values of a particuler Tracker metadata key.
*/
-public class Rygel.TrackerMetadataValues : Rygel.SimpleContainer {
+public class Rygel.Tracker.MetadataValues : Rygel.SimpleContainer {
/* class-wide constants */
private const string TRACKER_SERVICE = "org.freedesktop.Tracker1";
private const string RESOURCES_PATH = "/org/freedesktop/Tracker1/Resources";
@@ -37,7 +37,7 @@ public class Rygel.TrackerMetadataValues : Rygel.SimpleContainer {
public delegate string IDFunc (string value);
public delegate string FilterFunc (string variable, string value);
- private TrackerItemFactory item_factory;
+ private ItemFactory item_factory;
// In tracker 0.7, we might don't get values of keys in place so you need a
// chain of keys to reach to final destination. For instances:
@@ -47,20 +47,17 @@ public class Rygel.TrackerMetadataValues : Rygel.SimpleContainer {
public IDFunc title_func;
public FilterFunc filter_func;
- private TrackerResourcesIface resources;
- private TrackerResourcesClassIface resources_class;
-
- public TrackerMetadataValues (string id,
- MediaContainer parent,
- string title,
- TrackerItemFactory item_factory,
- string[] key_chain,
- IDFunc? id_func =
- default_id_func,
- IDFunc? title_func =
- default_id_func,
- FilterFunc? filter_func =
- default_filter_func) {
+ private ResourcesIface resources;
+ private ResourcesClassIface resources_class;
+
+ public MetadataValues (string id,
+ MediaContainer parent,
+ string title,
+ ItemFactory item_factory,
+ string[] key_chain,
+ IDFunc? id_func = default_id_func,
+ IDFunc? title_func = default_id_func,
+ FilterFunc? filter_func = default_filter_func) {
base (id, parent, title);
this.item_factory = item_factory;
@@ -87,7 +84,7 @@ public class Rygel.TrackerMetadataValues : Rygel.SimpleContainer {
this.clear ();
int i;
- var triplets = new TrackerQueryTriplets ();
+ var triplets = new QueryTriplets ();
// All variables used in the query
var num_keys = this.key_chain.length - 1;
@@ -102,15 +99,14 @@ public class Rygel.TrackerMetadataValues : Rygel.SimpleContainer {
subject = variables[i - 1];
}
- triplets.add (new TrackerQueryTriplet (subject,
- this.key_chain[i],
- variables[i]));
+ triplets.add (new QueryTriplet (subject,
+ this.key_chain[i],
+ variables[i]));
}
- triplets.insert (0, new TrackerQueryTriplet (
- ITEM_VARIABLE,
- "a",
- this.item_factory.category));
+ triplets.insert (0, new QueryTriplet (ITEM_VARIABLE,
+ "a",
+ this.item_factory.category));
// Variables to select from query
var selected = new ArrayList<string> ();
@@ -118,10 +114,10 @@ public class Rygel.TrackerMetadataValues : Rygel.SimpleContainer {
var last_variable = variables[num_keys - 1];
selected.add ("DISTINCT " + last_variable);
- var query = new TrackerSelectionQuery (selected,
- triplets,
- null,
- last_variable);
+ var query = new SelectionQuery (selected,
+ triplets,
+ null,
+ last_variable);
try {
yield query.execute (this.resources);
@@ -150,19 +146,19 @@ public class Rygel.TrackerMetadataValues : Rygel.SimpleContainer {
// The child container can use the same triplets we used in our
// query.
- var child_triplets = new TrackerQueryTriplets.clone (triplets);
+ var child_triplets = new QueryTriplets.clone (triplets);
// However we constrain the object of our last triplet.
var filters = new ArrayList<string> ();
var filter = this.filter_func (child_triplets.last ().obj, value);
filters.add (filter);
- var container = new TrackerSearchContainer (id,
- this,
- title,
- this.item_factory,
- child_triplets,
- filters);
+ var container = new SearchContainer (id,
+ this,
+ title,
+ this.item_factory,
+ child_triplets,
+ filters);
this.add_child (container);
}
@@ -181,13 +177,12 @@ public class Rygel.TrackerMetadataValues : Rygel.SimpleContainer {
private void create_proxies () throws DBus.Error {
DBus.Connection connection = DBus.Bus.get (DBus.BusType.SESSION);
- this.resources = connection.get_object (TRACKER_SERVICE,
- RESOURCES_PATH)
- as TrackerResourcesIface;
+ this.resources = connection.get_object (TRACKER_SERVICE, RESOURCES_PATH)
+ as ResourcesIface;
this.resources_class = connection.get_object (
TRACKER_SERVICE,
this.item_factory.resources_class_path)
- as TrackerResourcesClassIface;
+ as ResourcesClassIface;
}
private void hook_to_changes () {
diff --git a/src/plugins/tracker/rygel-tracker-music-item-factory.vala b/src/plugins/tracker/rygel-tracker-music-item-factory.vala
index b630fd7..12a8fa5 100644
--- a/src/plugins/tracker/rygel-tracker-music-item-factory.vala
+++ b/src/plugins/tracker/rygel-tracker-music-item-factory.vala
@@ -26,7 +26,7 @@ using Gee;
/**
* Tracker music item factory.
*/
-public class Rygel.TrackerMusicItemFactory : Rygel.TrackerItemFactory {
+public class Rygel.Tracker.MusicItemFactory : ItemFactory {
private enum MusicMetadata {
DURATION = Metadata.LAST_KEY,
AUDIO_ALBUM,
@@ -38,7 +38,7 @@ public class Rygel.TrackerMusicItemFactory : Rygel.TrackerItemFactory {
private const string CATEGORY = "nmm:MusicPiece";
- public TrackerMusicItemFactory () {
+ public MusicItemFactory () {
base (CATEGORY,
MediaItem.MUSIC_CLASS,
MUSIC_RESOURCES_CLASS_PATH,
@@ -56,9 +56,9 @@ public class Rygel.TrackerMusicItemFactory : Rygel.TrackerItemFactory {
this.key_chains[MusicMetadata.AUDIO_TRACK_NUM].add ("nmm:trackNumber");
}
- public override MediaItem create (string id,
- string uri,
- TrackerSearchContainer parent,
+ public override MediaItem create (string id,
+ string uri,
+ SearchContainer parent,
string[] metadata)
throws GLib.Error {
var item = base.create (id, uri, parent, metadata);
diff --git a/src/plugins/tracker/rygel-tracker-music.vala b/src/plugins/tracker/rygel-tracker-music.vala
index 9112039..d2fbc03 100644
--- a/src/plugins/tracker/rygel-tracker-music.vala
+++ b/src/plugins/tracker/rygel-tracker-music.vala
@@ -26,28 +26,26 @@ using Gee;
/**
* Container listing Music content hierarchy.
*/
-public class Rygel.TrackerMusic : Rygel.TrackerCategoryContainer {
- public TrackerMusic (string id,
- MediaContainer parent,
- string title) {
- base (id, parent, title, new TrackerMusicItemFactory ());
+public class Rygel.Tracker.Music : CategoryContainer {
+ public Music (string id, MediaContainer parent, string title) {
+ base (id, parent, title, new MusicItemFactory ());
var key_chain = new string[] { "nmm:performer",
"nmm:artistName",
null };
- this.add_child (new TrackerMetadataValues (id + "Artists",
- this,
- _("Artists"),
- this.item_factory,
- key_chain));
+ this.add_child (new MetadataValues (id + "Artists",
+ this,
+ _("Artists"),
+ this.item_factory,
+ key_chain));
key_chain = new string[] { "nmm:musicAlbum", "nmm:albumTitle", null };
- this.add_child (new TrackerMetadataValues (id + "Albums",
- this,
- _("Albums"),
- this.item_factory,
- key_chain));
- this.add_child (new TrackerTags (this, item_factory));
+ this.add_child (new MetadataValues (id + "Albums",
+ this,
+ _("Albums"),
+ this.item_factory,
+ key_chain));
+ this.add_child (new Tags (this, item_factory));
}
}
diff --git a/src/plugins/tracker/rygel-tracker-picture-item-factory.vala b/src/plugins/tracker/rygel-tracker-picture-item-factory.vala
index 8dbe436..c8b162f 100644
--- a/src/plugins/tracker/rygel-tracker-picture-item-factory.vala
+++ b/src/plugins/tracker/rygel-tracker-picture-item-factory.vala
@@ -26,7 +26,7 @@ using Gee;
/**
* Tracker picture item factory.
*/
-public class Rygel.TrackerPictureItemFactory : Rygel.TrackerItemFactory {
+public class Rygel.Tracker.PictureItemFactory : ItemFactory {
private enum PictureMetadata {
HEIGHT = Metadata.LAST_KEY,
WIDTH,
@@ -36,7 +36,7 @@ public class Rygel.TrackerPictureItemFactory : Rygel.TrackerItemFactory {
private const string CATEGORY = "nmm:Photo";
- public TrackerPictureItemFactory () {
+ public PictureItemFactory () {
base (CATEGORY,
MediaItem.PHOTO_CLASS,
PHOTO_RESOURCES_CLASS_PATH,
@@ -50,10 +50,10 @@ public class Rygel.TrackerPictureItemFactory : Rygel.TrackerItemFactory {
this.key_chains[PictureMetadata.HEIGHT].add ("nfo:height");
}
- public override MediaItem create (string id,
- string uri,
- TrackerSearchContainer parent,
- string[] metadata)
+ public override MediaItem create (string id,
+ string uri,
+ SearchContainer parent,
+ string[] metadata)
throws GLib.Error {
var item = base.create (id, uri, parent, metadata);
diff --git a/src/plugins/tracker/rygel-tracker-pictures.vala b/src/plugins/tracker/rygel-tracker-pictures.vala
index 9778c95..42e761b 100644
--- a/src/plugins/tracker/rygel-tracker-pictures.vala
+++ b/src/plugins/tracker/rygel-tracker-pictures.vala
@@ -26,16 +26,14 @@ using Gee;
/**
* Container listing Pictures content hierarchy.
*/
-public class Rygel.TrackerPictures : Rygel.TrackerCategoryContainer {
+public class Rygel.Tracker.Pictures : CategoryContainer {
private const string[] KEY_CHAIN = { "nie:contentCreated", null };
- public TrackerPictures (string id,
- MediaContainer parent,
- string title) {
- base (id, parent, title, new TrackerPictureItemFactory ());
+ public Pictures (string id, MediaContainer parent, string title) {
+ base (id, parent, title, new PictureItemFactory ());
- this.add_child (new TrackerTags (this, this.item_factory));
- this.add_child (new TrackerYears (this, this.item_factory));
+ this.add_child (new Tags (this, this.item_factory));
+ this.add_child (new Years (this, this.item_factory));
}
}
diff --git a/src/plugins/tracker/rygel-tracker-plugin-factory.vala b/src/plugins/tracker/rygel-tracker-plugin-factory.vala
index f91a5a7..c2083b9 100644
--- a/src/plugins/tracker/rygel-tracker-plugin-factory.vala
+++ b/src/plugins/tracker/rygel-tracker-plugin-factory.vala
@@ -25,36 +25,35 @@
using Rygel;
using Gee;
-private TrackerPluginFactory plugin_factory;
+private Tracker.PluginFactory plugin_factory;
public void module_init (PluginLoader loader) {
try {
- plugin_factory = new TrackerPluginFactory (loader);
+ plugin_factory = new Tracker.PluginFactory (loader);
} catch (DBus.Error err) {
warning (_("Failed to start Tracker service: %s. Plugin disabled.") +
err.message);
}
}
-public class TrackerPluginFactory {
+public class Rygel.Tracker.PluginFactory {
private const string TRACKER_SERVICE = "org.freedesktop.Tracker1";
private const string STATISTICS_OBJECT =
"/org/freedesktop/Tracker1/Statistics";
- TrackerStatsIface stats;
+ StatsIface stats;
PluginLoader loader;
- public TrackerPluginFactory (PluginLoader loader) throws DBus.Error {
+ public PluginFactory (PluginLoader loader) throws DBus.Error {
var connection = DBus.Bus.get (DBus.BusType.SESSION);
- this.stats = connection.get_object (TRACKER_SERVICE,
- STATISTICS_OBJECT)
- as TrackerStatsIface;
+ this.stats = connection.get_object (TRACKER_SERVICE, STATISTICS_OBJECT)
+ as StatsIface;
this.loader = loader;
this.stats.get_statistics ();
- this.loader.add_plugin (new TrackerPlugin ());
+ this.loader.add_plugin (new Tracker.Plugin ());
}
}
diff --git a/src/plugins/tracker/rygel-tracker-plugin.vala b/src/plugins/tracker/rygel-tracker-plugin.vala
index 2bd240b..6b89c14 100644
--- a/src/plugins/tracker/rygel-tracker-plugin.vala
+++ b/src/plugins/tracker/rygel-tracker-plugin.vala
@@ -22,17 +22,17 @@
using Gee;
-public class Rygel.TrackerPlugin : Rygel.Plugin {
+public class Rygel.Tracker.Plugin : Rygel.Plugin {
// class-wide constants
private const string ICON = BuildConfig.DATA_DIR + // Path
"/icons/hicolor/48x48/apps/tracker.png";
- public TrackerPlugin () {
+ public Plugin () {
base.MediaServer ("Tracker",
// @REALNAME@ is substituted for user's real name
// and it doesn't need translation.
_("@REALNAME@'s media"),
- typeof (TrackerContentDirectory));
+ typeof (Tracker.ContentDirectory));
var icon_info = new IconInfo ("image/png");
diff --git a/src/plugins/tracker/rygel-tracker-query-triplet.vala b/src/plugins/tracker/rygel-tracker-query-triplet.vala
index e644892..6543102 100644
--- a/src/plugins/tracker/rygel-tracker-query-triplet.vala
+++ b/src/plugins/tracker/rygel-tracker-query-triplet.vala
@@ -25,30 +25,28 @@ using Gee;
/**
* Represents SPARQL Triplet
*/
-public class Rygel.TrackerQueryTriplet {
+public class Rygel.Tracker.QueryTriplet {
public string subject;
public string predicate;
public string obj;
- public TrackerQueryTriplet next;
+ public QueryTriplet next;
- public TrackerQueryTriplet (string subject,
- string predicate,
- string obj) {
+ public QueryTriplet (string subject, string predicate, string obj) {
this.subject = subject;
this.predicate = predicate;
this.obj = obj;
}
- public TrackerQueryTriplet.chain (string subject,
- string predicate,
- TrackerQueryTriplet next) {
+ public QueryTriplet.chain (string subject,
+ string predicate,
+ QueryTriplet next) {
this.subject = subject;
this.predicate = predicate;
this.next = next;
}
- public TrackerQueryTriplet.clone (TrackerQueryTriplet triplet) {
+ public QueryTriplet.clone (QueryTriplet triplet) {
this.subject = triplet.subject;
this.predicate = triplet.predicate;
@@ -59,8 +57,7 @@ public class Rygel.TrackerQueryTriplet {
}
}
- public static bool equal_func (TrackerQueryTriplet a,
- TrackerQueryTriplet b) {
+ public static bool equal_func (QueryTriplet a, QueryTriplet b) {
bool chain_equal;
if (a.next != null && b.next != null) {
diff --git a/src/plugins/tracker/rygel-tracker-query-triplets.vala b/src/plugins/tracker/rygel-tracker-query-triplets.vala
index 2d3e095..f25a55e 100644
--- a/src/plugins/tracker/rygel-tracker-query-triplets.vala
+++ b/src/plugins/tracker/rygel-tracker-query-triplets.vala
@@ -25,16 +25,16 @@ using Gee;
/**
* Represents a list of SPARQL Triplet
*/
-public class Rygel.TrackerQueryTriplets : ArrayList<TrackerQueryTriplet> {
- public TrackerQueryTriplets () {
- base ((EqualFunc) TrackerQueryTriplet.equal_func);
+public class Rygel.Tracker.QueryTriplets : ArrayList<QueryTriplet> {
+ public QueryTriplets () {
+ base ((EqualFunc) QueryTriplet.equal_func);
}
- public TrackerQueryTriplets.clone (TrackerQueryTriplets triplets) {
- base ((EqualFunc) TrackerQueryTriplet.equal_func);
+ public QueryTriplets.clone (QueryTriplets triplets) {
+ base ((EqualFunc) QueryTriplet.equal_func);
foreach (var triplet in triplets) {
- this.add (new TrackerQueryTriplet.clone (triplet));
+ this.add (new QueryTriplet.clone (triplet));
}
}
@@ -61,7 +61,7 @@ public class Rygel.TrackerQueryTriplets : ArrayList<TrackerQueryTriplet> {
// FIXME: Remove this method and override 'add' method from the base class
// instead once bug#623685 is fixed.
- public void add_triplet (TrackerQueryTriplet triplet) {
+ public void add_triplet (QueryTriplet triplet) {
if (!this.contains (triplet)) {
this.add (triplet);
}
diff --git a/src/plugins/tracker/rygel-tracker-query.vala b/src/plugins/tracker/rygel-tracker-query.vala
index b9db4ed..16ab833 100644
--- a/src/plugins/tracker/rygel-tracker-query.vala
+++ b/src/plugins/tracker/rygel-tracker-query.vala
@@ -25,14 +25,14 @@ using Gee;
/**
* Represents Tracker SPARQL query
*/
-public abstract class Rygel.TrackerQuery {
- public TrackerQueryTriplets triplets;
+public abstract class Rygel.Tracker.Query {
+ public QueryTriplets triplets;
- public TrackerQuery (TrackerQueryTriplets triplets) {
+ public Query (QueryTriplets triplets) {
this.triplets = triplets;
}
- public abstract async void execute (TrackerResourcesIface resources)
+ public abstract async void execute (ResourcesIface resources)
throws DBus.Error;
// Deriving classes should override this method and complete it by
diff --git a/src/plugins/tracker/rygel-tracker-root-container.vala b/src/plugins/tracker/rygel-tracker-root-container.vala
index 231544b..7662b67 100644
--- a/src/plugins/tracker/rygel-tracker-root-container.vala
+++ b/src/plugins/tracker/rygel-tracker-root-container.vala
@@ -29,20 +29,20 @@ using Gee;
/**
* Represents the root container for Tracker media content hierarchy.
*/
-public class Rygel.TrackerRootContainer : Rygel.SimpleContainer {
- public TrackerRootContainer (string title) {
+public class Rygel.Tracker.RootContainer : Rygel.SimpleContainer {
+ public RootContainer (string title) {
base.root (title);
if (this.get_bool_config_without_error ("share-music")) {
- this.add_child (new TrackerMusic ("Music", this, "Music"));
+ this.add_child (new Music ("Music", this, "Music"));
}
if (this.get_bool_config_without_error ("share-videos")) {
- this.add_child (new TrackerVideos ("Videos", this, "Videos"));
+ this.add_child (new Videos ("Videos", this, "Videos"));
}
if (this.get_bool_config_without_error ("share-pictures")) {
- this.add_child (new TrackerPictures ("Pictures", this, "Pictures"));
+ this.add_child (new Pictures ("Pictures", this, "Pictures"));
}
}
diff --git a/src/plugins/tracker/rygel-tracker-search-container.vala b/src/plugins/tracker/rygel-tracker-search-container.vala
index 1548cec..fff93fa 100644
--- a/src/plugins/tracker/rygel-tracker-search-container.vala
+++ b/src/plugins/tracker/rygel-tracker-search-container.vala
@@ -28,7 +28,7 @@ using Gee;
/**
* A container listing a Tracker search result.
*/
-public class Rygel.TrackerSearchContainer : Rygel.MediaContainer {
+public class Rygel.Tracker.SearchContainer : Rygel.MediaContainer {
/* class-wide constants */
private const string TRACKER_SERVICE = "org.freedesktop.Tracker1";
private const string RESOURCES_PATH = "/org/freedesktop/Tracker1/Resources";
@@ -39,17 +39,17 @@ public class Rygel.TrackerSearchContainer : Rygel.MediaContainer {
private const string URL_PREDICATE = "nie:url";
private const string URL_VARIABLE = "?url";
- public TrackerSelectionQuery query;
- public TrackerItemFactory item_factory;
+ public SelectionQuery query;
+ public ItemFactory item_factory;
- private TrackerResourcesIface resources;
+ private ResourcesIface resources;
- public TrackerSearchContainer (string id,
- MediaContainer parent,
- string title,
- TrackerItemFactory item_factory,
- TrackerQueryTriplets? triplets = null,
- ArrayList<string>? filters = null) {
+ public SearchContainer (string id,
+ MediaContainer parent,
+ string title,
+ ItemFactory item_factory,
+ QueryTriplets? triplets = null,
+ ArrayList<string>? filters = null) {
base (id, parent, title, 0);
this.item_factory = item_factory;
@@ -58,23 +58,22 @@ public class Rygel.TrackerSearchContainer : Rygel.MediaContainer {
variables.add (ITEM_VARIABLE);
variables.add (URL_VARIABLE);
- TrackerQueryTriplets our_triplets;
+ QueryTriplets our_triplets;
if (triplets != null) {
our_triplets = triplets;
} else {
- our_triplets = new TrackerQueryTriplets ();
+ our_triplets = new QueryTriplets ();
}
- our_triplets.add_triplet (new TrackerQueryTriplet (
- ITEM_VARIABLE,
- "a",
- item_factory.category));
- our_triplets.add_triplet (new TrackerQueryTriplet (ITEM_VARIABLE,
- MODIFIED_PREDICATE,
- MODIFIED_VARIABLE));
- our_triplets.add_triplet (new TrackerQueryTriplet (ITEM_VARIABLE,
- URL_PREDICATE,
- URL_VARIABLE));
+ our_triplets.add_triplet (new QueryTriplet (ITEM_VARIABLE,
+ "a",
+ item_factory.category));
+ our_triplets.add_triplet (new QueryTriplet (ITEM_VARIABLE,
+ MODIFIED_PREDICATE,
+ MODIFIED_VARIABLE));
+ our_triplets.add_triplet (new QueryTriplet (ITEM_VARIABLE,
+ URL_PREDICATE,
+ URL_VARIABLE));
foreach (var chain in this.item_factory.key_chains) {
var variable = ITEM_VARIABLE;
@@ -86,10 +85,10 @@ public class Rygel.TrackerSearchContainer : Rygel.MediaContainer {
variables.add (variable);
}
- this.query = new TrackerSelectionQuery (variables,
- our_triplets,
- filters,
- MODIFIED_VARIABLE);
+ this.query = new SelectionQuery (variables,
+ our_triplets,
+ filters,
+ MODIFIED_VARIABLE);
try {
this.create_proxies ();
@@ -161,7 +160,7 @@ public class Rygel.TrackerSearchContainer : Rygel.MediaContainer {
private async void get_children_count () {
try {
- var query = new TrackerSelectionQuery.clone (this.query);
+ var query = new SelectionQuery.clone (this.query);
query.variables = new ArrayList<string> ();
query.variables.add ("COUNT(" + ITEM_VARIABLE + ") AS x");
@@ -179,15 +178,15 @@ public class Rygel.TrackerSearchContainer : Rygel.MediaContainer {
}
}
- private TrackerSelectionQuery? create_query (SearchExpression expression,
- int offset,
- int max_count) {
+ private SelectionQuery? create_query (SearchExpression expression,
+ int offset,
+ int max_count) {
if (expression == null || !(expression is RelationalExpression)) {
return null;
}
var rel_expression = expression as RelationalExpression;
- var query = new TrackerSelectionQuery.clone (this.query);
+ var query = new SelectionQuery.clone (this.query);
if (rel_expression.operand1 == "@parentID") {
if (!rel_expression.compare_string (this.id)) {
@@ -272,9 +271,8 @@ public class Rygel.TrackerSearchContainer : Rygel.MediaContainer {
private void create_proxies () throws DBus.Error {
DBus.Connection connection = DBus.Bus.get (DBus.BusType.SESSION);
- this.resources = connection.get_object (TRACKER_SERVICE,
- RESOURCES_PATH)
- as TrackerResourcesIface;
+ this.resources = connection.get_object (TRACKER_SERVICE, RESOURCES_PATH)
+ as ResourcesIface;
}
/**
diff --git a/src/plugins/tracker/rygel-tracker-selection-query.vala b/src/plugins/tracker/rygel-tracker-selection-query.vala
index 5dfb7c8..e459bb2 100644
--- a/src/plugins/tracker/rygel-tracker-selection-query.vala
+++ b/src/plugins/tracker/rygel-tracker-selection-query.vala
@@ -25,7 +25,7 @@ using Gee;
/**
* Represents Tracker SPARQL Selection query
*/
-public class Rygel.TrackerSelectionQuery : Rygel.TrackerQuery {
+public class Rygel.Tracker.SelectionQuery : Query {
public ArrayList<string> variables;
public ArrayList<string> filters;
@@ -35,12 +35,12 @@ public class Rygel.TrackerSelectionQuery : Rygel.TrackerQuery {
public string[,] result;
- public TrackerSelectionQuery (ArrayList<string> variables,
- TrackerQueryTriplets triplets,
- ArrayList<string>? filters,
- string? order_by = null,
- int offset = 0,
- int max_count = -1) {
+ public SelectionQuery (ArrayList<string> variables,
+ QueryTriplets triplets,
+ ArrayList<string>? filters,
+ string? order_by = null,
+ int offset = 0,
+ int max_count = -1) {
base (triplets);
if (filters != null) {
@@ -55,16 +55,16 @@ public class Rygel.TrackerSelectionQuery : Rygel.TrackerQuery {
this.max_count = max_count;
}
- public TrackerSelectionQuery.clone (TrackerSelectionQuery query) {
+ public SelectionQuery.clone (SelectionQuery query) {
this (copy_str_list (query.variables),
- new TrackerQueryTriplets.clone (query.triplets),
+ new QueryTriplets.clone (query.triplets),
copy_str_list (query.filters),
query.order_by,
query.offset,
query.max_count);
}
- public override async void execute (TrackerResourcesIface resources)
+ public override async void execute (ResourcesIface resources)
throws DBus.Error {
var str = this.to_string ();
diff --git a/src/plugins/tracker/rygel-tracker-tags.vala b/src/plugins/tracker/rygel-tracker-tags.vala
index 96cefd3..2b2ebe9 100644
--- a/src/plugins/tracker/rygel-tracker-tags.vala
+++ b/src/plugins/tracker/rygel-tracker-tags.vala
@@ -28,13 +28,12 @@ using Gee;
/**
* Container listing all available tag labels in Tracker DB.
*/
-public class Rygel.TrackerTags : Rygel.TrackerMetadataValues {
+public class Rygel.Tracker.Tags : MetadataValues {
/* class-wide constants */
private const string TITLE = "Tags";
private const string[] KEY_CHAIN = { "nao:hasTag", "nao:prefLabel", null };
- public TrackerTags (MediaContainer parent,
- TrackerItemFactory item_factory) {
+ public Tags (MediaContainer parent, ItemFactory item_factory) {
base (parent.id + TITLE, parent, TITLE, item_factory, KEY_CHAIN);
}
}
diff --git a/src/plugins/tracker/rygel-tracker-video-item-factory.vala b/src/plugins/tracker/rygel-tracker-video-item-factory.vala
index cd115b7..3e1d366 100644
--- a/src/plugins/tracker/rygel-tracker-video-item-factory.vala
+++ b/src/plugins/tracker/rygel-tracker-video-item-factory.vala
@@ -26,7 +26,7 @@ using Gee;
/**
* Tracker video item factory.
*/
-public class Rygel.TrackerVideoItemFactory : Rygel.TrackerItemFactory {
+public class Rygel.Tracker.VideoItemFactory : ItemFactory {
private enum VideoMetadata {
HEIGHT = Metadata.LAST_KEY,
WIDTH,
@@ -37,7 +37,7 @@ public class Rygel.TrackerVideoItemFactory : Rygel.TrackerItemFactory {
private const string CATEGORY = "nmm:Video";
- public TrackerVideoItemFactory () {
+ public VideoItemFactory () {
base (CATEGORY,
MediaItem.VIDEO_CLASS,
VIDEO_RESOURCES_CLASS_PATH,
@@ -52,10 +52,10 @@ public class Rygel.TrackerVideoItemFactory : Rygel.TrackerItemFactory {
this.key_chains[VideoMetadata.DURATION].add ("nfo:duration");
}
- public override MediaItem create (string id,
- string uri,
- TrackerSearchContainer parent,
- string[] metadata)
+ public override MediaItem create (string id,
+ string uri,
+ SearchContainer parent,
+ string[] metadata)
throws GLib.Error {
var item = base.create (id, uri, parent, metadata);
diff --git a/src/plugins/tracker/rygel-tracker-videos.vala b/src/plugins/tracker/rygel-tracker-videos.vala
index 1395203..9ae8fec 100644
--- a/src/plugins/tracker/rygel-tracker-videos.vala
+++ b/src/plugins/tracker/rygel-tracker-videos.vala
@@ -26,14 +26,12 @@ using Gee;
/**
* Container listing video content hierarchy.
*/
-public class Rygel.TrackerVideos : Rygel.TrackerCategoryContainer {
- public TrackerVideos (string id,
- MediaContainer parent,
- string title) {
- base (id, parent, title, new TrackerVideoItemFactory ());
+public class Rygel.Tracker.Videos : CategoryContainer {
+ public Videos (string id, MediaContainer parent, string title) {
+ base (id, parent, title, new VideoItemFactory ());
- this.add_child (new TrackerTags (this, this.item_factory));
- this.add_child (new TrackerYears (this, this.item_factory));
+ this.add_child (new Tags (this, this.item_factory));
+ this.add_child (new Years (this, this.item_factory));
}
}
diff --git a/src/plugins/tracker/rygel-tracker-years.vala b/src/plugins/tracker/rygel-tracker-years.vala
index d7dc246..5bd0b84 100644
--- a/src/plugins/tracker/rygel-tracker-years.vala
+++ b/src/plugins/tracker/rygel-tracker-years.vala
@@ -26,11 +26,10 @@ using Gee;
/**
* Container listing content hierarchy by year of creation.
*/
-public class Rygel.TrackerYears : Rygel.TrackerMetadataValues {
+public class Rygel.Tracker.Years : MetadataValues {
private const string[] KEY_CHAIN = { "nie:contentCreated", null };
- public TrackerYears (MediaContainer parent,
- TrackerItemFactory item_factory) {
+ public Years (MediaContainer parent, ItemFactory item_factory) {
base (parent.id + "Year",
parent,
_("Year"),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]