Re: [Planner Dev] Patch for planner Bugzilla 138595 Task up and down should work on selections.
- From: "lincoln phipps openmutual net" <lincoln phipps openmutual net>
- To: Planner Project Manager - Development List <planner-dev lists imendio com>
- Subject: Re: [Planner Dev] Patch for planner Bugzilla 138595 Task up and down should work on selections.
- Date: Wed, 07 Apr 2004 03:10:44 +0100
Richard Hult wrote:
Hi,
patch says that this diff has "misordered hunks". The hunks that it
succeeds in applying seems to have weird indentation so I suspect that
there is a { missing or something like that.
The indentation isn't because of a missing { (else it wouldn't
compile clean) but because we give you patches without whitespace
adgustments :) and existing code need to be tabbed out because
its now inside a new if {} block.
Could you please see if there is anything wrong and maybe generate a new
patch against CVS when it has synced the commits from today?
The attached diff is against planner-task-tree.c v1.15 so won't have
misordered hunks - the version yesterday was against 1.14. If it
doesn't patch can you tell me which version of planner-task-tree.c
you have. As mentioned Bonsai not working so I have no visibilty of
live GNOME CVS.
/Richard
Index: src/planner-task-tree.c
===================================================================
RCS file: /cvs/gnome/planner/src/planner-task-tree.c,v
retrieving revision 1.15
diff -u -b -B -p -r1.15 planner-task-tree.c
--- src/planner-task-tree.c 4 Apr 2004 15:12:34 -0000 1.15
+++ src/planner-task-tree.c 7 Apr 2004 01:59:49 -0000
@@ -2538,9 +2538,11 @@ planner_task_tree_move_task_up (PlannerT
GtkTreeModel *model;
GtkTreePath *path;
MrpProject *project;
- MrpTask *task, *parent, *sibling;
- GList *list;
+ MrpTask *task, *parent, *sibling, *temptask;
+ GList *list, *l, *m;
guint position;
+ gboolean proceed, skip;
+ gint count;
/* FIXME: undo */
@@ -2555,27 +2557,47 @@ planner_task_tree_move_task_up (PlannerT
return;
}
- task = list->data;
+ proceed = TRUE; /* seed this */
+ count = 0 ;
+
+ for (l = list; l; l = l->next) {
+ count++;
+ task = l->data;
position = mrp_task_get_position (task);
parent = mrp_task_get_parent (task);
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (tree));
model = gtk_tree_view_get_model (GTK_TREE_VIEW (tree));
- if (position == 0) {
- /* Task on the top of the list */
- } else {
+ /* We now check if the parent is selected as well me. as If it is then
+ * we skip checks on our position and skip moving because its just not relevant !
+ */
+ skip = FALSE;
+ for (m = list; m; m = m->next) {
+ temptask = m->data;
+ if (temptask == parent ) {
+ skip = TRUE;
+ }
+ }
+
+ if (position == 0 && count ==1) {
+ /* We stop everything if at top of list and first task else just stop moving this one task */
+ proceed = FALSE;
+ }
+ if (skip == FALSE && position != 0 && proceed) {
sibling = mrp_task_get_nth_child (parent,
position - 1);
/* Move task from 'position' to 'position-1' */
mrp_project_move_task (project, task, sibling,
parent, TRUE, NULL);
- path = planner_gantt_model_get_path_from_task (
- PLANNER_GANTT_MODEL (model), task);
+ path = planner_gantt_model_get_path_from_task (PLANNER_GANTT_MODEL (model),
+ task);
gtk_tree_selection_select_path (selection, path);
}
+ }
task_tree_unblock_selection_changed (tree);
+ g_list_free (list);
}
void
@@ -2585,9 +2607,11 @@ planner_task_tree_move_task_down (Planne
GtkTreeModel *model;
GtkTreePath *path;
MrpProject *project;
- MrpTask *task, *parent, *sibling;
- GList *list;
+ MrpTask *task, *parent, *sibling, *temptask;
+ GList *list, *l , *m;
guint position;
+ gboolean proceed, skip;
+ gint count;
/* FIXME: undo */
@@ -2600,16 +2624,38 @@ planner_task_tree_move_task_down (Planne
if (list == NULL) {
/* Nothing selected */
return;
- } else {
- task = list->data;
+ }
+
+ list = g_list_reverse (list); /* swap the selection around */
+
+ proceed = TRUE; /* seed this */
+ count = 0 ;
+
+ for (l = list; l; l = l->next) {
+ count++;
+ task = l->data;
position = mrp_task_get_position (task);
parent = mrp_task_get_parent (task);
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (tree));
model = gtk_tree_view_get_model (GTK_TREE_VIEW (tree));
- if (position == (mrp_task_get_n_children (parent) - 1) ) {
- /* The task is in the bottom of the list */
- } else {
+ /* We now check if parent is selected also. If so then we skip checks on our position as its not relevant */
+ skip = FALSE;
+ for (m = list; m; m = m->next) {
+ temptask = m->data;
+ if (temptask == parent ) {
+ skip = TRUE;
+ }
+ }
+
+ if (position == (mrp_task_get_n_children (mrp_project_get_root_task (project)) - 1) && count ==1) {
+ /* We stop if at bottom of project and first attempt at moving stuff else just stop moving this one task */
+ proceed = FALSE;
+ } else if ((skip == FALSE) && (position == (mrp_task_get_n_children (parent) - 1)) && (count ==1)) {
+ /* If the parent task is selected then we don't care if we are at the bottom of our particular position */
+ proceed = FALSE;
+ }
+ if (skip == FALSE && position <= (mrp_task_get_n_children (parent) - 1) && proceed) {
sibling = mrp_task_get_nth_child (parent, position + 1);
/* Moving task from 'position' to 'position + 1' */
mrp_project_move_task (project, task, sibling,
@@ -2621,6 +2667,7 @@ planner_task_tree_move_task_down (Planne
}
task_tree_unblock_selection_changed (tree);
+ g_list_free (list);
}
void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]