summaryrefslogtreecommitdiff
path: root/src/trg-status-bar.c
diff options
context:
space:
mode:
authorGravatar Alan Fitton <ajf@eth0.org.uk>2011-04-16 23:41:56 +0000
committerGravatar Alan Fitton <ajf@eth0.org.uk>2011-04-16 23:41:56 +0000
commit2743f8edc3b22deb7a5cd34760faef137fbf4fdc (patch)
tree5ab296a8f08945d24c364a9e99f3aa6299db56f7 /src/trg-status-bar.c
parent2515c70aec58814f32fc7e22ab9dfa90fcd934e6 (diff)
updating a torrents file or trackers doesn't make it recently active, so these changes could get missed if doing active only updates. for these: send the torrent id as the request tag, which Transmission passes back, then we request an update just for that torrent.
Diffstat (limited to 'src/trg-status-bar.c')
-rw-r--r--src/trg-status-bar.c54
1 files changed, 31 insertions, 23 deletions
diff --git a/src/trg-status-bar.c b/src/trg-status-bar.c
index 34b53ed..3e45b72 100644
--- a/src/trg-status-bar.c
+++ b/src/trg-status-bar.c
@@ -78,49 +78,57 @@ void trg_status_bar_connect(TrgStatusBar * sb, JsonObject * session)
}
void trg_status_bar_update(TrgStatusBar * sb,
- trg_torrent_model_update_stats * stats, trg_client * client)
+ trg_torrent_model_update_stats * stats,
+ trg_client * client)
{
TrgStatusBarPrivate *priv;
gchar *statusBarUpdate;
- gint64 uplimitraw, downlimitraw;
+ gint64 uplimitraw, downlimitraw;
gchar downRateTotalString[32], upRateTotalString[32];
- gchar uplimit[64], downlimit[64];
+ gchar uplimit[64], downlimit[64];
priv = TRG_STATUS_BAR_GET_PRIVATE(sb);
- /* The session should always exist otherwise this function wouldn't be called */
- downlimitraw = json_object_get_boolean_member(client->session, SGET_SPEED_LIMIT_DOWN_ENABLED) ?
- json_object_get_int_member(client->session, SGET_SPEED_LIMIT_DOWN) : -1;
+ /* The session should always exist otherwise this function wouldn't be called */
+ downlimitraw =
+ json_object_get_boolean_member(client->session,
+ SGET_SPEED_LIMIT_DOWN_ENABLED) ?
+ json_object_get_int_member(client->session,
+ SGET_SPEED_LIMIT_DOWN) : -1;
- uplimitraw = json_object_get_boolean_member(client->session, SGET_SPEED_LIMIT_UP_ENABLED) ?
- json_object_get_int_member(client->session, SGET_SPEED_LIMIT_UP) : -1;
+ uplimitraw =
+ json_object_get_boolean_member(client->session,
+ SGET_SPEED_LIMIT_UP_ENABLED) ?
+ json_object_get_int_member(client->session,
+ SGET_SPEED_LIMIT_UP) : -1;
trg_strlspeed(downRateTotalString,
stats->downRateTotal / KILOBYTE_FACTOR);
trg_strlspeed(upRateTotalString, stats->upRateTotal / KILOBYTE_FACTOR);
- if (uplimitraw >= 0)
- {
- gchar uplimitstring[32];
- trg_strlspeed(uplimitstring, uplimitraw);
- g_snprintf(uplimit, sizeof(uplimit), _( " (Limit: %s)" ), uplimitstring);
- }
+ if (uplimitraw >= 0) {
+ gchar uplimitstring[32];
+ trg_strlspeed(uplimitstring, uplimitraw);
+ g_snprintf(uplimit, sizeof(uplimit), _(" (Limit: %s)"),
+ uplimitstring);
+ }
- if (downlimitraw >= 0)
- {
- gchar downlimitstring[32];
- trg_strlspeed(downlimitstring, downlimitraw);
- g_snprintf(downlimit, sizeof(downlimit), _( " (Limit: %s)" ), downlimitstring);
- }
+ if (downlimitraw >= 0) {
+ gchar downlimitstring[32];
+ trg_strlspeed(downlimitstring, downlimitraw);
+ g_snprintf(downlimit, sizeof(downlimit), _(" (Limit: %s)"),
+ downlimitstring);
+ }
statusBarUpdate =
g_strdup_printf
(ngettext
("%d torrent .. Down %s%s, Up %s%s .. %d seeding, %d downloading, %d paused",
"%d torrents .. Down %s%s, Up %s%s .. %d seeding, %d downloading, %d paused",
- stats->count), stats->count, downRateTotalString, downlimitraw >= 0 ? downlimit : "",
- upRateTotalString, uplimitraw >= 0 ? uplimit : "",
- stats->seeding, stats->down, stats->paused);
+ stats->count), stats->count, downRateTotalString,
+ downlimitraw >= 0 ? downlimit : "", upRateTotalString,
+ uplimitraw >= 0 ? uplimit : "", stats->seeding, stats->down,
+ stats->paused);
gtk_statusbar_pop(GTK_STATUSBAR(sb), priv->countSpeedsCtx);
gtk_statusbar_push(GTK_STATUSBAR(sb),
priv->countSpeedsCtx, statusBarUpdate);