1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
|
$NetBSD: patch-ae,v 1.4 2004/05/03 20:55:36 jmmv Exp $
--- gconf/gconftool.c.orig 2004-04-05 21:07:34.000000000 +0200
+++ gconf/gconftool.c
@@ -59,6 +59,7 @@ static char* long_desc = NULL;
static char* owner = NULL;
static char* schema_file = NULL;
static char* entry_file = NULL;
+static char* unload_entry_file = NULL;
static const char* config_source = NULL;
static int use_local_source = FALSE;
static int makefile_install_mode = FALSE;
@@ -167,6 +168,15 @@ struct poptOption options[] = {
NULL
},
{
+ "unload",
+ '\0',
+ POPT_ARG_STRING,
+ &unload_entry_file,
+ 0,
+ N_("Unload a set of values described in an XML file."),
+ NULL
+ },
+ {
"recursive-list",
'R',
POPT_ARG_NONE,
@@ -838,6 +848,18 @@ main (int argc, char** argv)
return retval;
}
+ if (unload_entry_file != NULL)
+ {
+ const gchar** args = poptGetArgs(ctx);
+ gint retval;
+
+ retval = do_load_file(conf, LOAD_ENTRY_FILE, unload_entry_file, args);
+
+ gconf_engine_unref(conf);
+
+ return retval;
+ }
+
if (spawn_gconfd)
{
do_spawn_daemon(conf);
@@ -2769,30 +2791,29 @@ set_values(GConfEngine* conf, const gcha
else
full_key = g_strdup(key);
- if (schema_key)
+ if (unload_entry_file != NULL || schema_key)
{
- gchar* full_schema_key;
+ gchar* full_schema_key = NULL;
+ GError* error = NULL;
- if (base_dir && *schema_key != '/')
- full_schema_key = gconf_concat_dir_and_key(base_dir, schema_key);
- else
- full_schema_key = g_strdup(schema_key);
+ if (unload_entry_file == NULL)
+ {
+ if (base_dir && *schema_key != '/')
+ full_schema_key = gconf_concat_dir_and_key(base_dir, schema_key);
+ else
+ full_schema_key = g_strdup(schema_key);
+ }
- if (full_schema_key)
+ if (!gconf_engine_associate_schema(conf, full_key, full_schema_key, &error))
{
- GError* error = NULL;
-
- if (!gconf_engine_associate_schema(conf, full_key, full_schema_key, &error))
- {
- g_assert(error != NULL);
+ g_assert(error != NULL);
- g_printerr (_("WARNING: failed to associate schema `%s' with key `%s': %s\n"),
- full_schema_key, full_key, error->message);
- g_error_free(error);
- }
+ g_printerr (_("WARNING: failed to associate schema `%s' with key `%s': %s\n"),
+ full_schema_key, full_key, error->message);
+ g_error_free(error);
+ }
- g_free(full_schema_key);
- }
+ g_free(full_schema_key);
}
tmp = values;
@@ -2802,7 +2823,10 @@ set_values(GConfEngine* conf, const gcha
GError* error;
error = NULL;
- gconf_engine_set(conf, full_key, value, &error);
+ if (unload_entry_file != NULL)
+ gconf_engine_unset(conf, full_key, &error);
+ else
+ gconf_engine_set(conf, full_key, value, &error);
if (error != NULL)
{
g_printerr (_("Error setting value: %s\n"), error->message);
@@ -3318,7 +3342,7 @@ process_key_list(GConfEngine* conf, cons
GSList* tmp;
GError* error = NULL;
- if (makefile_uninstall_mode)
+ if (makefile_uninstall_mode || unload_entry_file != NULL)
{
schema_name = NULL;
}
@@ -3515,7 +3539,7 @@ process_schema(GConfEngine* conf, xmlNod
hash_foreach_info.conf = conf;
hash_foreach_info.key = schema_key;
- if (makefile_uninstall_mode)
+ if (makefile_uninstall_mode || unload_entry_file != NULL)
g_hash_table_foreach(schemas_hash, hash_uninstall_foreach, &hash_foreach_info);
else
g_hash_table_foreach(schemas_hash, hash_install_foreach, &hash_foreach_info);
|