I had these modules listed as being owned by me, but they are really owned by
wangke, correcting.
--- gnome-netstatus-2.28.0.orig/src/netstatus-applet.c 2009-09-25 13:29:53.358922003 +0100
+++ gnome-netstatus-2.28.0/src/netstatus-applet.c 2009-09-25 13:34:49.693188336 +0100
@@ -32,6 +32,7 @@
#include "netstatus-icon.h"
#include "netstatus-iface.h"
+#include "netstatus-sysdeps.h"
#include "netstatus-dialog.h"
struct _NetstatusAppletPrivate
@@ -481,6 +482,9 @@
{
GError *error = NULL;
GList *iface_names;
+ gulong in_packets, out_packets;
+ gulong in_bytes, out_bytes;
+ char *error_message;
g_free (iface_name);
iface_name = NULL;
@@ -494,10 +498,29 @@
* figure out what interfaces aren't currently
* displayed in an applet.
*/
- iface_name = iface_names->data;
-
- for (l = iface_names->next; l; l = l->next)
- g_free (l->data);
+ /* Process list of interfaces, and instead of showing first one,
+ * Show first non error interface.
+ */
+ for (l = iface_names; l; l = l->next) {
+ if ((error_message = netstatus_sysdeps_read_iface_statistics (l->data,
+ &in_packets, &out_packets, &in_bytes, &out_bytes)) == NULL) {
+ /* Success !! make this the iface_name */
+ iface_name = l->data;
+ break;
+ } else {
+ g_free (error_message);
+ }
+ }
+
+ if (!iface_name || !iface_name [0])
+ iface_name = iface_names->data;
+
+ for (l = iface_names; l; l = l->next) {
+ /* Only free non used names */
+ if (strcmp(l->data, iface_name)) {
+ g_free (l->data);
+ }
+ }
g_list_free (iface_names);
}
else