diff options
Diffstat (limited to 'calendar/gui/tasks-control.c')
-rw-r--r-- | calendar/gui/tasks-control.c | 42 |
1 files changed, 41 insertions, 1 deletions
diff --git a/calendar/gui/tasks-control.c b/calendar/gui/tasks-control.c index d3154de0d6..5269f21cdf 100644 --- a/calendar/gui/tasks-control.c +++ b/calendar/gui/tasks-control.c @@ -59,7 +59,32 @@ static void tasks_control_deactivate (BonoboControl *control); static void tasks_control_new_task_cmd (BonoboUIComponent *uic, gpointer data, const char *path); +static void tasks_control_delete_cmd (BonoboUIComponent *uic, + gpointer data, + const char *path); + +/* Callback used when the selection in the table changes */ +static void +selection_changed_cb (ETasks *tasks, int n_selected, gpointer data) +{ + BonoboControl *control; + BonoboUIComponent *uic; + Bonobo_UIContainer ui_container; + + control = BONOBO_CONTROL (data); + + uic = bonobo_control_get_ui_component (control); + g_assert (uic != NULL); + + ui_container = bonobo_ui_component_get_container (uic); + if (ui_container == CORBA_OBJECT_NIL) + return; + + bonobo_ui_component_set_prop (uic, "/commands/TasksDelete", "sensitive", + n_selected == 0 ? "0" : "1", + NULL); +} BonoboControl * tasks_control_new (void) @@ -85,6 +110,9 @@ tasks_control_new (void) GTK_SIGNAL_FUNC (tasks_control_activate_cb), tasks); + gtk_signal_connect (GTK_OBJECT (tasks), "selection_changed", + GTK_SIGNAL_FUNC (selection_changed_cb), control); + return control; } @@ -180,6 +208,7 @@ tasks_control_activate_cb (BonoboControl *control, static BonoboUIVerb verbs [] = { BONOBO_UI_VERB ("TasksNewTask", tasks_control_new_task_cmd), + BONOBO_UI_VERB ("TasksDelete", tasks_control_delete_cmd), BONOBO_UI_VERB_END }; @@ -236,8 +265,19 @@ tasks_control_new_task_cmd (BonoboUIComponent *uic, gpointer data, const char *path) { - ETasks *tasks = data; + ETasks *tasks; + tasks = E_TASKS (data); e_tasks_new_task (tasks); } +static void +tasks_control_delete_cmd (BonoboUIComponent *uic, + gpointer data, + const char *path) +{ + ETasks *tasks; + + tasks = E_TASKS (data); + e_tasks_delete_selected (tasks); +} |