Treferwynd / transmission-remote-gtk

Automatically exported from code.google.com/p/transmission-remote-gtk
GNU General Public License v2.0
0 stars 0 forks source link

Speed limit on status bar #227

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
When alternate speed limits are active, status bar could show the minimum speed 
between global and alternate limits.

Original issue reported on code.google.com by alve...@gmail.com on 10 Apr 2013 at 4:13

Attachments:

GoogleCodeExporter commented 9 years ago
In my case it's actually maximum: normal up limit = 120, alt up limit = 60, 
when alt limits are enabled status shows 120.

Original comment by Radist.M...@gmail.com on 22 Oct 2013 at 4:09

GoogleCodeExporter commented 9 years ago
Ok, it was easy. Alt speed-limits should supersede normal speed limits. Here is 
the patch

--- a/src/trg-status-bar.c  1979-12-31 00:00:00.000000000 +0100
+++ b/src/trg-status-bar.c" 2013-10-22 18:22:22.238896849 +0200
@@ -200,19 +200,19 @@
     gchar downRateTotalString[32], upRateTotalString[32];
     gchar uplimit[64], downlimit[64];

-    if (session_get_speed_limit_down_enabled(session))
-        downlimitraw = session_get_speed_limit_down(session);
-    else if (altLimits)
+    if (altLimits) {
         downlimitraw = session_get_alt_speed_limit_down(session);
-    else
-        downlimitraw = -1;
-
-    if (session_get_speed_limit_up_enabled(session))
-        uplimitraw = session_get_speed_limit_up(session);
-    else if (altLimits)
         uplimitraw = session_get_alt_speed_limit_up(session);
-    else
-        uplimitraw = -1;
+    } else {
+        if (session_get_speed_limit_down_enabled(session))
+            downlimitraw = session_get_speed_limit_down(session);
+        else
+            downlimitraw = -1;
+        if (session_get_speed_limit_up_enabled(session))
+            uplimitraw = session_get_speed_limit_up(session);
+        else
+            uplimitraw = -1;
+    }

     trg_strlspeed(downRateTotalString, stats->downRateTotal / disk_K);
     trg_strlspeed(upRateTotalString, stats->upRateTotal / disk_K);

Original comment by Radist.M...@gmail.com on 22 Oct 2013 at 4:29

GoogleCodeExporter commented 9 years ago
Thanks for the good patch, I've committed it :)

Original comment by a...@eth0.org.uk on 22 Oct 2013 at 7:21