gnome-power-manager r2836 - in branches/gnome-2-22: . src



Author: rhughes
Date: Tue Jul  8 14:51:06 2008
New Revision: 2836
URL: http://svn.gnome.org/viewvc/gnome-power-manager?rev=2836&view=rev

Log:
2008-05-15  Richard Hughes  <richard hughsie com>

* src/gpm-conf.c: (gpm_conf_set_bool), (gpm_conf_set_string),
(gpm_conf_set_int):
Check keys for writability before we try to change them. Fixes rh#444026


Modified:
   branches/gnome-2-22/ChangeLog
   branches/gnome-2-22/src/gpm-conf.c

Modified: branches/gnome-2-22/src/gpm-conf.c
==============================================================================
--- branches/gnome-2-22/src/gpm-conf.c	(original)
+++ branches/gnome-2-22/src/gpm-conf.c	Tue Jul  8 14:51:06 2008
@@ -189,13 +189,18 @@
 	g_return_val_if_fail (GPM_IS_CONF (conf), FALSE);
 	g_return_val_if_fail (key != NULL, FALSE);
 
+	ret = gconf_client_key_is_writable (conf->priv->gconf_client, key, NULL);
+	if (!ret) {
+		gpm_debug ("%s not writable", key);
+		goto out;
+	}
 	gconf_client_set_bool (conf->priv->gconf_client, key, value, &error);
 	if (error) {
 		gpm_debug ("Error: %s", error->message);
 		g_error_free (error);
 		ret = FALSE;
 	}
-
+out:
 	return ret;
 }
 
@@ -221,13 +226,18 @@
 	g_return_val_if_fail (key != NULL, FALSE);
 	g_return_val_if_fail (value != NULL, FALSE);
 
+	ret = gconf_client_key_is_writable (conf->priv->gconf_client, key, NULL);
+	if (!ret) {
+		gpm_debug ("%s not writable", key);
+		goto out;
+	}
 	gconf_client_set_string (conf->priv->gconf_client, key, value, &error);
 	if (error) {
 		gpm_debug ("Error: %s", error->message);
 		g_error_free (error);
 		ret = FALSE;
 	}
-
+out:
 	return ret;
 }
 
@@ -250,13 +260,18 @@
 	g_return_val_if_fail (GPM_IS_CONF (conf), FALSE);
 	g_return_val_if_fail (key != NULL, FALSE);
 
+	ret = gconf_client_key_is_writable (conf->priv->gconf_client, key, NULL);
+	if (!ret) {
+		gpm_debug ("%s not writable", key);
+		goto out;
+	}
 	gconf_client_set_int (conf->priv->gconf_client, key, value, &error);
 	if (error) {
 		gpm_debug ("Error: %s", error->message);
 		g_error_free (error);
 		ret = FALSE;
 	}
-
+out:
 	return ret;
 }
 



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