[Xfce4-commits] <xfce4-cpugraph-plugin:master> Better compliance with panel plugin HIG

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


Updating branch refs/heads/master
         to 7a29f3435734fa83cc3b18eae52ca2a28c5b853c (commit)
       from 9447368801204a4ffc8686ca411a91da8be25c43 (commit)

commit 7a29f3435734fa83cc3b18eae52ca2a28c5b853c
Author: Landry Breuil <landry at xfce.org>
Date:   Sun Jun 24 16:14:33 2012 +0200

    Better compliance with panel plugin HIG
    
    - size pbars with 8px*-1
    - call set_border() in size_cb() since border is size-dependant
    - zero the border_width depending on boolean, compute it depending
      on size otherwise

 panel-plugin/cpu.c |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/panel-plugin/cpu.c b/panel-plugin/cpu.c
index f72c626..719dd4f 100644
--- a/panel-plugin/cpu.c
+++ b/panel-plugin/cpu.c
@@ -249,6 +249,7 @@ static gboolean size_cb( XfcePanelPlugin *plugin, guint size, CPUGraph *base )
 
 	if( base->has_bars )
 		set_bars_size( base, size, orientation );
+	set_border( base, base->has_border );
 
 	return TRUE;
 }
@@ -260,13 +261,13 @@ static void set_bars_size( CPUGraph *base, gint size, GtkOrientation orientation
 	gint h, v;
 	if( orientation == GTK_ORIENTATION_HORIZONTAL )
 	{
-		h = BORDER;
-		v = size;
+		h = 8;
+		v = -1;
 	}
 	else
 	{
-		h = size;
-		v = BORDER;
+		h = -1;
+		v = 8;
 	}
 	n = nb_bars( base );
 	for( i=0; i < n ; i++ )
@@ -443,8 +444,11 @@ void set_bars( CPUGraph * base, gboolean bars)
 
 void set_border( CPUGraph *base, gboolean border )
 {
+	int border_width = (xfce_panel_plugin_get_size( base->plugin ) > 26 ? 2 : 1);
 	base->has_border = border;
-	gtk_container_set_border_width( GTK_CONTAINER( base->box ), border ? BORDER / 2 : 0 );
+	if (!base->has_border)
+		border_width = 0;
+	gtk_container_set_border_width( GTK_CONTAINER( base->box ), border_width);
 }
 
 void set_frame( CPUGraph *base, gboolean frame )


More information about the Xfce4-commits mailing list