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-calendar-table.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-calendar-table.c')
-rw-r--r-- | calendar/gui/e-calendar-table.c | 147 |
1 files changed, 89 insertions, 58 deletions
diff --git a/calendar/gui/e-calendar-table.c b/calendar/gui/e-calendar-table.c index 23104866ca..685a56d9f9 100644 --- a/calendar/gui/e-calendar-table.c +++ b/calendar/gui/e-calendar-table.c @@ -31,7 +31,6 @@ #include <config.h> #include <sys/stat.h> #include <unistd.h> -#include <gal/e-table/e-table-scrolled.h> #include <gal/e-table/e-cell-checkbox.h> #include <gal/e-table/e-cell-toggle.h> #include <gal/e-table/e-cell-text.h> @@ -526,60 +525,22 @@ e_calendar_table_set_cal_client (ECalendarTable *cal_table, CALOBJ_TYPE_TODO); } - -/* Opens a task in the task editor */ -static void -open_task (ECalendarTable *cal_table, CalComponent *comp) -{ - TaskEditor *tedit; - - tedit = task_editor_new (); - task_editor_set_cal_client (tedit, calendar_model_get_cal_client (cal_table->model)); - task_editor_set_todo_object (tedit, comp); - task_editor_focus (tedit); -} - -/* Opens the task in the specified row */ -static void -open_task_by_row (ECalendarTable *cal_table, int row) -{ - CalComponent *comp; - - comp = calendar_model_get_component (cal_table->model, row); - open_task (cal_table, comp); -} - -static void -e_calendar_table_on_double_click (ETable *table, - gint row, - gint col, - GdkEvent *event, - ECalendarTable *cal_table) -{ - open_task_by_row (cal_table, row); -} - -/* Used from e_table_selected_row_foreach() */ -static void -mark_row_complete_cb (int model_row, gpointer data) -{ - ECalendarTable *cal_table; - - cal_table = E_CALENDAR_TABLE (data); - calendar_model_mark_task_complete (cal_table->model, model_row); -} - -/* Callback used for the "mark tasks as complete" menu item */ -static void -mark_as_complete_cb (GtkWidget *menuitem, gpointer data) +/** + * e_calendar_table_get_table: + * @cal_table: A calendar table. + * + * Queries the #ETable widget that the calendar table is using. + * + * Return value: The #ETable widget that the calendar table uses to display its + * data. + **/ +ETable * +e_calendar_table_get_table (ECalendarTable *cal_table) { - ECalendarTable *cal_table; - ETable *etable; - - cal_table = E_CALENDAR_TABLE (data); + g_return_val_if_fail (cal_table != NULL, NULL); + g_return_val_if_fail (E_IS_CALENDAR_TABLE (cal_table), NULL); - etable = e_table_scrolled_get_table (E_TABLE_SCROLLED (cal_table->etable)); - e_table_selected_row_foreach (etable, mark_row_complete_cb, cal_table); + return e_table_scrolled_get_table (E_TABLE_SCROLLED (cal_table->etable)); } /* Used from e_table_selected_row_foreach(); puts the selected row number in an @@ -676,16 +637,21 @@ delete_selected_components (ECalendarTable *cal_table) g_slist_free (uids); } -/* Callback for the "delete tasks" menu item */ -static void -delete_cb (GtkWidget *menuitem, gpointer data) +/** + * e_calendar_table_delete_selected: + * @cal_table: A calendar table. + * + * Deletes the selected components in the table; asks the user first. + **/ +void +e_calendar_table_delete_selected (ECalendarTable *cal_table) { - ECalendarTable *cal_table; ETable *etable; int n_selected; CalComponent *comp; - cal_table = E_CALENDAR_TABLE (data); + g_return_if_fail (cal_table != NULL); + g_return_if_fail (E_IS_CALENDAR_TABLE (cal_table)); etable = e_table_scrolled_get_table (E_TABLE_SCROLLED (cal_table->etable)); @@ -701,6 +667,71 @@ delete_cb (GtkWidget *menuitem, gpointer data) delete_selected_components (cal_table); } +/* Opens a task in the task editor */ +static void +open_task (ECalendarTable *cal_table, CalComponent *comp) +{ + TaskEditor *tedit; + + tedit = task_editor_new (); + task_editor_set_cal_client (tedit, calendar_model_get_cal_client (cal_table->model)); + task_editor_set_todo_object (tedit, comp); + task_editor_focus (tedit); +} + +/* Opens the task in the specified row */ +static void +open_task_by_row (ECalendarTable *cal_table, int row) +{ + CalComponent *comp; + + comp = calendar_model_get_component (cal_table->model, row); + open_task (cal_table, comp); +} + +static void +e_calendar_table_on_double_click (ETable *table, + gint row, + gint col, + GdkEvent *event, + ECalendarTable *cal_table) +{ + open_task_by_row (cal_table, row); +} + +/* Used from e_table_selected_row_foreach() */ +static void +mark_row_complete_cb (int model_row, gpointer data) +{ + ECalendarTable *cal_table; + + cal_table = E_CALENDAR_TABLE (data); + calendar_model_mark_task_complete (cal_table->model, model_row); +} + +/* Callback used for the "mark tasks as complete" menu item */ +static void +mark_as_complete_cb (GtkWidget *menuitem, gpointer data) +{ + ECalendarTable *cal_table; + ETable *etable; + + cal_table = E_CALENDAR_TABLE (data); + + etable = e_table_scrolled_get_table (E_TABLE_SCROLLED (cal_table->etable)); + e_table_selected_row_foreach (etable, mark_row_complete_cb, cal_table); +} + +/* Callback for the "delete tasks" menu item */ +static void +delete_cb (GtkWidget *menuitem, gpointer data) +{ + ECalendarTable *cal_table; + + cal_table = E_CALENDAR_TABLE (data); + e_calendar_table_delete_selected (cal_table); +} + static GnomeUIInfo tasks_popup_one[] = { GNOMEUIINFO_ITEM_NONE (N_("Edit this task"), NULL, e_calendar_table_on_open_task), GNOMEUIINFO_SEPARATOR, |