[Planner Dev] Patch to solve 144742 and 144734 partial



Hi guys!

Here goes a first patch to close:

http://bugs.gnome.org/show_bug.cgi?id=144742

and also I can't resist during the previous change to change all the
undo code to use the new undo API:

http://bugs.gnome.org/show_bug.cgi?id=144734

I understand that this isn't the right moment for so a big change in
undo code, but it is only a sintax change and I have test it and nothing
seems broken, and you know, this is the kind of change that you need to
do with motivation because it is so bored ;-)

Cheers

-- 
Alvaro del Castillo San Félix
Lambdaux Software Services S.R.L.
Universidad Rey Juan Carlos
Centro de Apoyo Tecnológico
C/ Tulipán sn 28933 Mostoles, Madrid-Spain
www.lambdaux.com
acs lambdaux com
Index: src/planner-calendar-dialog.c
===================================================================
RCS file: /cvs/gnome/planner/src/planner-calendar-dialog.c,v
retrieving revision 1.5
diff -u -b -B -p -r1.5 planner-calendar-dialog.c
--- src/planner-calendar-dialog.c	21 Jun 2004 10:46:16 -0000	1.5
+++ src/planner-calendar-dialog.c	23 Jun 2004 18:19:03 -0000
@@ -156,10 +156,6 @@ cal_cmd_day_type_undo (PlannerCmd *cmd_b
 {
 	CalCmdDayType *cmd = (CalCmdDayType*) cmd_base;
 
-	if (g_getenv ("PLANNER_DEBUG_UNDO_CAL")) {
-		g_message ("Undo Changing calendar for day ...");
-	}
-
 	mrp_calendar_set_days (cmd->calendar, cmd->time, cmd->old_day, -1);
 }
 
@@ -255,10 +251,6 @@ cal_cmd_remove_undo (PlannerCmd *cmd_bas
 	GList        *c;
 	CalCmdRemove *cmd = (CalCmdRemove*) cmd_base;
 
-	if (g_getenv ("PLANNER_DEBUG_UNDO_CAL")) {
-		g_message ("Undo removing calendar ...");
-	}
-
 	mrp_calendar_add (cmd->calendar, cmd->parent);
 
 	if (cmd->resources != NULL) {
@@ -376,9 +368,6 @@ cal_cmd_add_undo (PlannerCmd *cmd_base)
 {
 	CalCmdAdd *cmd = (CalCmdAdd*) cmd_base;
 
-	if (g_getenv ("PLANNER_DEBUG_UNDO_CAL")) {
-		g_message ("Undo adding calendar ...");
-	}
 	mrp_calendar_remove (cmd->calendar);
 }
 
Index: src/planner-day-type-dialog.c
===================================================================
RCS file: /cvs/gnome/planner/src/planner-day-type-dialog.c,v
retrieving revision 1.4
diff -u -b -B -p -r1.4 planner-day-type-dialog.c
--- src/planner-day-type-dialog.c	2 May 2004 16:21:28 -0000	1.4
+++ src/planner-day-type-dialog.c	23 Jun 2004 18:19:04 -0000
@@ -487,14 +487,13 @@ day_type_cmd_add (DialogData  *data,
 	PlannerCmd    *cmd_base;
 	DayTypeCmdAdd *cmd;
 
-	cmd = g_new0 (DayTypeCmdAdd, 1);
+	cmd_base = planner_cmd_new (DayTypeCmdAdd,
+				    g_strdup_printf (_("Add day type \"%s\""), name), /*FIXME: leak?*/
+				    day_type_cmd_add_do,
+				    day_type_cmd_add_undo,
+				    day_type_cmd_add_free);
 
-	cmd_base = (PlannerCmd*) cmd;
-
-	cmd_base->label = g_strdup_printf (_("Add day type \"%s\""), name);
-	cmd_base->do_func = day_type_cmd_add_do;
-	cmd_base->undo_func = day_type_cmd_add_undo;
-	cmd_base->free_func = day_type_cmd_add_free;
+	cmd = (DayTypeCmdAdd *) cmd_base;
 
 	cmd->project = data->project;
 
@@ -546,14 +545,13 @@ day_type_cmd_remove (DialogData *data,
 	PlannerCmd       *cmd_base;
 	DayTypeCmdRemove *cmd;
 
-	cmd = g_new0 (DayTypeCmdRemove, 1);
-
-	cmd_base = (PlannerCmd*) cmd;
+	cmd_base = planner_cmd_new (DayTypeCmdRemove,
+				    g_strdup_printf (_("Remove day type \"%s\""), mrp_day_get_name (day)),
+				    day_type_cmd_remove_do,
+				    day_type_cmd_remove_undo,
+				    day_type_cmd_remove_free);
 
-	cmd_base->label = g_strdup_printf (_("Remove day type \"%s\""), mrp_day_get_name (day));
-	cmd_base->do_func = day_type_cmd_remove_do;
-	cmd_base->undo_func = day_type_cmd_remove_undo;
-	cmd_base->free_func = day_type_cmd_remove_free;
+	cmd = (DayTypeCmdRemove *) cmd_base;
 
 	cmd->project = data->project;
 
Index: src/planner-group-dialog.c
===================================================================
RCS file: /cvs/gnome/planner/src/planner-group-dialog.c,v
retrieving revision 1.11
diff -u -b -B -p -r1.11 planner-group-dialog.c
--- src/planner-group-dialog.c	2 May 2004 16:21:28 -0000	1.11
+++ src/planner-group-dialog.c	23 Jun 2004 18:19:06 -0000
@@ -297,14 +297,13 @@ group_cmd_insert (PlannerView *view)
 	PlannerCmd      *cmd_base;
 	GroupCmdInsert  *cmd;
 
-	cmd = g_new0 (GroupCmdInsert, 1);
+	cmd_base = planner_cmd_new (GroupCmdInsert,
+				    _("Insert group"),
+				    group_cmd_insert_do,
+				    group_cmd_insert_undo,
+				    group_cmd_insert_free);
 
-	cmd_base = (PlannerCmd*) cmd;
-
-	cmd_base->label = g_strdup (_("Insert group"));
-	cmd_base->do_func = group_cmd_insert_do;
-	cmd_base->undo_func = group_cmd_insert_undo;
-	cmd_base->free_func = group_cmd_insert_free;
+	cmd = (GroupCmdInsert *) cmd_base;
 
 	cmd->project = planner_window_get_project (view->main_window);
 
@@ -422,14 +421,13 @@ group_cmd_remove (PlannerView *view, Mrp
 	PlannerCmd      *cmd_base;
 	GroupCmdRemove  *cmd;
 
-	cmd = g_new0 (GroupCmdRemove, 1);
-
-	cmd_base = (PlannerCmd*) cmd;
+	cmd_base = planner_cmd_new (GroupCmdRemove,
+				    _("Remove group"),
+				    group_cmd_remove_do,
+				    group_cmd_remove_undo,
+				    group_cmd_remove_free);
 
-	cmd_base->label = g_strdup (_("Remove group"));
-	cmd_base->do_func = group_cmd_remove_do;
-	cmd_base->undo_func = group_cmd_remove_undo;
-	cmd_base->free_func = group_cmd_remove_free;
+	cmd = (GroupCmdRemove *) cmd_base;
 
 	cmd->project = planner_window_get_project (view->main_window);
 	cmd->group = group;
@@ -518,14 +516,13 @@ group_cmd_default (PlannerView *view,
 	PlannerCmd       *cmd_base;
 	GroupCmdDefault  *cmd;
 
-	cmd = g_new0 (GroupCmdDefault, 1);
-
-	cmd_base = (PlannerCmd*) cmd;
+	cmd_base = planner_cmd_new (GroupCmdDefault,
+				    _("Default group"),
+				    group_cmd_default_do,
+				    group_cmd_default_undo,
+				    group_cmd_default_free);
 
-	cmd_base->label = g_strdup (_("Default group"));
-	cmd_base->do_func = group_cmd_default_do;
-	cmd_base->undo_func = group_cmd_default_undo;
-	cmd_base->free_func = group_cmd_default_free;
+	cmd = (GroupCmdDefault *) cmd_base;
 
 	cmd->project = planner_window_get_project (view->main_window);
 
@@ -637,14 +634,13 @@ group_cmd_edit_property (PlannerView  *v
 	PlannerCmd            *cmd_base;
 	GroupCmdEditProperty  *cmd;
 
-	cmd = g_new0 (GroupCmdEditProperty, 1);
+	cmd_base = planner_cmd_new (GroupCmdEditProperty,
+				    _("Edit group property"),
+				    group_cmd_edit_property_do,
+				    group_cmd_edit_property_undo,
+				    group_cmd_edit_property_free);
 
-	cmd_base = (PlannerCmd*) cmd;
-
-	cmd_base->label = g_strdup (_("Edit group property"));
-	cmd_base->do_func = group_cmd_edit_property_do;
-	cmd_base->undo_func = group_cmd_edit_property_undo;
-	cmd_base->free_func = group_cmd_edit_property_free;
+	cmd = (GroupCmdEditProperty *) cmd_base;
 
 	cmd->property = property;
 	cmd->group = group;
Index: src/planner-phase-dialog.c
===================================================================
RCS file: /cvs/gnome/planner/src/planner-phase-dialog.c,v
retrieving revision 1.3
diff -u -b -B -p -r1.3 planner-phase-dialog.c
--- src/planner-phase-dialog.c	9 May 2004 22:27:46 -0000	1.3
+++ src/planner-phase-dialog.c	23 Jun 2004 18:19:07 -0000
@@ -528,14 +528,13 @@ phase_cmd_insert (PlannerWindow *main_wi
 	PlannerCmd     *cmd_base;
 	PhaseCmdInsert *cmd;
 
-	cmd = g_new0 (PhaseCmdInsert, 1);
+	cmd_base = planner_cmd_new (PhaseCmdInsert,
+				    _("Insert phase"),
+				    phase_cmd_insert_do,
+				    phase_cmd_insert_undo,
+				    phase_cmd_insert_free);
 
-	cmd_base = (PlannerCmd*) cmd;
-
-	cmd_base->label = g_strdup (_("Insert phase"));
-	cmd_base->do_func =  phase_cmd_insert_do; 
-	cmd_base->undo_func = phase_cmd_insert_undo;
-	cmd_base->free_func = phase_cmd_insert_free;
+	cmd = (PhaseCmdInsert *) cmd_base;
 
 	cmd->project = planner_window_get_project (main_window);
 
@@ -628,14 +627,13 @@ phase_cmd_remove (PlannerWindow *window,
 	PlannerCmd     *cmd_base;
 	PhaseCmdRemove *cmd;
 
-	cmd = g_new0 (PhaseCmdRemove, 1);
-
-	cmd_base = (PlannerCmd*) cmd;
+	cmd_base = planner_cmd_new (PhaseCmdRemove,
+				    _("Remove phase"),
+				    phase_cmd_remove_do,
+				    phase_cmd_remove_undo,
+				    phase_cmd_remove_free);
 
-	cmd_base->label = g_strdup (_("Remove phase"));
-	cmd_base->do_func =   phase_cmd_remove_do;
-	cmd_base->undo_func = phase_cmd_remove_undo;
-	cmd_base->free_func = phase_cmd_remove_free;
+	cmd = (PhaseCmdRemove *) cmd_base;
 
 	cmd->project = planner_window_get_project (window);
 	cmd->phase = g_strdup (phase);
Index: src/planner-project-properties.c
===================================================================
RCS file: /cvs/gnome/planner/src/planner-project-properties.c,v
retrieving revision 1.8
diff -u -b -B -p -r1.8 planner-project-properties.c
--- src/planner-project-properties.c	2 Jun 2004 20:25:18 -0000	1.8
+++ src/planner-project-properties.c	23 Jun 2004 18:19:11 -0000
@@ -308,7 +308,13 @@ property_cmd_edit (DialogData  *data,
 	PlannerCmd      *cmd_base;
 	PropertyCmdEdit *cmd;
 
-	cmd = g_new0 (PropertyCmdEdit, 1);
+	cmd_base = planner_cmd_new (PropertyCmdEdit,
+				    label,
+				    property_cmd_edit_do,
+				    property_cmd_edit_undo,
+				     NULL /* FIXME */);
+	
+	cmd = (PropertyCmdEdit *) cmd_base;
 
 	switch (type) {
 	case PROP_STRING:
@@ -344,13 +350,6 @@ property_cmd_edit (DialogData  *data,
 		break;
 	}
 	
-	cmd_base = (PlannerCmd*) cmd;
-
-	cmd_base->label = g_strdup (label);
-	cmd_base->do_func = property_cmd_edit_do;
-	cmd_base->undo_func = property_cmd_edit_undo;
-	cmd_base->free_func = NULL; /* FIXME */
-
 	cmd->project = data->project;
 	cmd->type = type;
 	cmd->property = g_strdup (property);
Index: src/planner-resource-cmd.c
===================================================================
RCS file: /cvs/gnome/planner/src/planner-resource-cmd.c,v
retrieving revision 1.1
diff -u -b -B -p -r1.1 planner-resource-cmd.c
--- src/planner-resource-cmd.c	14 Jun 2004 15:28:50 -0000	1.1
+++ src/planner-resource-cmd.c	23 Jun 2004 18:19:11 -0000
@@ -70,14 +70,13 @@ planner_resource_cmd_insert (PlannerWind
 	PlannerCmd          *cmd_base;
 	ResourceCmdInsert   *cmd;
 
-	cmd = g_new0 (ResourceCmdInsert, 1);
+	cmd_base = planner_cmd_new (ResourceCmdInsert,
+				    _("Insert resource"),
+				    resource_cmd_insert_do,
+				    resource_cmd_insert_undo,
+				    resource_cmd_insert_free);
 
-	cmd_base = (PlannerCmd*) cmd;
-
-	cmd_base->label = g_strdup (_("Insert resource"));
-	cmd_base->do_func = resource_cmd_insert_do;
-	cmd_base->undo_func = resource_cmd_insert_undo;
-	cmd_base->free_func = resource_cmd_insert_free;
+	cmd = (ResourceCmdInsert *) cmd_base;
 
 	if (resource == NULL) {
 		cmd->resource = g_object_new (MRP_TYPE_RESOURCE, NULL);
Index: src/planner-resource-dialog.c
===================================================================
RCS file: /cvs/gnome/planner/src/planner-resource-dialog.c,v
retrieving revision 1.12
diff -u -b -B -p -r1.12 planner-resource-dialog.c
--- src/planner-resource-dialog.c	3 May 2004 05:23:52 -0000	1.12
+++ src/planner-resource-dialog.c	23 Jun 2004 18:19:15 -0000
@@ -506,14 +506,13 @@ resource_cmd_edit_calendar (DialogData  
 	ResourceCmdCalendar *cmd;
 	MrpCalendar         *current_calendar;
 
-	cmd = g_new0 (ResourceCmdCalendar, 1);
+	cmd_base = planner_cmd_new (ResourceCmdCalendar,
+				    _("Edit resource calendar"),
+				    resource_cmd_calendar_do,
+				    resource_cmd_calendar_undo,
+				    resource_cmd_calendar_free);
 
-	cmd_base = (PlannerCmd*) cmd;
-
-	cmd_base->label = g_strdup (_("Edit resource calendar from dialog"));
-	cmd_base->do_func = resource_cmd_calendar_do;
-	cmd_base->undo_func = resource_cmd_calendar_undo;
-	cmd_base->free_func = resource_cmd_calendar_free;
+	cmd = (ResourceCmdCalendar *) cmd_base;
 
 	cmd->resource = g_object_ref (data->resource);
 
@@ -588,14 +587,13 @@ resource_cmd_edit_note (DialogData  *dat
 		return NULL;
 	}
 
-	cmd = g_new0 (ResourceCmdEditNote, 1);
-
-	cmd_base = (PlannerCmd*) cmd;
+	cmd_base = planner_cmd_new (ResourceCmdEditNote,
+				    _("Edit resource note"),
+				    resource_cmd_note_do,
+				    resource_cmd_note_undo,
+				    resource_cmd_note_free);
 
-	cmd_base->label = g_strdup (_("Edit resource note from dialog"));
-	cmd_base->do_func = resource_cmd_note_do;
-	cmd_base->undo_func = resource_cmd_note_undo;
-	cmd_base->free_func = resource_cmd_note_free;
+	cmd = (ResourceCmdEditNote *) cmd_base;
 
 	cmd->property = g_strdup ("note");
 	cmd->resource = g_object_ref (data->resource);
@@ -662,14 +660,13 @@ resource_cmd_edit_cost (DialogData  *dat
 		return NULL;
 	}
 	
-	cmd = g_new0 (ResourceCmdEditCost, 1);
-
-	cmd_base = (PlannerCmd*) cmd;
+	cmd_base = planner_cmd_new (ResourceCmdEditCost,
+				    _("Edit resource note"),
+				    resource_cmd_cost_do,
+				    resource_cmd_cost_undo,
+				    resource_cmd_cost_free);
 
-	cmd_base->label = g_strdup (_("Edit resource cost from dialog"));
-	cmd_base->do_func = resource_cmd_cost_do;
-	cmd_base->undo_func = resource_cmd_cost_undo;
-	cmd_base->free_func = resource_cmd_cost_free;
+	cmd = (ResourceCmdEditCost *) cmd_base;
 
 	cmd->property = g_strdup ("cost");
 	cmd->resource = g_object_ref (data->resource);
@@ -732,14 +729,13 @@ resource_cmd_edit_property (PlannerWindo
 	PlannerCmd              *cmd_base;
 	ResourceCmdEditProperty *cmd;
 
-	cmd = g_new0 (ResourceCmdEditProperty, 1);
+	cmd_base = planner_cmd_new (ResourceCmdEditProperty,
+				    _("Edit resource property"),
+				    resource_cmd_edit_property_do,
+				    resource_cmd_edit_property_undo,
+				    resource_cmd_edit_property_free);
 
-	cmd_base = (PlannerCmd*) cmd;
-
-	cmd_base->label = g_strdup (_("Edit resource property from dialog"));
-	cmd_base->do_func = resource_cmd_edit_property_do;
-	cmd_base->undo_func = resource_cmd_edit_property_undo;
-	cmd_base->free_func = resource_cmd_edit_property_free;
+	cmd = (ResourceCmdEditProperty *) cmd_base;
 
 	cmd->property = g_strdup (property);
 	cmd->resource = g_object_ref (resource);
@@ -774,14 +770,13 @@ resource_cmd_edit_property_focus (Planne
 	PlannerCmd              *cmd_base;
 	ResourceCmdEditProperty *cmd;
 
-	cmd = g_new0 (ResourceCmdEditProperty, 1);
-
-	cmd_base = (PlannerCmd*) cmd;
+	cmd_base = planner_cmd_new (ResourceCmdEditProperty,
+				    _("Edit resource property"),
+				    resource_cmd_edit_property_do,
+				    resource_cmd_edit_property_undo,
+				    resource_cmd_edit_property_free);
 
-	cmd_base->label = g_strdup (_("Edit resource property from dialog"));
-	cmd_base->do_func = resource_cmd_edit_property_do;
-	cmd_base->undo_func = resource_cmd_edit_property_undo;
-	cmd_base->free_func = resource_cmd_edit_property_free;
+	cmd = (ResourceCmdEditProperty *) cmd_base;
 
 	cmd->property = g_strdup (property);
 	cmd->resource = g_object_ref (resource);
@@ -1286,7 +1281,7 @@ resource_dialog_resource_cost_changed_cb
 					   dialog);
 }
 
-/* FIXME: undo support */
+/* FIXME: undo support ... it seems undo is working */
 static void  
 resource_dialog_resource_calendar_changed_cb (MrpResource *resource,  
 					      GParamSpec  *pspec, 
Index: src/planner-resource-view.c
===================================================================
RCS file: /cvs/gnome/planner/src/planner-resource-view.c,v
retrieving revision 1.23
diff -u -b -B -p -r1.23 planner-resource-view.c
--- src/planner-resource-view.c	18 Jun 2004 23:03:36 -0000	1.23
+++ src/planner-resource-view.c	23 Jun 2004 18:19:19 -0000
@@ -923,14 +923,13 @@ resource_cmd_remove (PlannerView *view, 
 	PlannerCmd          *cmd_base;
 	ResourceCmdRemove   *cmd;
 
-	cmd = g_new0 (ResourceCmdRemove, 1);
+	cmd_base = planner_cmd_new (ResourceCmdRemove,
+				    _("Remove resource"),
+				    resource_cmd_remove_do,
+				    resource_cmd_remove_undo,
+				    resource_cmd_remove_free);
 
-	cmd_base = (PlannerCmd*) cmd;
-
-	cmd_base->label = g_strdup (_("Remove resource"));
-	cmd_base->do_func = resource_cmd_remove_do;
-	cmd_base->undo_func = resource_cmd_remove_undo;
-	cmd_base->free_func = resource_cmd_remove_free;
+	cmd = (ResourceCmdRemove *) cmd_base;
 
 	cmd->project = planner_window_get_project (view->main_window);
 	cmd->resource = g_object_ref (resource);
@@ -1325,14 +1324,13 @@ resource_cmd_edit_property (PlannerView 
 	PlannerCmd              *cmd_base;
 	ResourceCmdEditProperty *cmd;
 
-	cmd = g_new0 (ResourceCmdEditProperty, 1);
-
-	cmd_base = (PlannerCmd*) cmd;
+	cmd_base = planner_cmd_new (ResourceCmdEditProperty,
+				    _("Edit resource property"),
+				    resource_cmd_edit_property_do,
+				    resource_cmd_edit_property_undo,
+				    resource_cmd_edit_property_free);
 
-	cmd_base->label = g_strdup (_("Edit resource property"));
-	cmd_base->do_func = resource_cmd_edit_property_do;
-	cmd_base->undo_func = resource_cmd_edit_property_undo;
-	cmd_base->free_func = resource_cmd_edit_property_free;
+	cmd = (ResourceCmdEditProperty *) cmd_base;
 
 	cmd->property = g_strdup (property);
 	cmd->resource = g_object_ref (resource);
@@ -1410,14 +1408,13 @@ resource_cmd_edit_custom_property (Plann
 	PlannerCmd                    *cmd_base;
 	ResourceCmdEditCustomProperty *cmd;
 
-	cmd = g_new0 (ResourceCmdEditCustomProperty, 1);
-
-	cmd_base = (PlannerCmd*) cmd;
+	cmd_base = planner_cmd_new (ResourceCmdEditCustomProperty,
+				    _("Edit resource custom property"),
+				    resource_cmd_edit_custom_property_do,
+				    resource_cmd_edit_custom_property_undo,
+				    resource_cmd_edit_custom_property_free);
 
-	cmd_base->label = g_strdup (_("Edit resource custom property"));
-	cmd_base->do_func = resource_cmd_edit_custom_property_do;
-	cmd_base->undo_func = resource_cmd_edit_custom_property_undo;
-	cmd_base->free_func = resource_cmd_edit_custom_property_free;
+	cmd = (ResourceCmdEditCustomProperty *) cmd_base;
 
 	cmd->property = property;
 	cmd->resource = g_object_ref (resource);
Index: src/planner-task-cmd.c
===================================================================
RCS file: /cvs/gnome/planner/src/planner-task-cmd.c,v
retrieving revision 1.2
diff -u -b -B -p -r1.2 planner-task-cmd.c
--- src/planner-task-cmd.c	18 Jun 2004 04:47:12 -0000	1.2
+++ src/planner-task-cmd.c	23 Jun 2004 18:19:20 -0000
@@ -127,10 +127,6 @@ task_cmd_unlink_do (PlannerCmd *cmd_base
 	
 	cmd = (TaskCmdLink*) cmd_base;
 
-	if (g_getenv ("PLANNER_DEBUG_UNDO_TASK")) {
-		g_message ("Removing the link ...");
-	}
-	
 	mrp_task_remove_predecessor (cmd->after, cmd->before);
 
 	return TRUE;
Index: src/planner-task-dialog.c
===================================================================
RCS file: /cvs/gnome/planner/src/planner-task-dialog.c,v
retrieving revision 1.22
diff -u -b -B -p -r1.22 planner-task-dialog.c
--- src/planner-task-dialog.c	22 Jun 2004 08:17:01 -0000	1.22
+++ src/planner-task-dialog.c	23 Jun 2004 18:19:25 -0000
@@ -444,7 +444,7 @@ task_cmd_edit_property_focus (PlannerWin
 	TaskCmdEditProperty *cmd;
 
 	cmd_base = planner_cmd_new (TaskCmdEditProperty,
-				    _("Edit task property from dialog"),
+				    _("Edit task property"),
 				    task_cmd_edit_property_do,
 				    task_cmd_edit_property_undo,
 				    task_cmd_edit_property_free);
@@ -518,7 +518,7 @@ task_cmd_edit_type (PlannerWindow *main_
 	}
 
 	cmd_base = planner_cmd_new (TaskCmdEditType,
-				    _("Edit task type from dialog"),
+				    _("Edit task type"),
 				    task_cmd_edit_type_do,
 				    task_cmd_edit_type_undo,
 				    task_cmd_edit_type_free);
@@ -585,7 +585,7 @@ task_cmd_edit_sched (PlannerWindow *main
 	}
 
 	cmd_base = planner_cmd_new (TaskCmdEditSchedule,
-				    _("Edit task schedule from dialog"),
+				    _("Edit task schedule"),
 				    task_cmd_edit_sched_do,
 				    task_cmd_edit_sched_undo,
 				    task_cmd_edit_sched_free);
@@ -663,7 +663,7 @@ task_cmd_assign_add (PlannerWindow *main
 	}
 
 	cmd_base = planner_cmd_new (TaskCmdEditAssignment,
-				    _("Add a resource for a task from dialog"),
+				    _("Add resource to task"),
 				    task_cmd_assign_add_do,
 				    task_cmd_assign_add_undo,
 				    task_cmd_assign_add_free);
@@ -723,7 +723,7 @@ task_cmd_assign_remove (PlannerWindow *m
 	TaskCmdEditAssignment  *cmd;
 
 	cmd_base = planner_cmd_new (TaskCmdEditAssignment,
-				    _("Remove a resource from a task from dialog"),
+				    _("Remove resource from task"),
 				    task_cmd_assign_remove_do,
 				    task_cmd_assign_remove_undo,
 				    task_cmd_assign_remove_free);
@@ -782,7 +782,7 @@ task_cmd_assign_units (PlannerWindow *ma
 	TaskCmdEditAssignment  *cmd;
 
 	cmd_base = planner_cmd_new (TaskCmdEditAssignment,
-				    _("Change resource units for a task from dialog"),
+				    _("Change resource units in task"),
 				    task_cmd_assign_units_do,
 				    task_cmd_assign_units_undo,
 				    task_cmd_assign_units_free);
@@ -949,7 +949,7 @@ task_cmd_edit_lag (PlannerWindow *main_w
 	}
 
 	cmd_base = planner_cmd_new (TaskCmdEditType,
-				    _("Edit lag predecessor from dialog"),
+				    _("Edit lag predecessor"),
 				    task_cmd_edit_lag_do,
 				    task_cmd_edit_lag_undo,
 				    task_cmd_edit_lag_free);
@@ -1015,7 +1015,7 @@ task_cmd_edit_note (DialogData  *data,
 	}
 
 	cmd_base = planner_cmd_new (TaskCmdEditNote,
-				    _("Edit task note from dialog"),
+				    _("Edit task note"),
 				    task_cmd_edit_note_do,
 				    task_cmd_edit_note_undo,
 				    task_cmd_edit_note_free);
@@ -2489,7 +2489,6 @@ task_dialog_assignment_toggled_cb (GtkCe
 	} else {
 		MrpAssignment *assignment;
 		
-		/* FIXME: UNDO */
 		assignment = mrp_task_get_assignment (data->task, resource);
 
 		if (assignment) {
Index: src/planner-task-tree.c
===================================================================
RCS file: /cvs/gnome/planner/src/planner-task-tree.c,v
retrieving revision 1.35
diff -u -b -B -p -r1.35 planner-task-tree.c
--- src/planner-task-tree.c	21 Jun 2004 10:21:29 -0000	1.35
+++ src/planner-task-tree.c	23 Jun 2004 18:19:32 -0000
@@ -237,15 +237,13 @@ task_cmd_edit_property (PlannerTaskTree 
 	TaskCmdEditProperty *cmd;
 	PlannerGanttModel   *model;
 
-	cmd = g_new0 (TaskCmdEditProperty, 1);
+	cmd_base = planner_cmd_new (TaskCmdEditProperty,
+				    _("Edit task property"),
+				    task_cmd_edit_property_do,
+				    task_cmd_edit_property_undo,
+				    task_cmd_edit_property_free);
 
-	cmd_base = (PlannerCmd*) cmd;
-
-	cmd_base->label = g_strdup (_("Edit task property"));
-
-	cmd_base->do_func = task_cmd_edit_property_do;
-	cmd_base->undo_func = task_cmd_edit_property_undo;
-	cmd_base->free_func = task_cmd_edit_property_free;
+	cmd = (TaskCmdEditProperty *) cmd_base;
 
 	cmd->tree = tree;
 	cmd->project = task_tree_get_project (tree);
@@ -688,16 +686,15 @@ task_cmd_constraint (PlannerTaskTree *tr
 	PlannerCmd          *cmd_base;
 	TaskCmdConstraint   *cmd;
 
-	cmd = g_new0 (TaskCmdConstraint, 1);
+	cmd_base = planner_cmd_new (TaskCmdConstraint,
+				    _("Apply constraint to task"),
+				    task_cmd_constraint_do,
+				    task_cmd_constraint_undo,
+				    task_cmd_constraint_free);
 
-	cmd_base = (PlannerCmd *) cmd;
-	cmd_base->label = g_strdup (_("Constraint task"));
-	cmd_base->do_func = task_cmd_constraint_do;
-	cmd_base->undo_func = task_cmd_constraint_undo;
-	cmd_base->free_func = task_cmd_constraint_free;
+	cmd = (TaskCmdConstraint *) cmd_base;
 	
 	cmd->task = g_object_ref (task);
-
 	cmd->constraint = g_new0 (MrpConstraint, 1);
 	cmd->constraint->time = constraint.time;
 	cmd->constraint->type = constraint.type;
@@ -751,13 +748,13 @@ task_cmd_reset_constraint (PlannerTaskTr
 	PlannerCmd          *cmd_base;
 	TaskCmdConstraint   *cmd;
 
-	cmd = g_new0 (TaskCmdConstraint, 1);
+	cmd_base = planner_cmd_new (TaskCmdConstraint,
+				    _("Reset task constraint"),
+				    task_cmd_constraint_reset_do,
+				    task_cmd_constraint_reset_undo,
+				    task_cmd_constraint_reset_free);
 
-	cmd_base = (PlannerCmd *) cmd;
-	cmd_base->label = g_strdup (_("Constraint task reset"));
-	cmd_base->do_func = task_cmd_constraint_reset_do;
-	cmd_base->undo_func = task_cmd_constraint_reset_undo;
-	cmd_base->free_func = task_cmd_constraint_reset_free;
+	cmd = (TaskCmdConstraint *) cmd_base;
 	
 	cmd->task = g_object_ref (task);
 
@@ -885,13 +882,13 @@ task_cmd_move (PlannerTaskTree *tree,
 	MrpTask             *parent_old;
 
 
-	cmd = g_new0 (TaskCmdMove, 1);
+	cmd_base = planner_cmd_new (TaskCmdMove,
+				    _("Move task"),
+				    task_cmd_move_do,
+				    task_cmd_move_undo,
+				    task_cmd_move_free);
 
-	cmd_base = (PlannerCmd*) cmd;
-	cmd_base->label = g_strdup (_("Move task"));
-	cmd_base->do_func = task_cmd_move_do;
-	cmd_base->undo_func = task_cmd_move_undo;
-	cmd_base->free_func = task_cmd_move_free;
+	cmd = (TaskCmdMove *) cmd_base;
 	
 	cmd->project = g_object_ref (tree->priv->project);
 	cmd->task = g_object_ref (task);
@@ -994,14 +991,14 @@ task_cmd_edit_custom_property (PlannerTa
 	PlannerTaskTreePriv       *priv = tree->priv;
 	TaskCmdEditCustomProperty *cmd;
 
-	cmd = g_new0 (TaskCmdEditCustomProperty, 1);
+	cmd_base = planner_cmd_new (TaskCmdEditCustomProperty,
+				    _("Edit task custom property"),
+				    task_cmd_edit_custom_property_do,
+				    task_cmd_edit_custom_property_undo,
+				    task_cmd_edit_custom_property_free);
 
-	cmd_base = (PlannerCmd*) cmd;
 
-	cmd_base->label = g_strdup (_("Edit task custom property"));
-	cmd_base->do_func = task_cmd_edit_custom_property_do;
-	cmd_base->undo_func = task_cmd_edit_custom_property_undo;
-	cmd_base->free_func = task_cmd_edit_custom_property_free;
+	cmd = (TaskCmdEditCustomProperty *) cmd_base;
 
 	cmd->property = property;
 	cmd->task = g_object_ref (task);


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