A little patch for the modemlights applet



With this patch modemlights shows the connection time in the tooltip.
--- gnome-applets/modemlights/modemlights.c	Sat Oct 14 13:19:55 2000
+++ modemlights.c	Sat Oct 14 13:59:46 2000
@@ -526,10 +526,24 @@
 
 static void update_tooltip(int connected, int rx, int tx)
 {
-	gchar text[64];
+	gchar text[128];
+	gint  timer, a, b;
+	gchar s1[6], s2[3];
+
 	if (connected)
 		{
-		g_snprintf(text,sizeof(text),"%#.1fM / %#.1fM",(float)rx / 1000000, (float)tx / 1000000);
+		timer = get_connect_time(FALSE);
+
+		a = timer / 3600;
+		b = (timer - (a*3600)) / 60;
+		
+		sprintf (s1, "%2d", a);
+		if (a < 10) s1[0] = '0';
+
+		sprintf (s2, "%2d", b); 
+		if (b < 10) s2[0] = '0';
+
+		g_snprintf(text,sizeof(text), _("%d bytes received and %d bytes transmitted, connection time: %s:%s"), rx, tx, s1, s2);
 		}
 	else
 		{


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