[evolution] Bug 783348 - Add 'Edit as New' event context menu option
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution] Bug 783348 - Add 'Edit as New' event context menu option
- Date: Thu, 8 Jun 2017 07:54:40 +0000 (UTC)
commit 8378caaf5dfc3c499539cb547b6c84d9e0410ff2
Author: Milan Crha <mcrha redhat com>
Date: Thu Jun 8 09:54:06 2017 +0200
Bug 783348 - Add 'Edit as New' event context menu option
data/ui/evolution-calendars.ui | 1 +
src/modules/calendar/e-cal-shell-view-actions.c | 51 +++++++++++++++++++++++
src/modules/calendar/e-cal-shell-view-actions.h | 2 +
src/modules/calendar/e-cal-shell-view.c | 5 ++
4 files changed, 59 insertions(+), 0 deletions(-)
---
diff --git a/data/ui/evolution-calendars.ui b/data/ui/evolution-calendars.ui
index 580764c..20dbe46 100644
--- a/data/ui/evolution-calendars.ui
+++ b/data/ui/evolution-calendars.ui
@@ -97,6 +97,7 @@
</popup>
<popup name='calendar-event-popup'>
<menuitem action='event-popup-open'/>
+ <menuitem action='event-popup-edit-as-new'/>
<menuitem action='event-popup-save-as'/>
<menuitem action='event-popup-print'/>
<separator/>
diff --git a/src/modules/calendar/e-cal-shell-view-actions.c b/src/modules/calendar/e-cal-shell-view-actions.c
index e92e9cd..634079e 100644
--- a/src/modules/calendar/e-cal-shell-view-actions.c
+++ b/src/modules/calendar/e-cal-shell-view-actions.c
@@ -945,6 +945,46 @@ action_event_open_cb (GtkAction *action,
}
static void
+action_event_edit_as_new_cb (GtkAction *action,
+ ECalShellView *cal_shell_view)
+{
+ ECalShellContent *cal_shell_content;
+ ECalendarView *calendar_view;
+ ECalendarViewEvent *event;
+ GList *selected;
+ icalcomponent *clone;
+ gchar *uid;
+
+ cal_shell_content = cal_shell_view->priv->cal_shell_content;
+ calendar_view = e_cal_shell_content_get_current_calendar_view (cal_shell_content);
+
+ selected = e_calendar_view_get_selected_events (calendar_view);
+ g_return_if_fail (g_list_length (selected) == 1);
+
+ event = selected->data;
+
+ if (!is_comp_data_valid (event) ||
+ e_cal_util_component_is_instance (event->comp_data->icalcomp)) {
+ g_list_free (selected);
+ return;
+ }
+
+ clone = icalcomponent_new_clone (event->comp_data->icalcomp);
+
+ uid = e_util_generate_uid ();
+ icalcomponent_set_uid (clone, uid);
+
+ g_free (uid);
+
+ e_calendar_view_open_event_with_flags (
+ calendar_view, event->comp_data->client, clone,
+ E_COMP_EDITOR_FLAG_IS_NEW);
+
+ icalcomponent_free (clone);
+ g_list_free (selected);
+}
+
+static void
action_event_print_cb (GtkAction *action,
ECalShellView *cal_shell_view)
{
@@ -1369,6 +1409,13 @@ static GtkActionEntry calendar_entries[] = {
N_("Delete all occurrences"),
G_CALLBACK (action_event_delete_cb) },
+ { "event-edit-as-new",
+ NULL,
+ N_("Edit as Ne_w..."),
+ NULL,
+ N_("Edit the current appointment as new"),
+ G_CALLBACK (action_event_edit_as_new_cb) },
+
{ "event-all-day-new",
"stock_new-24h-appointment",
N_("New All Day _Event..."),
@@ -1529,6 +1576,10 @@ static EPopupActionEntry calendar_popup_entries[] = {
NULL,
"event-delete-occurrence-all" },
+ { "event-popup-edit-as-new",
+ NULL,
+ "event-edit-as-new" },
+
{ "event-popup-forward",
NULL,
"event-forward" },
diff --git a/src/modules/calendar/e-cal-shell-view-actions.h b/src/modules/calendar/e-cal-shell-view-actions.h
index cef460b..834d86d 100644
--- a/src/modules/calendar/e-cal-shell-view-actions.h
+++ b/src/modules/calendar/e-cal-shell-view-actions.h
@@ -80,6 +80,8 @@
E_SHELL_WINDOW_ACTION ((window), "event-delete-occurrence")
#define E_SHELL_WINDOW_ACTION_EVENT_DELETE_OCCURRENCE_ALL(window) \
E_SHELL_WINDOW_ACTION ((window), "event-delete-occurrence-all")
+#define E_SHELL_WINDOW_ACTION_EVENT_EDIT_AS_NEW(window) \
+ E_SHELL_WINDOW_ACTION ((window), "event-edit-as-new")
#define E_SHELL_WINDOW_ACTION_EVENT_FORWARD(window) \
E_SHELL_WINDOW_ACTION ((window), "event-forward")
#define E_SHELL_WINDOW_ACTION_EVENT_OPEN(window) \
diff --git a/src/modules/calendar/e-cal-shell-view.c b/src/modules/calendar/e-cal-shell-view.c
index 2a354bf..fbff988 100644
--- a/src/modules/calendar/e-cal-shell-view.c
+++ b/src/modules/calendar/e-cal-shell-view.c
@@ -434,6 +434,11 @@ cal_shell_view_update_actions (EShellView *shell_view)
sensitive = single_event_selected;
gtk_action_set_sensitive (action, sensitive);
+ action = ACTION (EVENT_EDIT_AS_NEW);
+ sensitive = single_event_selected &&
+ !selection_is_instance;
+ gtk_action_set_sensitive (action, sensitive);
+
action = ACTION (EVENT_PRINT);
sensitive = single_event_selected;
gtk_action_set_sensitive (action, sensitive);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]