summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/requests.c5
-rw-r--r--src/torrent.c10
-rw-r--r--src/trg-main-window.c3
-rw-r--r--src/trg-prefs.c6
-rw-r--r--src/trg-torrent-model.c7
-rw-r--r--src/trg-torrent-model.h2
6 files changed, 22 insertions, 11 deletions
diff --git a/src/requests.c b/src/requests.c
index 23528f8..cb8b863 100644
--- a/src/requests.c
+++ b/src/requests.c
@@ -159,12 +159,13 @@ JsonNode *torrent_get(gint64 id)
json_array_add_string_element(fields, FIELD_PEERS_SENDING_TO_US);
json_array_add_string_element(fields, FIELD_PEERS_GETTING_FROM_US);
json_array_add_string_element(fields, FIELD_PEERS_CONNECTED);
- json_array_add_string_element(fields, FIELD_HAVEVALID);
- json_array_add_string_element(fields, FIELD_HAVEUNCHECKED);
+ /*json_array_add_string_element(fields, FIELD_HAVEVALID);
+ json_array_add_string_element(fields, FIELD_HAVEUNCHECKED);*/
json_array_add_string_element(fields, FIELD_RATEUPLOAD);
json_array_add_string_element(fields, FIELD_RATEDOWNLOAD);
json_array_add_string_element(fields, FIELD_STATUS);
json_array_add_string_element(fields, FIELD_ADDED_DATE);
+ json_array_add_string_element(fields, FIELD_DOWNLOADEDEVER);
json_array_add_string_element(fields, FIELD_UPLOADEDEVER);
json_array_add_string_element(fields, FIELD_SIZEWHENDONE);
json_array_add_string_element(fields, FIELD_QUEUE_POSITION);
diff --git a/src/torrent.c b/src/torrent.c
index c4cb2c8..4f8cdaa 100644
--- a/src/torrent.c
+++ b/src/torrent.c
@@ -137,6 +137,11 @@ gint64 torrent_get_eta(JsonObject * t)
return json_object_get_int_member(t, FIELD_ETA);
}
+gint64 torrent_get_downloaded(JsonObject *t)
+{
+ return json_object_get_int_member(t, FIELD_DOWNLOADEDEVER);
+}
+
gint64 torrent_get_uploaded(JsonObject * t)
{
return json_object_get_int_member(t, FIELD_UPLOADEDEVER);
@@ -152,11 +157,6 @@ gint64 torrent_get_have_unchecked(JsonObject * t)
return json_object_get_int_member(t, FIELD_HAVEUNCHECKED);
}
-gint64 torrent_get_downloaded(JsonObject * t)
-{
- return torrent_get_have_valid(t) + torrent_get_have_unchecked(t);
-}
-
gint64 torrent_get_status(JsonObject * t)
{
return json_object_get_int_member(t, FIELD_STATUS);
diff --git a/src/trg-main-window.c b/src/trg-main-window.c
index 61e5c45..89a7123 100644
--- a/src/trg-main-window.c
+++ b/src/trg-main-window.c
@@ -1181,12 +1181,13 @@ void trg_main_window_conn_changed(TrgMainWindow * win, gboolean connected) {
;
if (!connected) {
- gtk_list_store_clear(GTK_LIST_STORE(priv->torrentModel));
trg_main_window_torrent_scrub(win);
trg_state_selector_disconnect(priv->stateSelector);
if (priv->graphNotebookIndex >= 0)
trg_torrent_graph_set_nothing(priv->graph);
+
+ trg_torrent_model_remove_all(priv->torrentModel);
}
trg_client_status_change(tc, connected);
diff --git a/src/trg-prefs.c b/src/trg-prefs.c
index 862b21d..be9d4e5 100644
--- a/src/trg-prefs.c
+++ b/src/trg-prefs.c
@@ -340,11 +340,11 @@ gboolean trg_prefs_save(TrgPrefs *p) {
json_generator_set_root(gen, priv->user);
success = json_generator_to_file(gen, priv->file, NULL);
- if (!success) {
+
+ if (!success)
g_error("Problem writing configuration file (permissions?) to: %s", priv->file);
- } else if (isNew ) {
+ else if (isNew)
g_chmod(priv->file, 384);
- }
g_object_unref(gen);
diff --git a/src/trg-torrent-model.c b/src/trg-torrent-model.c
index a40f2b0..39aa65d 100644
--- a/src/trg-torrent-model.c
+++ b/src/trg-torrent-model.c
@@ -220,6 +220,13 @@ trg_torrent_model_stats_scan_foreachfunc(GtkTreeModel * model,
return FALSE;
}
+void trg_torrent_model_remove_all(TrgTorrentModel *model)
+{
+ TrgTorrentModelPrivate *priv = TRG_TORRENT_MODEL_GET_PRIVATE(model);
+ g_hash_table_remove_all(priv->ht);
+ gtk_list_store_clear(GTK_LIST_STORE(model));
+}
+
static void
update_torrent_iter(TrgTorrentModel * model, gint64 rpcv, gint64 serial,
GtkTreeIter * iter, JsonObject * t,
diff --git a/src/trg-torrent-model.h b/src/trg-torrent-model.h
index ce5cf8c..8d192a9 100644
--- a/src/trg-torrent-model.h
+++ b/src/trg-torrent-model.h
@@ -65,6 +65,7 @@ GType trg_torrent_model_get_type(void);
TrgTorrentModel *trg_torrent_model_new();
G_END_DECLS
+
gboolean
find_existing_peer_item(GtkListStore * model, JsonObject * p,
GtkTreeIter * iter);
@@ -75,6 +76,7 @@ void trg_torrent_model_update(TrgTorrentModel * model, TrgClient * tc,
gint mode);
GHashTable *get_torrent_table(TrgTorrentModel * model);
+void trg_torrent_model_remove_all(TrgTorrentModel *model);
gboolean trg_torrent_model_is_remove_in_progress(TrgTorrentModel * model);