summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/trg-files-model.c20
-rw-r--r--src/trg-files-tree-view-common.c9
2 files changed, 12 insertions, 17 deletions
diff --git a/src/trg-files-model.c b/src/trg-files-model.c
index 803f7f5..de5d54b 100644
--- a/src/trg-files-model.c
+++ b/src/trg-files-model.c
@@ -85,19 +85,15 @@ static void trg_files_tree_update_ancestors(trg_files_tree_node * node)
for (li = back_iter->children; li; li = g_list_next(li)) {
trg_files_tree_node *back_node =
(trg_files_tree_node *) li->data;
- gboolean stop = FALSE;
+ gint common_result = 0;
- if (back_node->priority != pri_result) {
- pri_result = TR_PRI_MIXED;
- stop = TRUE;
- }
+ if (back_node->priority != pri_result)
+ common_result = pri_result = TR_PRI_MIXED;
- if (back_node->enabled != enabled_result) {
- enabled_result = TR_PRI_MIXED;
- stop = TRUE;
- }
+ if (back_node->enabled != enabled_result)
+ common_result = enabled_result = TR_PRI_MIXED;
- if (stop)
+ if (common_result == TR_PRI_MIXED)
break;
}
@@ -295,16 +291,14 @@ void trg_files_model_update(TrgFilesModel * model, gint64 updateSerial,
GList *filesList, *li;
JsonObject *file;
gint j = 0;
- guint n_updates;
priv->torrentId = torrent_get_id(t);
priv->priorities = torrent_get_priorities(t);
priv->wanted = torrent_get_wanted(t);
filesList = json_array_get_elements(torrent_get_files(t));
- n_updates = g_list_length(filesList);
- if (mode == TORRENT_GET_MODE_FIRST || priv->n_items != n_updates) {
+ if (mode == TORRENT_GET_MODE_FIRST || priv->n_items != g_list_length(filesList)) {
trg_files_tree_node *top_node = g_new0(trg_files_tree_node, 1);
trg_files_tree_node *lastNode = NULL;
gtk_tree_store_clear(GTK_TREE_STORE(model));
diff --git a/src/trg-files-tree-view-common.c b/src/trg-files-tree-view-common.c
index c405323..4eeb65a 100644
--- a/src/trg-files-tree-view-common.c
+++ b/src/trg-files-tree-view-common.c
@@ -113,7 +113,8 @@ gboolean trg_files_tree_view_viewOnPopupMenu(GtkWidget * treeview,
static gboolean onViewPathToggled(GtkTreeView * view,
GtkTreeViewColumn * col,
- GtkTreePath * path, gint pri_id,
+ GtkTreePath * path, gboolean oneClick,
+ gint pri_id,
gint enabled_id, gpointer data)
{
int cid;
@@ -129,7 +130,7 @@ static gboolean onViewPathToggled(GtkTreeView * view,
gtk_tree_model_get_iter(model, &iter, path);
- if (cid == pri_id) {
+ if (cid == pri_id && oneClick) {
int priority;
gtk_tree_model_get(model, &iter, pri_id, &priority, -1);
switch (priority) {
@@ -198,11 +199,11 @@ gboolean trg_files_tree_view_onViewButtonPressed(GtkWidget * w,
gboolean handled = FALSE;
GtkTreeView *treeview = GTK_TREE_VIEW(w);
- if (one_click && event->type == GDK_BUTTON_PRESS && event->button == 1
+ if (event->type == GDK_BUTTON_PRESS && event->button == 1
&& !(event->state & (GDK_SHIFT_MASK | GDK_CONTROL_MASK))
&& getAndSelectEventPath(treeview, event, &col, &path)) {
handled =
- onViewPathToggled(treeview, col, path, pri_id, enabled_id,
+ onViewPathToggled(treeview, col, path, one_click, pri_id, enabled_id,
NULL);
} else if (event->type == GDK_BUTTON_PRESS && event->button == 3) {
selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview));