Hi!
El mié, 05-05-2004 a las 14:46, Richard Hult escribió:
> On ons, 2004-05-05 at 16:00 +0000, Alvaro del Castillo wrote:
> > El mié, 05-05-2004 a las 11:45, Richard Hult escribió:
> > > On ons, 2004-05-05 at 07:57 +0000, Alvaro del Castillo wrote:
> > > > Hi guys!
> > > >
> > > > Here goes another patch for the undo system. With this one you can
> > > > do/undo link/unlink tasks, using the link/unlink button and also,
> > > > linking tasks with drag and drop.
> > >
> > > Thanks, will take a look later today.
> > >
> > > > I have had to modify a little the PlannerCmd and here goes a proposal to
> > > > add 2 new fields: error and success. Richard, what do you think? I am
> > > > not sure I like to add new fields in this way to PlannerCmd.
> > >
> > > Hm, the boolean return value is for indicating success/failure, why do
> > > you need the field?
> > >
> >
> > I need the field because I need to know if a "PlannerCmd" has been
> > executed ok. For example:
> >
> > cmd = planner_task_tree_task_cmdlink (tree, task, target_task,
> > MRP_RELATION_FS, 0);
> >
> > if (cmd->success == FALSE) {
> > GtkWidget *dialog;
> >
> > ...
> >
> > a dialog to tell the user that the cmd can't be done.
>
> But that's what the boolean I added is for. The function shouldn't
> return a cmd if it didn't succeed, it should return NULL.
> (..._insert_and_do propagates the boolean from the command).
>
Hmm, finally, after trying to remove the cmd->success field, I have
found why I need it. If a command fails, I need to know why, and this is
why we need the cmd->error string field.
But then, we can return NULL when a PlannerCmd fails because we can't
access then to the cmd->error field :(
One solution could be to have a global last error field in
PlannerCmdManager, but I don't like a lot the idea becasue we can have
sync problems between several commands.
What do you think?
Cheers
> /Richard
Attachment:
signature.asc
Description: Esta parte del mensaje =?ISO-8859-1?Q?est=E1?= firmada digitalmente