summaryrefslogtreecommitdiff
path: root/mate-panel
diff options
context:
space:
mode:
authorDenis Gorodnichev <[email protected]>2023-05-17 06:56:21 +0300
committerGitHub <[email protected]>2023-05-17 03:56:21 +0000
commit277418cea7b011520df9759301d416cd51709564 (patch)
tree11b412b6aab737b8f22146ca67deac3e56737044 /mate-panel
parent1a16bc12de9b45637445ca53ec81cfe0a26c831f (diff)
downloadmate-panel-277418cea7b011520df9759301d416cd51709564.tar.bz2
mate-panel-277418cea7b011520df9759301d416cd51709564.tar.xz
tell dconf-edit about relocatable schemas (#1355)
* tell dconf-edit about relocatable schemas * self fix for incorrect and duplicated records remove duplicated schemas for currect path remove incorrect schemas for current path * remove clock applet hack * expose mate_panel_applet_settings_new to introspection add "transfer full" annotation to make this method available throught introspection
Diffstat (limited to 'mate-panel')
-rw-r--r--mate-panel/panel-profile.c47
1 files changed, 47 insertions, 0 deletions
diff --git a/mate-panel/panel-profile.c b/mate-panel/panel-profile.c
index 05da882e..47d6d95b 100644
--- a/mate-panel/panel-profile.c
+++ b/mate-panel/panel-profile.c
@@ -835,6 +835,52 @@ key_from_type (PanelGSettingsKeyType type) {
return NULL;
}
+static GVariant *
+remove_from_dict (GVariant *dict, const gchar *path)
+{
+ GVariantIter iter;
+ GVariantBuilder builder;
+
+ gchar *key;
+ gchar *value;
+
+ g_variant_builder_init (&builder, (const GVariantType *) "a{ss}");
+ g_variant_iter_init (&iter, dict);
+
+ while (g_variant_iter_next (&iter, "{ss}", &key, &value)) {
+ if ( g_strcmp0 (value, path) != 0) {
+ g_variant_builder_add (&builder, "{ss}", key, value);
+ }
+
+ g_free (key);
+ g_free (value);
+ }
+
+ return g_variant_ref_sink (g_variant_builder_end (&builder));
+}
+
+static void
+unregister_dconf_editor_relocatable_schema (const gchar *path)
+{
+ GSettings *dconf_editor_settings;
+ dconf_editor_settings = g_settings_new ("ca.desrt.dconf-editor.Settings");
+
+ if (dconf_editor_settings && g_settings_is_writable (dconf_editor_settings, "relocatable-schemas-user-paths")) {
+ GVariant *relocatable_schemas = g_settings_get_value (dconf_editor_settings, "relocatable-schemas-user-paths");
+
+ if (g_variant_is_of_type (relocatable_schemas, G_VARIANT_TYPE_DICTIONARY)) {
+ GVariant * new_relocatable_schemas = remove_from_dict (relocatable_schemas, path);
+ g_settings_set_value (dconf_editor_settings, "relocatable-schemas-user-paths", new_relocatable_schemas);
+ g_variant_unref (new_relocatable_schemas);
+ }
+
+ g_variant_unref (relocatable_schemas);
+ }
+
+ g_object_unref (dconf_editor_settings);
+}
+
+
void
panel_profile_add_to_list (PanelGSettingsKeyType type,
const char *id)
@@ -1345,6 +1391,7 @@ panel_profile_delete_dir (PanelGSettingsKeyType type,
gchar *subdir;
subdir = g_strdup_printf (PANEL_TOPLEVEL_PATH "%s/prefs/", id);
mate_dconf_recursive_reset (subdir, NULL);
+ unregister_dconf_editor_relocatable_schema (subdir);
g_free (subdir);
}