[totem] main: Hidden config to add filesystem paths to channels



commit 053b121302b72bd0c510919d2805775b3f083994
Author: Bastien Nocera <hadess hadess net>
Date:   Fri Jan 31 17:09:13 2014 +0100

    main: Hidden config to add filesystem paths to channels
    
    This will allow people that don't want to use Tracker, to still
    have some videos to use totem with.

 data/org.gnome.totem.gschema.xml.in.in |    5 +++++
 src/totem-grilo.c                      |   32 ++++++++++++++++++++++++++++++--
 2 files changed, 35 insertions(+), 2 deletions(-)
---
diff --git a/data/org.gnome.totem.gschema.xml.in.in b/data/org.gnome.totem.gschema.xml.in.in
index 72da8e7..401aef3 100644
--- a/data/org.gnome.totem.gschema.xml.in.in
+++ b/data/org.gnome.totem.gschema.xml.in.in
@@ -98,5 +98,10 @@
                        <_summary>Active plugins list</_summary>
                        <_description>A list of the names of the plugins which are currently active (loaded 
and running).</_description>
                </key>
+               <key name="filesystem-paths" type="as">
+                       <default>[]</default>
+                       <_summary>Directories to show</_summary>
+                       <_description>Directories to show in the browse interface, none by 
default</_description>
+               </key>
        </schema>
 </schemalist>
diff --git a/src/totem-grilo.c b/src/totem-grilo.c
index 62ae9c7..1a4f509 100644
--- a/src/totem-grilo.c
+++ b/src/totem-grilo.c
@@ -60,6 +60,7 @@ struct _TotemGriloPrivate {
 
        GrlSource *local_metadata_src;
        GrlSource *metadata_store_src;
+       gboolean fs_plugin_configured;
 
        /* Current media selected in results*/
        GrlMedia *selected_media;
@@ -966,7 +967,6 @@ source_is_blacklisted (GrlSource *source)
        const char *id;
        const char const *sources[] = {
                "grl-bookmarks",
-               "grl-filesystem",
                "grl-shoutcast",
                "grl-flickr",
                "grl-podcasts",
@@ -1168,16 +1168,26 @@ source_added_cb (GrlRegistry *registry,
 
        self = TOTEM_GRILO (user_data);
        id = grl_source_get_id (source);
+
+       /* The filesystem plugin */
+       if (g_str_equal (id, "grl-filesystem") &&
+           self->priv->fs_plugin_configured == FALSE) {
+               return;
+       }
+
+       /* The local search source */
        if (g_str_equal (id, "grl-tracker-source"))
                name = _("Local");
        else
                name = grl_source_get_name (source);
+
+       /* Metadata */
        if (g_str_equal (id, "grl-local-metadata"))
                self->priv->local_metadata_src = source;
        else if (g_str_equal (id, "grl-metadata-store"))
                self->priv->metadata_store_src = source;
-       ops = grl_source_supported_operations (source);
 
+       ops = grl_source_supported_operations (source);
        if (ops & GRL_OP_BROWSE) {
                gboolean monitor = FALSE;
 
@@ -1277,9 +1287,27 @@ load_grilo_plugins (TotemGrilo *self)
 {
        GrlRegistry *registry;
        GError *error = NULL;
+       GSettings *settings;
+       char **configs;
+       guint i;
 
        registry = grl_registry_get_default ();
 
+       /* Check if there's filesystems to show */
+       settings = g_settings_new ("org.gnome.totem");
+       configs = g_settings_get_strv (settings, "filesystem-paths");
+       g_object_unref (settings);
+
+       for (i = 0; configs[i] != NULL; i++) {
+               GrlConfig *config;
+
+               config = grl_config_new ("grl-filesystem", NULL);
+               grl_config_set_string (config, "base-uri", configs[i]);
+               grl_registry_add_config (registry, config, NULL);
+               self->priv->fs_plugin_configured = TRUE;
+       }
+       g_strfreev (configs);
+
        g_signal_connect (registry, "source-added",
                          G_CALLBACK (source_added_cb), self);
        g_signal_connect (registry, "source-removed",


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