Re: [PATCH] unindent disables task buttons fix

Maurice van der Pot <griffon26-bCGDfOjggl9Wk0Htik3J/[email protected]>
Newsgroups gmane.comp.gnome.apps.planner.devel
Message-ID <[email protected]>
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   [email protected]     http://www.gentoo.org
Creator of BiteMe!       griffon26-bCGDfOjggl9Wk0Htik3J/[email protected]   http://www.kfk4ever.com

_______________________________________________
Planner-dev-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/planner-dev-list
planner-keep-selection-on-indent2.patch (text/plain, 2 KB)
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
signature.asc (application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.5 (GNU/Linux)

iD8DBQFGwKuAMGnpIbeahxwRAkUqAJ9K1rk58zVGkAhFoo7FD2WJYTfQQQCgyDM8
UMW7NGX8GQA0NTN/nPDsDfc=
=rhiz
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.