[totem] Revert "plugins: Don't save builtin plugins to GSettings"



commit 54215692596b3187bbed5d4aa52f9bf9395629b0
Author: Bastien Nocera <hadess hadess net>
Date:   Fri Mar 11 20:03:07 2016 +0100

    Revert "plugins: Don't save builtin plugins to GSettings"
    
    This reverts commit f0c645c7c33867be239a0f637909fa8314e53d92.
    
    It caused builtin plugins not to get loaded.
    
    See https://bugzilla.gnome.org/show_bug.cgi?id=749722

 data/org.gnome.totem.gschema.xml.in |    2 +-
 src/plugins/totem-plugins-engine.c  |   72 ++++++----------------------------
 2 files changed, 14 insertions(+), 60 deletions(-)
---
diff --git a/data/org.gnome.totem.gschema.xml.in b/data/org.gnome.totem.gschema.xml.in
index 847b01c..15ed617 100644
--- a/data/org.gnome.totem.gschema.xml.in
+++ b/data/org.gnome.totem.gschema.xml.in
@@ -77,7 +77,7 @@
                        <summary>Whether to autoload external chapter files when a movie is loaded</summary>
                </key>
                <key name="active-plugins" type="as">
-                       <default>[]</default>
+                       
<default>['skipto','chapters','screenshot','media_player_keys','screensaver','movie-properties','save-file']</default>
                        <summary>Active plugins list</summary>
                        <description>A list of the names of the plugins which are currently active (loaded 
and running).</description>
                </key>
diff --git a/src/plugins/totem-plugins-engine.c b/src/plugins/totem-plugins-engine.c
index 24d1f74..37744d6 100644
--- a/src/plugins/totem-plugins-engine.c
+++ b/src/plugins/totem-plugins-engine.c
@@ -93,65 +93,13 @@ on_activatable_extension_removed (PeasExtensionSet *set,
        peas_activatable_deactivate (PEAS_ACTIVATABLE (exten));
 }
 
-static gboolean
-get_active_plugins_mapping (GValue   *value,
-                           GVariant *variant,
-                           gpointer  user_data)
-{
-       TotemPluginsEngine *engine = user_data;
-       GPtrArray *plugins;
-       const GList *list;
-       GVariantIter it;
-       gchar *name;
-
-       plugins = g_ptr_array_new ();
-
-       for (list = peas_engine_get_plugin_list (PEAS_ENGINE (engine)); list; list = list->next) {
-               PeasPluginInfo *info = list->data;
-               if (peas_plugin_info_is_builtin (info))
-                       g_ptr_array_add (plugins, g_strdup (peas_plugin_info_get_name (info)));
-       }
-
-       g_variant_iter_init (&it, variant);
-       while (g_variant_iter_next (&it, "s", &name))
-               g_ptr_array_add (plugins, name); /* consumes name */
-
-       g_ptr_array_add (plugins, NULL);
-
-       g_value_take_boxed (value, g_ptr_array_free (plugins, FALSE));
-       return TRUE;
-}
-
-static GVariant *
-set_active_plugins_mapping (const GValue       *value,
-                           const GVariantType *expected_type,
-                           gpointer            user_data)
-{
-       TotemPluginsEngine *engine = user_data;
-       gchar **loaded_plugins;
-       GVariantBuilder builder;
-       gint i;
-
-       loaded_plugins = g_value_get_boxed (value);
-       g_variant_builder_init (&builder, G_VARIANT_TYPE ("as"));
-
-       for (i = 0; loaded_plugins[i]; i++) {
-               PeasPluginInfo *info;
-
-               info = peas_engine_get_plugin_info (PEAS_ENGINE (engine), loaded_plugins[i]);
-               if (!peas_plugin_info_is_builtin (info))
-                       g_variant_builder_add (&builder, "s", loaded_plugins[i]);
-       }
-
-       return g_variant_ref_sink (g_variant_builder_end (&builder));
-}
-
 TotemPluginsEngine *
 totem_plugins_engine_get_default (TotemObject *totem)
 {
        static TotemPluginsEngine *engine = NULL;
        char **paths;
        guint i;
+       const GList *plugin_infos, *l;
 
        if (G_LIKELY (engine != NULL))
                return g_object_ref (engine);
@@ -190,12 +138,18 @@ totem_plugins_engine_get_default (TotemObject *totem)
        g_signal_connect (engine->priv->activatable_extensions, "extension-removed",
                          G_CALLBACK (on_activatable_extension_removed), engine);
 
-       /* bind to settings, but don't write out built-in plugins */
-       g_settings_bind_with_mapping (engine->priv->settings, "active-plugins",
-                                     engine, "loaded-plugins",
-                                     G_SETTINGS_BIND_DEFAULT | G_SETTINGS_BIND_NO_SENSITIVITY,
-                                     get_active_plugins_mapping, set_active_plugins_mapping,\
-                                     g_object_ref (engine), g_object_unref);
+       g_settings_bind (engine->priv->settings, "active-plugins", engine, "loaded-plugins", 
G_SETTINGS_BIND_DEFAULT | G_SETTINGS_BIND_NO_SENSITIVITY);
+
+       /* Load builtin plugins */
+       plugin_infos = peas_engine_get_plugin_list (PEAS_ENGINE (engine));
+
+       for (l = plugin_infos; l != NULL; l = l->next) {
+               PeasPluginInfo *plugin_info = PEAS_PLUGIN_INFO (l->data);
+
+               if (peas_plugin_info_is_builtin (plugin_info)) {
+                       peas_engine_load_plugin (PEAS_ENGINE (engine), plugin_info);
+               }
+       }
 
        return engine;
 }


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