[Xfce4-commits] <xfce4-cpugraph-plugin:master> Get default barcolor from Gtk theme.

Landry Breuil noreply at xfce.org
Sun Jun 24 17:10:01 CEST 2012


Updating branch refs/heads/master
         to 8b9f945b6c459dcfd050651ab4bb8371f41505d2 (commit)
       from fb8f36e68b72fe1694c9c6d28ce7699a06568674 (commit)

commit 8b9f945b6c459dcfd050651ab4bb8371f41505d2
Author: Landry Breuil <landry at xfce.org>
Date:   Sun Jun 24 17:08:47 2012 +0200

    Get default barcolor from Gtk theme.

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

diff --git a/panel-plugin/settings.c b/panel-plugin/settings.c
index 4123140..76346ba 100644
--- a/panel-plugin/settings.c
+++ b/panel-plugin/settings.c
@@ -62,6 +62,8 @@ void read_settings( XfcePanelPlugin * plugin, CPUGraph * base )
 	GdkColor foreground3;
 	GdkColor background;
 	GdkColor barscolor;
+	GtkWidget* bar;
+	GtkStyle* barstyle;
 	guint size;
 	const gchar  *associated_command;
 	gboolean in_terminal;
@@ -83,10 +85,11 @@ void read_settings( XfcePanelPlugin * plugin, CPUGraph * base )
 	background.green = 65535;
 	background.blue = 65535;
 
-	/* gold yellow */
-	barscolor.red = 65535;
-	barscolor.green = 47872;
-	barscolor.blue = 0;
+	/* use color from theme for default bar color */
+	bar = gtk_progress_bar_new();
+	barstyle = gtk_widget_get_style(bar);
+	gtk_widget_destroy(bar);
+	barscolor = barstyle->bg[GTK_STATE_SELECTED];
 
 	size = xfce_panel_plugin_get_size( plugin );
 	default_command( &associated_command, &in_terminal, &startup_notification );


More information about the Xfce4-commits mailing list