From 435218908045cdca1fb01ea160f9de64501159cf Mon Sep 17 00:00:00 2001 From: Harald Judt Date: Sat, 26 May 2012 16:28:36 +0200 Subject: Separate #defines for widget borders, make label spacing consistent. The defined "BORDER" is used for various widgets, even in the configuration dialog, and I think it's cleaner to rework this a little. Why should someone expect the plugin border of a configuration dialog widget or the sizes of the progress bars be influenced when trying to change the border of the main plugin box? Therefore define the plugin border, label border and progress bar size separately and optimize them to be consistent with other plugins. Note: The some_BORDER variables now represent the real values of the border, you don't have to calculate them by dividing the value or do other calculations. --- panel-plugin/main.c | 17 +++++++++-------- 1 files changed, 9 insertions(+), 8 deletions(-) diff --git a/panel-plugin/main.c b/panel-plugin/main.c index 6a2d154..301e129 100644 --- a/panel-plugin/main.c +++ b/panel-plugin/main.c @@ -46,8 +46,9 @@ #endif #define PLUGIN_NAME "DiskPerf" -#define BORDER 8 - +#define PLUGIN_BORDER 4 +#define LABEL_BORDER 2 +#define PROGRESSBAR_SIZE 8 /* Some platforms do not provide busy times as separate read and write data, but only a single value combining both */ @@ -393,7 +394,7 @@ static int CreateMonitorBars (struct diskperf_t *p_poPlugin, poMonitor->wBox = gtk_vbox_new (FALSE, 0); gtk_widget_show (poMonitor->wBox); gtk_container_set_border_width (GTK_CONTAINER - (poMonitor->wBox), 4); + (poMonitor->wBox), PLUGIN_BORDER); gtk_container_add (GTK_CONTAINER (poMonitor->wEventBox), poMonitor->wBox); @@ -402,7 +403,7 @@ static int CreateMonitorBars (struct diskperf_t *p_poPlugin, if (poConf->fTitleDisplayed) gtk_widget_show (poMonitor->wTitle); gtk_box_pack_start (GTK_BOX (poMonitor->wBox), - GTK_WIDGET (poMonitor->wTitle), FALSE, FALSE, 0); + GTK_WIDGET (poMonitor->wTitle), FALSE, FALSE, LABEL_BORDER); for (i = 0; i < 2; i++) { pwBar = poMonitor->awProgressBar + i; @@ -993,8 +994,8 @@ static void diskperf_create_options (XfcePanelPlugin *plugin, gtk_window_set_position (GTK_WINDOW (dlg), GTK_WIN_POS_CENTER); gtk_window_set_icon_name (GTK_WINDOW (dlg), "drive-harddisk"); - vbox = gtk_vbox_new(FALSE, BORDER); - gtk_container_set_border_width (GTK_CONTAINER (vbox), BORDER - 2); + vbox = gtk_vbox_new(FALSE, 8); + gtk_container_set_border_width (GTK_CONTAINER (vbox), 6); gtk_widget_show(vbox); gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->vbox), vbox, TRUE, TRUE, 0); @@ -1099,13 +1100,13 @@ static gboolean diskperf_set_size (XfcePanelPlugin *plugin, int p_size, TRACE ("diskperf_set_size()\n"); if (xfce_panel_plugin_get_orientation (plugin) == GTK_ORIENTATION_HORIZONTAL) { - size1 = BORDER; + size1 = PROGRESSBAR_SIZE; size2 = -1; gtk_widget_set_size_request (GTK_WIDGET (plugin), -1, p_size); } else { size1 = -1; - size2 = BORDER; + size2 = PROGRESSBAR_SIZE; gtk_widget_set_size_request (GTK_WIDGET (plugin), p_size, -1); } for (i = 0; i < 2; i++) { -- 1.7.8.6