gnome-applets r11114 - trunk/multiload



Author: callum
Date: Sat Nov  8 23:37:30 2008
New Revision: 11114
URL: http://svn.gnome.org/viewvc/gnome-applets?rev=11114&view=rev

Log:
Report the actual bandwidth in the tooltip.

Modified:
   trunk/multiload/ChangeLog
   trunk/multiload/Makefile.am
   trunk/multiload/global.h
   trunk/multiload/linux-proc.c
   trunk/multiload/load-graph.c
   trunk/multiload/main.c

Modified: trunk/multiload/Makefile.am
==============================================================================
--- trunk/multiload/Makefile.am	(original)
+++ trunk/multiload/Makefile.am	Sat Nov  8 23:37:30 2008
@@ -17,6 +17,7 @@
 			load-graph.c	\
 			main.c	\
 			properties.c	\
+			netspeed.c netspeed.h \
 			autoscaler.c	\
 			autoscaler.h
 

Modified: trunk/multiload/global.h
==============================================================================
--- trunk/multiload/global.h	(original)
+++ trunk/multiload/global.h	Sat Nov  8 23:37:30 2008
@@ -15,6 +15,8 @@
 typedef struct _LoadGraph LoadGraph;
 typedef void (*LoadGraphDataFunc) (int, int [], LoadGraph *);
 
+#include "netspeed.h"
+
 struct _LoadGraph {
     MultiloadApplet *multiload;
 
@@ -45,6 +47,8 @@
     int cpu_initialized;
 
     double loadavg1;
+    NetSpeed *netspeed_in;
+    NetSpeed *netspeed_out;
 
     gboolean visible;
     gboolean tooltip_update;

Modified: trunk/multiload/linux-proc.c
==============================================================================
--- trunk/multiload/linux-proc.c	(original)
+++ trunk/multiload/linux-proc.c	Sat Nov  8 23:37:30 2008
@@ -364,7 +364,8 @@
     }
 
     g_strfreev(devices);
-
+    netspeed_add(g->netspeed_in, present[IN_COUNT]);
+    netspeed_add(g->netspeed_out, present[OUT_COUNT]);
 
     if(ticks < 2) /* avoid initial spike */
     {

Modified: trunk/multiload/load-graph.c
==============================================================================
--- trunk/multiload/load-graph.c	(original)
+++ trunk/multiload/load-graph.c	Sat Nov  8 23:37:30 2008
@@ -247,7 +247,9 @@
     LoadGraph *g = (LoadGraph *) data_ptr;
 
     load_graph_stop (g);
- 
+    netspeed_delete(g->netspeed_in);
+    netspeed_delete(g->netspeed_out);
+
     gtk_widget_destroy(widget);
 }
 
@@ -289,7 +291,8 @@
     PanelAppletOrient orient;
     
     g = g_new0 (LoadGraph, 1);
-
+    g->netspeed_in = netspeed_new(g);
+    g->netspeed_out = netspeed_new(g);
     g->visible = visible;
     g->name = name;
     g->n = n;

Modified: trunk/multiload/main.c
==============================================================================
--- trunk/multiload/main.c	(original)
+++ trunk/multiload/main.c	Sat Nov  8 23:37:30 2008
@@ -326,6 +326,17 @@
 		tooltip_text = g_strdup_printf(_("The system load average is %0.02f"),
 					       g->loadavg1);
 
+	} else if (!strcmp(g->name, "netload2")) {
+		char *tx_in, *tx_out;
+		tx_in = netspeed_get(g->netspeed_in);
+		tx_out = netspeed_get(g->netspeed_out);
+		/* xgettext: same as in graphic tab of g-s-m */
+		tooltip_text = g_strdup_printf(_("%s:\n"
+						 "Receiving %s\n"
+						 "Sending %s"),
+					       name, tx_in, tx_out);
+		g_free(tx_in);
+		g_free(tx_out);
 	} else {
 		const char *msg;
 		guint i, total_used, percent;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]