From 8ba9cdd592fdc47771c9b3bd8491db9d4510b5e7 Mon Sep 17 00:00:00 2001 From: Alan Fitton Date: Sun, 26 Aug 2012 21:36:43 +0100 Subject: fix units in torrent-cell-renderer, fix crash closing old style torrent properties --- src/torrent-cell-renderer.c | 4 ++-- src/trg-torrent-props-dialog.c | 26 ++++++++++++++------------ 2 files changed, 16 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/torrent-cell-renderer.c b/src/torrent-cell-renderer.c index ab4eeeb..128473e 100644 --- a/src/torrent-cell-renderer.c +++ b/src/torrent-cell-renderer.c @@ -248,9 +248,9 @@ static char *getShortTransferString(TorrentCellRenderer * r, const gboolean haveDown = haveMeta && priv->peersToUs > 0; if (haveDown) - tr_formatter_speed_KBps(downStr, priv->downSpeed, sizeof(downStr)); + tr_formatter_speed_KBps(downStr, priv->downSpeed/speed_K, sizeof(downStr)); if (haveUp) - tr_formatter_speed_KBps(upStr, priv->upSpeed, sizeof(upStr)); + tr_formatter_speed_KBps(upStr, priv->upSpeed/speed_K, sizeof(upStr)); if (haveDown && haveUp) /* 1==down arrow, 2==down speed, 3==up arrow, 4==down speed */ diff --git a/src/trg-torrent-props-dialog.c b/src/trg-torrent-props-dialog.c index 97f2534..b237949 100644 --- a/src/trg-torrent-props-dialog.c +++ b/src/trg-torrent-props-dialog.c @@ -146,15 +146,17 @@ trg_torrent_props_response_cb(GtkDialog * dlg, gint res_id, priv = TRG_TORRENT_PROPS_DIALOG_GET_PRIVATE(dlg); - trg_tree_view_persist(TRG_TREE_VIEW(priv->peersTv), - TRG_TREE_VIEW_PERSIST_SORT | - TRG_TREE_VIEW_PERSIST_LAYOUT); - trg_tree_view_persist(TRG_TREE_VIEW(priv->filesTv), - TRG_TREE_VIEW_PERSIST_SORT | - TRG_TREE_VIEW_PERSIST_LAYOUT); - trg_tree_view_persist(TRG_TREE_VIEW(priv->trackersTv), - TRG_TREE_VIEW_PERSIST_SORT | - TRG_TREE_VIEW_PERSIST_LAYOUT); + if (priv->peersTv) { + trg_tree_view_persist(TRG_TREE_VIEW(priv->peersTv), + TRG_TREE_VIEW_PERSIST_SORT | + TRG_TREE_VIEW_PERSIST_LAYOUT); + trg_tree_view_persist(TRG_TREE_VIEW(priv->filesTv), + TRG_TREE_VIEW_PERSIST_SORT | + TRG_TREE_VIEW_PERSIST_LAYOUT); + trg_tree_view_persist(TRG_TREE_VIEW(priv->trackersTv), + TRG_TREE_VIEW_PERSIST_SORT | + TRG_TREE_VIEW_PERSIST_LAYOUT); + } if (res_id != GTK_RESPONSE_OK) { gtk_widget_destroy(GTK_WIDGET(dlg)); @@ -275,12 +277,12 @@ static void models_updated(TrgTorrentModel * model, gpointer data) (ht, json_array_get_int_element(priv->targetIds, 0), &t, NULL)) { trg_files_model_update(priv->filesModel, GTK_TREE_VIEW(priv->filesTv), serial, t, - TORRENT_GET_MODE_FIRST); + TORRENT_GET_MODE_UPDATE); trg_peers_model_update(priv->peersModel, TRG_TREE_VIEW(priv->peersTv), serial, t, - TORRENT_GET_MODE_FIRST); + TORRENT_GET_MODE_UPDATE); trg_trackers_model_update(priv->trackersModel, serial, t, - TORRENT_GET_MODE_FIRST); + TORRENT_GET_MODE_UPDATE); } } -- cgit v1.2.3