diff options
author | Federico Mena Quintero <federico@ximian.com> | 2001-05-22 06:38:37 +0800 |
---|---|---|
committer | Federico Mena Quintero <federico@src.gnome.org> | 2001-05-22 06:38:37 +0800 |
commit | ffcb9b625c4f5e4191cb465df865f841171eec12 (patch) | |
tree | 1699c28e08dfcf07db2df6a39749fd6defbbae87 /calendar/gui/tasks-control.c | |
parent | f825ab30af5fb433efde95cbe3aced99f2059b48 (diff) | |
download | gsoc2013-evolution-ffcb9b625c4f5e4191cb465df865f841171eec12.tar gsoc2013-evolution-ffcb9b625c4f5e4191cb465df865f841171eec12.tar.gz gsoc2013-evolution-ffcb9b625c4f5e4191cb465df865f841171eec12.tar.bz2 gsoc2013-evolution-ffcb9b625c4f5e4191cb465df865f841171eec12.tar.lz gsoc2013-evolution-ffcb9b625c4f5e4191cb465df865f841171eec12.tar.xz gsoc2013-evolution-ffcb9b625c4f5e4191cb465df865f841171eec12.tar.zst gsoc2013-evolution-ffcb9b625c4f5e4191cb465df865f841171eec12.zip |
Fix bug #2831; the tasks toolbar and menu now have a button to delete the
2001-05-21 Federico Mena Quintero <federico@ximian.com>
Fix bug #2831; the tasks toolbar and menu now have a button to
delete the selected tasks.
* gui/e-calendar-table.c (e_calendar_table_delete_selected): New
function.
(delete_cb): Use e_calendar_table_delete_selected().
(e_calendar_table_get_table): New function.
* gui/tasks-control.c (tasks_control_new_task_cmd): Handle the
delete command.
(selection_changed_cb): Change the sensitivity of the TasksDelete
command when the selection in the table changes.
* gui/e-tasks.c (table_selection_change_cb): Notify upstream when
the ETable selection changes.
svn path=/trunk/; revision=9910
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); +} |