[totem/gnome-3-10] grilo: Fix shutting down plugins



commit 2224d7a1c3ae80b0c0e26edd947a3be8da61e838
Author: Bastien Nocera <hadess hadess net>
Date:   Mon Nov 4 12:05:37 2013 +0100

    grilo: Fix shutting down plugins
    
    We were only unregistering sources, which isn't enough for
    the plugins to get unloaded, and all their resources removed.
    This was causing plugin cache directories not to be removed.

 src/plugins/grilo/totem-grilo.c |   27 +++++++++++++++++++--------
 1 files changed, 19 insertions(+), 8 deletions(-)
---
diff --git a/src/plugins/grilo/totem-grilo.c b/src/plugins/grilo/totem-grilo.c
index dd304c1..f489df3 100644
--- a/src/plugins/grilo/totem-grilo.c
+++ b/src/plugins/grilo/totem-grilo.c
@@ -954,6 +954,23 @@ load_grilo_plugins (TotemGriloPlugin *self)
        }
 }
 
+static void
+unload_grilo_plugins (TotemGriloPlugin *self)
+{
+       GrlRegistry *registry;
+       GList *l, *plugins;
+
+       registry = grl_registry_get_default ();
+       plugins = grl_registry_get_plugins (registry, TRUE);
+
+       for (l = plugins; l != NULL; l = l->next) {
+               GrlPlugin *plugin = l->data;
+               grl_registry_unload_plugin (registry, grl_plugin_get_id (plugin), NULL);
+       }
+
+       g_list_free (plugins);
+}
+
 static gboolean
 show_popup_menu (TotemGriloPlugin *self, GtkWidget *view, GdkEventButton *event)
 {
@@ -1344,14 +1361,8 @@ impl_deactivate (PeasActivatable *plugin)
        g_signal_handlers_disconnect_by_func (registry, source_added_cb, self);
        g_signal_handlers_disconnect_by_func (registry, source_removed_cb, self);
 
-       /* Shutdown all sources */
-       sources  = grl_registry_get_sources (registry, FALSE);
-       for (s = sources; s; s = g_list_next (s)) {
-               grl_registry_unregister_source (registry,
-                                               GRL_SOURCE (s->data),
-                                               NULL);
-       }
-       g_list_free (sources);
+       /* Shutdown all plugins */
+       unload_grilo_plugins (self);
 
        /* Empty results */
        gtk_tree_store_clear (GTK_TREE_STORE (self->priv->browser_model));


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