From 4a6cfa60774e14c8136fb6903fe72c1e07d720d7 Mon Sep 17 00:00:00 2001 From: Alan Fitton Date: Thu, 14 Apr 2011 21:26:45 +0000 Subject: show speed limits in status bar, thanks to jdhore for the patch. --- po/de.po | 10 ++--- po/ko.po | 10 ++--- po/pl.po | 8 ++-- po/ru.po | 12 +++--- src/Makefile.am | 2 +- src/trg-main-window.c | 16 +++---- src/trg-status-bar.c | 34 ++++++++++++--- src/trg-status-bar.h | 2 +- src/trg-torrent-add-dialog.c | 2 +- transmission-remote-gtk.pot | 99 +++++++++++++++++++++++++------------------- 10 files changed, 116 insertions(+), 79 deletions(-) diff --git a/po/de.po b/po/de.po index cf5964e..65df2e4 100644 --- a/po/de.po +++ b/po/de.po @@ -585,12 +585,12 @@ msgstr "Verschiebe %s Torrents" msgid "Connected to Transmission %g, getting torrents..." msgstr "Verbunden mit Transmission %g, hole Torrents..." -#: src/trg-status-bar.c:95 +#: src/trg-status-bar.c:119 #, c-format -msgid "%d torrent .. Down %s, Up %s .. %d seeding, %d downloading, %d paused" -msgid_plural "%d torrents .. Down %s, Up %s .. %d seeding, %d downloading, %d paused" -msgstr[0] "%d Torrent .. Down %s, Up %s .. %d seeding, %d downloading, %d paused" -msgstr[1] "%d Torrents .. Down %s, Up %s .. %d seeding, %d downloading, %d paused" +msgid "%d torrent .. Down %s%s, Up %s%s .. %d seeding, %d downloading, %d paused" +msgid_plural "%d torrents .. Down %s%s, Up %s%s .. %d seeding, %d downloading, %d paused" +msgstr[0] "%d Torrent .. Down %s%s, Up %s%s .. %d seeding, %d downloading, %d paused" +msgstr[1] "%d Torrents .. Down %s%s, Up %s%s .. %d seeding, %d downloading, %d paused" #: src/trg-stats-dialog.c:267 msgid "Statistics" diff --git a/po/ko.po b/po/ko.po index 7cc036f..1ea390b 100644 --- a/po/ko.po +++ b/po/ko.po @@ -656,12 +656,12 @@ msgstr "누적" msgid "Connected to Transmission %g, getting torrents..." msgstr "트랜스미션에 접속됨 %g, 토렌트 정보를 받는 중" -#: src/trg-status-bar.c:95 +#: src/trg-status-bar.c:119 #, c-format -msgid "%d torrent .. Down %s, Up %s .. %d seeding, %d downloading, %d paused" -msgid_plural "%d torrents .. Down %s, Up %s .. %d seeding, %d downloading, %d paused" -msgstr[0] "%d 개의 토렌트 .. 다운로드 속도: %s, 업로드 속도: %s .. %d 개 배포 중, %d 개 다운로드 중, %d 개 멈춤" -msgstr[1] "%d 개의 토렌트 .. 다운로드 속도: %s, 업로드 속도: %s .. %d 개 배포 중, %d 개 다운로드 중, %d 개 멈춤" +msgid "%d torrent .. Down %s%s, Up %s%s .. %d seeding, %d downloading, %d paused" +msgid_plural "%d torrents .. Down %s%s, Up %s%s .. %d seeding, %d downloading, %d paused" +msgstr[0] "%d 개의 토렌트 .. 다운로드 속도: %s%s, 업로드 속도: %s %s .. %d 개 배포 중, %d 개 다운로드 중, %d 개 멈춤" +msgstr[1] "%d 개의 토렌트 .. 다운로드 속도: %s%s, 업로드 속도: %s %s .. %d 개 배포 중, %d 개 다운로드 중, %d 개 멈춤" #: src/trg-toolbar.c:246 msgid "Remove with data" diff --git a/po/pl.po b/po/pl.po index e70ed05..ecc5f6f 100644 --- a/po/pl.po +++ b/po/pl.po @@ -713,10 +713,10 @@ msgstr "Połączono z Transmission %g, pobieranie torentów..." #: src/trg-status-bar.c:95 #, c-format -msgid "%d torrent .. Down %s, Up %s .. %d seeding, %d downloading, %d paused" -msgid_plural "%d torrents .. Down %s, Up %s .. %d seeding, %d downloading, %d paused" -msgstr[0] "%d torentów .. Pob. %s, Wys. %s .. %d rozsiewanych, %d pobieranych, %d zatrzymanych" -msgstr[1] "%d torentów .. Pob. %s, Wys. %s .. %d rozsiewanych, %d pobieranych, %d zatrzymanych" +msgid "%d torrent .. Down %s%s, Up %s%s .. %d seeding, %d downloading, %d paused" +msgid_plural "%d torrents .. Down %s%s, Up %s%s .. %d seeding, %d downloading, %d paused" +msgstr[0] "%d torentów .. Pob. %s%s, Wys. %s%s .. %d rozsiewanych, %d pobieranych, %d zatrzymanych" +msgstr[1] "%d torentów .. Pob. %s%s, Wys. %s%s .. %d rozsiewanych, %d pobieranych, %d zatrzymanych" #: src/trg-toolbar.c:246 msgid "Remove with data" diff --git a/po/ru.po b/po/ru.po index 68ed359..c692861 100644 --- a/po/ru.po +++ b/po/ru.po @@ -720,13 +720,13 @@ msgstr "Всего" msgid "Connected to Transmission %g, getting torrents..." msgstr "Подключен к Transmission %g, получаю список торрентов..." -#: src/trg-status-bar.c:96 +#: src/trg-status-bar.c:119 #, c-format -msgid "%d torrent .. Down %s, Up %s .. %d seeding, %d downloading, %d paused" -msgid_plural "%d torrents .. Down %s, Up %s .. %d seeding, %d downloading, %d paused" -msgstr[0] "%d торрент .. Загрузка %s, Отдача %s .. %d раздающихся, %d загружаемых, %d остановленных" -msgstr[1] "%d торрента .. Загрузка %s, Отдача %s .. %d раздающихся, %d загружаемых, %d остановленных" -msgstr[2] "%d торрентов .. Загрузка %s, Отдача %s .. %d раздающихся, %d загружаемых, %d остановленных" +msgid "%d torrent .. Down %s%s, Up %s%s .. %d seeding, %d downloading, %d paused" +msgid_plural "%d torrents .. Down %s%s, Up %s%s .. %d seeding, %d downloading, %d paused" +msgstr[0] "%d торрент .. Загрузка %s%s, Отдача %s%s .. %d раздающихся, %d загружаемых, %d остановленных" +msgstr[1] "%d торрента .. Загрузка %s%s, Отдача %s%s .. %d раздающихся, %d загружаемых, %d остановленных" +msgstr[2] "%d торрентов .. Загрузка %s%s, Отдача %s%s .. %d раздающихся, %d загружаемых, %d остановленных" #: src/trg-toolbar.c:246 msgid "Remove with data" diff --git a/src/Makefile.am b/src/Makefile.am index 229211f..11086c4 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -23,7 +23,7 @@ schemadir = @GCONF_SCHEMA_FILE_DIR@ schema_DATA = transmission-remote-gtk.schemas bin_PROGRAMS = transmission-remote-gtk -INCLUDES = --pedantic -Wall -I.. -O2 -DTRGLICENSE=\""$(trglicense)"\" -DTRGLOCALEDIR=\""$(trglocaledir)"\" $(jsonglib_CFLAGS) $(gthread_CFLAGS) $(gtk_CFLAGS) $(gconf_CFLAGS) $(gio_CFLAGS) $(unique_CFLAGS) $(notify_CFLAGS) +INCLUDES = --pedantic -Wall -I.. -O2 -DTRGLICENSE=\""$(trglicense)"\" -DTRGLOCALEDIR=\""$(trglocaledir)"\" $(jsonglib_CFLAGS) $(gthread_CFLAGS) $(gtk_CFLAGS) $(gconf_CFLAGS) $(gio_CFLAGS) $(unique_CFLAGS) $(notify_CFLAGS) -std=gnu99 transmission_remote_gtk_SOURCES = main.c \ requests.c \ diff --git a/src/trg-main-window.c b/src/trg-main-window.c index bafa3e6..17af3e3 100644 --- a/src/trg-main-window.c +++ b/src/trg-main-window.c @@ -935,7 +935,7 @@ on_torrent_get(JsonObject * response, int mode, int status, gpointer data) update_selected_torrent_notebook(TRG_MAIN_WINDOW(data), mode); - trg_status_bar_update(priv->statusBar, &stats); + trg_status_bar_update(priv->statusBar, &stats, client); if (priv->graphNotebookIndex >= 0) trg_torrent_graph_set_speed(priv->graph, &stats); @@ -1410,7 +1410,7 @@ static GtkWidget *limit_item_new(TrgMainWindow * win, GtkWidget * menu, gboolean active = limit < 0 ? FALSE : (currentLimit == (gint64) limit); if (limit >= 1000) - g_snprintf(speed, sizeof(speed), "%.2f MB/s", limit / 1000); + g_snprintf(speed, sizeof(speed), "%.2f MB/s", limit / 1024); else g_snprintf(speed, sizeof(speed), "%.0f KB/s", limit); @@ -1482,12 +1482,12 @@ static GtkWidget *limit_menu_new(TrgMainWindow * win, gchar * title, limit_item_new(win, menu, limit, 400); limit_item_new(win, menu, limit, 500); limit_item_new(win, menu, limit, 750); - limit_item_new(win, menu, limit, 1000); - limit_item_new(win, menu, limit, 1250); - limit_item_new(win, menu, limit, 1500); - limit_item_new(win, menu, limit, 2000); - limit_item_new(win, menu, limit, 2500); - limit_item_new(win, menu, limit, 3000); + limit_item_new(win, menu, limit, 1024); + limit_item_new(win, menu, limit, 1280); + limit_item_new(win, menu, limit, 1536); + limit_item_new(win, menu, limit, 2048); + limit_item_new(win, menu, limit, 2560); + limit_item_new(win, menu, limit, 3072); gtk_menu_item_set_submenu(GTK_MENU_ITEM(toplevel), menu); diff --git a/src/trg-status-bar.c b/src/trg-status-bar.c index c5a0ca1..34b53ed 100644 --- a/src/trg-status-bar.c +++ b/src/trg-status-bar.c @@ -78,25 +78,49 @@ void trg_status_bar_connect(TrgStatusBar * sb, JsonObject * session) } void trg_status_bar_update(TrgStatusBar * sb, - trg_torrent_model_update_stats * stats) + trg_torrent_model_update_stats * stats, trg_client * client) { TrgStatusBarPrivate *priv; gchar *statusBarUpdate; + gint64 uplimitraw, downlimitraw; gchar downRateTotalString[32], upRateTotalString[32]; + 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; + + 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 (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, Up %s .. %d seeding, %d downloading, %d paused", - "%d torrents .. Down %s, Up %s .. %d seeding, %d downloading, %d paused", - stats->count), stats->count, downRateTotalString, - upRateTotalString, stats->seeding, stats->down, stats->paused); + ("%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); gtk_statusbar_pop(GTK_STATUSBAR(sb), priv->countSpeedsCtx); gtk_statusbar_push(GTK_STATUSBAR(sb), priv->countSpeedsCtx, statusBarUpdate); diff --git a/src/trg-status-bar.h b/src/trg-status-bar.h index 5908c9f..27f2c44 100644 --- a/src/trg-status-bar.h +++ b/src/trg-status-bar.h @@ -52,7 +52,7 @@ TrgStatusBar *trg_status_bar_new(); G_END_DECLS void trg_status_bar_update(TrgStatusBar * sb, - trg_torrent_model_update_stats * stats); + trg_torrent_model_update_stats * stats, trg_client * client); void trg_status_bar_connect(TrgStatusBar * sb, JsonObject * session); void trg_status_bar_push_connection_msg(TrgStatusBar * sb, const gchar * msg); diff --git a/src/trg-torrent-add-dialog.c b/src/trg-torrent-add-dialog.c index 5ea7a6a..0b018a0 100644 --- a/src/trg-torrent-add-dialog.c +++ b/src/trg-torrent-add-dialog.c @@ -241,7 +241,7 @@ static void launch_add_thread(struct add_torrent_threadfunc_args *args) GError *error = NULL; g_thread_create(add_files_threadfunc, args, FALSE, &error); - if (error != NULL) { + if (error) { g_printf("thread creation error: %s\n", error->message); g_error_free(error); g_str_slist_free(args->list); diff --git a/transmission-remote-gtk.pot b/transmission-remote-gtk.pot index 9349f06..56f9518 100644 --- a/transmission-remote-gtk.pot +++ b/transmission-remote-gtk.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-04-12 22:47+0100\n" +"POT-Creation-Date: 2011-04-14 22:11+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -67,7 +67,7 @@ msgstr "" msgid "Low Priority" msgstr "" -#: src/trg-files-tree-view.c:227 src/trg-torrent-add-dialog.c:601 +#: src/trg-files-tree-view.c:227 src/trg-torrent-add-dialog.c:600 msgid "Download" msgstr "" @@ -76,12 +76,12 @@ msgid "Skip" msgstr "" #: src/trg-files-tree-view.c:318 src/trg-general-panel.c:251 -#: src/trg-torrent-tree-view.c:40 src/trg-torrent-add-dialog.c:571 +#: src/trg-torrent-tree-view.c:40 src/trg-torrent-add-dialog.c:570 msgid "Name" msgstr "" #: src/trg-files-tree-view.c:319 src/trg-general-panel.c:254 -#: src/trg-torrent-tree-view.c:42 src/trg-torrent-add-dialog.c:588 +#: src/trg-torrent-tree-view.c:42 src/trg-torrent-add-dialog.c:587 msgid "Size" msgstr "" @@ -93,7 +93,7 @@ msgstr "" msgid "Wanted" msgstr "" -#: src/trg-files-tree-view.c:326 src/trg-torrent-add-dialog.c:618 +#: src/trg-files-tree-view.c:326 src/trg-torrent-add-dialog.c:617 msgid "Priority" msgstr "" @@ -102,7 +102,7 @@ msgid "N/A" msgstr "" #: src/trg-general-panel.c:169 src/trg-main-window.c:853 -#: src/trg-main-window.c:1110 src/trg-state-selector.c:439 src/util.c:83 +#: src/trg-main-window.c:1113 src/trg-state-selector.c:439 src/util.c:83 msgid "Error" msgstr "" @@ -217,86 +217,86 @@ msgstr "" msgid "This application supports Transmission %.2f and later, you have %.2f." msgstr "" -#: src/trg-main-window.c:905 +#: src/trg-main-window.c:908 #, c-format msgid "Request %d/%d failed: %s" msgstr "" -#: src/trg-main-window.c:1460 +#: src/trg-main-window.c:1463 msgid "No Limit" msgstr "" -#: src/trg-main-window.c:1504 src/trg-menu-bar.c:302 src/trg-toolbar.c:238 +#: src/trg-main-window.c:1507 src/trg-menu-bar.c:302 src/trg-toolbar.c:238 msgid "Properties" msgstr "" -#: src/trg-main-window.c:1507 src/trg-toolbar.c:231 +#: src/trg-main-window.c:1510 src/trg-toolbar.c:231 msgid "Resume" msgstr "" -#: src/trg-main-window.c:1510 src/trg-toolbar.c:234 +#: src/trg-main-window.c:1513 src/trg-toolbar.c:234 msgid "Pause" msgstr "" -#: src/trg-main-window.c:1513 +#: src/trg-main-window.c:1516 msgid "Verify" msgstr "" -#: src/trg-main-window.c:1516 +#: src/trg-main-window.c:1519 msgid "Re-announce" msgstr "" -#: src/trg-main-window.c:1519 src/trg-torrent-move-dialog.c:99 +#: src/trg-main-window.c:1522 src/trg-torrent-move-dialog.c:99 #: src/trg-torrent-move-dialog.c:106 msgid "Move" msgstr "" -#: src/trg-main-window.c:1522 src/trg-menu-bar.c:320 src/trg-toolbar.c:242 +#: src/trg-main-window.c:1525 src/trg-menu-bar.c:320 src/trg-toolbar.c:242 msgid "Remove" msgstr "" -#: src/trg-main-window.c:1525 +#: src/trg-main-window.c:1528 msgid "Remove & Delete" msgstr "" -#: src/trg-main-window.c:1531 src/trg-main-window.c:1576 +#: src/trg-main-window.c:1534 src/trg-main-window.c:1579 msgid "Down Limit" msgstr "" -#: src/trg-main-window.c:1536 src/trg-main-window.c:1581 +#: src/trg-main-window.c:1539 src/trg-main-window.c:1584 msgid "Up Limit" msgstr "" -#: src/trg-main-window.c:1558 src/trg-toolbar.c:215 +#: src/trg-main-window.c:1561 src/trg-toolbar.c:215 msgid "Connect" msgstr "" -#: src/trg-main-window.c:1562 src/trg-toolbar.c:218 +#: src/trg-main-window.c:1565 src/trg-toolbar.c:218 msgid "Disconnect" msgstr "" -#: src/trg-main-window.c:1566 src/trg-toolbar.c:221 +#: src/trg-main-window.c:1569 src/trg-toolbar.c:221 #: src/trg-trackers-tree-view.c:251 src/trg-trackers-tree-view.c:278 msgid "Add" msgstr "" -#: src/trg-main-window.c:1570 +#: src/trg-main-window.c:1573 msgid "Add from URL" msgstr "" -#: src/trg-main-window.c:1585 +#: src/trg-main-window.c:1588 msgid "Resume All" msgstr "" -#: src/trg-main-window.c:1589 +#: src/trg-main-window.c:1592 msgid "Pause All" msgstr "" -#: src/trg-main-window.c:1596 +#: src/trg-main-window.c:1599 msgid "Quit" msgstr "" -#: src/trg-main-window.c:1710 +#: src/trg-main-window.c:1713 msgid "Graph" msgstr "" @@ -722,12 +722,19 @@ msgstr "" msgid "Connected to Transmission %g, getting torrents..." msgstr "" -#: src/trg-status-bar.c:96 +#: src/trg-status-bar.c:106 src/trg-status-bar.c:113 +#, c-format +msgid "(Limit: %s)" +msgstr "" + +#: src/trg-status-bar.c:119 #, c-format msgid "" -"%d torrent .. Down %s, Up %s .. %d seeding, %d downloading, %d paused" +"%d torrent .. Down %s %s, Up %s %s .. %d seeding, %d downloading, %d " +"paused" msgid_plural "" -"%d torrents .. Down %s, Up %s .. %d seeding, %d downloading, %d paused" +"%d torrents .. Down %s %s, Up %s %s .. %d seeding, %d downloading, %d " +"paused" msgstr[0] "" msgstr[1] "" @@ -774,17 +781,17 @@ msgid "Honor global limits" msgstr "" #: src/trg-torrent-props-dialog.c:184 src/trg-cell-renderer-priority.c:73 -#: src/trg-torrent-add-dialog.c:345 src/trg-torrent-add-dialog.c:708 +#: src/trg-torrent-add-dialog.c:345 src/trg-torrent-add-dialog.c:707 msgid "Low" msgstr "" #: src/trg-torrent-props-dialog.c:185 src/trg-cell-renderer-priority.c:77 -#: src/trg-torrent-add-dialog.c:342 src/trg-torrent-add-dialog.c:709 +#: src/trg-torrent-add-dialog.c:342 src/trg-torrent-add-dialog.c:708 msgid "Normal" msgstr "" #: src/trg-torrent-props-dialog.c:186 src/trg-cell-renderer-priority.c:75 -#: src/trg-torrent-add-dialog.c:339 src/trg-torrent-add-dialog.c:710 +#: src/trg-torrent-add-dialog.c:339 src/trg-torrent-add-dialog.c:709 msgid "High" msgstr "" @@ -948,46 +955,52 @@ msgstr[1] "" msgid "Mixed" msgstr "" -#: src/trg-torrent-add-dialog.c:718 +#: src/trg-torrent-add-dialog.c:717 msgid "Torrent files" msgstr "" -#: src/trg-torrent-add-dialog.c:723 +#: src/trg-torrent-add-dialog.c:722 msgid "All files" msgstr "" -#: src/trg-torrent-add-dialog.c:775 +#: src/trg-torrent-add-dialog.c:754 +msgid "" +"Unable to parse torrent file. File preferences unavailable, but you can " +"still try uploading it." +msgstr "" + +#: src/trg-torrent-add-dialog.c:789 msgid "(None)" msgstr "" -#: src/trg-torrent-add-dialog.c:777 +#: src/trg-torrent-add-dialog.c:791 msgid "(Multiple)" msgstr "" -#: src/trg-torrent-add-dialog.c:799 +#: src/trg-torrent-add-dialog.c:813 msgid "Add a Torrent" msgstr "" -#: src/trg-torrent-add-dialog.c:862 +#: src/trg-torrent-add-dialog.c:876 msgid "Add Torrent" msgstr "" -#: src/trg-torrent-add-dialog.c:886 +#: src/trg-torrent-add-dialog.c:900 msgid "Start _paused" msgstr "" -#: src/trg-torrent-add-dialog.c:894 +#: src/trg-torrent-add-dialog.c:908 msgid "_Torrent file:" msgstr "" -#: src/trg-torrent-add-dialog.c:914 +#: src/trg-torrent-add-dialog.c:928 msgid "_Destination folder:" msgstr "" -#: src/trg-torrent-add-dialog.c:940 +#: src/trg-torrent-add-dialog.c:947 msgid "Torrent _priority:" msgstr "" -#: src/trg-torrent-add-dialog.c:1040 +#: src/trg-torrent-add-dialog.c:1047 msgid "Show _options dialog" msgstr "" -- cgit v1.2.3