diff options
-rw-r--r-- | mate-settings-daemon/mate-settings-manager.c | 38 | ||||
-rw-r--r-- | mate-settings-daemon/mate-settings-plugin-info.c | 26 | ||||
-rw-r--r-- | plugins/housekeeping/msd-disk-space.c | 1 | ||||
-rw-r--r-- | plugins/housekeeping/msd-ldsm-trash-empty.c | 1 |
4 files changed, 49 insertions, 17 deletions
diff --git a/mate-settings-daemon/mate-settings-manager.c b/mate-settings-daemon/mate-settings-manager.c index d0e38b2..a9c99ed 100644 --- a/mate-settings-daemon/mate-settings-manager.c +++ b/mate-settings-daemon/mate-settings-manager.c @@ -145,6 +145,23 @@ on_plugin_deactivated (MateSettingsPluginInfo *info, g_signal_emit (manager, signals [PLUGIN_DEACTIVATED], 0, name); } +static gboolean +is_item_in_schema (const char * const *items, + const char *item) +{ + while (*items) { + if (g_strcmp0 (*items++, item) == 0) + return TRUE; + } + return FALSE; +} + +static gboolean +is_schema (const char *schema) +{ + return is_item_in_schema (g_settings_list_schemas (), schema); +} + static void _load_file (MateSettingsManager *manager, const char *filename) @@ -171,16 +188,25 @@ _load_file (MateSettingsManager *manager, manager->priv->plugins = g_slist_prepend (manager->priv->plugins, g_object_ref (info)); - g_signal_connect (info, "activated", - G_CALLBACK (on_plugin_activated), manager); - g_signal_connect (info, "deactivated", - G_CALLBACK (on_plugin_deactivated), manager); - schema = g_strdup_printf ("%s.plugins.%s", DEFAULT_SETTINGS_PREFIX, mate_settings_plugin_info_get_location (info)); - mate_settings_plugin_info_set_schema (info, schema); + /* Ignore unknown schemas or else we'll assert */ + if (is_schema (schema)) { + manager->priv->plugins = g_slist_prepend (manager->priv->plugins, + g_object_ref (info)); + + g_signal_connect (info, "activated", + G_CALLBACK (on_plugin_activated), manager); + g_signal_connect (info, "deactivated", + G_CALLBACK (on_plugin_deactivated), manager); + + /* Also sets priority for plugins */ + mate_settings_plugin_info_set_schema (info, schema); + } else { + g_warning ("Ignoring unknown module '%s'", schema); + } g_free (schema); diff --git a/mate-settings-daemon/mate-settings-plugin-info.c b/mate-settings-daemon/mate-settings-plugin-info.c index 9936fb7..17bc0d6 100644 --- a/mate-settings-daemon/mate-settings-plugin-info.c +++ b/mate-settings-daemon/mate-settings-plugin-info.c @@ -117,7 +117,9 @@ mate_settings_plugin_info_finalize (GObject *object) g_free (info->priv->copyright); g_strfreev (info->priv->authors); - g_object_unref (info->priv->settings); + if (info->priv->settings != NULL) { + g_object_unref (info->priv->settings); + } G_OBJECT_CLASS (mate_settings_plugin_info_parent_class)->finalize (object); } @@ -288,8 +290,8 @@ mate_settings_plugin_info_fill_from_file (MateSettingsPluginInfo *info, } static void -plugin_enabled_cb (GSettings *settings, - gchar *key, +plugin_enabled_cb (GSettings *settings, + gchar *key, MateSettingsPluginInfo *info) { if (g_settings_get_boolean (info->priv->settings, key)) { @@ -596,11 +598,17 @@ void mate_settings_plugin_info_set_schema (MateSettingsPluginInfo *info, gchar *schema) { - g_return_if_fail (MATE_IS_SETTINGS_PLUGIN_INFO (info)); + int priority; + + g_return_if_fail (MATE_IS_SETTINGS_PLUGIN_INFO (info)); + + info->priv->settings = g_settings_new (schema); + info->priv->enabled = g_settings_get_boolean (info->priv->settings, "active"); + + priority = g_settings_get_int (info->priv->settings, "priority"); + if (priority > 0) + info->priv->priority = priority; - info->priv->settings = g_settings_new (schema); - info->priv->priority = g_settings_get_int(info->priv->settings, "priority"); - info->priv->enabled = g_settings_get_boolean(info->priv->settings, "active"); - - g_signal_connect (info->priv->settings, "changed::active", G_CALLBACK (plugin_enabled_cb), info); + g_signal_connect (G_OBJECT (info->priv->settings), "changed::active", + G_CALLBACK (plugin_enabled_cb), info); } diff --git a/plugins/housekeeping/msd-disk-space.c b/plugins/housekeeping/msd-disk-space.c index f419658..3065b39 100644 --- a/plugins/housekeeping/msd-disk-space.c +++ b/plugins/housekeeping/msd-disk-space.c @@ -35,7 +35,6 @@ #include <gio/gunixmounts.h> #include <gio/gio.h> #include <gtk/gtk.h> -#include <gio/gio.h> #include "msd-disk-space.h" #include "msd-ldsm-dialog.h" diff --git a/plugins/housekeeping/msd-ldsm-trash-empty.c b/plugins/housekeeping/msd-ldsm-trash-empty.c index e218d6d..af01aa1 100644 --- a/plugins/housekeeping/msd-ldsm-trash-empty.c +++ b/plugins/housekeeping/msd-ldsm-trash-empty.c @@ -18,7 +18,6 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include <gio/gio.h> #include <glib/gi18n.h> #include <gio/gio.h> |