[totem/wip/hadess/update-plugin-names: 1/2] plugins: Only write once to GSettings on startup



commit e3aa3373aeaf4917a28e83531b397b006fd39eca
Author: Bastien Nocera <hadess hadess net>
Date:   Sat Feb 23 17:09:39 2019 +0100

    plugins: Only write once to GSettings on startup
    
    On startup, coalesce the writes to GSettings into a single write when it
    syncs the builtin plugins list. This write would only happen on the
    first run, or any time the list of builtin plugins changes.
    
    Closes: #145

 data/org.gnome.totem.gschema.xml.in | 2 +-
 src/plugins/totem-plugins-engine.c  | 6 +++++-
 2 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/data/org.gnome.totem.gschema.xml.in b/data/org.gnome.totem.gschema.xml.in
index d2d0f221b..e4b65ef47 100644
--- a/data/org.gnome.totem.gschema.xml.in
+++ b/data/org.gnome.totem.gschema.xml.in
@@ -73,7 +73,7 @@
                        <summary>Whether to autoload text subtitle files when a movie is loaded</summary>
                </key>
                <key name="active-plugins" type="as">
-                       
<default>['skipto','chapters','screenshot','media_player_keys','screensaver','movie-properties','save-file']</default>
+                       <default>[]</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 62788e661..77750d74c 100644
--- a/src/plugins/totem-plugins-engine.c
+++ b/src/plugins/totem-plugins-engine.c
@@ -133,11 +133,14 @@ totem_plugins_engine_get_default (TotemObject *totem)
        g_signal_connect (engine->priv->activatable_extensions, "extension-removed",
                          G_CALLBACK (on_activatable_extension_removed), engine);
 
-       g_settings_bind (engine->priv->settings, "active-plugins", engine, "loaded-plugins", 
G_SETTINGS_BIND_DEFAULT | G_SETTINGS_BIND_NO_SENSITIVITY);
+       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));
 
+       g_object_freeze_notify (G_OBJECT (engine));
        for (l = plugin_infos; l != NULL; l = l->next) {
                PeasPluginInfo *plugin_info = PEAS_PLUGIN_INFO (l->data);
 
@@ -145,6 +148,7 @@ totem_plugins_engine_get_default (TotemObject *totem)
                        peas_engine_load_plugin (PEAS_ENGINE (engine), plugin_info);
                }
        }
+       g_object_thaw_notify (G_OBJECT (engine));
 
        return engine;
 }


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