Index: gconf/gconf-internals.h
===================================================================
--- gconf/gconf-internals.h	(révision 2711)
+++ gconf/gconf-internals.h	(copie de travail)
@@ -177,9 +177,6 @@ void   gconf_unquote_string_inplace (gch
                                      gchar       **end,
                                      GError      **err);
 
-GConfValue* gconf_value_decode (const gchar *encoded);
-gchar*      gconf_value_encode (GConfValue  *val);
-
 /*
  * List/pair conversion stuff
  */
Index: gconf/gconf-value.h
===================================================================
--- gconf/gconf-value.h	(révision 2711)
+++ gconf/gconf-value.h	(copie de travail)
@@ -112,6 +112,9 @@ gchar*      gconf_value_to_string
 int         gconf_value_compare              (const GConfValue* value_a,
                                               const GConfValue* value_b);
 
+GConfValue* gconf_value_decode               (const gchar *encoded);
+gchar*      gconf_value_encode               (GConfValue  *val);
+
 /* Meta-information about a key. Not the same as a schema; this is
  * information stored on the key, the schema is a specification
  * that may apply to this key.
Index: defaults/gconf-defaults.xml
===================================================================
--- defaults/gconf-defaults.xml	(révision 2711)
+++ defaults/gconf-defaults.xml	(copie de travail)
@@ -21,6 +21,23 @@
       <arg name="excludes" direction="in" type="as"/>
     </method>
 
+    <!--
+      path: a path to a gconf key
+      value: a value, as encoded by gconf_value_encode
+
+      Sets the key at path to value in the system-wide database.
+      To decide which PolicyKit privilege to require for the copying of
+      each path in includes, the mechanism looks for a privilege with an
+      annotation with key org.gnome.gconf.defaults.set-system.prefix whose
+      value is a prefix of the path. If no privilege is found this way, the
+      org.gnome.gconf.defaults.set-system privilege is required.
+    -->
+    <method name="SetSystemValue">
+      <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
+      <arg name="path"  direction="in" type="s"/>
+      <arg name="value" direction="in" type="s"/>
+    </method>
+
     <signal name="SystemSet">
       <arg name="keys" type="as"/>
     </signal>
@@ -45,6 +62,23 @@
     </method>
 
     <!--
+      path: a path to a gconf key
+      value: a value, as encoded by gconf_value_encode
+
+      Sets the key at path to value in the system-wide mandatory database.
+      To decide which PolicyKit privilege to require for the copying of
+      each path in includes, the mechanism looks for a privilege with an
+      annotation with key org.gnome.gconf.defaults.set-mandatory.prefix whose
+      value is a prefix of the path. If no privilege is found this way, the
+      org.gnome.gconf.defaults.set-mandatory privilege is required.
+    -->
+    <method name="SetMandatoryValue">
+      <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
+      <arg name="path"  direction="in" type="s"/>
+      <arg name="value" direction="in" type="s"/>
+    </method>
+
+    <!--
       Unsets keys in the system-wide mandatory GConf database, making the
       keys writable again. The subtree below each included path is copied 
       recursively, skipping the excluded subtrees.
Index: defaults/org.gnome.GConf.Defaults.conf
===================================================================
--- defaults/org.gnome.GConf.Defaults.conf	(révision 2711)
+++ defaults/org.gnome.GConf.Defaults.conf	(copie de travail)
@@ -9,14 +9,18 @@
   <policy user="root">
     <allow own="org.gnome.GConf.Defaults"/>
     <allow send_interface="org.gnome.GConf.Defaults.SetSystem"/>
+    <allow send_interface="org.gnome.GConf.Defaults.SetSystemValue"/>
     <allow send_interface="org.gnome.GConf.Defaults.SetMandatory"/>
+    <allow send_interface="org.gnome.GConf.Defaults.SetMandatoryValue"/>
     <allow send_interface="org.gnome.GConf.Defaults.UnsetMandatory"/>
   </policy>
 
   <!-- Allow anyone to invoke methods on the interfaces -->
   <policy context="default">
     <allow send_interface="org.gnome.GConf.Defaults.SetSystem"/>
+    <allow send_interface="org.gnome.GConf.Defaults.SetSystemValue"/>
     <allow send_interface="org.gnome.GConf.Defaults.SetMandatory"/>
+    <allow send_interface="org.gnome.GConf.Defaults.SetMandatoryValue"/>
     <allow send_interface="org.gnome.GConf.Defaults.UnsetMandatory"/>
   </policy>
 
Index: defaults/gconf-defaults.c
===================================================================
--- defaults/gconf-defaults.c	(révision 2711)
+++ defaults/gconf-defaults.c	(copie de travail)
@@ -594,17 +594,12 @@ append_key (GConfChangeSet *cs,
 	g_ptr_array_add (keys, (gpointer) key);
 }
 
-void
-gconf_defaults_set_system (GConfDefaults          *mechanism,
-			   const char            **includes,
-			   const char            **excludes,
-			   DBusGMethodInvocation  *context)
+static void
+emit_system_set_signal (GConfDefaults  *mechanism,
+                        GConfChangeSet *changes)
 {
-	GConfChangeSet *changes = NULL;
 	GPtrArray *keys;
 
-	do_copy (mechanism, FALSE, includes, excludes, context, &changes);
-
 	if (!changes)
 		return;
 
@@ -615,6 +610,19 @@ gconf_defaults_set_system (GConfDefaults
 	g_signal_emit (mechanism, signals[SYSTEM_SET], 0, keys->pdata);
 
 	g_ptr_array_free (keys, TRUE);
+}
+
+void
+gconf_defaults_set_system (GConfDefaults          *mechanism,
+			   const char            **includes,
+			   const char            **excludes,
+			   DBusGMethodInvocation  *context)
+{
+	GConfChangeSet *changes = NULL;
+
+	do_copy (mechanism, FALSE, includes, excludes, context, &changes);
+
+        emit_system_set_signal (mechanism, changes);
 	gconf_change_set_unref (changes);
 }
 
@@ -624,7 +632,121 @@ gconf_defaults_set_mandatory (GConfDefau
                               const char            **excludes,
                               DBusGMethodInvocation  *context)
 {
-	do_copy (mechanism, TRUE, includes, excludes, context, NULL);
+	do_copy (mechanism, FALSE, includes, excludes, context, NULL);
+}
+
+static void
+do_set_value (GConfDefaults          *mechanism,
+              gboolean                mandatory,
+              const char             *path,
+              const char             *value,
+              DBusGMethodInvocation  *context,
+              GConfChangeSet        **changeset_out)
+{
+	GConfClient *dest = NULL;
+	GConfChangeSet *changes = NULL;
+	GConfEngine *engine;
+	GConfValue *gvalue;
+	GError *error;
+	GError *error2;
+	const char *action;
+	const char *annotation_key;
+	const char *default_action;
+	const char *dest_address;
+
+	if (changeset_out)
+		*changeset_out = NULL;
+
+        stop_killtimer ();
+
+	/* check privileges for each include */
+	if (mandatory) {
+		annotation_key = "org.gnome.gconf.defaults.set-mandatory.prefix"; 
+		default_action = "org.gnome.gconf.defaults.set-mandatory";
+		dest_address = "xml:merged:/etc/gconf/gconf.xml.mandatory";
+	}
+	else {
+		annotation_key = "org.gnome.gconf.defaults.set-system.prefix"; 
+		default_action = "org.gnome.gconf.defaults.set-system";
+		dest_address = "xml:merged:/etc/gconf/gconf.xml.system";
+	}
+
+        action = polkit_action_for_gconf_path (mechanism, annotation_key, path);
+        if (action == NULL) 
+                action = default_action;
+
+        if (!check_polkit_for_action (mechanism, context, action)) 
+                goto out;
+
+	error = NULL;
+	engine = gconf_engine_get_local (dest_address, &error);
+	if (error) 
+		goto cleanup;	
+
+	dest = gconf_client_get_for_engine (engine);
+	gconf_engine_unref (engine);
+
+	changes = gconf_change_set_new ();
+
+	gvalue = gconf_value_decode (value);
+	if (!gvalue)
+                goto cleanup;
+
+        gconf_change_set_set (changes, path, gvalue);
+        gconf_value_free (gvalue);
+
+        gconf_client_commit_change_set (dest, changes, FALSE, &error);
+        gconf_client_suggest_sync (dest, NULL);
+
+	if (changeset_out) {
+		*changeset_out = changes;
+		changes = NULL;
+	}
+
+cleanup:
+	if (changes)
+		gconf_change_set_unref (changes);
+	if (dest) 
+		g_object_unref (dest);
+
+	if (error) {
+		g_print ("failed to set GConf values:  %s\n", error->message);
+		error2 = g_error_new_literal (GCONF_DEFAULTS_ERROR,
+					      GCONF_DEFAULTS_ERROR_GENERAL,
+					      error->message);
+		g_error_free (error);
+
+		dbus_g_method_return_error (context, error2);
+		g_error_free (error2);
+	}
+	else
+        	dbus_g_method_return (context);
+
+out:
+	start_killtimer ();
+}
+
+void
+gconf_defaults_set_system_value (GConfDefaults         *mechanism,
+                                 const char            *path,
+                                 const char            *value,
+                                 DBusGMethodInvocation *context)
+{
+	GConfChangeSet *changes = NULL;
+
+	do_set_value (mechanism, FALSE, path, value, context, &changes);
+
+        emit_system_set_signal (mechanism, changes);
+	gconf_change_set_unref (changes);
+}
+
+void
+gconf_defaults_set_mandatory_value (GConfDefaults         *mechanism,
+                                    const char            *path,
+                                    const char            *value,
+                                    DBusGMethodInvocation *context)
+{
+	do_set_value (mechanism, TRUE, path, value, context, NULL);
 }
 
 static void
Index: defaults/gconf-defaults.h
===================================================================
--- defaults/gconf-defaults.h	(révision 2711)
+++ defaults/gconf-defaults.h	(copie de travail)
@@ -68,20 +68,30 @@ GType          gconf_defaults_get_type
 GConfDefaults *gconf_defaults_new            (void);
 
 /* exported methods */
-void           gconf_defaults_set_system        (GConfDefaults          *mechanism,
-                                                 const char            **includes,
-                                                 const char            **excludes,
-                                                 DBusGMethodInvocation  *context);
-
-void           gconf_defaults_set_mandatory     (GConfDefaults          *mechanism,
-                                                 const char            **includes,
-                                                 const char            **excludes,
-                                                 DBusGMethodInvocation  *context);
-
-void           gconf_defaults_unset_mandatory   (GConfDefaults          *mechanism,
-                                                 const char            **includes,
-                                                 const char            **excludes,
-                                                 DBusGMethodInvocation  *context);
+void           gconf_defaults_set_system          (GConfDefaults          *mechanism,
+                                                   const char            **includes,
+                                                   const char            **excludes,
+                                                   DBusGMethodInvocation  *context);
+
+void           gconf_defaults_set_system_value    (GConfDefaults          *mechanism,
+                                                   const char             *path,
+                                                   const char             *value,
+                                                   DBusGMethodInvocation  *context);
+
+void           gconf_defaults_set_mandatory       (GConfDefaults          *mechanism,
+                                                   const char            **includes,
+                                                   const char            **excludes,
+                                                   DBusGMethodInvocation  *context);
+
+void           gconf_defaults_set_mandatory_value (GConfDefaults          *mechanism,
+                                                   const char             *path,
+                                                   const char             *value,
+                                                   DBusGMethodInvocation  *context);
+
+void           gconf_defaults_unset_mandatory     (GConfDefaults          *mechanism,
+                                                   const char            **includes,
+                                                   const char            **excludes,
+                                                   DBusGMethodInvocation  *context);
 
 G_END_DECLS
 
