static void unset_tree (GConfClient *dest, const char *path, GConfChangeSet *changes, const char **excludes) { GSList *list, *l; GConfEntry *entry; if (path_is_excluded (path, excludes)) return; list = gconf_client_all_entries (dest, path, NULL); for (l = list; l; l = l->next) { entry = l->data; if (!path_is_excluded (entry->key, excludes)) gconf_change_set_unset (changes, entry->key); } g_slist_foreach (list, (GFunc)gconf_entry_free, NULL); g_slist_free (list); list = gconf_client_all_dirs (dest, path, NULL); for (l = list; l; l = l->next) unset_tree (dest, (const char *)l->data, changes, excludes); g_slist_foreach (list, (GFunc)g_free, NULL); g_slist_free (list); }
static void unset_entry (GConfClient *dest, const char *path, GConfChangeSet *changes, const char **excludes) { if (path_is_excluded (path, excludes)) return; gconf_change_set_unset (changes, path); }
static void nautilus_file_background_write_desktop_default_settings (void) { /* We just unset all the gconf keys so they go back to * defaults */ GConfClient *client; GConfChangeSet *set; client = gconf_client_get_default (); set = gconf_change_set_new (); /* the list of keys here has to be kept in sync with libgnome * schemas, which isn't the most maintainable thing ever. */ gconf_change_set_unset (set, "/desktop/gnome/background/picture_options"); gconf_change_set_unset (set, "/desktop/gnome/background/picture_filename"); gconf_change_set_unset (set, "/desktop/gnome/background/picture_opacity"); gconf_change_set_unset (set, "/desktop/gnome/background/primary_color"); gconf_change_set_unset (set, "/desktop/gnome/background/secondary_color"); gconf_change_set_unset (set, "/desktop/gnome/background/color_shading_type"); /* this isn't atomic yet so it'll be a bit inefficient, but * someday it might be atomic. */ gconf_client_commit_change_set (client, set, FALSE, NULL); gconf_change_set_unref (set); g_object_unref (G_OBJECT (client)); }
static void config_entry_changed_callback(GtkWidget* entry, gpointer data) { GtkWidget* prefs_dialog = data; GConfChangeSet* cs; gchar* text; const gchar* key; cs = prefs_dialog_get_change_set(prefs_dialog); text = gtk_editable_get_chars(GTK_EDITABLE(entry), 0, -1); key = g_object_get_data(entry, "key"); /* Unset if the string is zero-length, otherwise set */ if (*text != '\0') gconf_change_set_set_string(cs, key, text); else gconf_change_set_unset(cs, key); g_free(text); prefs_dialog_update_sensitivity(prefs_dialog); }