[Xfce4-commits] <xfce4-panel:xfce-4.8> Fix assert when storing property values in xfconf (bug #7117).

Nick Schermer noreply at xfce.org
Sat Jan 29 21:26:02 CET 2011


Updating branch refs/heads/xfce-4.8
         to 8b0c024c435b2cab825ceb2661e2589145e3b5ee (commit)
       from e43a35fe1422572a300c7c06e3867a913605ea30 (commit)

commit 8b0c024c435b2cab825ceb2661e2589145e3b5ee
Author: Nick Schermer <nick at xfce.org>
Date:   Tue Jan 18 13:10:03 2011 +0100

    Fix assert when storing property values in xfconf (bug #7117).

 common/panel-xfconf.c |   21 ++++++++++++++++++++-
 1 files changed, 20 insertions(+), 1 deletions(-)

diff --git a/common/panel-xfconf.c b/common/panel-xfconf.c
index b43809b..451dd18 100644
--- a/common/panel-xfconf.c
+++ b/common/panel-xfconf.c
@@ -36,6 +36,8 @@ panel_properties_store_value (XfconfChannel *channel,
                               const gchar   *object_property)
 {
   GValue      value = { 0, };
+  GdkColor   *color;
+  guint16     alpha = 0xffff;
 #ifndef NDEBUG
   GParamSpec *pspec;
 #endif
@@ -53,7 +55,24 @@ panel_properties_store_value (XfconfChannel *channel,
   /* write the property to the xfconf channel */
   g_value_init (&value, xfconf_property_type);
   g_object_get_property (G_OBJECT (object), object_property, &value);
-  xfconf_channel_set_property (channel, xfconf_property, &value);
+
+  if (G_LIKELY (xfconf_property_type != GDK_TYPE_COLOR))
+    {
+      xfconf_channel_set_property (channel, xfconf_property, &value);
+    }
+  else
+    {
+      /* work around xfconf's lack of storing colors (bug #7117) and
+       * do the same as xfconf_g_property_bind_gdkcolor() does */
+      color = g_value_get_boxed (&value);
+      xfconf_channel_set_array (channel, xfconf_property,
+                                XFCONF_TYPE_UINT16, &color->red,
+                                XFCONF_TYPE_UINT16, &color->green,
+                                XFCONF_TYPE_UINT16, &color->blue,
+                                XFCONF_TYPE_UINT16, &alpha,
+                                G_TYPE_INVALID);
+    }
+
   g_value_unset (&value);
 }
 



More information about the Xfce4-commits mailing list