network-manager-applet r693 - in trunk: . src/gconf-helpers



Author: dcbw
Date: Tue Apr 22 19:28:30 2008
New Revision: 693
URL: http://svn.gnome.org/viewvc/network-manager-applet?rev=693&view=rev

Log:
2008-04-22  Dan Williams  <dcbw redhat com>

	* src/gconf-helpers/gconf-helpers.c
		- (copy_one_setting_value_to_gconf): clear out values from gconf that
			are default values



Modified:
   trunk/ChangeLog
   trunk/src/gconf-helpers/gconf-helpers.c

Modified: trunk/src/gconf-helpers/gconf-helpers.c
==============================================================================
--- trunk/src/gconf-helpers/gconf-helpers.c	(original)
+++ trunk/src/gconf-helpers/gconf-helpers.c	Tue Apr 22 19:28:30 2008
@@ -1057,6 +1057,7 @@
 {
 	CopyOneSettingValueInfo *info = (CopyOneSettingValueInfo *) user_data;
 	GType type = G_VALUE_TYPE (value);
+	GParamSpec *pspec;
 
 	/* The 'name' key isn't written to GConf because it's pulled from the
 	 * gconf directory name instead.
@@ -1075,6 +1076,20 @@
 			return;
 	}
 
+	/* If the value is the default value, remove the item from GConf */
+	pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (setting), key);
+	if (pspec) {
+		if (g_param_value_defaults (pspec, (GValue *) value)) {
+		char *path;
+
+		path = g_strdup_printf ("%s/%s/%s", info->dir, setting->name, key);
+		if (path)
+			gconf_client_unset (info->client, path, NULL);
+		g_free (path);		
+		return;
+		}
+	}
+
 	if (type == G_TYPE_STRING) {
 		const char *str_val = g_value_get_string (value);
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]