From 8c3a47dc1eb98bb3df685a31139552174351aa03 Mon Sep 17 00:00:00 2001 From: Harald Judt Date: Mon, 28 May 2012 09:28:48 +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/main.c | 26 ++++++++++++++++++++++++++ 1 files changed, 26 insertions(+), 0 deletions(-) diff --git a/panel-plugin/main.c b/panel-plugin/main.c index 301e129..9c3715d 100644 --- a/panel-plugin/main.c +++ b/panel-plugin/main.c @@ -144,6 +144,28 @@ typedef struct diskperf_t { static int timerNeedsUpdate = 0; +/* 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 void UpdateProgressBars(struct diskperf_t *p_poPlugin, double rw, double r, double w) { /* Update combined or separate progress bars with actual data */ struct monitor_t *poMonitor = &(p_poPlugin->oMonitor); @@ -1096,6 +1118,7 @@ static gboolean diskperf_set_size (XfcePanelPlugin *plugin, int p_size, { int i, size1, size2; Widget_t *pwBar; + struct monitor_t *poMonitor = &(poPlugin->oMonitor); TRACE ("diskperf_set_size()\n"); if (xfce_panel_plugin_get_orientation (plugin) == @@ -1114,6 +1137,9 @@ static gboolean diskperf_set_size (XfcePanelPlugin *plugin, int p_size, gtk_widget_set_size_request (GTK_WIDGET (*pwBar), size1, size2); } + gtk_container_set_border_width (GTK_CONTAINER + (poMonitor->wBox), get_optimal_border(plugin)); + return TRUE; } /* diskperf_set_size() */ -- 1.7.8.6