Commit 94a02e2f authored by Richard Hult's avatar Richard Hult Committed by Richard Hult

Change the command manager interface slightly to be able to handle

2004-05-02  Richard Hult  <richard@imendio.com>

	* src/planner-calendar-dialog.c: (cal_dialog_response_cb),
	(planner_calendar_dialog_new),
	(cal_dialog_update_calendar_widgets):
	* src/planner-cmd-manager.c: (cmd_manager_insert),
	(planner_cmd_manager_insert_and_do), (transaction_cmd_do),
	(planner_cmd_manager_end_transaction), (planner_cmd_new_size):
	* src/planner-cmd-manager.h:
	* src/planner-day-type-dialog.c: (day_type_cmd_add_do),
	(day_type_cmd_remove_do):
	* src/planner-default-week-dialog.c:
	(default_week_dialog_response_cb),
	(planner_default_week_dialog_new), (default_week_cmd_edit_do),
	(default_week_cmd_edit_undo), (default_week_cmd_edit_free),
	(default_week_cmd_edit):
	* src/planner-group-dialog.c: (group_cmd_insert_do),
	(group_cmd_remove_do), (group_cmd_default_do),
	(group_cmd_edit_property_do):
	* src/planner-project-properties.c: (property_cmd_edit_do):
	* src/planner-resource-dialog.c: (resource_cmd_calendar_do),
	(resource_cmd_calendar_free), (resource_cmd_note_do),
	(resource_cmd_edit_property_do):
	* src/planner-resource-view.c: (resource_cmd_insert_do),
	(resource_cmd_remove_do), (resource_cmd_edit_property_do),
	(resource_cmd_edit_custom_property_do):
	* src/planner-task-tree.c: (task_cmd_insert_do),
	(task_cmd_insert_undo), (task_cmd_insert),
	(task_cmd_edit_property_do), (task_cmd_remove_do),
	(task_cmd_remove), (task_cmd_constraint_do), (task_cmd_constraint),
	(task_cmd_task_move_do): Change the command manager interface
	slightly to be able to handle commands that fail, and add some
	convenience API. Update everything to the new interface.

	* src/planner-resource-dialog.c (resource_cmd_calendar_free):
	Check the right calendar before unreffing it.
parent b8d5eb16
2004-05-02 Richard Hult <richard@imendio.com>
* src/planner-calendar-dialog.c: (cal_dialog_response_cb),
(planner_calendar_dialog_new),
(cal_dialog_update_calendar_widgets):
* src/planner-cmd-manager.c: (cmd_manager_insert),
(planner_cmd_manager_insert_and_do), (transaction_cmd_do),
(planner_cmd_manager_end_transaction), (planner_cmd_new_size):
* src/planner-cmd-manager.h:
* src/planner-day-type-dialog.c: (day_type_cmd_add_do),
(day_type_cmd_remove_do):
* src/planner-default-week-dialog.c:
(default_week_dialog_response_cb),
(planner_default_week_dialog_new), (default_week_cmd_edit_do),
(default_week_cmd_edit_undo), (default_week_cmd_edit_free),
(default_week_cmd_edit):
* src/planner-group-dialog.c: (group_cmd_insert_do),
(group_cmd_remove_do), (group_cmd_default_do),
(group_cmd_edit_property_do):
* src/planner-project-properties.c: (property_cmd_edit_do):
* src/planner-resource-dialog.c: (resource_cmd_calendar_do),
(resource_cmd_calendar_free), (resource_cmd_note_do),
(resource_cmd_edit_property_do):
* src/planner-resource-view.c: (resource_cmd_insert_do),
(resource_cmd_remove_do), (resource_cmd_edit_property_do),
(resource_cmd_edit_custom_property_do):
* src/planner-task-tree.c: (task_cmd_insert_do),
(task_cmd_insert_undo), (task_cmd_insert),
(task_cmd_edit_property_do), (task_cmd_remove_do),
(task_cmd_remove), (task_cmd_constraint_do), (task_cmd_constraint),
(task_cmd_task_move_do): Change the command manager interface
slightly to be able to handle commands that fail, and add some
convenience API. Update everything to the new interface.
* src/planner-resource-dialog.c (resource_cmd_calendar_free):
Check the right calendar before unreffing it.
2004-05-02 Richard Hult <richard@imendio.com>
* libplanner/Makefile.am:
......
......@@ -3,6 +3,7 @@
* Copyright (C) 2002 CodeFactory AB
* Copyright (C) 2002 Richard Hult <richard@imendio.com>
* Copyright (C) 2002 Mikael Hallendal <micke@imendio.com>
* Copyright (C) 2004 Imendio HB
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
......@@ -241,7 +242,7 @@ cal_dialog_response_cb (GtkWidget *dialog,
window = planner_default_week_dialog_new (data->main_window, calendar);
/* FIXME: Not very nice to have it modal, but I can't think of a
* better way right now.
* better way right now.
*/
gtk_window_set_transient_for (GTK_WINDOW (window),
GTK_WINDOW (data->dialog));
......@@ -326,10 +327,10 @@ planner_calendar_dialog_new (PlannerWindow *window)
gtk_widget_show (data->calendar);
planner_calendar_display_options (PLANNER_CALENDAR (data->calendar),
PLANNER_CALENDAR_SHOW_HEADING |
PLANNER_CALENDAR_SHOW_DAY_NAMES |
PLANNER_CALENDAR_SHOW_WEEK_NUMBERS |
PLANNER_CALENDAR_WEEK_START_MONDAY);
PLANNER_CALENDAR_SHOW_HEADING |
PLANNER_CALENDAR_SHOW_DAY_NAMES |
PLANNER_CALENDAR_SHOW_WEEK_NUMBERS |
PLANNER_CALENDAR_WEEK_START_MONDAY);
g_signal_connect (data->calendar,
"month_changed",
G_CALLBACK (cal_dialog_month_changed_cb),
......@@ -605,13 +606,13 @@ cal_dialog_update_calendar_widgets (DialogData *data)
if (day == mrp_day_get_nonwork ()) {
planner_calendar_mark_day (calendar_widget,
d,
PLANNER_CALENDAR_MARK_SHADE);
d,
PLANNER_CALENDAR_MARK_SHADE);
}
else if (day == mrp_day_get_work ()) {
planner_calendar_mark_day (calendar_widget,
d,
PLANNER_CALENDAR_MARK_NONE);
d,
PLANNER_CALENDAR_MARK_NONE);
}
}
}
......
......@@ -49,6 +49,7 @@ static void cmd_manager_finalize (GObject *object);
static void cmd_manager_free_func (PlannerCmd *cmd,
gpointer data);
GType
planner_cmd_manager_get_type (void)
{
......@@ -259,13 +260,14 @@ cmd_manager_free_func (PlannerCmd *cmd,
*/
}
static void
static gboolean
cmd_manager_insert (PlannerCmdManager *manager,
PlannerCmd *cmd,
gboolean run_do)
{
PlannerCmdManagerPriv *priv;
GList *current;
gboolean retval;
priv = manager->priv;
......@@ -314,21 +316,25 @@ cmd_manager_insert (PlannerCmdManager *manager,
cmd->manager = manager;
if (run_do && cmd->do_func) {
cmd->do_func (cmd);
retval = cmd->do_func (cmd);
} else {
retval = TRUE;
}
cmd_manager_dump (manager);
state_changed (manager);
return retval;
}
void
gboolean
planner_cmd_manager_insert_and_do (PlannerCmdManager *manager, PlannerCmd *cmd)
{
g_return_if_fail (PLANNER_IS_CMD_MANAGER (manager));
g_return_if_fail (cmd != NULL);
g_return_val_if_fail (PLANNER_IS_CMD_MANAGER (manager), FALSE);
g_return_val_if_fail (cmd != NULL, FALSE);
cmd_manager_insert (manager, cmd, TRUE);
return cmd_manager_insert (manager, cmd, TRUE);
}
gboolean
......@@ -399,7 +405,7 @@ planner_cmd_manager_new (void)
* Transaction commands
*/
static void
static gboolean
transaction_cmd_do (PlannerCmd *cmd)
{
PlannerCmd *cmd_sub;
......@@ -423,6 +429,10 @@ transaction_cmd_do (PlannerCmd *cmd)
g_assert (cmd_sub->type == PLANNER_CMD_TYPE_NORMAL);
}
/* FIXME: need to make sure we handle transactions that doesn't work. */
return TRUE;
}
static void
......@@ -530,3 +540,22 @@ planner_cmd_manager_end_transaction (PlannerCmdManager *manager)
return TRUE;
}
PlannerCmd *
planner_cmd_new_size (gsize size,
const gchar *label,
PlannerCmdDoFunc do_func,
PlannerCmdUndoFunc undo_func,
PlannerCmdFreeFunc free_func)
{
PlannerCmd *cmd;
cmd = g_malloc0 (size);
cmd->label = g_strdup (label);
cmd->do_func = do_func;
cmd->undo_func = undo_func;
cmd->free_func = free_func;
return cmd;
}
......@@ -45,9 +45,9 @@ struct _PlannerCmdManagerClass {
typedef struct _PlannerCmd PlannerCmd;
typedef void (*PlannerCmdDoFunc) (PlannerCmd *cmd);
typedef void (*PlannerCmdUndoFunc) (PlannerCmd *cmd);
typedef void (*PlannerCmdFreeFunc) (PlannerCmd *cmd);
typedef gboolean (*PlannerCmdDoFunc) (PlannerCmd *cmd);
typedef void (*PlannerCmdUndoFunc) (PlannerCmd *cmd);
typedef void (*PlannerCmdFreeFunc) (PlannerCmd *cmd);
typedef enum {
PLANNER_CMD_TYPE_NORMAL = 0,
......@@ -71,13 +71,20 @@ struct _PlannerCmd {
GType planner_cmd_manager_get_type (void) G_GNUC_CONST;
PlannerCmdManager *planner_cmd_manager_new (void);
void planner_cmd_manager_insert_and_do (PlannerCmdManager *manager,
PlannerCmd *cmd);
gboolean planner_cmd_manager_undo (PlannerCmdManager *manager);
gboolean planner_cmd_manager_redo (PlannerCmdManager *manager);
gboolean planner_cmd_manager_begin_transaction (PlannerCmdManager *manager,
const gchar *label);
gboolean planner_cmd_manager_end_transaction (PlannerCmdManager *manager);
gboolean planner_cmd_manager_insert_and_do (PlannerCmdManager *manager,
PlannerCmd *cmd);
gboolean planner_cmd_manager_undo (PlannerCmdManager *manager);
gboolean planner_cmd_manager_redo (PlannerCmdManager *manager);
gboolean planner_cmd_manager_begin_transaction (PlannerCmdManager *manager,
const gchar *label);
gboolean planner_cmd_manager_end_transaction (PlannerCmdManager *manager);
PlannerCmd * planner_cmd_new_size (gsize size,
const gchar *label,
PlannerCmdDoFunc do_func,
PlannerCmdUndoFunc undo_func,
PlannerCmdFreeFunc free_func);
#define planner_cmd_new(t,l,d,u,f) planner_cmd_new_size(sizeof(t),l,d,u,f)
#endif /* __PLANNER_CMD_MANAGER_H__ */
......
......@@ -447,7 +447,7 @@ day_type_dialog_new_dialog_run (DialogData *data)
/* Commands */
static void
static gboolean
day_type_cmd_add_do (PlannerCmd *cmd_base)
{
DayTypeCmdAdd *cmd;
......@@ -455,6 +455,8 @@ day_type_cmd_add_do (PlannerCmd *cmd_base)
cmd = (DayTypeCmdAdd *) cmd_base;
cmd->day = mrp_day_add (cmd->project, cmd->name, "");
return TRUE;
}
static void
......@@ -504,7 +506,7 @@ day_type_cmd_add (DialogData *data,
return cmd_base;
}
static void
static gboolean
day_type_cmd_remove_do (PlannerCmd *cmd_base)
{
DayTypeCmdRemove *cmd;
......@@ -513,6 +515,8 @@ day_type_cmd_remove_do (PlannerCmd *cmd_base)
mrp_day_remove (cmd->project, cmd->day);
cmd->day = NULL;
return TRUE;
}
static void
......
......@@ -3,6 +3,7 @@
* Copyright (C) 2002 CodeFactory AB
* Copyright (C) 2002 Richard Hult <richard@imendio.com>
* Copyright (C) 2002 Mikael Hallendal <micke@imendio.com>
* Copyright (C) 2004 Imendio HB
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
......@@ -53,7 +54,7 @@ enum {
};
typedef struct {
PlannerWindow *main_window;
PlannerWindow *main_window;
MrpProject *project;
MrpCalendar *calendar;
......@@ -67,27 +68,36 @@ typedef struct {
GtkWidget *dash_label[5];
} DialogData;
typedef struct {
PlannerCmd base;
#define DIALOG_GET_DATA(d) g_object_get_data ((GObject*)d, "data")
MrpProject *project;
gchar *name;
MrpDay *day;
} DefaultWeekCmdEdit;
static void default_week_dialog_response_cb (GtkWidget *dialog,
gint response,
DialogData *data);
static void default_week_dialog_update_labels (DialogData *data);
static void default_week_dialog_weekday_selected_cb (GtkOptionMenu *option_menu,
DialogData *data);
static void default_week_dialog_day_selected_cb (GtkOptionMenu *option_menu,
DialogData *data);
static void default_week_dialog_setup_day_option_menu (GtkOptionMenu *option_menu,
MrpProject *project,
MrpCalendar *calendar);
static void
default_week_dialog_setup_weekday_option_menu (GtkOptionMenu *option_menu);
static gint default_week_dialog_get_selected_weekday (DialogData *data);
static MrpDay *default_week_dialog_get_selected_day (DialogData *data);
static void default_week_dialog_set_selected_day (DialogData *data,
MrpDay *day);
#define DIALOG_GET_DATA(d) g_object_get_data ((GObject*)d, "data")
static void default_week_dialog_response_cb (GtkWidget *dialog,
gint response,
DialogData *data);
static void default_week_dialog_update_labels (DialogData *data);
static void default_week_dialog_weekday_selected_cb (GtkOptionMenu *option_menu,
DialogData *data);
static void default_week_dialog_day_selected_cb (GtkOptionMenu *option_menu,
DialogData *data);
static void default_week_dialog_setup_day_option_menu (GtkOptionMenu *option_menu,
MrpProject *project,
MrpCalendar *calendar);
static void default_week_dialog_setup_weekday_option_menu (GtkOptionMenu *option_menu);
static gint default_week_dialog_get_selected_weekday (DialogData *data);
static MrpDay * default_week_dialog_get_selected_day (DialogData *data);
static void default_week_dialog_set_selected_day (DialogData *data,
MrpDay *day);
static PlannerCmd *default_week_cmd_edit (DialogData *data,
MrpDay *day);
static void
......@@ -99,16 +109,15 @@ default_week_dialog_response_cb (GtkWidget *dialog,
gint weekday;
switch (response) {
case RESPONSE_REMOVE:
break;
case RESPONSE_ADD:
break;
case RESPONSE_APPLY:
weekday = default_week_dialog_get_selected_weekday (data);
day = default_week_dialog_get_selected_day (data);
/* FIXME: implement. */
if (0) {
default_week_cmd_edit (data, NULL);
}
mrp_calendar_set_default_days (data->calendar,
weekday, day,
-1);
......@@ -134,7 +143,7 @@ default_week_dialog_parent_destroy_cb (GtkWidget *window, GtkWidget *dialog)
GtkWidget *
planner_default_week_dialog_new (PlannerWindow *window,
MrpCalendar *calendar)
MrpCalendar *calendar)
{
DialogData *data;
GladeXML *glade;
......@@ -446,3 +455,60 @@ default_week_dialog_set_selected_day (DialogData *data,
}
}
static gboolean
default_week_cmd_edit_do (PlannerCmd *cmd_base)
{
DefaultWeekCmdEdit *cmd;
cmd = (DefaultWeekCmdEdit *) cmd_base;
mrp_day_remove (cmd->project, cmd->day);
cmd->day = NULL;
return TRUE;
}
static void
default_week_cmd_edit_undo (PlannerCmd *cmd_base)
{
DefaultWeekCmdEdit *cmd;
cmd = (DefaultWeekCmdEdit *) cmd_base;
cmd->day = mrp_day_add (cmd->project, cmd->name, "");
}
static void
default_week_cmd_edit_free (PlannerCmd *cmd_base)
{
DefaultWeekCmdEdit *cmd;
cmd = (DefaultWeekCmdEdit *) cmd_base;
g_free (cmd->name);
}
static PlannerCmd *
default_week_cmd_edit (DialogData *data,
MrpDay *day)
{
PlannerCmd *cmd_base;
DefaultWeekCmdEdit *cmd;
cmd_base = planner_cmd_new (DefaultWeekCmdEdit,
_("Edit default week\""),
default_week_cmd_edit_do,
default_week_cmd_edit_undo,
default_week_cmd_edit_free);
cmd = (DefaultWeekCmdEdit *) cmd_base;
cmd->project = data->project;
cmd->day = day;
cmd->name = g_strdup (mrp_day_get_name (day));
planner_cmd_manager_insert_and_do (planner_window_get_cmd_manager (data->main_window),
cmd_base);
return cmd_base;
}
......@@ -253,7 +253,7 @@ group_dialog_setup_tree_view (GtkWidget *dialog)
g_object_unref (sorted_model);
}
static void
static gboolean
group_cmd_insert_do (PlannerCmd *cmd_base)
{
GroupCmdInsert *cmd;
......@@ -263,6 +263,8 @@ group_cmd_insert_do (PlannerCmd *cmd_base)
g_assert (MRP_IS_GROUP (cmd->group));
mrp_project_add_group (cmd->project, cmd->group);
return TRUE;
}
static void
......@@ -348,7 +350,7 @@ group_dialog_insert_group_cb (GtkWidget *button, GtkWidget *dialog)
}
}
static void
static gboolean
group_cmd_remove_do (PlannerCmd *cmd_base)
{
GroupCmdRemove *cmd;
......@@ -373,6 +375,8 @@ group_cmd_remove_do (PlannerCmd *cmd_base)
cmd->is_default = TRUE;
mrp_project_remove_group (cmd->project, cmd->group);
return TRUE;
}
static void
......@@ -472,7 +476,7 @@ group_dialog_close_editor_cb (GtkWidget *button, GtkWidget *dialog)
gtk_widget_destroy (dialog);
}
static void
static gboolean
group_cmd_default_do (PlannerCmd *cmd_base)
{
GroupCmdDefault *cmd;
......@@ -480,6 +484,8 @@ group_cmd_default_do (PlannerCmd *cmd_base)
cmd = (GroupCmdDefault*) cmd_base;
mrp_object_set (cmd->project, "default-group", cmd->group, NULL);
return TRUE;
}
static void
......@@ -584,7 +590,7 @@ group_dialog_cell_toggled (GtkCellRendererText *cell,
}
static void
static gboolean
group_cmd_edit_property_do (PlannerCmd *cmd_base)
{
GroupCmdEditProperty *cmd;
......@@ -594,6 +600,8 @@ group_cmd_edit_property_do (PlannerCmd *cmd_base)
g_object_set_property (G_OBJECT (cmd->group),
cmd->property,
cmd->value);
return TRUE;
}
static void
......
......@@ -171,7 +171,7 @@ typedef struct {
MrpCalendar *calendar_old;
} PropertyCmdEdit;
static void
static gboolean
property_cmd_edit_do (PlannerCmd *cmd_base)
{
PropertyCmdEdit *cmd;
......@@ -180,20 +180,25 @@ property_cmd_edit_do (PlannerCmd *cmd_base)
switch (cmd->type) {
case PROP_STRING:
g_object_set (cmd->project, cmd->property,
cmd->str, NULL);
g_object_set (cmd->project,
cmd->property, cmd->str,
NULL);
break;
case PROP_DATE:
g_object_set (cmd->project, cmd->property,
cmd->t, NULL);
g_object_set (cmd->project,
cmd->property, cmd->t,
NULL);
break;
case PROP_CALENDAR:
g_object_set (cmd->project, cmd->property,
cmd->calendar, NULL);
g_object_set (cmd->project,
cmd->property, cmd->calendar,
NULL);
break;
}
return TRUE;
}
static void
......
......@@ -437,7 +437,7 @@ resource_dialog_resource_removed_cb (GtkWidget *w,
gtk_widget_destroy (data->dialog);
}
static void
static gboolean
resource_cmd_calendar_do (PlannerCmd *cmd_base)
{
ResourceCmdCalendar *cmd;
......@@ -445,6 +445,8 @@ resource_cmd_calendar_do (PlannerCmd *cmd_base)
cmd = (ResourceCmdCalendar*) cmd_base;
mrp_resource_set_calendar (cmd->resource, cmd->calendar);
return TRUE;
}
static void
......@@ -467,7 +469,7 @@ resource_cmd_calendar_free (PlannerCmd *cmd_base)
g_object_unref (cmd->resource);
if (cmd->old_calendar) {
if (cmd->calendar) {
g_object_unref (cmd->calendar);
}
if (cmd->old_calendar) {
......@@ -516,7 +518,7 @@ resource_cmd_edit_calendar (DialogData *data,
return cmd_base;
}
static void
static gboolean
resource_cmd_note_do (PlannerCmd *cmd_base)
{
ResourceCmdEditNote *cmd;
......@@ -529,6 +531,8 @@ resource_cmd_note_do (PlannerCmd *cmd_base)
}
g_object_set (cmd->resource, "note", cmd->note, NULL);
return TRUE;
}
static void
......@@ -599,7 +603,7 @@ resource_cmd_edit_note (DialogData *data,
return cmd_base;
}
static void
static gboolean
resource_cmd_edit_property_do (PlannerCmd *cmd_base)
{
ResourceCmdEditProperty *cmd;
......@@ -609,6 +613,8 @@ resource_cmd_edit_property_do (PlannerCmd *cmd_base)
g_object_set_property (G_OBJECT (cmd->resource),
cmd->property,
cmd->value);
return TRUE;
}
static void
......
......@@ -751,7 +751,7 @@ resource_view_popup_edit_resource_cb (gpointer callback_data,
resource_view_edit_resource_cb (NULL, callback_data, NULL);
}
static void
static gboolean
resource_cmd_insert_do (PlannerCmd *cmd_base)
{
ResourceCmdInsert *cmd;
......@@ -759,6 +759,8 @@ resource_cmd_insert_do (PlannerCmd *cmd_base)
cmd = (ResourceCmdInsert*) cmd_base;
mrp_project_add_resource (cmd->project, cmd->resource);
return TRUE;
}
static void
......@@ -875,7 +877,7 @@ resource_view_insert_resources_cb (BonoboUIComponent *component,
(gpointer *) &priv->resource_input_dialog);
}
static void
static gboolean
resource_cmd_remove_do (PlannerCmd *cmd_base)
{
ResourceCmdRemove *cmd;
......@@ -890,8 +892,9 @@ resource_cmd_remove_do (PlannerCmd *cmd_base)
g_object_ref (l->data));
}
mrp_project_remove_resource (cmd->project, cmd->resource);
return TRUE;
}
static void
......@@ -1289,7 +1292,7 @@ resource_view_setup_tree_view (PlannerView *view)
}
}
static void
static gboolean
resource_cmd_edit_property_do (PlannerCmd *cmd_base)
{
ResourceCmdEditProperty *cmd;
......@@ -1299,6 +1302,8 @@ resource_cmd_edit_property_do (PlannerCmd *cmd_base)
g_object_set_property (G_OBJECT (cmd->resource),
cmd->property,
cmd->value);
return TRUE;
}
static void
......@@ -1372,7 +1377,7 @@ resource_cmd_edit_property (PlannerView *view,
return cmd_base;
}
static void
static gboolean
resource_cmd_edit_custom_property_do (PlannerCmd *cmd_base)
{
ResourceCmdEditCustomProperty *cmd;
......@@ -1381,6 +1386,8 @@ resource_cmd_edit_custom_property_do (PlannerCmd *cmd_base)
mrp_object_set_property (MRP_OBJECT (cmd->resource),
cmd->property,
cmd->value);
return TRUE;
}
static void
......
......@@ -196,7 +196,7 @@ task_cmd_insert_free (PlannerCmd *cmd_base)
g_free (cmd);
}
static void
static gboolean
task_cmd_insert_do (PlannerCmd *cmd_base)
{
TaskCmdInsert *cmd;
......@@ -205,7 +205,7 @@ task_cmd_insert_do (PlannerCmd *cmd_base)
gint depth;
gint position;
cmd = (TaskCmdInsert*) cmd_base;
cmd = (TaskCmdInsert *) cmd_base;
path = gtk_tree_path_copy (cmd->path);
......@@ -233,6 +233,7 @@ task_cmd_insert_do (PlannerCmd *cmd_base)
position,
cmd->task);
return TRUE;
}
static void
......@@ -240,10 +241,9 @@ task_cmd_insert_undo (PlannerCmd *cmd_base)
{
TaskCmdInsert *cmd;
cmd = (TaskCmdInsert*) cmd_base;
cmd = (TaskCmdInsert *) cmd_base;
mrp_project_remove_task (cmd->project,
cmd->task);
mrp_project_remove_task (cmd->project, cmd->task);
}
static PlannerCmd *
......@@ -258,7 +258,7 @@ task_cmd_insert (PlannerTaskTree *tree,
cmd = g_new0 (TaskCmdInsert, 1);
cmd_base = (PlannerCmd*) cmd;
cmd_base = (PlannerCmd *) cmd;
cmd_base->label = g_strdup (_("Insert task"));
cmd_base->do_func = task_cmd_insert_do;
......@@ -291,7 +291,7 @@ typedef struct {
GValue *old_value;
} TaskCmdEditProperty;
static void
static gboolean
task_cmd_edit_property_do (PlannerCmd *cmd_base)
{
TaskCmdEditProperty *cmd;
......@@ -302,8 +302,9 @@ task_cmd_edit_property_do (PlannerCmd *cmd_base)
task = task_tree_get_task_from_path (cmd->tree, cmd->path);
g_object_set_property (G_OBJECT (task),
cmd->property,
cmd->value);
cmd->property, cmd->value);
return TRUE;
}
static void
......@@ -613,7 +614,7 @@ task_cmd_restore_children (TaskCmdRemove *cmd)
}
}
static void
static gboolean
task_cmd_remove_do (PlannerCmd *cmd_base)
{
TaskCmdRemove *cmd;
......@@ -631,6 +632,8 @@ task_cmd_remove_do (PlannerCmd *cmd_base)
}
mrp_project_remove_task (cmd->project, cmd->task);