[Xfce4-commits] [panel-plugins/xfce4-cpugraph-plugin] 01/16: start porting cpugraph to gtk3
noreply at xfce.org
noreply at xfce.org
Wed May 29 04:10:02 CEST 2019
This is an automated email from the git hooks/post-receive script.
a n d r e p u s h e d a c o m m i t t o b r a n c h m a s t e r
in repository panel-plugins/xfce4-cpugraph-plugin.
commit 752c4e3c7a83f3e5a85f733317ee8d559d225b97
Author: Olivier Duclos <odc at cpan.org>
Date: Sun Oct 15 21:41:05 2017 +0200
start porting cpugraph to gtk3
It compiles but it is not over yet. I need to implement
CSS styling and test under different configurations.
---
configure.ac.in | 8 ++---
panel-plugin/cpu.c | 46 ++++++++++++-------------
panel-plugin/cpu.h | 4 +--
panel-plugin/mode.c | 87 +++++++++++++++++++++++++++++++----------------
panel-plugin/properties.c | 26 +++++++-------
panel-plugin/settings.c | 65 +++++++++++++++++++----------------
6 files changed, 134 insertions(+), 102 deletions(-)
diff --git a/configure.ac.in b/configure.ac.in
index f538b63..5e05c71 100644
--- a/configure.ac.in
+++ b/configure.ac.in
@@ -5,7 +5,7 @@ dnl
dnl 2004 Alexander Nordfelth <alex.nordfelth at telia.com>
dnl
-m4_define([cpugraph_version],[1.0.5])
+m4_define([cpugraph_version],[1.1.0])
AC_INIT([xfce4-cpugraph-plugin], [cpugraph_version],
[goodies-dev at xfce.org])
@@ -31,9 +31,9 @@ dnl Check for standard header files
AC_HEADER_STDC
dnl configure the panel plugin
-XDT_CHECK_PACKAGE([LIBXFCE4UI], [libxfce4ui-1], [4.8.0])
-XDT_CHECK_PACKAGE([LIBXFCE4PANEL], [libxfce4panel-1.0], [4.8.0])
-XDT_CHECK_PACKAGE([GTK], [gtk+-2.0], [2.12.0])
+XDT_CHECK_PACKAGE([LIBXFCE4UI], [libxfce4ui-2], [4.12.0])
+XDT_CHECK_PACKAGE([LIBXFCE4PANEL], [libxfce4panel-2.0], [4.12.0])
+XDT_CHECK_PACKAGE([GTK], [gtk+-3.0], [3.14.0])
dnl translations
XDT_I18N([@LINGUAS@])
diff --git a/panel-plugin/cpu.c b/panel-plugin/cpu.c
index 927bb1e..befe4ed 100644
--- a/panel-plugin/cpu.c
+++ b/panel-plugin/cpu.c
@@ -27,7 +27,6 @@
#include "properties.h"
#include <libxfce4ui/libxfce4ui.h>
-#include <libxfce4panel/xfce-hvbox.h>
#ifndef _
# include <libintl.h>
# define _(String) gettext (String)
@@ -76,7 +75,7 @@ static void cpugraph_construct( XfcePanelPlugin *plugin )
xfce_panel_plugin_menu_show_about( plugin );
- g_signal_connect (plugin, "about", G_CALLBACK (about_cb), base );
+ g_signal_connect( plugin, "about", G_CALLBACK (about_cb), base );
g_signal_connect( plugin, "free-data", G_CALLBACK( shutdown ), base );
g_signal_connect( plugin, "save", G_CALLBACK( write_settings ), base );
g_signal_connect( plugin, "configure-plugin", G_CALLBACK( create_options ), base );
@@ -107,7 +106,7 @@ static CPUGraph * create_gui( XfcePanelPlugin * plugin )
xfce_panel_plugin_add_action_widget( plugin, ebox );
g_signal_connect( ebox, "button-press-event", G_CALLBACK( command_cb ), base );
- base->box = xfce_hvbox_new(orientation, FALSE, 0);
+ base->box = gtk_box_new(orientation, 0);
gtk_container_add(GTK_CONTAINER(ebox), base->box);
gtk_widget_set_has_tooltip( base->box, TRUE);
g_signal_connect( base->box, "query-tooltip", G_CALLBACK( tooltip_cb ), base );
@@ -175,9 +174,9 @@ static void create_bars( CPUGraph *base )
base->bars[i] = GTK_WIDGET(gtk_progress_bar_new());
/* Set bar colors */
if (base->has_barcolor) {
- gtk_widget_modify_bg(base->bars[i], GTK_STATE_PRELIGHT, &base->colors[4]);
- gtk_widget_modify_bg(base->bars[i], GTK_STATE_SELECTED, &base->colors[4]);
- gtk_widget_modify_base(base->bars[i], GTK_STATE_SELECTED, &base->colors[4]);
+ gtk_widget_override_background_color(base->bars[i], GTK_STATE_PRELIGHT, &base->colors[4]);
+ gtk_widget_override_background_color(base->bars[i], GTK_STATE_SELECTED, &base->colors[4]);
+ gtk_widget_override_color(base->bars[i], GTK_STATE_SELECTED, &base->colors[4]);
}
gtk_box_pack_end( GTK_BOX(base->box), base->bars[i], FALSE, FALSE, 0 );
gtk_widget_show( base->bars[i] );
@@ -286,11 +285,11 @@ static void mode_cb( XfcePanelPlugin * plugin, XfcePanelPluginMode mode, CPUGrap
GtkOrientation orientation = (mode == XFCE_PANEL_PLUGIN_MODE_HORIZONTAL) ?
GTK_ORIENTATION_HORIZONTAL : GTK_ORIENTATION_VERTICAL;
- xfce_hvbox_set_orientation( XFCE_HVBOX( base->box ), xfce_panel_plugin_get_orientation (plugin));
+ gtk_orientable_set_orientation( GTK_ORIENTABLE( base->box ), xfce_panel_plugin_get_orientation (plugin));
#else
static void orientation_cb( XfcePanelPlugin * plugin, GtkOrientation orientation, CPUGraph *base )
{
- xfce_hvbox_set_orientation( XFCE_HVBOX( base->box ), orientation );
+ gtk_orientable_set_orientation( base->box, orientation );
#endif
if( base->has_bars )
set_bars_orientation( base, orientation );
@@ -300,22 +299,17 @@ static void orientation_cb( XfcePanelPlugin * plugin, GtkOrientation orientation
static void set_bars_orientation( CPUGraph *base, GtkOrientation orientation)
{
- GtkProgressBarOrientation barOrientation;
- guint i;
- guint n;
- if( orientation == GTK_ORIENTATION_HORIZONTAL )
- barOrientation = GTK_PROGRESS_BOTTOM_TO_TOP;
- else
- barOrientation = GTK_PROGRESS_LEFT_TO_RIGHT;
+ guint i, n;
n = nb_bars( base );
for( i=0; i < n; i++ )
- gtk_progress_bar_set_orientation( GTK_PROGRESS_BAR( base->bars[i] ), barOrientation );
+ gtk_orientable_set_orientation( GTK_ORIENTABLE( base->bars[i] ), orientation );
}
static gboolean update_cb( CPUGraph * base )
{
gint i, a, b, factor;
+
if( !read_cpu_data( base->cpu_data, base->nr_cores ) )
return TRUE;
@@ -383,10 +377,12 @@ static void draw_area_cb( GtkWidget * da, GdkEventExpose * event, gpointer data
static void draw_graph( CPUGraph * base )
{
GtkWidget *da = base->draw_area;
+ GtkAllocation alloc;
gint w, h;
- w = da->allocation.width;
- h = da->allocation.height;
+ gtk_widget_get_allocation( da, &alloc );
+ w = alloc.width;
+ h = alloc.height;
switch( base->mode )
{
@@ -490,7 +486,7 @@ void set_update_rate( CPUGraph *base, guint rate )
default:
update = 1000;
}
- base->timeout_id = g_timeout_add( update, (GtkFunction) update_cb, base );
+ base->timeout_id = g_timeout_add( update, (GSourceFunc) update_cb, base );
}
void set_size( CPUGraph *base, guint size )
@@ -509,15 +505,15 @@ void set_mode( CPUGraph *base, guint mode )
base->mode = mode;
}
-void set_color( CPUGraph *base, guint number, GdkColor color )
+void set_color( CPUGraph *base, guint number, GdkRGBA color )
{
guint i, n;
base->colors[number] = color;
if( number == 0 )
{
- gtk_widget_modify_bg( base->draw_area, GTK_STATE_INSENSITIVE, &base->colors[0] );
- gtk_widget_modify_bg( base->draw_area, GTK_STATE_NORMAL, &base->colors[0] );
+ gtk_widget_override_background_color( base->draw_area, GTK_STATE_INSENSITIVE, &base->colors[0] );
+ gtk_widget_override_background_color( base->draw_area, GTK_STATE_NORMAL, &base->colors[0] );
}
if( number == 4 && base->has_bars && base->has_barcolor )
{
@@ -526,9 +522,9 @@ void set_color( CPUGraph *base, guint number, GdkColor color )
for( i=0; i< n; i++ )
{
/* Set bar colors */
- gtk_widget_modify_bg(base->bars[i], GTK_STATE_PRELIGHT, &base->colors[4]);
- gtk_widget_modify_bg(base->bars[i], GTK_STATE_SELECTED, &base->colors[4]);
- gtk_widget_modify_base(base->bars[i], GTK_STATE_SELECTED, &base->colors[4]);
+ gtk_widget_override_background_color(base->bars[i], GTK_STATE_PRELIGHT, &base->colors[4]);
+ gtk_widget_override_background_color(base->bars[i], GTK_STATE_SELECTED, &base->colors[4]);
+ gtk_widget_override_color(base->bars[i], GTK_STATE_SELECTED, &base->colors[4]);
}
}
}
diff --git a/panel-plugin/cpu.h b/panel-plugin/cpu.h
index fcd9d85..77bab3f 100644
--- a/panel-plugin/cpu.h
+++ b/panel-plugin/cpu.h
@@ -58,7 +58,7 @@ typedef struct
gchar *command;
gboolean in_terminal;
gboolean startup_notification;
- GdkColor colors[5];
+ GdkRGBA colors[5];
guint tracked_core;
/* Runtime data */
@@ -80,6 +80,6 @@ void set_update_rate( CPUGraph *base, guint rate );
void set_size( CPUGraph *base, guint width );
void set_color_mode( CPUGraph *base, guint color_mode );
void set_mode( CPUGraph *base, guint mode );
-void set_color( CPUGraph *base, guint number, GdkColor color );
+void set_color( CPUGraph *base, guint number, GdkRGBA color );
void set_tracked_core( CPUGraph *base, guint core );
#endif /* !_XFCE_CPU_H_ */
diff --git a/panel-plugin/mode.c b/panel-plugin/mode.c
index ad1ab95..640c082 100644
--- a/panel-plugin/mode.c
+++ b/panel-plugin/mode.c
@@ -22,6 +22,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+#include <cairo/cairo.h>
#include "mode.h"
static guint16 _lerp( gdouble t, guint16 a, guint16 b )
@@ -29,13 +30,14 @@ static guint16 _lerp( gdouble t, guint16 a, guint16 b )
return (guint16) (a + t * (b - a));
}
-static void mix_colors( gdouble ratio, GdkColor *color1, GdkColor *color2, GdkGC *target )
+static void mix_colors( gdouble ratio, GdkRGBA *color1, GdkRGBA *color2, cairo_t *target )
{
- GdkColor color;
+ GdkRGBA color;
color.red = _lerp (ratio, color1->red, color2->red);
color.green = _lerp (ratio, color1->green, color2->green);
color.blue = _lerp (ratio, color1->blue, color2->blue);
- gdk_gc_set_rgb_fg_color( target, &color );
+ color.alpha = 1.0;
+ gdk_cairo_set_source_rgba( target, &color );
}
void draw_graph_normal( CPUGraph *base, GtkWidget *da, gint w, gint h )
@@ -44,10 +46,10 @@ void draw_graph_normal( CPUGraph *base, GtkWidget *da, gint w, gint h )
gint usage;
gdouble t;
gint tmp;
- GdkGC *fg1 = gdk_gc_new( da->window );
+ cairo_t *fg1 = gdk_cairo_create( gtk_widget_get_window( da ) );
if( base->color_mode == 0 )
- gdk_gc_set_rgb_fg_color( fg1, &base->colors[1] );
+ gdk_cairo_set_source_rgba( fg1, &base->colors[1] );
for( x = 0; x < w; x++ )
{
@@ -57,7 +59,11 @@ void draw_graph_normal( CPUGraph *base, GtkWidget *da, gint w, gint h )
if( base->color_mode == 0 )
{
- gdk_draw_line( da->window, fg1, x, h-usage, x, h-1 );
+ /* draw line */
+ cairo_set_line_cap( fg1, CAIRO_LINE_CAP_SQUARE );
+ cairo_move_to( fg1, x, h - usage );
+ cairo_line_to( fg1, x, h - 1 );
+ cairo_stroke( fg1 );
}
else
{
@@ -67,12 +73,15 @@ void draw_graph_normal( CPUGraph *base, GtkWidget *da, gint w, gint h )
t = (base->color_mode == 1) ?
(tmp / (gdouble) (h)) :
(tmp / (gdouble) (usage));
- mix_colors( t, &base->colors[1], &base->colors[2], fg1);
- gdk_draw_point( da->window, fg1, x, y );
+ mix_colors( t, &base->colors[1], &base->colors[2], fg1 );
+ /* draw point */
+ cairo_set_line_cap( fg1, CAIRO_LINE_CAP_SQUARE );
+ cairo_move_to( fg1, x, y );
+ cairo_stroke( fg1 );
}
}
}
- g_object_unref( fg1 );
+ cairo_destroy( fg1 );
}
void draw_graph_LED( CPUGraph *base, GtkWidget *da, gint w, gint h )
@@ -83,10 +92,10 @@ void draw_graph_LED( CPUGraph *base, GtkWidget *da, gint w, gint h )
gint idx;
gint limit;
- GdkGC *fg1 = gdk_gc_new( da->window );
- GdkGC *fg2 = gdk_gc_new( da->window );
- gdk_gc_set_rgb_fg_color( fg1, &base->colors[1] );
- gdk_gc_set_rgb_fg_color( fg2, &base->colors[2] );
+ cairo_t *fg1 = gdk_cairo_create( gtk_widget_get_window( da ) );
+ cairo_t *fg2 = gdk_cairo_create( gtk_widget_get_window( da ) );
+ gdk_cairo_set_source_rgba( fg1, &base->colors[1] );
+ gdk_cairo_set_source_rgba( fg2, &base->colors[2] );
for( x = 0; x * 3 < w; x++ )
{
@@ -99,13 +108,16 @@ void draw_graph_LED( CPUGraph *base, GtkWidget *da, gint w, gint h )
gdouble t = (base->color_mode == 1) ?
(y / (gdouble)nry) :
(y / (gdouble)limit);
- mix_colors( t, &base->colors[3], &base->colors[2], fg2);
+ mix_colors( t, &base->colors[3], &base->colors[2], fg2 );
}
- gdk_draw_rectangle (da->window, y >= limit ? fg1 : fg2, TRUE, x * 3, y * 2, 2, 1);
+ /* draw rectangle */
+ cairo_t *fg = y >= limit ? fg1 : fg2;
+ cairo_rectangle( fg, x * 3, y * 2, 2, 1 );
+ cairo_fill( fg );
}
}
- g_object_unref( fg1 );
- g_object_unref( fg2 );
+ cairo_destroy( fg1 );
+ cairo_destroy( fg2 );
}
void draw_graph_no_history( CPUGraph *base, GtkWidget *da, gint w, gint h )
@@ -114,12 +126,13 @@ void draw_graph_no_history( CPUGraph *base, GtkWidget *da, gint w, gint h )
gint usage = h * base->history[0] / CPU_SCALE;
gint tmp = 0;
gdouble t;
- GdkGC *fg1 = gdk_gc_new( da->window );
+ cairo_t *fg1 = gdk_cairo_create( gtk_widget_get_window( da ) );
if( base->color_mode == 0 )
{
- gdk_gc_set_rgb_fg_color( fg1, &base->colors[1] );
- gdk_draw_rectangle( da->window, fg1, TRUE, 0, h-usage, w, usage );
+ gdk_cairo_set_source_rgba( fg1, &base->colors[1] );
+ cairo_rectangle( fg1, 0, h - usage, w, usage );
+ cairo_fill( fg1 );
}
else
{
@@ -130,10 +143,14 @@ void draw_graph_no_history( CPUGraph *base, GtkWidget *da, gint w, gint h )
(tmp / (gdouble) (usage));
mix_colors( t, &base->colors[1], &base->colors[2], fg1 );
tmp++;
- gdk_draw_line( da->window, fg1, 0, y, w-1, y );
+ /* draw line */
+ cairo_set_line_cap( fg1, CAIRO_LINE_CAP_SQUARE );
+ cairo_move_to( fg1, 0, y );
+ cairo_line_to( fg1, w -1, y );
+ cairo_stroke( fg1 );
}
}
- g_object_unref( fg1 );
+ cairo_destroy( fg1 );
}
typedef struct
@@ -149,26 +166,38 @@ void draw_graph_grid( CPUGraph *base, GtkWidget *da, gint w, gint h )
point last, current;
last.x = 0;
last.y = h;
- GdkGC *fg1 = gdk_gc_new( da->window );
+ cairo_t *fg1 = gdk_cairo_create( gtk_widget_get_window( da ) );
- gdk_gc_set_rgb_fg_color( fg1, &base->colors[1] );
+ gdk_cairo_set_source_rgba( fg1, &base->colors[1] );
for( x = 0; x * 6 < w; x++ )
{
- gdk_draw_line( da->window, fg1, x*6, 0, x*6, h-1 );
+ /* draw line */
+ cairo_set_line_cap( fg1, CAIRO_LINE_CAP_SQUARE );
+ cairo_move_to( fg1, x * 6, 0 );
+ cairo_line_to( fg1, x * 6, h - 1 );
+ cairo_stroke( fg1 );
}
for( y = 0; y * 4 < h; y++ )
{
- gdk_draw_line( da->window, fg1, 0, y*4, w-1, y*4 );
+ /* draw line */
+ cairo_set_line_cap( fg1, CAIRO_LINE_CAP_SQUARE );
+ cairo_move_to( fg1, 0, y * 4 );
+ cairo_line_to( fg1, w - 1, y * 4 );
+ cairo_stroke( fg1 );
}
- gdk_gc_set_rgb_fg_color( fg1, &base->colors[2] );
+ gdk_cairo_set_source_rgba( fg1, &base->colors[2] );
for( x = 0; x < w; x++ )
{
usage = h * base->history[w - 1- x] / CPU_SCALE;
current.x = x;
current.y = h - usage;
- gdk_draw_line( da->window, fg1, current.x, current.y, last.x, last.y );
+ /* draw line */
+ cairo_set_line_cap( fg1, CAIRO_LINE_CAP_SQUARE );
+ cairo_move_to( fg1, current.x, current.y );
+ cairo_line_to( fg1, last.x, last.y );
+ cairo_stroke( fg1 );
last = current;
}
- g_object_unref( fg1 );
+ cairo_destroy( fg1 );
}
diff --git a/panel-plugin/properties.c b/panel-plugin/properties.c
index 53fe0ff..16fcaa5 100644
--- a/panel-plugin/properties.c
+++ b/panel-plugin/properties.c
@@ -69,7 +69,7 @@ static void change_core( GtkComboBox * combo, CPUGraph * base );
void create_options( XfcePanelPlugin *plugin, CPUGraph *base )
{
- GtkWidget *dlg, *header;
+ GtkWidget *dlg, *header, *content;
GtkBox *vbox, *vbox2;
GtkWidget *label;
GtkSizeGroup *sg;
@@ -79,8 +79,8 @@ void create_options( XfcePanelPlugin *plugin, CPUGraph *base )
dlg = xfce_titled_dialog_new_with_buttons( _("CPU Graph Properties"),
GTK_WINDOW( gtk_widget_get_toplevel( GTK_WIDGET( plugin ) ) ),
- GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_NO_SEPARATOR,
- GTK_STOCK_CLOSE,
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ "window-close",
GTK_RESPONSE_OK,
NULL
);
@@ -122,7 +122,8 @@ void create_options( XfcePanelPlugin *plugin, CPUGraph *base )
gtk_notebook_append_page( GTK_NOTEBOOK( Notebook ), GTK_WIDGET( vbox ), GTK_WIDGET( label ) );
gtk_widget_show( Notebook );
- gtk_box_pack_start( GTK_BOX( GTK_DIALOG( dlg )->vbox), GTK_WIDGET( Notebook ), TRUE, TRUE, 0 );
+ content = gtk_dialog_get_content_area( GTK_DIALOG( dlg ) );
+ gtk_container_add( GTK_CONTAINER( content ), Notebook );
gtk_widget_show( dlg );
}
@@ -130,7 +131,7 @@ void create_options( XfcePanelPlugin *plugin, CPUGraph *base )
static GtkBox *create_tab()
{
GtkBox *tab;
- tab = GTK_BOX( gtk_vbox_new( FALSE, BORDER ) );
+ tab = GTK_BOX( gtk_box_new( GTK_ORIENTATION_VERTICAL, BORDER ) );
gtk_container_set_border_width( GTK_CONTAINER( tab ), BORDER );
gtk_widget_show( GTK_WIDGET( tab ) );
return tab;
@@ -141,14 +142,15 @@ static GtkBox *create_option_line( GtkBox *tab, GtkSizeGroup *sg, const gchar *n
GtkBox *line;
GtkWidget *label;
- line = GTK_BOX( gtk_hbox_new( FALSE, BORDER ) );
+ line = GTK_BOX( gtk_box_new( GTK_ORIENTATION_HORIZONTAL, BORDER ) );
gtk_widget_show( GTK_WIDGET( line ) );
gtk_box_pack_start( GTK_BOX( tab ), GTK_WIDGET( line ), FALSE, FALSE, 0 );
if( name )
{
label = gtk_label_new( name );
- gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
+ gtk_label_set_xalign( GTK_LABEL( label ), 0.0 );
+ gtk_label_set_yalign( GTK_LABEL( label ), 0.5 );
gtk_size_group_add_widget( sg, label );
gtk_widget_show( label );
gtk_box_pack_start( GTK_BOX( line ), GTK_WIDGET( label ), FALSE, FALSE, 0 );
@@ -179,10 +181,10 @@ static void create_drop_down( GtkBox *tab, GtkSizeGroup *sg, const gchar * name,
hbox = create_option_line( tab, sg, name );
- combo = gtk_combo_box_new_text();
+ combo = gtk_combo_box_text_new();
for( i = 0; i < nb_items; i++ )
{
- gtk_combo_box_append_text( GTK_COMBO_BOX( combo ), items[i] );
+ gtk_combo_box_text_append( GTK_COMBO_BOX_TEXT( combo ), NULL, items[i] );
}
gtk_combo_box_set_active( GTK_COMBO_BOX( combo), init );
gtk_box_pack_start( GTK_BOX( hbox ), combo, FALSE, FALSE, 0 );
@@ -256,7 +258,7 @@ static void setup_color_option( GtkBox *vbox, GtkSizeGroup *sg, CPUGraph *base,
hbox = create_option_line( vbox, sg, name );
- base->color_buttons[number] = gtk_color_button_new_with_color( &base->colors[number] );
+ base->color_buttons[number] = gtk_color_button_new_with_rgba( &base->colors[number] );
gtk_widget_show( GTK_WIDGET( base->color_buttons[number] ) );
gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( base->color_buttons[number] ), FALSE, FALSE, 0 );
@@ -303,8 +305,8 @@ static void change_command( GtkEntry *entry, CPUGraph * base )
static void change_color( GtkColorButton * button, CPUGraph * base, guint number)
{
- GdkColor color;
- gtk_color_button_get_color( button, &color );
+ GdkRGBA color;
+ gtk_color_chooser_get_rgba( GTK_COLOR_CHOOSER( button ), &color );
set_color( base, number, color );
}
diff --git a/panel-plugin/settings.c b/panel-plugin/settings.c
index 8679f2d..2676edf 100644
--- a/panel-plugin/settings.c
+++ b/panel-plugin/settings.c
@@ -57,35 +57,40 @@ void read_settings( XfcePanelPlugin * plugin, CPUGraph * base )
gboolean bars = TRUE;
guint tracked_core = 0;
- GdkColor foreground1;
- GdkColor foreground2;
- GdkColor foreground3;
- GdkColor background;
- GdkColor barscolor;
+ GdkRGBA foreground1;
+ GdkRGBA foreground2;
+ GdkRGBA foreground3;
+ GdkRGBA background;
+ GdkRGBA barscolor;
guint size;
const gchar *associated_command;
gboolean in_terminal;
gboolean startup_notification;
- foreground1.red = 0;
- foreground1.green = 65535;
- foreground1.blue = 0;
+ foreground1.red = 0.0;
+ foreground1.green = 1.0;
+ foreground1.blue = 0.0;
+ foreground1.alpha = 1.0;
- foreground2.red = 65535;
- foreground2.green = 0;
- foreground2.blue = 0;
+ foreground2.red = 1.0;
+ foreground2.green = 0.0;
+ foreground2.blue = 0.0;
+ foreground2.alpha = 1.0;
- foreground3.red = 0;
- foreground3.green = 0;
- foreground3.blue = 65535;
+ foreground3.red = 0.0;
+ foreground3.green = 0.0;
+ foreground3.blue = 1.0;
+ foreground3.alpha = 1.0;
- background.red = 65535;
- background.green = 65535;
- background.blue = 65535;
+ background.red = 1.0;
+ background.green = 1.0;
+ background.blue = 1.0;
+ background.alpha = 1.0;
- barscolor.red = 65535;
- barscolor.green = 47872;
- barscolor.blue = 0;
+ barscolor.red = 1.0;
+ barscolor.green = 0.73048;
+ barscolor.blue = 0.0;
+ barscolor.alpha = 1.0;
size = xfce_panel_plugin_get_size( plugin );
default_command( &associated_command, &in_terminal, &startup_notification );
@@ -111,15 +116,15 @@ void read_settings( XfcePanelPlugin * plugin, CPUGraph * base )
tracked_core = xfce_rc_read_int_entry( rc, "TrackedCore", tracked_core );
if( (value = xfce_rc_read_entry( rc, "Foreground1", NULL )) )
- gdk_color_parse( value, &foreground1 );
+ gdk_rgba_parse( &foreground1, value );
if( (value = xfce_rc_read_entry( rc, "Foreground2", NULL )) )
- gdk_color_parse( value, &foreground2 );
+ gdk_rgba_parse( &foreground2, value );
if( (value = xfce_rc_read_entry( rc, "Foreground3", NULL )) )
- gdk_color_parse( value, &foreground3 );
+ gdk_rgba_parse( &foreground3, value );
if( (value = xfce_rc_read_entry( rc, "Background", NULL )) )
- gdk_color_parse( value, &background );
+ gdk_rgba_parse( &background, value );
if( (value = xfce_rc_read_entry( rc, "BarsColor", NULL )) ) {
- gdk_color_parse( value, &barscolor );
+ gdk_rgba_parse( &barscolor, value );
base->has_barcolor = TRUE;
}
@@ -173,11 +178,11 @@ 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 );
- 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, "Foreground1", gdk_rgba_to_string(&(base->colors[1])) );
+ xfce_rc_write_entry( rc, "Foreground2", gdk_rgba_to_string(&(base->colors[2])) );
+ xfce_rc_write_entry( rc, "Foreground3", gdk_rgba_to_string(&(base->colors[3])) );
+ xfce_rc_write_entry( rc, "Background", gdk_rgba_to_string(&(base->colors[0])) );
if (base->has_barcolor)
- xfce_rc_write_entry( rc, "BarsColor", gdk_color_to_string(&(base->colors[4])) );
+ xfce_rc_write_entry( rc, "BarsColor", gdk_rgba_to_string(&(base->colors[4])) );
xfce_rc_close( rc );
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list