Package: xfce4-netload-plugin Version: 1.1.0-1+b1 Severity: important Tags: upstream patch
Dear Maintainer, I have switched to XFCE few weeks ago and was happy user of XFCE 4.10. Recently I decided to downgrade to 4.8 to test the Wheezy. The netload plugin is rather hard to use, it suffers from several bugs, from which most are fixed in 4:10. Comparing to other 4.8 monitoring plugins (systemload, fsguard, diskperf) it is inconsistent and rather low quality. I have prepared several - hopefully simple and uninvasive - patches to fix some issues: - plugin GUI gets totally broken on panel orientation change - context menu is unaccessible on many situations - inconsistent padding and border with other plugins: bars are smaller than bars of other plugins, border width does not adapt to panel size, breaks Panel HIG [1] - entries (text input boxes) in preferences require pressing the ENTER or closing the dialog to be applied - without any feedback user is required to do that, This breaks Panel HIG [2], is inconsistent with other control widgets (check boxes, spinners, color choosers) that are applied instantly and with other plugins. - default text of the label is "Net" while other plugins use lowercase I tried to make those patches as simple as I was able to make sure they won't cause regressions. Please, consider including them to wheezy. Thanks, Petr Gajdůšek [1] https://wiki.xfce.org/dev/hig/panel-plugins#widgets_paddingsize [2] https://wiki.xfce.org/dev/hig/panel-plugins#properties_dialog -- System Information: Debian Release: wheezy/sid APT prefers testing APT policy: (1001, 'testing') Architecture: amd64 (x86_64) Kernel: Linux 3.2.0-4-amd64 (SMP w/1 CPU core) Locale: LANG=cs_CZ.utf8, LC_CTYPE=cs_CZ.utf8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Versions of packages xfce4-netload-plugin depends on: ii libc6 2.13-35 ii libcairo2 1.12.2-2 ii libgdk-pixbuf2.0-0 2.26.1-1 ii libglib2.0-0 2.33.12+really2.32.4-2 ii libgtk2.0-0 2.24.10-2 ii libxfce4ui-1-0 4.8.1-1 ii libxfce4util4 4.8.2-1 ii xfce4-panel 4.8.6-4 xfce4-netload-plugin recommends no packages. xfce4-netload-plugin suggests no packages. -- no debconf information
>From 0cced55d1bfc3966e1b35b3ec7d1162f225e3338 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Gajd=C5=AF=C5=A1ek?= <gajdusek.p...@centrum.cz> Date: Tue, 23 Oct 2012 07:06:09 +0200 Subject: [PATCH 1/6] Preserve widgets visibility on orientation change Preserve label, values and bars visibility on panel orientation change. This partially backports upstream commit b5a375 [1] that preserves values widgets visibility only. Included additional changes to preserve label and bars visibility too (not fixed in upstream). [1] b5a375: Bug 8914: Fix widget visibility on orientation change. http://git.xfce.org/panel-plugins/xfce4-netload-plugin/commit/?id=b5a375218d255906bd41f4f6a383bd06f19de1fe https://bugzilla.xfce.org/show_bug.cgi?id=8914 --- panel-plugin/netload.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/panel-plugin/netload.c b/panel-plugin/netload.c index 998447f..3306952 100644 --- a/panel-plugin/netload.c +++ b/panel-plugin/netload.c @@ -310,12 +310,17 @@ static void monitor_set_orientation (XfcePanelPlugin *plugin, GtkOrientation ori gtk_widget_show(global->box); global->monitor->label = gtk_label_new(global->monitor->options.label_text); - gtk_widget_show(global->monitor->label); + if (global->monitor->options.use_label) { + gtk_widget_show(global->monitor->label); + } global->monitor->rcv_label = gtk_label_new(""); gtk_label_set_width_chars(GTK_LABEL(global->monitor->rcv_label), 7); gtk_misc_set_alignment(GTK_MISC(global->monitor->rcv_label), 1.0f, 0.5f); - gtk_widget_show(global->monitor->rcv_label); + if (global->monitor->options.show_values) + { + gtk_widget_show(global->monitor->rcv_label); + } for (i = 0; i < SUM; i++) { @@ -324,7 +329,10 @@ static void monitor_set_orientation (XfcePanelPlugin *plugin, GtkOrientation ori global->monitor->sent_label = gtk_label_new(""); gtk_label_set_width_chars(GTK_LABEL(global->monitor->sent_label), 7); - gtk_widget_show(global->monitor->sent_label); + if (global->monitor->options.show_values) + { + gtk_widget_show(global->monitor->sent_label); + } if (orientation == GTK_ORIENTATION_HORIZONTAL) { @@ -370,7 +378,10 @@ static void monitor_set_orientation (XfcePanelPlugin *plugin, GtkOrientation ori GTK_STATE_SELECTED, &global->monitor->options.color[i]); - gtk_widget_show(GTK_WIDGET(global->monitor->status[i])); + if (global->monitor->options.show_bars) + { + gtk_widget_show(GTK_WIDGET(global->monitor->status[i])); + } gtk_box_pack_start(GTK_BOX(global->monitor->box), GTK_WIDGET(global->monitor->status[i]), FALSE, FALSE, 0); -- 1.7.10.4
>From 44849dfa0abec175d72f3617e379f59ed44b284b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Gajd=C5=AF=C5=A1ek?= <gajdusek.p...@centrum.cz> Date: Mon, 22 Oct 2012 16:59:25 +0200 Subject: [PATCH 2/6] Keep colorized values after orientation change This bacports upstream commit b6efbf: Bug 8915: Keep colorized values after orientation change http://git.xfce.org/panel-plugins/xfce4-netload-plugin/commit/?id=b6efbf1286eee3ae0c7ba4cfcedf66b7f4160b90 --- panel-plugin/netload.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/panel-plugin/netload.c b/panel-plugin/netload.c index 3306952..770a843 100644 --- a/panel-plugin/netload.c +++ b/panel-plugin/netload.c @@ -355,6 +355,14 @@ static void monitor_set_orientation (XfcePanelPlugin *plugin, GtkOrientation ori gtk_misc_set_alignment(GTK_MISC(global->monitor->sent_label), 1.0f, 0.5f); } + if (global->monitor->options.show_values) + { + gtk_widget_modify_fg(global->monitor->rcv_label, GTK_STATE_NORMAL, + (global->monitor->options.colorize_values ? &global->monitor->options.color[IN] : NULL)); + gtk_widget_modify_fg(global->monitor->sent_label, GTK_STATE_NORMAL, + (global->monitor->options.colorize_values ? &global->monitor->options.color[OUT] : NULL)); + } + gtk_box_pack_start(GTK_BOX(global->monitor->box), GTK_WIDGET(global->monitor->label), TRUE, FALSE, BORDER / 2); -- 1.7.10.4
>From bcc181ec9fc2f4156ff5d604947cd47007dbc3c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Gajd=C5=AF=C5=A1ek?= <gajdusek.p...@centrum.cz> Date: Tue, 23 Oct 2012 07:15:23 +0200 Subject: [PATCH 3/6] Fix context menu not accessible by right-clicking on most part of the plugin The event box is set invisible and above its children, so that the context menu is accessible by right-clicking on any part of the plugin. Backported relevant changes from upstream commit e098ea: http://git.xfce.org/panel-plugins/xfce4-netload-plugin/commit/?id=e098eaa220e76ad5ee68fb82591abc78b5614baf Additionally, the event box is hidden while the monitor is being setup. Without this the context menu ability was lost on options change. --- panel-plugin/netload.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/panel-plugin/netload.c b/panel-plugin/netload.c index 770a843..c1d27c3 100644 --- a/panel-plugin/netload.c +++ b/panel-plugin/netload.c @@ -446,6 +446,8 @@ static t_global_monitor * monitor_new(XfcePanelPlugin *plugin) global = g_new(t_global_monitor, 1); global->timeout_id = 0; global->ebox = gtk_event_box_new(); + gtk_event_box_set_visible_window(GTK_EVENT_BOX(global->ebox), FALSE); + gtk_event_box_set_above_child(GTK_EVENT_BOX(global->ebox), TRUE); gtk_widget_set_has_tooltip(global->ebox, TRUE); g_signal_connect(global->ebox, "query-tooltip", G_CALLBACK(tooltip_cb), global); gtk_widget_show(global->ebox); @@ -491,6 +493,7 @@ static void setup_monitor(t_global_monitor *global, gboolean supress_warnings) { gint i; + gtk_widget_hide(GTK_WIDGET(global->ebox)); gtk_widget_hide(GTK_WIDGET(global->monitor->box)); gtk_widget_hide(global->monitor->label); gtk_label_set_text(GTK_LABEL(global->monitor->label), @@ -563,6 +566,8 @@ static void setup_monitor(t_global_monitor *global, gboolean supress_warnings) } global->monitor->options.old_network_device = g_strdup(global->monitor->options.network_device); + gtk_widget_show(GTK_WIDGET(global->ebox)); + run_update( global ); } -- 1.7.10.4
>From cb85d5e254c22c0e9b477f9bec9ad17de61685dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Gajd=C5=AF=C5=A1ek?= <gajdusek.p...@centrum.cz> Date: Tue, 23 Oct 2012 07:45:15 +0200 Subject: [PATCH 4/6] Properly set padding and border width Respect the Panel HIG partially as other 4.8 plugins do: 1) Set 1px border width for very small panels (<=26px), 2px otherwise. 2) Use 2px padding around labels. Backports upstream commit 005d94: http://git.xfce.org/panel-plugins/xfce4-netload-plugin/commit/?id=005d94bf49ff66fca30c35d1ce8ee79fe63a2788 Partially backports upstream commit 7434a7: http://git.xfce.org/panel-plugins/xfce4-netload-plugin/commit/?id=7434a7f1fbb4c35c92add675d5a0314cacda8671 --- panel-plugin/netload.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/panel-plugin/netload.c b/panel-plugin/netload.c index c1d27c3..b16a635 100644 --- a/panel-plugin/netload.c +++ b/panel-plugin/netload.c @@ -282,6 +282,8 @@ static void run_update (t_global_monitor *global) } } +static gboolean monitor_set_size(XfcePanelPlugin *plugin, int size, t_global_monitor *global); + /* ---------------------------------------------------------------------------------------------- */ static void monitor_set_orientation (XfcePanelPlugin *plugin, GtkOrientation orientation, @@ -365,13 +367,12 @@ static void monitor_set_orientation (XfcePanelPlugin *plugin, GtkOrientation ori gtk_box_pack_start(GTK_BOX(global->monitor->box), GTK_WIDGET(global->monitor->label), - TRUE, FALSE, BORDER / 2); + TRUE, FALSE, 2); gtk_box_pack_start(GTK_BOX(global->monitor->box), GTK_WIDGET(global->monitor->rcv_label), - TRUE, FALSE, BORDER / 2); + TRUE, FALSE, 2); - gtk_container_set_border_width(GTK_CONTAINER(global->monitor->box), BORDER / 2); gtk_widget_show(GTK_WIDGET(global->monitor->box)); for (i = 0; i < SUM; i++) @@ -397,7 +398,7 @@ static void monitor_set_orientation (XfcePanelPlugin *plugin, GtkOrientation ori gtk_box_pack_start(GTK_BOX(global->monitor->box), GTK_WIDGET(global->monitor->sent_label), - TRUE, FALSE, BORDER / 2); + TRUE, FALSE, 2); gtk_box_pack_start(GTK_BOX(global->box), GTK_WIDGET(global->monitor->box), FALSE, FALSE, 0); @@ -406,6 +407,8 @@ static void monitor_set_orientation (XfcePanelPlugin *plugin, GtkOrientation ori gtk_container_add(GTK_CONTAINER(global->ebox), GTK_WIDGET(global->box)); gtk_widget_show(GTK_WIDGET(global->ebox)); + monitor_set_size(plugin, xfce_panel_plugin_get_size(plugin), global); + run_update( global ); } @@ -703,16 +706,17 @@ static gboolean monitor_set_size(XfcePanelPlugin *plugin, int size, t_global_mon if (xfce_panel_plugin_get_orientation (plugin) == GTK_ORIENTATION_HORIZONTAL) { gtk_widget_set_size_request(GTK_WIDGET(global->monitor->status[i]), - BORDER, size - BORDER); + BORDER, -1); } else { gtk_widget_set_size_request(GTK_WIDGET(global->monitor->status[i]), - size - BORDER, BORDER); + -1, BORDER); } } PRINT_DBG("monitor_set_size"); - setup_monitor(global, TRUE); + + gtk_container_set_border_width(GTK_CONTAINER(global->monitor->box), size > 26 ? 2 : 1); return TRUE; } -- 1.7.10.4
>From a0b13b44434307e40969979de51730793536c315 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Gajd=C5=AF=C5=A1ek?= <gajdusek.p...@centrum.cz> Date: Tue, 23 Oct 2012 23:54:41 +0200 Subject: [PATCH 5/6] Preferences: commit changes of label and maximum values immediately Rationale: - activation requirement is inconsistent with other widgets: check buttons, spinners and color choosers are committed immediately - no feedback to end user that activation (ENTER) is required - respect the plugin HIG - other plugins - systemload, fsguard - work this way already - diskperf plugin requires activation but also describes this behaviour in the tooltips Drawbacks: - device entry still requires activation: warning dialog is displayed if the device does not exist Other solutions: Add descriptive tooltips like diskperf plugin does. This would require translation updates and would break the panel HIG. Still would be nice to bind a tooltip to the device entry. --- panel-plugin/netload.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/panel-plugin/netload.c b/panel-plugin/netload.c index b16a635..c8c3b1b 100644 --- a/panel-plugin/netload.c +++ b/panel-plugin/netload.c @@ -1131,7 +1131,7 @@ static void monitor_create_options(XfcePanelPlugin *plugin, t_global_monitor *gl gtk_widget_set_sensitive(GTK_WIDGET(global->monitor->max_hbox[i]), !(global->monitor->options.auto_max) ); - g_signal_connect(GTK_WIDGET(global->monitor->max_entry[i]), "activate", + g_signal_connect(GTK_WIDGET(global->monitor->max_entry[i]), "changed", G_CALLBACK(max_label_changed), global); } @@ -1241,7 +1241,7 @@ static void monitor_create_options(XfcePanelPlugin *plugin, t_global_monitor *gl G_CALLBACK(change_color_out), global); g_signal_connect(GTK_WIDGET(global->monitor->opt_use_label), "toggled", G_CALLBACK(label_toggled), global); - g_signal_connect(GTK_WIDGET(global->monitor->opt_entry), "activate", + g_signal_connect(GTK_WIDGET(global->monitor->opt_entry), "changed", G_CALLBACK(label_changed), global); g_signal_connect(GTK_WIDGET(global->monitor->opt_present_data_combobox), "changed", G_CALLBACK(present_data_combobox_changed), global); -- 1.7.10.4
>From 4a926c62abb60de7b35d2801774b94fc5b40e22e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Gajd=C5=AF=C5=A1ek?= <gajdusek.p...@centrum.cz> Date: Tue, 23 Oct 2012 23:56:05 +0200 Subject: [PATCH 6/6] Change default label text from "Net" to "net" Be consistent with systemload plugin that uses lowercase letters. --- panel-plugin/netload.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/panel-plugin/netload.c b/panel-plugin/netload.c index c8c3b1b..9490d6f 100644 --- a/panel-plugin/netload.c +++ b/panel-plugin/netload.c @@ -37,7 +37,7 @@ #define BORDER 8 /* Defaults */ -#define DEFAULT_TEXT "Net" +#define DEFAULT_TEXT "net" #define INIT_MAX 4096 #define MINIMAL_MAX 1024 -- 1.7.10.4