[totem] grilo: Fix shutting down plugins



commit d5e7ee69d7c0daef69e23974c377a9a0f2236696
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 9db7869..a997c55 100644
--- a/src/plugins/grilo/totem-grilo.c
+++ b/src/plugins/grilo/totem-grilo.c
@@ -916,6 +916,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)
 {
@@ -1341,14 +1358,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);
 
        totem_grilo_clear_icons ();
 


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