From c8b14a90d1a92b4a9f75cd8c8ba479e96c9fd7cb Mon Sep 17 00:00:00 2001 From: Harald Judt Date: Mon, 28 May 2012 10:22:06 +0200 Subject: Use better border sizes dependent on the panel size. Use 0px on very small panels, which look ugly anyway and where the only concern is to preserve as much space as possible. Use 1px on small panels to optimize for the use of space, while still trying to preserve a good look. Use 2px for bigger panel sizes. Looks pretty and does not waste space unnecessarily. --- panel-plugin/systemload.c | 28 ++++++++++++++++++++++++++-- 1 files changed, 26 insertions(+), 2 deletions(-) diff --git a/panel-plugin/systemload.c b/panel-plugin/systemload.c index 966b1c1..b2c609f 100644 --- a/panel-plugin/systemload.c +++ b/panel-plugin/systemload.c @@ -115,6 +115,30 @@ typedef struct #endif } t_global_monitor; + +/* Find the optimal border for the current panel size */ +static int get_optimal_border(XfcePanelPlugin *plugin) +{ + int panel_size = xfce_panel_plugin_get_size (plugin); + + /* Use 0px on very small panels, which look ugly anyway and where + the only concern is to preserve as much space as possible. */ + int border = 0; + + /* Use 1px on small panels to optimize for the use of space, while + still trying to preserve a good look. */ + if (panel_size > 20) + border = 1; + + /* Use 2px for bigger panel sizes. Looks pretty and does not waste + space unnecessarily. */ + if (panel_size > 26) + border = 2; + + return border; +} + + static gint update_monitors(t_global_monitor *global) { @@ -356,7 +380,6 @@ monitor_control_new(XfcePanelPlugin *plugin) global->use_timeout_seconds = TRUE; global->timeout_id = 0; global->ebox = gtk_event_box_new(); - gtk_container_set_border_width (GTK_CONTAINER (global->ebox), BORDER/2); gtk_widget_show(global->ebox); global->box = NULL; @@ -627,7 +650,8 @@ monitor_set_size(XfcePanelPlugin *plugin, int size, t_global_monitor *global) -1, PROGRESSBAR_SIZE); } } - + gtk_container_set_border_width (GTK_CONTAINER (global->ebox), get_optimal_border(plugin)); + setup_monitor(global); return TRUE; -- 1.7.8.6