[Planner Dev] Fix for Altering resource assignments does not trigger save reminder (bugzilla 138368)
- From: Lincoln Phipps <lincoln phipps openmutual net>
- To: Planner Project Manager - Development List <planner-dev lists imendio com>
- Subject: [Planner Dev] Fix for Altering resource assignments does not trigger save reminder (bugzilla 138368)
- Date: Thu, 15 Apr 2004 05:36:29 +0100
http://bugzilla.gnome.org/show_bug.cgi?id=138368
See the patch - it has the cludge to get over fact that object->priv->project
doesn't exist for assignments so calling mrp_object_changed with an assignment
as your object won't work. Only notice this for setting units.
FIXME: Should assignments->priv->project actually be expected to
exist. Is there more to do in that we should also have an
assignment->priv->project or am I misreading this bit of code in
mrp_object_changed()
Rgds,
Lincoln.
Index: libplanner/mrp-assignment.c
===================================================================
RCS file: /cvs/gnome/planner/libplanner/mrp-assignment.c,v
retrieving revision 1.1.1.1
diff -u -b -B -p -r1.1.1.1 mrp-assignment.c
--- libplanner/mrp-assignment.c 1 Dec 2003 17:36:21 -0000 1.1.1.1
+++ libplanner/mrp-assignment.c 15 Apr 2004 04:09:57 -0000
@@ -162,6 +162,7 @@ assignment_set_property (GObject *o
{
MrpAssignment *assignment;
MrpAssignmentPriv *priv;
+ gboolean changed = FALSE;
assignment = MRP_ASSIGNMENT (object);
priv = assignment->priv;
@@ -172,19 +173,40 @@ assignment_set_property (GObject *o
g_object_unref (priv->task);
}
priv->task = g_object_ref (g_value_get_object (value));
+ changed = TRUE;
break;
case PROP_RESOURCE:
if (priv->resource) {
g_object_unref (priv->resource);
}
priv->resource = g_object_ref (g_value_get_object (value));
+ changed = TRUE;
break;
case PROP_UNITS:
priv->units = g_value_get_int (value);
+ changed = TRUE;
break;
default:
break;
}
+ if (changed) {
+ /* Firstly the unusual case of changing UNITS because
+ * mrp_object_changed uses object priv->project and
+ * assignment units doesn't have that so we lie and
+ * use resource instead as our object.
+ * If the resource/task change then the resource/task
+ * fixes that up via its own mrp-??? calls but just changing
+ * Units gets a bit stuck because it relies only on this function.
+ * FIXME: Find out how we can add priv->project to assignment
+ * so that mrp_object_change() works OK on assignments
+ * without this cludge.
+ */
+ if (prop_id == PROP_UNITS) {
+ mrp_object_changed (MRP_OBJECT (priv->resource));
+ } else {
+ mrp_object_changed (MRP_OBJECT (object));
+ }
+ }
}
static void
Index: src/planner-task-dialog.c
===================================================================
RCS file: /cvs/gnome/planner/src/planner-task-dialog.c,v
retrieving revision 1.6
diff -u -b -B -p -r1.6 planner-task-dialog.c
--- src/planner-task-dialog.c 6 Apr 2004 21:26:39 -0000 1.6
+++ src/planner-task-dialog.c 15 Apr 2004 04:09:59 -0000
@@ -948,8 +948,9 @@ task_dialog_resource_units_cell_edited (
assignment = mrp_task_get_assignment (data->task, resource);
if (assignment) {
- g_object_set (assignment,
- "units", atoi (new_text),
+ mrp_object_set (assignment,
+ "units",
+ atoi (new_text),
NULL);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]