[Xfce4-commits] <xfce4-cpugraph-plugin:master> use gdk_color_to_string() instead of handcrafting color codes when saving them

Landry Breuil noreply at xfce.org
Sun Jun 24 21:28:01 CEST 2012


Updating branch refs/heads/master
         to 9b7a70384962f4ada26b09342e8460c61c727b00 (commit)
       from cd8aff8ee7055ee32444aa38a7ebf3eac1ff5d84 (commit)

commit 9b7a70384962f4ada26b09342e8460c61c727b00
Author: Landry Breuil <landry at xfce.org>
Date:   Sun Jun 24 21:26:13 2012 +0200

    use gdk_color_to_string() instead of handcrafting color codes when saving them

 panel-plugin/settings.c |   16 +++++-----------
 1 files changed, 5 insertions(+), 11 deletions(-)

diff --git a/panel-plugin/settings.c b/panel-plugin/settings.c
index ca82cf1..bec6585 100644
--- a/panel-plugin/settings.c
+++ b/panel-plugin/settings.c
@@ -150,7 +150,6 @@ void read_settings( XfcePanelPlugin * plugin, CPUGraph * base )
 
 void write_settings( XfcePanelPlugin *plugin, CPUGraph *base )
 {
-	char value[10];
 	XfceRc *rc;
 	char *file;
 
@@ -176,15 +175,10 @@ void write_settings( XfcePanelPlugin *plugin, CPUGraph *base )
 	xfce_rc_write_int_entry( rc, "StartupNotification", base->startup_notification );
 	xfce_rc_write_int_entry( rc, "ColorMode", base->color_mode );
 
-	g_snprintf( value, 8, "#%02X%02X%02X", base->colors[1].red >> 8, base->colors[1].green >> 8, base->colors[1].blue >> 8 );
-	xfce_rc_write_entry( rc, "Foreground1", value );
-	g_snprintf( value, 8, "#%02X%02X%02X", base->colors[2].red >> 8, base->colors[2].green >> 8, base->colors[2].blue >> 8 );
-	xfce_rc_write_entry( rc, "Foreground2", value );
-	g_snprintf( value, 8, "#%02X%02X%02X", base->colors[0].red >> 8, base->colors[0].green >> 8, base->colors[0].blue >> 8 );
-	xfce_rc_write_entry( rc, "Background", value );
-	g_snprintf( value, 8, "#%02X%02X%02X", base->colors[3].red >> 8, base->colors[3].green >> 8, base->colors[3].blue >> 8 );
-	xfce_rc_write_entry( rc, "Foreground3", value );
-	g_snprintf( value, 8, "#%02X%02X%02X", base->colors[4].red >> 8, base->colors[4].green >> 8, base->colors[4].blue >> 8 );
-	xfce_rc_write_entry( rc, "BarsColor", value );
+	xfce_rc_write_entry( rc, "Foreground1", gdk_color_to_string(&(base->colors[1])) );
+	xfce_rc_write_entry( rc, "Foreground2", gdk_color_to_string(&(base->colors[2])) );
+	xfce_rc_write_entry( rc, "Foreground3", gdk_color_to_string(&(base->colors[3])) );
+	xfce_rc_write_entry( rc, "Background", gdk_color_to_string(&(base->colors[0])) );
+	xfce_rc_write_entry( rc, "BarsColor", gdk_color_to_string(&(base->colors[4])) );
 	xfce_rc_close( rc );
 }


More information about the Xfce4-commits mailing list