summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Alan Fitton <ajf@eth0.org.uk>2012-01-24 17:21:15 +0000
committerGravatar Alan Fitton <ajf@eth0.org.uk>2012-01-24 17:21:15 +0000
commit4d57ef2197461c450aaaf79cdbb31b256ae0e81e (patch)
tree3f7978c5efe071318fb7301114141d997a709ade
parentdba44731b5864251f9da56b7d0c71f5b729b202a (diff)
try to suspend sorting while model is updated
-rw-r--r--src/main.c39
-rw-r--r--src/trg-main-window.c13
2 files changed, 33 insertions, 19 deletions
diff --git a/src/main.c b/src/main.c
index 5e521ad..329f421 100644
--- a/src/main.c
+++ b/src/main.c
@@ -157,26 +157,8 @@ static gint trg_gtkapp_init(TrgClient * client, int argc, char *argv[])
return exitCode;
}
-#else
-
-static gint trg_simple_init(TrgClient * client, int argc, char *argv[],
- gchar ** args)
-{
- TrgMainWindow *window =
- trg_main_window_new(client, should_be_minimised(argc, argv));
- trg_main_window_set_start_args(window, args);
- auto_connect_if_required(window);
- gtk_main();
-
- return EXIT_SUCCESS;
-}
-
-#endif
-
-
-/* Win32 mailslots. I've implemented this in win32-mailslot.c */
+#elif WIN32
-#ifdef WIN32
static gint trg_win32_init(TrgClient * client, int argc, char *argv[],
gchar ** args)
{
@@ -201,7 +183,26 @@ static gint trg_win32_init(TrgClient * client, int argc, char *argv[],
return EXIT_SUCCESS;
}
+
#else
+
+static gint trg_simple_init(TrgClient * client, int argc, char *argv[],
+ gchar ** args)
+{
+ TrgMainWindow *window =
+ trg_main_window_new(client, should_be_minimised(argc, argv));
+ trg_main_window_set_start_args(window, args);
+ auto_connect_if_required(window);
+ gtk_main();
+
+ return EXIT_SUCCESS;
+}
+
+#endif
+
+/* Win32 mailslots. I've implemented this in win32-mailslot.c */
+
+#if !WIN32
static void trg_non_win32_init()
{
bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR);
diff --git a/src/trg-main-window.c b/src/trg-main-window.c
index a810495..a189664 100644
--- a/src/trg-main-window.c
+++ b/src/trg-main-window.c
@@ -1170,6 +1170,8 @@ static gboolean on_torrent_get(gpointer data, int mode)
TrgPrefs *prefs = trg_client_get_prefs(client);
trg_torrent_model_update_stats *stats;
guint interval;
+ gint old_sort_id;
+ GtkSortType old_order;
/* Disconnected between request and response callback */
if (!trg_client_is_connected(client)) {
@@ -1192,6 +1194,7 @@ static gboolean on_torrent_get(gpointer data, int mode)
gint64 max_retries =
trg_prefs_get_int(prefs, TRG_PREFS_KEY_RETRIES,
TRG_PREFS_CONNECTION);
+
if (trg_client_inc_failcount(client) >= max_retries) {
trg_main_window_conn_changed(win, FALSE);
trg_dialog_error_handler(win, response);
@@ -1210,17 +1213,27 @@ static gboolean on_torrent_get(gpointer data, int mode)
trg_update_torrents_timerfunc,
win);
}
+
trg_client_updateunlock(client);
trg_response_free(response);
+
return FALSE;
}
trg_client_reset_failcount(client);
trg_client_inc_serial(client);
+ gtk_widget_freeze_child_notify(GTK_WIDGET(priv->torrentTreeView));
+ gtk_tree_sortable_get_sort_column_id(GTK_TREE_SORTABLE(priv->sortedTorrentModel), &old_sort_id, &old_order);
+ gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(priv->sortedTorrentModel), GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID, GTK_SORT_ASCENDING);
+
stats =
trg_torrent_model_update(priv->torrentModel, client, response->obj,
mode);
+
+ gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(priv->sortedTorrentModel), old_sort_id, old_order);
+ gtk_widget_thaw_child_notify(GTK_WIDGET(priv->torrentTreeView));
+
update_selected_torrent_notebook(win, mode, priv->selectedTorrentId);
trg_status_bar_update(priv->statusBar, stats, client);
update_whatever_statusicon(win, stats);