aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--addressbook/gui/widgets/e-addressbook-view.c17
-rw-r--r--calendar/gui/e-calendar-view.c339
-rw-r--r--calendar/gui/e-calendar-view.h4
-rw-r--r--calendar/gui/e-memo-table.c155
-rw-r--r--calendar/gui/e-memo-table.h1
-rw-r--r--calendar/gui/e-task-table.c312
-rw-r--r--calendar/gui/e-task-table.h1
-rw-r--r--modules/addressbook/e-book-shell-view-actions.c11
-rw-r--r--modules/addressbook/e-book-shell-view-private.h1
-rw-r--r--modules/calendar/e-cal-shell-content.c133
-rw-r--r--modules/calendar/e-cal-shell-content.h4
-rw-r--r--modules/calendar/e-cal-shell-view-actions.c44
-rw-r--r--modules/calendar/e-cal-shell-view-actions.h4
-rw-r--r--modules/calendar/e-cal-shell-view-memopad.c31
-rw-r--r--modules/calendar/e-cal-shell-view-private.h3
-rw-r--r--modules/calendar/e-cal-shell-view-taskpad.c31
-rw-r--r--modules/calendar/e-memo-shell-view-actions.c22
-rw-r--r--modules/calendar/e-memo-shell-view-private.h3
-rw-r--r--modules/calendar/e-task-shell-view-actions.c22
-rw-r--r--modules/calendar/e-task-shell-view-private.h3
-rw-r--r--ui/evolution-calendars.ui7
-rw-r--r--ui/evolution-contacts.ui15
-rw-r--r--ui/evolution-memos.ui5
-rw-r--r--ui/evolution-tasks.ui5
24 files changed, 487 insertions, 686 deletions
diff --git a/addressbook/gui/widgets/e-addressbook-view.c b/addressbook/gui/widgets/e-addressbook-view.c
index 37d1376340..bcf6ed6277 100644
--- a/addressbook/gui/widgets/e-addressbook-view.c
+++ b/addressbook/gui/widgets/e-addressbook-view.c
@@ -587,6 +587,12 @@ addressbook_view_update_actions (ESelectable *selectable,
gtk_action_set_sensitive (action, sensitive);
gtk_action_set_tooltip (action, tooltip);
+ action = e_focus_tracker_get_delete_selection_action (focus_tracker);
+ sensitive = source_is_editable && (n_selected > 0);
+ tooltip = _("Delete selected contacts");
+ gtk_action_set_sensitive (action, sensitive);
+ gtk_action_set_tooltip (action, tooltip);
+
action = e_focus_tracker_get_select_all_action (focus_tracker);
sensitive = (n_contacts > 0);
tooltip = _("Select all visible contacts");
@@ -660,6 +666,16 @@ addressbook_view_paste_clipboard (ESelectable *selectable)
}
static void
+addressbook_view_delete_selection (ESelectable *selectable)
+{
+ EAddressbookView *view;
+
+ view = E_ADDRESSBOOK_VIEW (selectable);
+
+ e_addressbook_view_delete_selection (view, TRUE);
+}
+
+static void
addressbook_view_select_all (ESelectable *selectable)
{
EAddressbookView *view;
@@ -782,6 +798,7 @@ addressbook_view_selectable_init (ESelectableInterface *interface)
interface->cut_clipboard = addressbook_view_cut_clipboard;
interface->copy_clipboard = addressbook_view_copy_clipboard;
interface->paste_clipboard = addressbook_view_paste_clipboard;
+ interface->delete_selection = addressbook_view_delete_selection;
interface->select_all = addressbook_view_select_all;
}
diff --git a/calendar/gui/e-calendar-view.c b/calendar/gui/e-calendar-view.c
index 2bfa0918c3..57973828a3 100644
--- a/calendar/gui/e-calendar-view.c
+++ b/calendar/gui/e-calendar-view.c
@@ -103,6 +103,138 @@ G_DEFINE_ABSTRACT_TYPE_WITH_CODE (ECalendarView, e_calendar_view, GTK_TYPE_TABLE
G_IMPLEMENT_INTERFACE (E_TYPE_SELECTABLE, calendar_view_selectable_init));
static void
+calendar_view_add_retract_data (ECalComponent *comp,
+ const gchar *retract_comment,
+ CalObjModType mod)
+{
+ icalcomponent *icalcomp = NULL;
+ icalproperty *icalprop = NULL;
+
+ icalcomp = e_cal_component_get_icalcomponent (comp);
+ if (retract_comment && *retract_comment)
+ icalprop = icalproperty_new_x (retract_comment);
+ else
+ icalprop = icalproperty_new_x ("0");
+ icalproperty_set_x_name (icalprop, "X-EVOLUTION-RETRACT-COMMENT");
+ icalcomponent_add_property (icalcomp, icalprop);
+
+ if (mod == CALOBJ_MOD_ALL)
+ icalprop = icalproperty_new_x ("All");
+ else
+ icalprop = icalproperty_new_x ("This");
+ icalproperty_set_x_name (icalprop, "X-EVOLUTION-RECUR-MOD");
+ icalcomponent_add_property (icalcomp, icalprop);
+}
+
+static gboolean
+calendar_view_check_for_retract (ECalComponent *comp,
+ ECal *client)
+{
+ ECalComponentOrganizer organizer;
+ const gchar *strip;
+ gchar *email = NULL;
+ gboolean ret_val;
+
+ if (!e_cal_component_has_attendees (comp))
+ return FALSE;
+
+ if (!e_cal_get_save_schedules (client))
+ return FALSE;
+
+ e_cal_component_get_organizer (comp, &organizer);
+ strip = itip_strip_mailto (organizer.value);
+
+ ret_val =
+ e_cal_get_cal_address (client, &email, NULL) &&
+ (g_ascii_strcasecmp (email, strip) == 0);
+
+ g_free (email);
+
+ return ret_val;
+}
+
+static void
+calendar_view_delete_event (ECalendarView *cal_view,
+ ECalendarViewEvent *event)
+{
+ ECalComponent *comp;
+ ECalComponentVType vtype;
+ gboolean delete = FALSE;
+ GError *error = NULL;
+
+ comp = e_cal_component_new ();
+ e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp));
+ vtype = e_cal_component_get_vtype (comp);
+
+ /*FIXME remove it once the we dont set the recurrence id for all the generated instances */
+ if (!e_cal_get_static_capability (event->comp_data->client, CAL_STATIC_CAPABILITY_RECURRENCES_NO_MASTER))
+ e_cal_component_set_recurid (comp, NULL);
+
+ /*FIXME Retract should be moved to Groupwise features plugin */
+ if (calendar_view_check_for_retract (comp, event->comp_data->client)) {
+ gchar *retract_comment = NULL;
+ gboolean retract = FALSE;
+
+ delete = prompt_retract_dialog (comp, &retract_comment, GTK_WIDGET (cal_view), &retract);
+ if (retract) {
+ GList *users = NULL;
+ icalcomponent *icalcomp = NULL, *mod_comp = NULL;
+
+ calendar_view_add_retract_data (
+ comp, retract_comment, CALOBJ_MOD_ALL);
+ icalcomp = e_cal_component_get_icalcomponent (comp);
+ icalcomponent_set_method (icalcomp, ICAL_METHOD_CANCEL);
+ if (!e_cal_send_objects (event->comp_data->client, icalcomp, &users,
+ &mod_comp, &error)) {
+ delete_error_dialog (error, E_CAL_COMPONENT_EVENT);
+ g_clear_error (&error);
+ error = NULL;
+ } else {
+
+ if (mod_comp)
+ icalcomponent_free (mod_comp);
+
+ if (users) {
+ g_list_foreach (users, (GFunc) g_free, NULL);
+ g_list_free (users);
+ }
+ }
+ }
+ } else
+ delete = delete_component_dialog (comp, FALSE, 1, vtype, GTK_WIDGET (cal_view));
+
+ if (delete) {
+ const gchar *uid;
+ gchar *rid = NULL;
+
+ if ((itip_organizer_is_user (comp, event->comp_data->client) || itip_sentby_is_user (comp, event->comp_data->client))
+ && cancel_component_dialog ((GtkWindow *) gtk_widget_get_toplevel (GTK_WIDGET (cal_view)),
+ event->comp_data->client,
+ comp, TRUE))
+ itip_send_comp (E_CAL_COMPONENT_METHOD_CANCEL, comp,
+ event->comp_data->client, NULL, NULL, NULL, TRUE, FALSE);
+
+ e_cal_component_get_uid (comp, &uid);
+ if (!uid || !*uid) {
+ g_object_unref (comp);
+ return;
+ }
+ rid = e_cal_component_get_recurid_as_string (comp);
+ if (e_cal_util_component_is_instance (event->comp_data->icalcomp) || e_cal_util_component_has_recurrences (event->comp_data->icalcomp))
+ e_cal_remove_object_with_mod (event->comp_data->client, uid,
+ rid, CALOBJ_MOD_ALL, &error);
+ else
+ e_cal_remove_object (event->comp_data->client, uid, &error);
+
+ delete_error_dialog (error, E_CAL_COMPONENT_EVENT);
+ g_clear_error (&error);
+ g_free (rid);
+ }
+
+ g_object_unref (comp);
+}
+
+static void
calendar_view_set_model (ECalendarView *calendar_view,
ECalModel *model)
{
@@ -189,6 +321,7 @@ calendar_view_update_actions (ESelectable *selectable,
GList *list, *iter;
gboolean sources_are_editable = TRUE;
gboolean clipboard_has_calendar;
+ gboolean recurring = FALSE;
gboolean sensitive;
const gchar *tooltip;
gint n_selected;
@@ -200,13 +333,22 @@ calendar_view_update_actions (ESelectable *selectable,
for (iter = list; iter != NULL; iter = iter->next) {
ECalendarViewEvent *event = iter->data;
+ ECal *client;
+ icalcomponent *icalcomp;
gboolean read_only;
if (event == NULL || event->comp_data == NULL)
continue;
- e_cal_is_read_only (event->comp_data->client, &read_only, NULL);
+ client = event->comp_data->client;
+ icalcomp = event->comp_data->icalcomp;
+
+ e_cal_is_read_only (client, &read_only, NULL);
sources_are_editable &= !read_only;
+
+ recurring |=
+ e_cal_util_component_is_instance (icalcomp) ||
+ e_cal_util_component_has_recurrences (icalcomp);
}
g_list_free (list);
@@ -232,6 +374,12 @@ calendar_view_update_actions (ESelectable *selectable,
tooltip = _("Paste events from the clipboard");
gtk_action_set_sensitive (action, sensitive);
gtk_action_set_tooltip (action, tooltip);
+
+ action = e_focus_tracker_get_delete_selection_action (focus_tracker);
+ sensitive = (n_selected > 0) && sources_are_editable && !recurring;
+ tooltip = _("Delete selected events");
+ gtk_action_set_sensitive (action, sensitive);
+ gtk_action_set_tooltip (action, tooltip);
}
static void
@@ -520,6 +668,29 @@ calendar_view_paste_clipboard (ESelectable *selectable)
}
static void
+calendar_view_delete_selection (ESelectable *selectable)
+{
+ ECalendarView *cal_view;
+ GList *selected, *iter;
+
+ cal_view = E_CALENDAR_VIEW (selectable);
+
+ selected = e_calendar_view_get_selected_events (cal_view);
+
+ for (iter = selected; iter != NULL; iter = iter->next) {
+ ECalendarViewEvent *event = iter->data;
+
+ /* XXX Why would this ever be NULL? */
+ if (event == NULL)
+ continue;
+
+ calendar_view_delete_event (cal_view, event);
+ }
+
+ g_list_free (selected);
+}
+
+static void
e_calendar_view_class_init (ECalendarViewClass *class)
{
GObjectClass *object_class;
@@ -659,6 +830,7 @@ calendar_view_selectable_init (ESelectableInterface *interface)
interface->cut_clipboard = calendar_view_cut_clipboard;
interface->copy_clipboard = calendar_view_copy_clipboard;
interface->paste_clipboard = calendar_view_paste_clipboard;
+ interface->delete_selection = calendar_view_delete_selection;
}
void
@@ -938,166 +1110,6 @@ e_calendar_view_update_query (ECalendarView *cal_view)
class->update_query (cal_view);
}
-static void
-add_retract_data (ECalComponent *comp, const gchar *retract_comment, CalObjModType mod)
-{
- icalcomponent *icalcomp = NULL;
- icalproperty *icalprop = NULL;
-
- icalcomp = e_cal_component_get_icalcomponent (comp);
- if (retract_comment && *retract_comment)
- icalprop = icalproperty_new_x (retract_comment);
- else
- icalprop = icalproperty_new_x ("0");
- icalproperty_set_x_name (icalprop, "X-EVOLUTION-RETRACT-COMMENT");
- icalcomponent_add_property (icalcomp, icalprop);
-
- if (mod == CALOBJ_MOD_ALL)
- icalprop = icalproperty_new_x ("All");
- else
- icalprop = icalproperty_new_x ("This");
- icalproperty_set_x_name (icalprop, "X-EVOLUTION-RECUR-MOD");
- icalcomponent_add_property (icalcomp, icalprop);
-}
-
-static gboolean
-check_for_retract (ECalComponent *comp, ECal *client)
-{
- ECalComponentOrganizer org;
- gchar *email = NULL;
- const gchar *strip = NULL;
- gboolean ret_val = FALSE;
-
- if (!(e_cal_component_has_attendees (comp) &&
- e_cal_get_save_schedules (client)))
- return ret_val;
-
- e_cal_component_get_organizer (comp, &org);
- strip = itip_strip_mailto (org.value);
-
- if (e_cal_get_cal_address (client, &email, NULL) && !g_ascii_strcasecmp (email, strip)) {
- ret_val = TRUE;
- }
-
- g_free (email);
- return ret_val;
-}
-
-static void
-delete_event (ECalendarView *cal_view, ECalendarViewEvent *event)
-{
- ECalComponent *comp;
- ECalComponentVType vtype;
- gboolean delete = FALSE;
- GError *error = NULL;
-
- comp = e_cal_component_new ();
- e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp));
- vtype = e_cal_component_get_vtype (comp);
-
- /*FIXME remove it once the we dont set the recurrence id for all the generated instances */
- if (!e_cal_get_static_capability (event->comp_data->client, CAL_STATIC_CAPABILITY_RECURRENCES_NO_MASTER))
- e_cal_component_set_recurid (comp, NULL);
-
- /*FIXME Retract should be moved to Groupwise features plugin */
- if (check_for_retract (comp, event->comp_data->client)) {
- gchar *retract_comment = NULL;
- gboolean retract = FALSE;
-
- delete = prompt_retract_dialog (comp, &retract_comment, GTK_WIDGET (cal_view), &retract);
- if (retract) {
- GList *users = NULL;
- icalcomponent *icalcomp = NULL, *mod_comp = NULL;
-
- add_retract_data (comp, retract_comment, CALOBJ_MOD_ALL);
- icalcomp = e_cal_component_get_icalcomponent (comp);
- icalcomponent_set_method (icalcomp, ICAL_METHOD_CANCEL);
- if (!e_cal_send_objects (event->comp_data->client, icalcomp, &users,
- &mod_comp, &error)) {
- delete_error_dialog (error, E_CAL_COMPONENT_EVENT);
- g_clear_error (&error);
- error = NULL;
- } else {
-
- if (mod_comp)
- icalcomponent_free (mod_comp);
-
- if (users) {
- g_list_foreach (users, (GFunc) g_free, NULL);
- g_list_free (users);
- }
- }
- }
- } else
- delete = delete_component_dialog (comp, FALSE, 1, vtype, GTK_WIDGET (cal_view));
-
- if (delete) {
- const gchar *uid;
- gchar *rid = NULL;
-
- if ((itip_organizer_is_user (comp, event->comp_data->client) || itip_sentby_is_user (comp, event->comp_data->client))
- && cancel_component_dialog ((GtkWindow *) gtk_widget_get_toplevel (GTK_WIDGET (cal_view)),
- event->comp_data->client,
- comp, TRUE))
- itip_send_comp (E_CAL_COMPONENT_METHOD_CANCEL, comp,
- event->comp_data->client, NULL, NULL, NULL, TRUE, FALSE);
-
- e_cal_component_get_uid (comp, &uid);
- if (!uid || !*uid) {
- g_object_unref (comp);
- return;
- }
- rid = e_cal_component_get_recurid_as_string (comp);
- if (e_cal_util_component_is_instance (event->comp_data->icalcomp) || e_cal_util_component_has_recurrences (event->comp_data->icalcomp))
- e_cal_remove_object_with_mod (event->comp_data->client, uid,
- rid, CALOBJ_MOD_ALL, &error);
- else
- e_cal_remove_object (event->comp_data->client, uid, &error);
-
- delete_error_dialog (error, E_CAL_COMPONENT_EVENT);
- g_clear_error (&error);
- g_free (rid);
- }
-
- g_object_unref (comp);
-}
-
-void
-e_calendar_view_delete_selected_event (ECalendarView *cal_view)
-{
- GList *selected;
- ECalendarViewEvent *event;
-
- selected = e_calendar_view_get_selected_events (cal_view);
- if (!selected)
- return;
-
- event = (ECalendarViewEvent *) selected->data;
- if (event)
- delete_event (cal_view, event);
-
- g_list_free (selected);
-}
-
-void
-e_calendar_view_delete_selected_events (ECalendarView *cal_view)
-{
- GList *selected, *l;
- ECalendarViewEvent *event;
-
- selected = e_calendar_view_get_selected_events (cal_view);
- if (!selected)
- return;
-
- for (l = selected; l != NULL; l = l->next) {
- event = (ECalendarViewEvent *) l->data;
- if (event)
- delete_event (cal_view, event);
- }
-
- g_list_free (selected);
-}
-
void
e_calendar_view_delete_selected_occurrence (ECalendarView *cal_view)
{
@@ -1117,7 +1129,7 @@ e_calendar_view_delete_selected_occurrence (ECalendarView *cal_view)
vtype = e_cal_component_get_vtype (comp);
/*FIXME Retract should be moved to Groupwise features plugin */
- if (check_for_retract (comp, event->comp_data->client)) {
+ if (calendar_view_check_for_retract (comp, event->comp_data->client)) {
gchar *retract_comment = NULL;
gboolean retract = FALSE;
@@ -1126,7 +1138,8 @@ e_calendar_view_delete_selected_occurrence (ECalendarView *cal_view)
GList *users = NULL;
icalcomponent *icalcomp = NULL, *mod_comp = NULL;
- add_retract_data (comp, retract_comment, CALOBJ_MOD_THIS);
+ calendar_view_add_retract_data (
+ comp, retract_comment, CALOBJ_MOD_THIS);
icalcomp = e_cal_component_get_icalcomponent (comp);
icalcomponent_set_method (icalcomp, ICAL_METHOD_CANCEL);
if (!e_cal_send_objects (event->comp_data->client, icalcomp, &users,
diff --git a/calendar/gui/e-calendar-view.h b/calendar/gui/e-calendar-view.h
index 3ad9565de3..d79a6fdc9d 100644
--- a/calendar/gui/e-calendar-view.h
+++ b/calendar/gui/e-calendar-view.h
@@ -176,10 +176,6 @@ gboolean e_calendar_view_get_visible_time_range
time_t *end_time);
void e_calendar_view_update_query (ECalendarView *cal_view);
-void e_calendar_view_delete_selected_event
- (ECalendarView *cal_view);
-void e_calendar_view_delete_selected_events
- (ECalendarView *cal_view);
void e_calendar_view_delete_selected_occurrence
(ECalendarView *cal_view);
CompEditor * e_calendar_view_open_event_with_flags
diff --git a/calendar/gui/e-memo-table.c b/calendar/gui/e-memo-table.c
index 62c0b99e6e..5f2cd26baf 100644
--- a/calendar/gui/e-memo-table.c
+++ b/calendar/gui/e-memo-table.c
@@ -731,6 +731,12 @@ memo_table_update_actions (ESelectable *selectable,
gtk_action_set_sensitive (action, sensitive);
gtk_action_set_tooltip (action, tooltip);
+ action = e_focus_tracker_get_delete_selection_action (focus_tracker);
+ sensitive = (n_selected > 0) && sources_are_editable;
+ tooltip = _("Delete selected memos");
+ gtk_action_set_sensitive (action, sensitive);
+ gtk_action_set_tooltip (action, tooltip);
+
action = e_focus_tracker_get_select_all_action (focus_tracker);
sensitive = TRUE;
tooltip = _("Select all visible memos");
@@ -939,6 +945,77 @@ memo_table_paste_clipboard (ESelectable *selectable)
}
}
+/* Used from e_table_selected_row_foreach(); puts the selected row number in an
+ * gint pointed to by the closure data.
+ */
+static void
+get_selected_row_cb (gint model_row, gpointer data)
+{
+ gint *row;
+
+ row = data;
+ *row = model_row;
+}
+
+/*
+ * Returns the component that is selected in the table; only works if there is
+ * one and only one selected row.
+ */
+static ECalModelComponent *
+get_selected_comp (EMemoTable *memo_table)
+{
+ ECalModel *model;
+ gint row;
+
+ model = e_memo_table_get_model (memo_table);
+ if (e_table_selected_count (E_TABLE (memo_table)) != 1)
+ return NULL;
+
+ row = -1;
+ e_table_selected_row_foreach (
+ E_TABLE (memo_table), get_selected_row_cb, &row);
+ g_return_val_if_fail (row != -1, NULL);
+
+ return e_cal_model_get_component_at (model, row);
+}
+
+static void
+memo_table_delete_selection (ESelectable *selectable)
+{
+ EMemoTable *memo_table;
+ ECalComponent *comp = NULL;
+ ECalModelComponent *comp_data;
+ gint n_selected;
+
+ memo_table = E_MEMO_TABLE (selectable);
+
+ n_selected = e_table_selected_count (E_TABLE (memo_table));
+ if (n_selected <= 0)
+ return;
+
+ if (n_selected == 1)
+ comp_data = get_selected_comp (memo_table);
+ else
+ comp_data = NULL;
+
+ /* FIXME: this may be something other than a TODO component */
+
+ if (comp_data) {
+ comp = e_cal_component_new ();
+ e_cal_component_set_icalcomponent (
+ comp, icalcomponent_new_clone (comp_data->icalcomp));
+ }
+
+ if (delete_component_dialog (
+ comp, FALSE, n_selected, E_CAL_COMPONENT_JOURNAL,
+ GTK_WIDGET (memo_table)))
+ delete_selected_components (memo_table);
+
+ /* free memory */
+ if (comp)
+ g_object_unref (comp);
+}
+
static void
memo_table_select_all (ESelectable *selectable)
{
@@ -1044,6 +1121,7 @@ memo_table_selectable_init (ESelectableInterface *interface)
interface->cut_clipboard = memo_table_cut_clipboard;
interface->copy_clipboard = memo_table_copy_clipboard;
interface->paste_clipboard = memo_table_paste_clipboard;
+ interface->delete_selection = memo_table_delete_selection;
interface->select_all = memo_table_select_all;
}
@@ -1128,40 +1206,6 @@ e_memo_table_get_shell_view (EMemoTable *memo_table)
return memo_table->priv->shell_view;
}
-/* Used from e_table_selected_row_foreach(); puts the selected row number in an
- * gint pointed to by the closure data.
- */
-static void
-get_selected_row_cb (gint model_row, gpointer data)
-{
- gint *row;
-
- row = data;
- *row = model_row;
-}
-
-/*
- * Returns the component that is selected in the table; only works if there is
- * one and only one selected row.
- */
-static ECalModelComponent *
-get_selected_comp (EMemoTable *memo_table)
-{
- ECalModel *model;
- gint row;
-
- model = e_memo_table_get_model (memo_table);
- if (e_table_selected_count (E_TABLE (memo_table)) != 1)
- return NULL;
-
- row = -1;
- e_table_selected_row_foreach (
- E_TABLE (memo_table), get_selected_row_cb, &row);
- g_return_val_if_fail (row != -1, NULL);
-
- return e_cal_model_get_component_at (model, row);
-}
-
struct get_selected_uids_closure {
EMemoTable *memo_table;
GSList *objects;
@@ -1184,49 +1228,6 @@ add_uid_cb (gint model_row, gpointer data)
}
/**
- * e_memo_table_delete_selected:
- * @memo_table: A memo table.
- *
- * Deletes the selected components in the table; asks the user first.
- **/
-void
-e_memo_table_delete_selected (EMemoTable *memo_table)
-{
- gint n_selected;
- ECalModelComponent *comp_data;
- ECalComponent *comp = NULL;
-
- g_return_if_fail (memo_table != NULL);
- g_return_if_fail (E_IS_MEMO_TABLE (memo_table));
-
- n_selected = e_table_selected_count (E_TABLE (memo_table));
- if (n_selected <= 0)
- return;
-
- if (n_selected == 1)
- comp_data = get_selected_comp (memo_table);
- else
- comp_data = NULL;
-
- /* FIXME: this may be something other than a TODO component */
-
- if (comp_data) {
- comp = e_cal_component_new ();
- e_cal_component_set_icalcomponent (
- comp, icalcomponent_new_clone (comp_data->icalcomp));
- }
-
- if (delete_component_dialog (
- comp, FALSE, n_selected, E_CAL_COMPONENT_JOURNAL,
- GTK_WIDGET (memo_table)))
- delete_selected_components (memo_table);
-
- /* free memory */
- if (comp)
- g_object_unref (comp);
-}
-
-/**
* e_memo_table_get_selected:
* @memo_table:
*
diff --git a/calendar/gui/e-memo-table.h b/calendar/gui/e-memo-table.h
index a5707ec22f..c891117203 100644
--- a/calendar/gui/e-memo-table.h
+++ b/calendar/gui/e-memo-table.h
@@ -102,7 +102,6 @@ gboolean e_memo_table_get_use_24_hour_format
void e_memo_table_set_use_24_hour_format
(EMemoTable *memo_table,
gboolean use_24_hour_format);
-void e_memo_table_delete_selected (EMemoTable *memo_table);
GSList * e_memo_table_get_selected (EMemoTable *memo_table);
G_END_DECLS
diff --git a/calendar/gui/e-task-table.c b/calendar/gui/e-task-table.c
index 5136a56b2d..9f0962dcb8 100644
--- a/calendar/gui/e-task-table.c
+++ b/calendar/gui/e-task-table.c
@@ -271,6 +271,7 @@ delete_selected_components (ETaskTable *task_table)
g_slist_free (objs);
}
+
static void
task_table_set_model (ETaskTable *task_table,
ECalModel *model)
@@ -911,6 +912,12 @@ task_table_update_actions (ESelectable *selectable,
gtk_action_set_sensitive (action, sensitive);
gtk_action_set_tooltip (action, tooltip);
+ action = e_focus_tracker_get_delete_selection_action (focus_tracker);
+ sensitive = (n_selected > 0) && sources_are_editable;
+ tooltip = _("Delete selected tasks");
+ gtk_action_set_sensitive (action, sensitive);
+ gtk_action_set_tooltip (action, tooltip);
+
action = e_focus_tracker_get_select_all_action (focus_tracker);
sensitive = TRUE;
tooltip = _("Select all visible tasks");
@@ -1119,6 +1126,155 @@ task_table_paste_clipboard (ESelectable *selectable)
}
}
+/* Used from e_table_selected_row_foreach(); puts the selected row number in an
+ * gint pointed to by the closure data.
+ */
+static void
+get_selected_row_cb (gint model_row, gpointer data)
+{
+ gint *row;
+
+ row = data;
+ *row = model_row;
+}
+
+/*
+ * Returns the component that is selected in the table; only works if there is
+ * one and only one selected row.
+ */
+static ECalModelComponent *
+get_selected_comp (ETaskTable *task_table)
+{
+ ECalModel *model;
+ gint row;
+
+ model = e_task_table_get_model (task_table);
+ if (e_table_selected_count (E_TABLE (task_table)) != 1)
+ return NULL;
+
+ row = -1;
+ e_table_selected_row_foreach (
+ E_TABLE (task_table), get_selected_row_cb, &row);
+ g_return_val_if_fail (row != -1, NULL);
+
+ return e_cal_model_get_component_at (model, row);
+}
+
+static void
+add_retract_data (ECalComponent *comp, const gchar *retract_comment)
+{
+ icalcomponent *icalcomp = NULL;
+ icalproperty *icalprop = NULL;
+
+ icalcomp = e_cal_component_get_icalcomponent (comp);
+ if (retract_comment && *retract_comment)
+ icalprop = icalproperty_new_x (retract_comment);
+ else
+ icalprop = icalproperty_new_x ("0");
+ icalproperty_set_x_name (icalprop, "X-EVOLUTION-RETRACT-COMMENT");
+ icalcomponent_add_property (icalcomp, icalprop);
+}
+
+static gboolean
+check_for_retract (ECalComponent *comp, ECal *client)
+{
+ ECalComponentOrganizer org;
+ gchar *email = NULL;
+ const gchar *strip = NULL;
+ gboolean ret_val;
+
+ if (!e_cal_component_has_attendees (comp))
+ return FALSE;
+
+ if (!e_cal_get_save_schedules (client))
+ return FALSE;
+
+ e_cal_component_get_organizer (comp, &org);
+ strip = itip_strip_mailto (org.value);
+
+ ret_val =
+ e_cal_get_cal_address (client, &email, NULL) &&
+ g_ascii_strcasecmp (email, strip) == 0;
+
+ g_free (email);
+
+ return ret_val;
+}
+
+static void
+task_table_delete_selection (ESelectable *selectable)
+{
+ ETaskTable *task_table;
+ ECalModelComponent *comp_data;
+ ECalComponent *comp = NULL;
+ gboolean delete = FALSE;
+ gint n_selected;
+ GError *error = NULL;
+
+ task_table = E_TASK_TABLE (selectable);
+
+ n_selected = e_table_selected_count (E_TABLE (task_table));
+ if (n_selected <= 0)
+ return;
+
+ if (n_selected == 1)
+ comp_data = get_selected_comp (task_table);
+ else
+ comp_data = NULL;
+
+ /* FIXME: this may be something other than a TODO component */
+
+ if (comp_data) {
+ comp = e_cal_component_new ();
+ e_cal_component_set_icalcomponent (
+ comp, icalcomponent_new_clone (comp_data->icalcomp));
+ }
+
+ if ((n_selected == 1) && comp && check_for_retract (comp, comp_data->client)) {
+ gchar *retract_comment = NULL;
+ gboolean retract = FALSE;
+
+ delete = prompt_retract_dialog (
+ comp, &retract_comment,
+ GTK_WIDGET (task_table), &retract);
+ if (retract) {
+ GList *users = NULL;
+ icalcomponent *icalcomp = NULL, *mod_comp = NULL;
+
+ add_retract_data (comp, retract_comment);
+ icalcomp = e_cal_component_get_icalcomponent (comp);
+ icalcomponent_set_method (icalcomp, ICAL_METHOD_CANCEL);
+ if (!e_cal_send_objects (comp_data->client, icalcomp, &users,
+ &mod_comp, &error)) {
+ delete_error_dialog (error, E_CAL_COMPONENT_TODO);
+ g_clear_error (&error);
+ error = NULL;
+ } else {
+
+ if (mod_comp)
+ icalcomponent_free (mod_comp);
+
+ if (users) {
+ g_list_foreach (users, (GFunc) g_free, NULL);
+ g_list_free (users);
+ }
+ }
+
+ }
+ } else {
+ delete = delete_component_dialog (
+ comp, FALSE, n_selected,
+ E_CAL_COMPONENT_TODO, GTK_WIDGET (task_table));
+ }
+
+ if (delete)
+ delete_selected_components (task_table);
+
+ /* free memory */
+ if (comp)
+ g_object_unref (comp);
+}
+
static void
task_table_select_all (ESelectable *selectable)
{
@@ -1224,6 +1380,7 @@ task_table_selectable_init (ESelectableInterface *interface)
interface->cut_clipboard = task_table_cut_clipboard;
interface->copy_clipboard = task_table_copy_clipboard;
interface->paste_clipboard = task_table_paste_clipboard;
+ interface->delete_selection = task_table_delete_selection;
interface->select_all = task_table_select_all;
}
@@ -1307,40 +1464,6 @@ e_task_table_get_shell_view (ETaskTable *task_table)
return task_table->priv->shell_view;
}
-/* Used from e_table_selected_row_foreach(); puts the selected row number in an
- * gint pointed to by the closure data.
- */
-static void
-get_selected_row_cb (gint model_row, gpointer data)
-{
- gint *row;
-
- row = data;
- *row = model_row;
-}
-
-/*
- * Returns the component that is selected in the table; only works if there is
- * one and only one selected row.
- */
-static ECalModelComponent *
-get_selected_comp (ETaskTable *task_table)
-{
- ECalModel *model;
- gint row;
-
- model = e_task_table_get_model (task_table);
- if (e_table_selected_count (E_TABLE (task_table)) != 1)
- return NULL;
-
- row = -1;
- e_table_selected_row_foreach (
- E_TABLE (task_table), get_selected_row_cb, &row);
- g_return_val_if_fail (row != -1, NULL);
-
- return e_cal_model_get_component_at (model, row);
-}
-
struct get_selected_uids_closure {
ETaskTable *task_table;
GSList *objects;
@@ -1360,127 +1483,6 @@ add_uid_cb (gint model_row, gpointer data)
closure->objects = g_slist_prepend (closure->objects, comp_data);
}
-static void
-add_retract_data (ECalComponent *comp, const gchar *retract_comment)
-{
- icalcomponent *icalcomp = NULL;
- icalproperty *icalprop = NULL;
-
- icalcomp = e_cal_component_get_icalcomponent (comp);
- if (retract_comment && *retract_comment)
- icalprop = icalproperty_new_x (retract_comment);
- else
- icalprop = icalproperty_new_x ("0");
- icalproperty_set_x_name (icalprop, "X-EVOLUTION-RETRACT-COMMENT");
- icalcomponent_add_property (icalcomp, icalprop);
-}
-
-static gboolean
-check_for_retract (ECalComponent *comp, ECal *client)
-{
- ECalComponentOrganizer org;
- gchar *email = NULL;
- const gchar *strip = NULL;
- gboolean ret_val;
-
- if (!e_cal_component_has_attendees (comp))
- return FALSE;
-
- if (!e_cal_get_save_schedules (client))
- return FALSE;
-
- e_cal_component_get_organizer (comp, &org);
- strip = itip_strip_mailto (org.value);
-
- ret_val =
- e_cal_get_cal_address (client, &email, NULL) &&
- g_ascii_strcasecmp (email, strip) == 0;
-
- g_free (email);
-
- return ret_val;
-}
-
-/**
- * e_task_table_delete_selected:
- * @task_table: A calendar table.
- *
- * Deletes the selected components in the table; asks the user first.
- **/
-void
-e_task_table_delete_selected (ETaskTable *task_table)
-{
- gint n_selected;
- ECalModelComponent *comp_data;
- ECalComponent *comp = NULL;
- gboolean delete = FALSE;
- GError *error = NULL;
-
- g_return_if_fail (task_table != NULL);
- g_return_if_fail (E_IS_CALENDAR_TABLE (task_table));
-
- n_selected = e_table_selected_count (E_TABLE (task_table));
- if (n_selected <= 0)
- return;
-
- if (n_selected == 1)
- comp_data = get_selected_comp (task_table);
- else
- comp_data = NULL;
-
- /* FIXME: this may be something other than a TODO component */
-
- if (comp_data) {
- comp = e_cal_component_new ();
- e_cal_component_set_icalcomponent (
- comp, icalcomponent_new_clone (comp_data->icalcomp));
- }
-
- if ((n_selected == 1) && comp && check_for_retract (comp, comp_data->client)) {
- gchar *retract_comment = NULL;
- gboolean retract = FALSE;
-
- delete = prompt_retract_dialog (
- comp, &retract_comment,
- GTK_WIDGET (task_table), &retract);
- if (retract) {
- GList *users = NULL;
- icalcomponent *icalcomp = NULL, *mod_comp = NULL;
-
- add_retract_data (comp, retract_comment);
- icalcomp = e_cal_component_get_icalcomponent (comp);
- icalcomponent_set_method (icalcomp, ICAL_METHOD_CANCEL);
- if (!e_cal_send_objects (comp_data->client, icalcomp, &users,
- &mod_comp, &error)) {
- delete_error_dialog (error, E_CAL_COMPONENT_TODO);
- g_clear_error (&error);
- error = NULL;
- } else {
-
- if (mod_comp)
- icalcomponent_free (mod_comp);
-
- if (users) {
- g_list_foreach (users, (GFunc) g_free, NULL);
- g_list_free (users);
- }
- }
-
- }
- } else {
- delete = delete_component_dialog (
- comp, FALSE, n_selected,
- E_CAL_COMPONENT_TODO, GTK_WIDGET (task_table));
- }
-
- if (delete)
- delete_selected_components (task_table);
-
- /* free memory */
- if (comp)
- g_object_unref (comp);
-}
-
/**
* e_task_table_get_selected:
* @task_table:
diff --git a/calendar/gui/e-task-table.h b/calendar/gui/e-task-table.h
index 8564d9901b..b23f128b87 100644
--- a/calendar/gui/e-task-table.h
+++ b/calendar/gui/e-task-table.h
@@ -92,7 +92,6 @@ GtkWidget * e_task_table_new (EShellView *shell_view,
ECalModel *model);
ECalModel * e_task_table_get_model (ETaskTable *task_table);
EShellView * e_task_table_get_shell_view (ETaskTable *task_table);
-void e_task_table_delete_selected (ETaskTable *task_table);
GSList * e_task_table_get_selected (ETaskTable *task_table);
ECalModelComponent *
e_task_table_get_selected_comp
diff --git a/modules/addressbook/e-book-shell-view-actions.c b/modules/addressbook/e-book-shell-view-actions.c
index 61434d4e52..e791f8e08d 100644
--- a/modules/addressbook/e-book-shell-view-actions.c
+++ b/modules/addressbook/e-book-shell-view-actions.c
@@ -337,7 +337,7 @@ action_contact_delete_cb (GtkAction *action,
view = e_book_shell_content_get_current_view (book_shell_content);
g_return_if_fail (view != NULL);
- e_addressbook_view_delete_selection (view, TRUE);
+ e_selectable_delete_selection (E_SELECTABLE (view));
}
static void
@@ -661,7 +661,7 @@ static GtkActionEntry contact_entries[] = {
{ "address-book-delete",
GTK_STOCK_DELETE,
- N_("Del_ete Address Book"),
+ N_("D_elete Address Book"),
NULL,
N_("Delete the selected address book"),
G_CALLBACK (action_address_book_delete_cb) },
@@ -803,10 +803,6 @@ static EPopupActionEntry contact_popup_entries[] = {
NULL,
"contact-copy" },
- { "contact-popup-delete",
- NULL,
- "contact-delete" },
-
{ "contact-popup-forward",
NULL,
"contact-forward" },
@@ -1042,9 +1038,6 @@ e_book_shell_view_actions_init (EBookShellView *book_shell_view)
/* Fine tuning. */
- action = ACTION (CONTACT_DELETE);
- g_object_set (action, "short-label", _("Delete"), NULL);
-
g_signal_connect (
ACTION (GAL_SAVE_CUSTOM_VIEW), "activate",
G_CALLBACK (action_gal_save_custom_view_cb), book_shell_view);
diff --git a/modules/addressbook/e-book-shell-view-private.h b/modules/addressbook/e-book-shell-view-private.h
index c0fb2f09df..97fe64e5c5 100644
--- a/modules/addressbook/e-book-shell-view-private.h
+++ b/modules/addressbook/e-book-shell-view-private.h
@@ -41,6 +41,7 @@
#include "shell/e-shell-sidebar.h"
#include "shell/e-shell-utils.h"
#include "misc/e-popup-action.h"
+#include "misc/e-selectable.h"
#include "addressbook/util/eab-book-util.h"
#include "addressbook/gui/contact-editor/e-contact-editor.h"
diff --git a/modules/calendar/e-cal-shell-content.c b/modules/calendar/e-cal-shell-content.c
index 1ab680eec4..5213480cee 100644
--- a/modules/calendar/e-cal-shell-content.c
+++ b/modules/calendar/e-cal-shell-content.c
@@ -28,6 +28,7 @@
#include "e-util/gconf-bridge.h"
#include "widgets/menus/gal-view-etable.h"
#include "widgets/misc/e-paned.h"
+#include "widgets/misc/e-selectable.h"
#include "calendar/gui/calendar-config.h"
#include "calendar/gui/calendar-view.h"
@@ -139,81 +140,6 @@ cal_shell_content_notify_view_id_cb (ECalShellContent *cal_shell_content)
cal_shell_content->priv->paned_binding_id = binding_id;
}
-static FocusLocation
-cal_shell_content_get_focus_location (ECalShellContent *cal_shell_content)
-{
- GnomeCalendar *calendar;
- GnomeCalendarViewType view_type;
- ECalendarView *calendar_view;
- EMemoTable *memo_table;
- ETaskTable *task_table;
- ETable *table;
-
- /* XXX This function is silly. Certainly there are better ways
- * of directing user input to the focused area than polling
- * a bunch of widgets to see what's focused. */
-
- calendar = GNOME_CALENDAR (cal_shell_content->priv->calendar);
- view_type = gnome_calendar_get_view (calendar);
- calendar_view = gnome_calendar_get_calendar_view (calendar, view_type);
-
- memo_table = E_MEMO_TABLE (cal_shell_content->priv->memo_table);
- task_table = E_TASK_TABLE (cal_shell_content->priv->task_table);
-
- table = E_TABLE (memo_table);
- if (gtk_widget_is_focus (GTK_WIDGET (table->table_canvas)))
- return FOCUS_MEMO_TABLE;
-
- table = E_TABLE (task_table);
- if (gtk_widget_is_focus (GTK_WIDGET (table->table_canvas)))
- return FOCUS_TASK_TABLE;
-
- if (E_IS_DAY_VIEW (calendar_view)) {
- EDayView *day_view = E_DAY_VIEW (calendar_view);
-
- if (gtk_widget_is_focus (day_view->top_canvas))
- return FOCUS_CALENDAR;
-
- if (GNOME_CANVAS (day_view->top_canvas)->focused_item != NULL)
- return FOCUS_CALENDAR;
-
- if (gtk_widget_is_focus (day_view->main_canvas))
- return FOCUS_CALENDAR;
-
- if (GNOME_CANVAS (day_view->main_canvas)->focused_item != NULL)
- return FOCUS_CALENDAR;
-
- if (gtk_widget_is_focus (GTK_WIDGET (day_view)))
- return FOCUS_CALENDAR;
-
- } else if (E_IS_WEEK_VIEW (calendar_view)) {
- EWeekView *week_view = E_WEEK_VIEW (calendar_view);
-
- if (gtk_widget_is_focus (week_view->main_canvas))
- return FOCUS_CALENDAR;
-
- if (GNOME_CANVAS (week_view->main_canvas)->focused_item != NULL)
- return FOCUS_CALENDAR;
-
- if (gtk_widget_is_focus (GTK_WIDGET (week_view)))
- return FOCUS_CALENDAR;
-
- } else if (E_IS_CAL_LIST_VIEW (calendar_view)) {
- ECalListView *list_view = E_CAL_LIST_VIEW (calendar_view);
-
- if (gtk_widget_is_focus (GTK_WIDGET (list_view->table)))
- return FOCUS_CALENDAR;
-
- if (gtk_widget_is_focus (GTK_WIDGET (list_view->table->table_canvas)))
- return FOCUS_CALENDAR;
-
- if (gtk_widget_is_focus (GTK_WIDGET (list_view)))
- return FOCUS_CALENDAR;
- }
-
- return FOCUS_OTHER;
-}
-
static void
cal_shell_content_set_property (GObject *object,
guint property_id,
@@ -720,60 +646,3 @@ e_cal_shell_content_get_view_instance (ECalShellContent *cal_shell_content)
return cal_shell_content->priv->view_instance;
}
-
-void
-e_cal_shell_content_delete_selection (ECalShellContent *cal_shell_content)
-{
- GnomeCalendar *calendar;
- EMemoTable *memo_table;
- ETaskTable *task_table;
- GnomeCalendarViewType view_type;
- ECalendarView *calendar_view;
-
- g_return_if_fail (E_IS_CAL_SHELL_CONTENT (cal_shell_content));
-
- calendar = e_cal_shell_content_get_calendar (cal_shell_content);
- memo_table = e_cal_shell_content_get_memo_table (cal_shell_content);
- task_table = e_cal_shell_content_get_task_table (cal_shell_content);
-
- view_type = gnome_calendar_get_view (calendar);
- calendar_view = gnome_calendar_get_calendar_view (calendar, view_type);
-
- switch (cal_shell_content_get_focus_location (cal_shell_content)) {
- case FOCUS_CALENDAR:
- e_calendar_view_delete_selected_events (calendar_view);
- break;
-
- case FOCUS_MEMO_TABLE:
- e_memo_table_delete_selected (memo_table);
- break;
-
- case FOCUS_TASK_TABLE:
- e_task_table_delete_selected (task_table);
- break;
-
- default:
- g_return_if_reached ();
- }
-}
-
-void
-e_cal_shell_content_delete_selected_occurrence (ECalShellContent *cal_shell_content)
-{
- GnomeCalendar *calendar;
- GnomeCalendarViewType view_type;
- ECalendarView *calendar_view;
- FocusLocation focus;
-
- g_return_if_fail (E_IS_CAL_SHELL_CONTENT (cal_shell_content));
-
- focus = cal_shell_content_get_focus_location (cal_shell_content);
- if (focus != FOCUS_CALENDAR)
- return;
-
- calendar = e_cal_shell_content_get_calendar (cal_shell_content);
- view_type = gnome_calendar_get_view (calendar);
- calendar_view = gnome_calendar_get_calendar_view (calendar, view_type);
-
- e_calendar_view_delete_selected_occurrence (calendar_view);
-}
diff --git a/modules/calendar/e-cal-shell-content.h b/modules/calendar/e-cal-shell-content.h
index 78c2199c50..92acbaa3c9 100644
--- a/modules/calendar/e-cal-shell-content.h
+++ b/modules/calendar/e-cal-shell-content.h
@@ -97,10 +97,6 @@ EShellSearchbar *
GalViewInstance *
e_cal_shell_content_get_view_instance
(ECalShellContent *cal_shell_content);
-void e_cal_shell_content_delete_selection
- (ECalShellContent *cal_shell_content);
-void e_cal_shell_content_delete_selected_occurrence
- (ECalShellContent *cal_shell_content);
G_END_DECLS
diff --git a/modules/calendar/e-cal-shell-view-actions.c b/modules/calendar/e-cal-shell-view-actions.c
index 0e361c5e2c..ca50b56cd9 100644
--- a/modules/calendar/e-cal-shell-view-actions.c
+++ b/modules/calendar/e-cal-shell-view-actions.c
@@ -659,9 +659,17 @@ action_event_delete_cb (GtkAction *action,
ECalShellView *cal_shell_view)
{
ECalShellContent *cal_shell_content;
+ GnomeCalendar *calendar;
+ GnomeCalendarViewType view_type;
+ ECalendarView *calendar_view;
cal_shell_content = cal_shell_view->priv->cal_shell_content;
- e_cal_shell_content_delete_selection (cal_shell_content);
+ calendar = e_cal_shell_content_get_calendar (cal_shell_content);
+
+ view_type = gnome_calendar_get_view (calendar);
+ calendar_view = gnome_calendar_get_calendar_view (calendar, view_type);
+
+ e_selectable_delete_selection (E_SELECTABLE (calendar_view));
}
static void
@@ -669,20 +677,17 @@ action_event_delete_occurrence_cb (GtkAction *action,
ECalShellView *cal_shell_view)
{
ECalShellContent *cal_shell_content;
+ GnomeCalendar *calendar;
+ GnomeCalendarViewType view_type;
+ ECalendarView *calendar_view;
cal_shell_content = cal_shell_view->priv->cal_shell_content;
- e_cal_shell_content_delete_selected_occurrence (cal_shell_content);
-}
+ calendar = e_cal_shell_content_get_calendar (cal_shell_content);
-static void
-action_event_delete_occurrence_all_cb (GtkAction *action,
- ECalShellView *cal_shell_view)
-{
- ECalShellContent *cal_shell_content;
+ view_type = gnome_calendar_get_view (calendar);
+ calendar_view = gnome_calendar_get_calendar_view (calendar, view_type);
- /* XXX Same as "event-delete". */
- cal_shell_content = cal_shell_view->priv->cal_shell_content;
- e_cal_shell_content_delete_selection (cal_shell_content);
+ e_calendar_view_delete_selected_occurrence (calendar_view);
}
static void
@@ -1236,9 +1241,9 @@ static GtkActionEntry calendar_entries[] = {
{ "calendar-delete",
GTK_STOCK_DELETE,
+ N_("D_elete Calendar"),
NULL,
- NULL,
- NULL, /* XXX Add a tooltip! */
+ N_("Delete the selected calendar"),
G_CALLBACK (action_calendar_delete_cb) },
{ "calendar-go-back",
@@ -1327,9 +1332,9 @@ static GtkActionEntry calendar_entries[] = {
{ "event-delete",
GTK_STOCK_DELETE,
- NULL,
+ N_("_Delete Appointment"),
"<Control>d",
- N_("Delete the appointment"),
+ N_("Delete selected appointments"),
G_CALLBACK (action_event_delete_cb) },
{ "event-delete-occurrence",
@@ -1341,10 +1346,10 @@ static GtkActionEntry calendar_entries[] = {
{ "event-delete-occurrence-all",
GTK_STOCK_DELETE,
- N_("Delete _All Occurrences"),
+ N_("Delete All Occ_urrences"),
NULL,
N_("Delete all occurrences"),
- G_CALLBACK (action_event_delete_occurrence_all_cb) },
+ G_CALLBACK (action_event_delete_cb) },
{ "event-all-day-new",
"stock_new-24h-appointment",
@@ -1451,7 +1456,7 @@ static EPopupActionEntry calendar_popup_entries[] = {
"calendar-copy" },
{ "calendar-popup-delete",
- NULL,
+ N_("_Delete"),
"calendar-delete" },
{ "calendar-popup-go-today",
@@ -1750,9 +1755,6 @@ e_cal_shell_view_actions_init (ECalShellView *cal_shell_view)
action = ACTION (CALENDAR_VIEW_WORKWEEK);
g_object_set (action, "is-important", TRUE, NULL);
- action = ACTION (EVENT_DELETE);
- g_object_set (action, "short-label", _("Delete"), NULL);
-
g_signal_connect (
ACTION (GAL_SAVE_CUSTOM_VIEW), "activate",
G_CALLBACK (action_gal_save_custom_view_cb), cal_shell_view);
diff --git a/modules/calendar/e-cal-shell-view-actions.h b/modules/calendar/e-cal-shell-view-actions.h
index a1cb31398b..a69b82f645 100644
--- a/modules/calendar/e-cal-shell-view-actions.h
+++ b/modules/calendar/e-cal-shell-view-actions.h
@@ -91,8 +91,6 @@
E_SHELL_WINDOW_ACTION ((window), "event-occurrence-movable")
/* Memo Pad Actions */
-#define E_SHELL_WINDOW_ACTION_CALENDAR_MEMOPAD_DELETE(window) \
- E_SHELL_WINDOW_ACTION ((window), "calendar-memopad-delete")
#define E_SHELL_WINDOW_ACTION_CALENDAR_MEMOPAD_FORWARD(window) \
E_SHELL_WINDOW_ACTION ((window), "calendar-memopad-forward")
#define E_SHELL_WINDOW_ACTION_CALENDAR_MEMOPAD_NEW(window) \
@@ -109,8 +107,6 @@
/* Task Pad Actions */
#define E_SHELL_WINDOW_ACTION_CALENDAR_TASKPAD_ASSIGN(window) \
E_SHELL_WINDOW_ACTION ((window), "calendar-taskpad-assign")
-#define E_SHELL_WINDOW_ACTION_CALENDAR_TASKPAD_DELETE(window) \
- E_SHELL_WINDOW_ACTION ((window), "calendar-taskpad-delete")
#define E_SHELL_WINDOW_ACTION_CALENDAR_TASKPAD_FORWARD(window) \
E_SHELL_WINDOW_ACTION ((window), "calendar-taskpad-forward")
#define E_SHELL_WINDOW_ACTION_CALENDAR_TASKPAD_MARK_COMPLETE(window) \
diff --git a/modules/calendar/e-cal-shell-view-memopad.c b/modules/calendar/e-cal-shell-view-memopad.c
index e34dac9adb..61ef73d1a4 100644
--- a/modules/calendar/e-cal-shell-view-memopad.c
+++ b/modules/calendar/e-cal-shell-view-memopad.c
@@ -24,23 +24,6 @@
/* Much of this file is based on e-memo-shell-view-actions.c. */
static void
-action_calendar_memopad_delete_cb (GtkAction *action,
- ECalShellView *cal_shell_view)
-{
- ECalShellContent *cal_shell_content;
- EMemoTable *memo_table;
-
- cal_shell_content = cal_shell_view->priv->cal_shell_content;
- memo_table = e_cal_shell_content_get_memo_table (cal_shell_content);
-
- e_cal_shell_view_memopad_set_status_message (
- cal_shell_view, _("Deleting selected memos..."), -1.0);
- e_memo_table_delete_selected (memo_table);
- e_cal_shell_view_memopad_set_status_message (
- cal_shell_view, NULL, -1.0);
-}
-
-static void
action_calendar_memopad_forward_cb (GtkAction *action,
ECalShellView *cal_shell_view)
{
@@ -255,13 +238,6 @@ action_calendar_memopad_save_as_cb (GtkAction *action,
static GtkActionEntry calendar_memopad_entries[] = {
- { "calendar-memopad-delete",
- GTK_STOCK_DELETE,
- N_("_Delete Memo"),
- NULL,
- N_("Delete selected memos"),
- G_CALLBACK (action_calendar_memopad_delete_cb) },
-
{ "calendar-memopad-forward",
"mail-forward",
N_("_Forward as iCalendar..."),
@@ -340,7 +316,6 @@ e_cal_shell_view_memopad_actions_update (ECalShellView *cal_shell_view)
EMemoTable *memo_table;
GtkAction *action;
GSList *list, *iter;
- const gchar *label;
gboolean editable = TRUE;
gboolean has_url = FALSE;
gboolean sensitive;
@@ -369,12 +344,6 @@ e_cal_shell_view_memopad_actions_update (ECalShellView *cal_shell_view)
}
g_slist_free (list);
- action = ACTION (CALENDAR_MEMOPAD_DELETE);
- sensitive = (n_selected > 0) && editable;
- gtk_action_set_sensitive (action, sensitive);
- label = ngettext ("Delete Memo", "Delete Memos", n_selected);
- g_object_set (action, "label", label, NULL);
-
action = ACTION (CALENDAR_MEMOPAD_FORWARD);
sensitive = (n_selected == 1);
gtk_action_set_sensitive (action, sensitive);
diff --git a/modules/calendar/e-cal-shell-view-private.h b/modules/calendar/e-cal-shell-view-private.h
index 1f9dc17f87..c69ffc7605 100644
--- a/modules/calendar/e-cal-shell-view-private.h
+++ b/modules/calendar/e-cal-shell-view-private.h
@@ -37,7 +37,8 @@
#include "e-util/e-file-utils.h"
#include "e-util/e-util.h"
#include "shell/e-shell-utils.h"
-#include "widgets/misc/e-popup-action.h"
+#include "misc/e-popup-action.h"
+#include "misc/e-selectable.h"
#include "calendar/common/authentication.h"
#include "calendar/gui/calendar-config.h"
diff --git a/modules/calendar/e-cal-shell-view-taskpad.c b/modules/calendar/e-cal-shell-view-taskpad.c
index 67a355a9bd..c7269bcfd1 100644
--- a/modules/calendar/e-cal-shell-view-taskpad.c
+++ b/modules/calendar/e-cal-shell-view-taskpad.c
@@ -47,23 +47,6 @@ action_calendar_taskpad_assign_cb (GtkAction *action,
}
static void
-action_calendar_taskpad_delete_cb (GtkAction *action,
- ECalShellView *cal_shell_view)
-{
- ECalShellContent *cal_shell_content;
- ETaskTable *task_table;
-
- cal_shell_content = cal_shell_view->priv->cal_shell_content;
- task_table = e_cal_shell_content_get_task_table (cal_shell_content);
-
- e_cal_shell_view_taskpad_set_status_message (
- cal_shell_view, _("Deleting selected tasks..."), -1.0);
- e_task_table_delete_selected (task_table);
- e_cal_shell_view_taskpad_set_status_message (
- cal_shell_view, NULL, -1.0);
-}
-
-static void
action_calendar_taskpad_forward_cb (GtkAction *action,
ECalShellView *cal_shell_view)
{
@@ -329,13 +312,6 @@ static GtkActionEntry calendar_taskpad_entries[] = {
NULL, /* XXX Add a tooltip! */
G_CALLBACK (action_calendar_taskpad_assign_cb) },
- { "calendar-taskpad-delete",
- GTK_STOCK_DELETE,
- N_("_Delete Task"),
- NULL,
- N_("Delete selected tasks"),
- G_CALLBACK (action_calendar_taskpad_delete_cb) },
-
{ "calendar-taskpad-forward",
"mail-forward",
N_("_Forward as iCalendar..."),
@@ -428,7 +404,6 @@ e_cal_shell_view_taskpad_actions_update (ECalShellView *cal_shell_view)
ETaskTable *task_table;
GtkAction *action;
GSList *list, *iter;
- const gchar *label;
gboolean assignable = TRUE;
gboolean editable = TRUE;
gboolean has_url = FALSE;
@@ -480,12 +455,6 @@ e_cal_shell_view_taskpad_actions_update (ECalShellView *cal_shell_view)
sensitive = (n_selected == 1) && editable && assignable;
gtk_action_set_sensitive (action, sensitive);
- action = ACTION (CALENDAR_TASKPAD_DELETE);
- sensitive = (n_selected > 0) && editable;
- gtk_action_set_sensitive (action, sensitive);
- label = ngettext ("Delete Task", "Delete Tasks", n_selected);
- g_object_set (action, "label", label, NULL);
-
action = ACTION (CALENDAR_TASKPAD_FORWARD);
sensitive = (n_selected == 1);
gtk_action_set_sensitive (action, sensitive);
diff --git a/modules/calendar/e-memo-shell-view-actions.c b/modules/calendar/e-memo-shell-view-actions.c
index 7891a5add2..1c0a7ef9ef 100644
--- a/modules/calendar/e-memo-shell-view-actions.c
+++ b/modules/calendar/e-memo-shell-view-actions.c
@@ -47,19 +47,12 @@ action_memo_delete_cb (GtkAction *action,
EMemoShellView *memo_shell_view)
{
EMemoShellContent *memo_shell_content;
- ECalComponentPreview *memo_preview;
EMemoTable *memo_table;
memo_shell_content = memo_shell_view->priv->memo_shell_content;
memo_table = e_memo_shell_content_get_memo_table (memo_shell_content);
- memo_preview = e_memo_shell_content_get_memo_preview (memo_shell_content);
-
- e_memo_shell_view_set_status_message (
- memo_shell_view, _("Deleting selected memos..."), -1.0);
- e_memo_table_delete_selected (memo_table);
- e_memo_shell_view_set_status_message (memo_shell_view, NULL, -1.0);
- e_cal_component_preview_clear (memo_preview);
+ e_selectable_delete_selection (E_SELECTABLE (memo_table));
}
static void
@@ -587,9 +580,9 @@ static GtkActionEntry memo_entries[] = {
{ "memo-list-delete",
GTK_STOCK_DELETE,
- N_("_Delete"),
+ N_("D_elete Memo List"),
NULL,
- NULL, /* XXX Add a tooltip! */
+ N_("Delete the selected memo list"),
G_CALLBACK (action_memo_list_delete_cb) },
{ "memo-list-new",
@@ -665,7 +658,7 @@ static EPopupActionEntry memo_popup_entries[] = {
"memo-list-copy" },
{ "memo-list-popup-delete",
- NULL,
+ N_("_Delete"),
"memo-list-delete" },
{ "memo-list-popup-properties",
@@ -684,10 +677,6 @@ static EPopupActionEntry memo_popup_entries[] = {
NULL,
"memo-list-select-one" },
- { "memo-popup-delete",
- NULL,
- "memo-delete" },
-
{ "memo-popup-forward",
NULL,
"memo-forward" },
@@ -919,9 +908,6 @@ e_memo_shell_view_actions_init (EMemoShellView *memo_shell_view)
/* Fine tuning. */
- action = ACTION (MEMO_DELETE);
- g_object_set (action, "short-label", _("Delete"), NULL);
-
g_signal_connect (
ACTION (GAL_SAVE_CUSTOM_VIEW), "activate",
G_CALLBACK (action_gal_save_custom_view_cb), memo_shell_view);
diff --git a/modules/calendar/e-memo-shell-view-private.h b/modules/calendar/e-memo-shell-view-private.h
index ac50d209a4..06db399036 100644
--- a/modules/calendar/e-memo-shell-view-private.h
+++ b/modules/calendar/e-memo-shell-view-private.h
@@ -35,7 +35,8 @@
#include "e-util/e-util.h"
#include "e-util/gconf-bridge.h"
#include "shell/e-shell-utils.h"
-#include "widgets/misc/e-popup-action.h"
+#include "misc/e-popup-action.h"
+#include "misc/e-selectable.h"
#include "calendar/gui/comp-util.h"
#include "calendar/gui/e-cal-component-preview.h"
diff --git a/modules/calendar/e-task-shell-view-actions.c b/modules/calendar/e-task-shell-view-actions.c
index 2b25f3373e..bd3d0627ff 100644
--- a/modules/calendar/e-task-shell-view-actions.c
+++ b/modules/calendar/e-task-shell-view-actions.c
@@ -78,19 +78,12 @@ action_task_delete_cb (GtkAction *action,
ETaskShellView *task_shell_view)
{
ETaskShellContent *task_shell_content;
- ECalComponentPreview *task_preview;
ETaskTable *task_table;
task_shell_content = task_shell_view->priv->task_shell_content;
task_table = e_task_shell_content_get_task_table (task_shell_content);
- task_preview = e_task_shell_content_get_task_preview (task_shell_content);
-
- e_task_shell_view_set_status_message (
- task_shell_view, _("Deleting selected tasks..."), -1.0);
- e_task_table_delete_selected (task_table);
- e_task_shell_view_set_status_message (task_shell_view, NULL, -1.0);
- e_cal_component_preview_clear (task_preview);
+ e_selectable_delete_selection (E_SELECTABLE (task_table));
}
static void
@@ -711,9 +704,9 @@ static GtkActionEntry task_entries[] = {
{ "task-list-delete",
GTK_STOCK_DELETE,
- N_("_Delete"),
+ N_("D_elete Task List"),
NULL,
- NULL, /* XXX Add a tooltip! */
+ N_("Delete the selected task list"),
G_CALLBACK (action_task_list_delete_cb) },
{ "task-list-new",
@@ -817,7 +810,7 @@ static EPopupActionEntry task_popup_entries[] = {
"task-list-copy" },
{ "task-list-popup-delete",
- NULL,
+ N_("_Delete"),
"task-list-delete" },
{ "task-list-popup-properties",
@@ -840,10 +833,6 @@ static EPopupActionEntry task_popup_entries[] = {
NULL,
"task-assign" },
- { "task-popup-delete",
- NULL,
- "task-delete" },
-
{ "task-popup-forward",
NULL,
"task-forward" },
@@ -1118,9 +1107,6 @@ e_task_shell_view_actions_init (ETaskShellView *task_shell_view)
/* Fine tuning. */
- action = ACTION (TASK_DELETE);
- g_object_set (action, "short-label", _("Delete"), NULL);
-
g_signal_connect (
ACTION (GAL_SAVE_CUSTOM_VIEW), "activate",
G_CALLBACK (action_gal_save_custom_view_cb), task_shell_view);
diff --git a/modules/calendar/e-task-shell-view-private.h b/modules/calendar/e-task-shell-view-private.h
index a76403f721..5b0231e108 100644
--- a/modules/calendar/e-task-shell-view-private.h
+++ b/modules/calendar/e-task-shell-view-private.h
@@ -36,7 +36,8 @@
#include "e-util/e-util.h"
#include "e-util/gconf-bridge.h"
#include "shell/e-shell-utils.h"
-#include "widgets/misc/e-popup-action.h"
+#include "misc/e-popup-action.h"
+#include "misc/e-selectable.h"
#include "calendar/common/authentication.h"
#include "calendar/gui/calendar-config.h"
diff --git a/ui/evolution-calendars.ui b/ui/evolution-calendars.ui
index 818ed176b3..feef83de6c 100644
--- a/ui/evolution-calendars.ui
+++ b/ui/evolution-calendars.ui
@@ -14,6 +14,7 @@
<menuitem action='event-delete'/>
<menuitem action='event-delete-occurrence'/>
<menuitem action='event-delete-occurrence-all'/>
+ <menuitem action='calendar-delete'/>
</placeholder>
</menu>
<menu action='view-menu'>
@@ -28,7 +29,7 @@
</menubar>
<toolbar name='main-toolbar'>
<toolitem action='calendar-print'/>
- <toolitem action='event-delete'/>
+ <toolitem action='delete-selection'/>
<separator/>
<toolitem action='calendar-go-back'/>
<toolitem action='calendar-go-today'/>
@@ -115,7 +116,7 @@
<separator/>
<menuitem action='calendar-memopad-forward'/>
<separator/>
- <menuitem action='calendar-memopad-delete'/>
+ <menuitem action='popup-delete-selection'/>
</popup>
<popup name='calendar-taskpad-popup'>
<menuitem action='calendar-taskpad-new'/>
@@ -134,7 +135,7 @@
<menuitem action='calendar-taskpad-mark-complete'/>
<menuitem action='calendar-taskpad-mark-incomplete'/>
<separator/>
- <menuitem action='calendar-taskpad-delete'/>
+ <menuitem action='popup-delete-selection'/>
</popup>
<popup name='calendar-search-options'>
<menuitem action='calendar-search-advanced-hidden'/>
diff --git a/ui/evolution-contacts.ui b/ui/evolution-contacts.ui
index c3ce87108a..1dc66b44bc 100644
--- a/ui/evolution-contacts.ui
+++ b/ui/evolution-contacts.ui
@@ -45,7 +45,7 @@
</menubar>
<toolbar name='main-toolbar'>
<toolitem action='address-book-print'/>
- <toolitem action='contact-delete'/>
+ <toolitem action='delete-selection'/>
<toolitem action='address-book-stop'/>
</toolbar>
<popup name='address-book-popup'>
@@ -64,17 +64,18 @@
<separator/>
<menuitem action='contact-popup-open'/>
<menuitem action='contact-popup-save-as'/>
- <menuitem action='contact-popup-forward'/>
- <menuitem action='contact-popup-send-message'/>
<menuitem action='contact-popup-print'/>
<separator/>
- <menuitem action='contact-popup-copy'/>
- <menuitem action='contact-popup-move'/>
- <separator/>
<menuitem action='popup-cut-clipboard'/>
<menuitem action='popup-copy-clipboard'/>
<menuitem action='popup-paste-clipboard'/>
- <menuitem action='contact-popup-delete'/>
+ <separator/>
+ <menuitem action='contact-popup-copy'/>
+ <menuitem action='contact-popup-move'/>
+ <menuitem action='contact-popup-forward'/>
+ <menuitem action='contact-popup-send-message'/>
+ <separator/>
+ <menuitem action='popup-delete-selection'/>
</popup>
<popup name='contact-search-options'>
<menuitem action='contact-search-advanced-hidden'/>
diff --git a/ui/evolution-memos.ui b/ui/evolution-memos.ui
index 29c4263440..c20ebc5334 100644
--- a/ui/evolution-memos.ui
+++ b/ui/evolution-memos.ui
@@ -12,6 +12,7 @@
<menu action='edit-menu'>
<placeholder name='edit-actions'>
<menuitem action='memo-delete'/>
+ <menuitem action='memo-list-delete'/>
</placeholder>
</menu>
<menu action='view-menu'>
@@ -32,7 +33,7 @@
<toolitem action='paste-clipboard'/>
<separator/>
<toolitem action='memo-list-print'/>
- <toolitem action='memo-delete'/>
+ <toolitem action='delete-selection'/>
</placeholder>
</toolbar>
<popup name='memo-popup'>
@@ -49,7 +50,7 @@
<separator/>
<menuitem action='memo-popup-forward'/>
<separator/>
- <menuitem action='memo-popup-delete'/>
+ <menuitem action='popup-delete-selection'/>
</popup>
<popup name='memo-list-popup'>
<menuitem action='memo-list-new'/>
diff --git a/ui/evolution-tasks.ui b/ui/evolution-tasks.ui
index de4d97e067..4483c95a1e 100644
--- a/ui/evolution-tasks.ui
+++ b/ui/evolution-tasks.ui
@@ -12,6 +12,7 @@
<menu action='edit-menu'>
<placeholder name='edit-actions'>
<menuitem action='task-delete'/>
+ <menuitem action='task-list-delete'/>
<separator/>
<menuitem action='task-mark-complete'/>
<menuitem action='task-mark-incomplete'/>
@@ -41,7 +42,7 @@
<toolitem action='paste-clipboard'/>
<separator/>
<toolitem action='task-print'/>
- <toolitem action='task-delete'/>
+ <toolitem action='delete-selection'/>
</toolbar>
<popup name='task-popup'>
<menuitem action='task-new'/>
@@ -60,7 +61,7 @@
<menuitem action='task-popup-mark-complete'/>
<menuitem action='task-popup-mark-incomplete'/>
<separator/>
- <menuitem action='task-popup-delete'/>
+ <menuitem action='popup-delete-selection'/>
</popup>
<popup name='task-list-popup'>
<menuitem action='task-list-new'/>