Re: [PATCH] unindent disables task buttons fix



On Fri, Jul 27, 2007 at 09:35:02PM -0400, Kurt Maute wrote:
> This seems to work if you only have one task selected.  If you have
> several, then all but the bottom most task still get unselected.

Here's a patch to do that.

There are still situations in which the selection will change on
indent/unindent and that is when some of the selected tasks do not share
the same parent with the first task in the selection.

Tasks that are deeper in the hierarchy will move along with their parent
and tasks that are higher up than the first selected task don't change at all. 

After the (un)indent action, neither are part of the selection anymore.

The reverse action will (with this pruned selection) still undo the
first action, so unindent->indent and indent->unindent are more or less
NOPs.

Maurice.

-- 
Maurice van der Pot

Gentoo Linux Developer   griffon26 gentoo org     http://www.gentoo.org
Creator of BiteMe!       griffon26 kfk4ever com   http://www.kfk4ever.com

Index: src/planner-task-tree.c
===================================================================
--- src/planner-task-tree.c	(revision 851)
+++ src/planner-task-tree.c	(working copy)
@@ -3056,20 +3056,22 @@
 		}
 	}
 
-	path = planner_gantt_model_get_path_from_task (PLANNER_GANTT_MODEL (model), 
-						       indent_tasks->data);
-
 	selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (tree));
-	gtk_tree_selection_select_path (selection, path);
-	task_tree_unblock_selection_changed (tree);
+	gtk_tree_selection_unselect_all(selection);
+	for (l = indent_tasks; l; l = l->next) {
+		task = l->data;
 
-	gtk_tree_path_free (path);
+		path = planner_gantt_model_get_path_from_task (model, task);
+		gtk_tree_selection_select_path (selection, path);
+		gtk_tree_path_free (path);
+	}
 
 	if (many) {
 		planner_cmd_manager_end_transaction (
 			planner_window_get_cmd_manager (priv->main_window));
 	}
 	
+	task_tree_unblock_selection_changed (tree);
 	g_list_free (indent_tasks);
 }
 
@@ -3156,20 +3158,22 @@
 			       NULL);
 	}
 
-	path = planner_gantt_model_get_path_from_task (PLANNER_GANTT_MODEL (model), 
-						       unindent_tasks->data);
-
 	selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (tree));
-	gtk_tree_selection_select_path (selection, path);
-	task_tree_unblock_selection_changed (tree);
+	gtk_tree_selection_unselect_all(selection);
+	for (l = unindent_tasks; l; l = l->next) {
+		task = l->data;
 
-	gtk_tree_path_free (path);
+		path = planner_gantt_model_get_path_from_task (model, task);
+		gtk_tree_selection_select_path (selection, path);
+		gtk_tree_path_free (path);
+	}
 
 	if (many) {
 		planner_cmd_manager_end_transaction (
 			planner_window_get_cmd_manager (priv->main_window));
 	}
-	
+
+	task_tree_unblock_selection_changed (tree);
 	g_list_free (unindent_tasks);
 }
 
@@ -3290,9 +3294,8 @@
 			planner_window_get_cmd_manager (priv->main_window));
 	}
 	
+	task_tree_unblock_selection_changed (tree);
 	g_list_free (list);
-
-	task_tree_unblock_selection_changed (tree);
 }
 
 void 

Attachment: pgpfoGPe6RJJ6.pgp
Description: PGP signature



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]