summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Alan Fitton <ajf@eth0.org.uk>2011-04-12 19:54:43 +0000
committerGravatar Alan Fitton <ajf@eth0.org.uk>2011-04-12 19:54:43 +0000
commitb2ff688493cf9f5381ad69fb05747c9944a46ca3 (patch)
treea818ae91925a5a8fcc592195981ae401cf565de4 /src
parent05a98f92cb9eeab843727e0fa2fc052cb371109a (diff)
fix the recently-active updates, add search columns for peers/file treeview
Diffstat (limited to 'src')
-rw-r--r--src/requests.c8
-rw-r--r--src/trg-cell-renderer-size.h1
-rw-r--r--src/trg-files-tree-view.c1
-rw-r--r--src/trg-main-window.c49
-rw-r--r--src/trg-peers-tree-view.c2
-rw-r--r--src/trg-torrent-add-dialog.c4
-rw-r--r--src/trg-torrent-model.c36
-rw-r--r--src/trg-torrent-props-dialog.c6
8 files changed, 43 insertions, 64 deletions
diff --git a/src/requests.c b/src/requests.c
index bccf4f5..36363bf 100644
--- a/src/requests.c
+++ b/src/requests.c
@@ -116,11 +116,9 @@ JsonNode *torrent_get(gboolean recent)
JsonObject *args = node_get_arguments(root);
JsonArray *fields = json_array_new();
- if (recent) {
- JsonArray *ids = json_array_new();
- json_array_add_string_element(ids, FIELD_RECENTLY_ACTIVE);
- json_object_set_array_member(args, PARAM_IDS, ids);
- }
+ if (recent)
+ json_object_set_string_member(args, PARAM_IDS,
+ FIELD_RECENTLY_ACTIVE);
json_array_add_string_element(fields, FIELD_ETA);
json_array_add_string_element(fields, FIELD_PEERS);
diff --git a/src/trg-cell-renderer-size.h b/src/trg-cell-renderer-size.h
index afeaab7..94e5a00 100644
--- a/src/trg-cell-renderer-size.h
+++ b/src/trg-cell-renderer-size.h
@@ -17,7 +17,6 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-
#ifndef TRG_CELL_RENDERER_SIZE_H_
#define TRG_CELL_RENDERER_SIZE_H_
diff --git a/src/trg-files-tree-view.c b/src/trg-files-tree-view.c
index 2b5c812..19af10b 100644
--- a/src/trg-files-tree-view.c
+++ b/src/trg-files-tree-view.c
@@ -325,6 +325,7 @@ static void trg_files_tree_view_init(TrgFilesTreeView * self)
trg_files_tree_view_add_priority_column(TRG_TREE_VIEW(self),
_("Priority"),
FILESCOL_PRIORITY, -1);
+ gtk_tree_view_set_search_column(GTK_TREE_VIEW(self), FILESCOL_NAME);
g_signal_connect(self, "button-press-event",
G_CALLBACK(view_onButtonPressed), NULL);
diff --git a/src/trg-main-window.c b/src/trg-main-window.c
index fce8a11..885db40 100644
--- a/src/trg-main-window.c
+++ b/src/trg-main-window.c
@@ -765,8 +765,6 @@ GtkWidget *trg_main_window_notebook_new(TrgMainWindow * win)
TrgMainWindowPrivate *priv = TRG_MAIN_WINDOW_GET_PRIVATE(win);
GtkWidget *notebook = priv->notebook = gtk_notebook_new();
- gboolean show_graph;
- GError *error = NULL;
gtk_widget_set_size_request(notebook, -1, 175);
@@ -798,21 +796,11 @@ GtkWidget *trg_main_window_notebook_new(TrgMainWindow * win)
(priv->peersTreeView)),
gtk_label_new(_("Peers")));
-
- show_graph =
- gconf_client_get_bool(priv->client->gconf,
- TRG_GCONF_KEY_SHOW_GRAPH, &error);
-
- if (error) {
- g_error_free(error);
- show_graph = TRUE;
- }
-
- if (show_graph) {
+ if (gconf_client_get_bool
+ (priv->client->gconf, TRG_GCONF_KEY_SHOW_GRAPH, NULL))
trg_main_window_add_graph(win, FALSE);
- } else {
+ else
priv->graphNotebookIndex = -1;
- }
return notebook;
}
@@ -856,7 +844,7 @@ static void on_session_get(JsonObject * response, int status,
gchar *msg =
g_strdup_printf(_
("This application supports Transmission %.2f and later, you have %.2f."),
- TRANSMISSION_MIN_SUPPORTED, version);
+TRANSMISSION_MIN_SUPPORTED, version);
GtkWidget *dialog = gtk_message_dialog_new(GTK_WINDOW(win),
GTK_DIALOG_MODAL,
GTK_MESSAGE_ERROR,
@@ -879,9 +867,9 @@ static void on_session_get(JsonObject * response, int status,
trg_client_set_session(client, newSession);
trg_trackers_tree_view_new_connection(priv->trackersTreeView, client);
+ json_object_ref(newSession);
out:
gdk_threads_leave();
- json_object_ref(newSession);
response_unref(response);
}
@@ -989,8 +977,8 @@ static gboolean trg_update_torrents_timerfunc(gpointer data)
if (priv->client->session)
dispatch_async(priv->client,
torrent_get(priv->client->activeOnlyUpdate),
- priv->client->
- activeOnlyUpdate ? on_torrent_get_active :
+ priv->
+ client->activeOnlyUpdate ? on_torrent_get_active :
on_torrent_get_update, data);
return FALSE;
@@ -1164,7 +1152,7 @@ on_generic_interactive_action(JsonObject * response, int status,
ts.tv_nsec = 350000000;
nanosleep(&ts, NULL);
- dispatch_async(priv->client, torrent_get(FALSE),
+ dispatch_async(priv->client, torrent_get(TRUE),
on_torrent_get_interactive, data);
}
}
@@ -1690,19 +1678,11 @@ static gboolean window_state_event(GtkWidget * widget,
&& event->changed_mask == GDK_WINDOW_STATE_ICONIFIED
&& (event->new_window_state == GDK_WINDOW_STATE_ICONIFIED
|| event->new_window_state ==
- (GDK_WINDOW_STATE_ICONIFIED | GDK_WINDOW_STATE_MAXIMIZED))) {
- GError *error = NULL;
- gboolean tray_min = gconf_client_get_bool(priv->client->gconf,
- TRG_GCONF_KEY_SYSTEM_TRAY_MINIMISE,
- &error);
-
- if (error) {
- g_error_free(error);
- tray_min = TRUE;
- }
-
- if (tray_min)
- gtk_widget_hide(GTK_WIDGET(widget));
+ (GDK_WINDOW_STATE_ICONIFIED | GDK_WINDOW_STATE_MAXIMIZED)) &&
+ gconf_client_get_bool_or_true(priv->client->gconf,
+ TRG_GCONF_KEY_SYSTEM_TRAY_MINIMISE))
+ {
+ gtk_widget_hide(GTK_WIDGET(widget));
}
return TRUE;
@@ -1972,8 +1952,7 @@ void auto_connect_if_required(TrgMainWindow * win, trg_client * tc)
g_free(host);
if (len > 0
&& gconf_client_get_bool(tc->gconf,
- TRG_GCONF_KEY_AUTO_CONNECT,
- NULL) == TRUE)
+ TRG_GCONF_KEY_AUTO_CONNECT, NULL))
connect_cb(NULL, win);
}
}
diff --git a/src/trg-peers-tree-view.c b/src/trg-peers-tree-view.c
index 58c297f..bf0b541 100644
--- a/src/trg-peers-tree-view.c
+++ b/src/trg-peers-tree-view.c
@@ -62,6 +62,8 @@ static void trg_peers_tree_view_init(TrgPeersTreeView * self)
PEERSCOL_FLAGS);
trg_tree_view_add_column(TRG_TREE_VIEW(self), _("Client"),
PEERSCOL_CLIENT);
+
+ gtk_tree_view_set_search_column(GTK_TREE_VIEW(self), PEERSCOL_HOST);
}
TrgPeersTreeView *trg_peers_tree_view_new(TrgPeersModel * model)
diff --git a/src/trg-torrent-add-dialog.c b/src/trg-torrent-add-dialog.c
index 3c0ffc9..d0eaefd 100644
--- a/src/trg-torrent-add-dialog.c
+++ b/src/trg-torrent-add-dialog.c
@@ -885,8 +885,8 @@ static GObject *trg_torrent_add_dialog_constructor(GType type,
priv->paused_check =
gtk_check_button_new_with_mnemonic(_("Start _paused"));
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->paused_check),
- pref_get_start_paused(priv->client->
- gconf));
+ pref_get_start_paused(priv->
+ client->gconf));
priv->priority_combo = gtr_priority_combo_new();
gtk_combo_box_set_active(GTK_COMBO_BOX(priv->priority_combo), 1);
diff --git a/src/trg-torrent-model.c b/src/trg-torrent-model.c
index b5c384d..120c932 100644
--- a/src/trg-torrent-model.c
+++ b/src/trg-torrent-model.c
@@ -405,8 +405,7 @@ void trg_torrent_model_update(TrgTorrentModel * model, trg_client * tc,
GtkTreePath *path;
GtkTreeRowReference *rr;
gpointer *result;
- gboolean added = FALSE;
- gboolean removed = FALSE;
+ gboolean addRemove = FALSE;
args = get_arguments(response);
newTorrents = get_torrents(args);
@@ -432,14 +431,13 @@ void trg_torrent_model_update(TrgTorrentModel * model, trg_client * tc,
*idCopy = id;
g_hash_table_insert(priv->ht, idCopy, rr);
gtk_tree_path_free(path);
- added = TRUE;
+ addRemove = TRUE;
if (mode != TORRENT_GET_MODE_FIRST)
g_signal_emit(model, signals[TMODEL_TORRENT_ADDED], 0,
&iter);
} else {
- path =
- gtk_tree_row_reference_get_path((GtkTreeRowReference *)
- result);
+ path = gtk_tree_row_reference_get_path((GtkTreeRowReference *)
+ result);
if (path) {
if (gtk_tree_model_get_iter
(GTK_TREE_MODEL(model), &iter, path)) {
@@ -451,17 +449,7 @@ void trg_torrent_model_update(TrgTorrentModel * model, trg_client * tc,
}
}
- if (mode == TORRENT_GET_MODE_ACTIVE) {
- removedTorrents = get_torrents_removed(args);
- if (removedTorrents) {
- for (li = json_array_get_elements(removedTorrents); li != NULL;
- li = g_list_next(li)) {
- id = json_node_get_int((JsonNode *) li->data);
- g_hash_table_remove(priv->ht, &id);
- removed = TRUE;
- }
- }
- } else if (mode >= TORRENT_GET_MODE_INTERACTION) {
+ if (mode == TORRENT_GET_MODE_UPDATE) {
GList *hitlist =
trg_torrent_model_find_removed(GTK_TREE_MODEL(model),
tc->updateSerial);
@@ -470,11 +458,21 @@ void trg_torrent_model_update(TrgTorrentModel * model, trg_client * tc,
g_hash_table_remove(priv->ht, li->data);
g_free(li->data);
}
- removed = TRUE;
+ addRemove = TRUE;
g_list_free(hitlist);
}
+ } else if (mode > TORRENT_GET_MODE_FIRST) {
+ removedTorrents = get_torrents_removed(args);
+ if (removedTorrents) {
+ for (li = json_array_get_elements(removedTorrents); li != NULL;
+ li = g_list_next(li)) {
+ id = json_node_get_int((JsonNode *) li->data);
+ g_hash_table_remove(priv->ht, &id);
+ addRemove = TRUE;
+ }
+ }
}
- if (added || removed)
+ if (addRemove)
g_signal_emit(model, signals[TMODEL_TORRENT_ADDREMOVE], 0);
}
diff --git a/src/trg-torrent-props-dialog.c b/src/trg-torrent-props-dialog.c
index bf9f096..2851b7c 100644
--- a/src/trg-torrent-props-dialog.c
+++ b/src/trg-torrent-props-dialog.c
@@ -138,10 +138,12 @@ trg_torrent_props_response_cb(GtkDialog * dlg, gint res_id,
(priv->seedRatioLimit), args);
json_object_set_int_member(args, FIELD_SEED_RATIO_MODE,
gtk_combo_box_get_active(GTK_COMBO_BOX
- (priv->seedRatioMode)));
+ (priv->
+ seedRatioMode)));
json_object_set_int_member(args, FIELD_BANDWIDTH_PRIORITY,
gtk_combo_box_get_active(GTK_COMBO_BOX
- (priv->bandwidthPriorityCombo))
+ (priv->
+ bandwidthPriorityCombo))
- 1);
gtk_spin_button_json_int_out(GTK_SPIN_BUTTON