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/e-tasks.c | |
parent | f825ab30af5fb433efde95cbe3aced99f2059b48 (diff) | |
download | gsoc2013-evolution-ffcb9b625c4f5e4191cb465df865f841171eec12.tar.gz 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/e-tasks.c')
-rw-r--r-- | calendar/gui/e-tasks.c | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/calendar/gui/e-tasks.c b/calendar/gui/e-tasks.c index e69b2a4037..1686ac793a 100644 --- a/calendar/gui/e-tasks.c +++ b/calendar/gui/e-tasks.c @@ -77,8 +77,14 @@ static gint e_tasks_add_menu_item (gpointer key, gpointer value, gpointer data); +/* Signal IDs */ +enum { + SELECTION_CHANGED, + LAST_SIGNAL +}; static GtkTableClass *parent_class; +static guint e_tasks_signals[LAST_SIGNAL] = { 0 }; E_MAKE_TYPE (e_tasks, "ETasks", ETasks, @@ -96,7 +102,20 @@ e_tasks_class_init (ETasksClass *class) parent_class = gtk_type_class (GTK_TYPE_TABLE); + e_tasks_signals[SELECTION_CHANGED] = + gtk_signal_new ("selection_changed", + GTK_RUN_FIRST, + object_class->type, + GTK_SIGNAL_OFFSET (ETasksClass, selection_changed), + gtk_marshal_NONE__INT, + GTK_TYPE_NONE, 1, + GTK_TYPE_INT); + + gtk_object_class_add_signals (object_class, e_tasks_signals, LAST_SIGNAL); + object_class->destroy = e_tasks_destroy; + + class->selection_changed = NULL; } @@ -112,6 +131,19 @@ e_tasks_init (ETasks *tasks) setup_widgets (tasks); } +/* Callback used when the selection changes in the table. */ +static void +table_selection_change_cb (ETable *etable, gpointer data) +{ + ETasks *tasks; + int n_selected; + + tasks = E_TASKS (data); + + n_selected = e_table_selected_count (etable); + gtk_signal_emit (GTK_OBJECT (tasks), e_tasks_signals[SELECTION_CHANGED], + n_selected); +} #define E_TASKS_TABLE_DEFAULT_STATE \ "<?xml version=\"1.0\"?>" \ @@ -170,6 +202,9 @@ setup_widgets (ETasks *tasks) gtk_signal_connect (GTK_OBJECT (E_CALENDAR_TABLE (priv->tasks_view)->model), "categories-changed", GTK_SIGNAL_FUNC (e_tasks_on_categories_changed), tasks); + + gtk_signal_connect (GTK_OBJECT (etable), "selection_change", + GTK_SIGNAL_FUNC (table_selection_change_cb), tasks); } @@ -445,6 +480,27 @@ e_tasks_new_task (ETasks *tasks) task_editor_focus (tedit); } +/** + * e_tasks_delete_selected: + * @tasks: A tasks control widget. + * + * Deletes the selected tasks in the task list. + **/ +void +e_tasks_delete_selected (ETasks *tasks) +{ + ETasksPrivate *priv; + ECalendarTable *cal_table; + + g_return_if_fail (tasks != NULL); + g_return_if_fail (E_IS_TASKS (tasks)); + + priv = tasks->priv; + + cal_table = E_CALENDAR_TABLE (priv->tasks_view); + e_calendar_table_delete_selected (cal_table); +} + static void e_tasks_on_filter_selected (GtkMenuShell *menu_shell, |