[evolution] I#1336 - Calendar: Preserve time when creating events with double-click



commit 76c26c34e8c8506d2762bef0067cc8ea867fc559
Author: Milan Crha <mcrha redhat com>
Date:   Wed Jan 20 14:04:00 2021 +0100

    I#1336 - Calendar: Preserve time when creating events with double-click
    
    ... and from the context menu.
    
    Closes https://gitlab.gnome.org/GNOME/evolution/-/issues/1336

 data/ui/evolution-calendars.ui                  |  6 +--
 src/calendar/gui/e-week-view.c                  |  2 +-
 src/calendar/gui/ea-cal-view.c                  |  2 +-
 src/modules/calendar/e-cal-shell-view-actions.c | 52 ++++++++-----------------
 4 files changed, 21 insertions(+), 41 deletions(-)
---
diff --git a/data/ui/evolution-calendars.ui b/data/ui/evolution-calendars.ui
index b7e85ec70b..2fc4eb5070 100644
--- a/data/ui/evolution-calendars.ui
+++ b/data/ui/evolution-calendars.ui
@@ -77,9 +77,9 @@
     <menuitem action='calendar-popup-properties'/>
   </popup>
   <popup name='calendar-empty-popup'>
-    <menuitem action='event-new'/>
-    <menuitem action='event-all-day-new'/>
-    <menuitem action='event-meeting-new'/>
+    <menuitem action='event-popup-new'/>
+    <menuitem action='event-popup-all-day-new'/>
+    <menuitem action='event-popup-meeting-new'/>
     <menuitem action='task-new'/>
     <separator/>
     <menuitem action='event-popup-print'/>
diff --git a/src/calendar/gui/e-week-view.c b/src/calendar/gui/e-week-view.c
index a966ddeed5..31644a6004 100644
--- a/src/calendar/gui/e-week-view.c
+++ b/src/calendar/gui/e-week-view.c
@@ -2980,7 +2980,7 @@ e_week_view_on_button_press (GtkWidget *widget,
                                week_view->before_click_dtstart,
                                week_view->before_click_dtend);
                }
-               e_calendar_view_new_appointment (E_CALENDAR_VIEW (week_view), 
E_NEW_APPOINTMENT_FLAG_NO_PAST_DATE |
+               e_calendar_view_new_appointment (E_CALENDAR_VIEW (week_view),
                        (calendar_config_get_prefer_meeting () ? E_NEW_APPOINTMENT_FLAG_MEETING : 0));
                return TRUE;
        }
diff --git a/src/calendar/gui/ea-cal-view.c b/src/calendar/gui/ea-cal-view.c
index 71a63e0593..c1303b43a3 100644
--- a/src/calendar/gui/ea-cal-view.c
+++ b/src/calendar/gui/ea-cal-view.c
@@ -316,7 +316,7 @@ action_interface_do_action (AtkAction *action,
        switch (index) {
        case 0:
                /* New Appointment */
-               e_calendar_view_new_appointment (cal_view, E_NEW_APPOINTMENT_FLAG_NO_PAST_DATE);
+               e_calendar_view_new_appointment (cal_view, E_NEW_APPOINTMENT_FLAG_NONE);
                break;
        case 1:
                /* New All Day Event */
diff --git a/src/modules/calendar/e-cal-shell-view-actions.c b/src/modules/calendar/e-cal-shell-view-actions.c
index d88734a135..efb2f95773 100644
--- a/src/modules/calendar/e-cal-shell-view-actions.c
+++ b/src/modules/calendar/e-cal-shell-view-actions.c
@@ -509,20 +509,6 @@ action_calendar_view_cb (GtkRadioAction *action,
        e_shell_view_set_view_id (shell_view, view_id);
 }
 
-static void
-action_event_all_day_new_cb (GtkAction *action,
-                             ECalShellView *cal_shell_view)
-{
-       ECalShellContent *cal_shell_content;
-       ECalendarView *calendar_view;
-
-       cal_shell_content = cal_shell_view->priv->cal_shell_content;
-       calendar_view = e_cal_shell_content_get_current_calendar_view (cal_shell_content);
-
-       e_calendar_view_new_appointment (calendar_view, E_NEW_APPOINTMENT_FLAG_ALL_DAY | 
E_NEW_APPOINTMENT_FLAG_NO_PAST_DATE |
-               (e_shell_view_is_active (E_SHELL_VIEW (cal_shell_view)) ? 0 : 
E_NEW_APPOINTMENT_FLAG_FORCE_CURRENT_TIME));
-}
-
 static void
 cal_shell_view_transfer_selected (ECalShellView *cal_shell_view,
                                  gboolean is_move)
@@ -777,30 +763,24 @@ action_event_forward_cb (GtkAction *action,
 }
 
 static void
-action_event_meeting_new_cb (GtkAction *action,
-                             ECalShellView *cal_shell_view)
+action_event_popup_new_cb (GtkAction *action,
+                          ECalShellView *cal_shell_view)
 {
        ECalShellContent *cal_shell_content;
        ECalendarView *calendar_view;
+       const gchar *action_name;
+       gboolean is_all_day, is_meeting;
 
        cal_shell_content = cal_shell_view->priv->cal_shell_content;
        calendar_view = e_cal_shell_content_get_current_calendar_view (cal_shell_content);
 
-       e_calendar_view_new_appointment (calendar_view, E_NEW_APPOINTMENT_FLAG_MEETING | 
E_NEW_APPOINTMENT_FLAG_NO_PAST_DATE |
-               (e_shell_view_is_active (E_SHELL_VIEW (cal_shell_view)) ? 0 : 
E_NEW_APPOINTMENT_FLAG_FORCE_CURRENT_TIME));
-}
-
-static void
-action_event_new_cb (GtkAction *action,
-                     ECalShellView *cal_shell_view)
-{
-       ECalShellContent *cal_shell_content;
-       ECalendarView *calendar_view;
-
-       cal_shell_content = cal_shell_view->priv->cal_shell_content;
-       calendar_view = e_cal_shell_content_get_current_calendar_view (cal_shell_content);
+       action_name = gtk_action_get_name (action);
+       is_all_day = g_strcmp0 (action_name, "event-popup-all-day-new") == 0;
+       is_meeting = g_strcmp0 (action_name, "event-popup-meeting-new") == 0;
 
-       e_calendar_view_new_appointment (calendar_view, E_NEW_APPOINTMENT_FLAG_NO_PAST_DATE |
+       e_calendar_view_new_appointment (calendar_view,
+               (is_all_day ? E_NEW_APPOINTMENT_FLAG_ALL_DAY : 0) |
+               (is_meeting ? E_NEW_APPOINTMENT_FLAG_MEETING : 0) |
                (e_shell_view_is_active (E_SHELL_VIEW (cal_shell_view)) ? 0 : 
E_NEW_APPOINTMENT_FLAG_FORCE_CURRENT_TIME));
 }
 
@@ -1391,12 +1371,12 @@ static GtkActionEntry calendar_entries[] = {
          N_("Edit the current appointment as new"),
          G_CALLBACK (action_event_edit_as_new_cb) },
 
-       { "event-all-day-new",
+       { "event-popup-all-day-new",
          "stock_new-24h-appointment",
          N_("New All Day _Event…"),
          NULL,
          N_("Create a new all day event"),
-         G_CALLBACK (action_event_all_day_new_cb) },
+         G_CALLBACK (action_event_popup_new_cb) },
 
        { "event-forward",
          "mail-forward",
@@ -1405,12 +1385,12 @@ static GtkActionEntry calendar_entries[] = {
          NULL,  /* XXX Add a tooltip! */
          G_CALLBACK (action_event_forward_cb) },
 
-       { "event-meeting-new",
+       { "event-popup-meeting-new",
          "stock_people",
          N_("New _Meeting…"),
          NULL,
          N_("Create a new meeting"),
-         G_CALLBACK (action_event_meeting_new_cb) },
+         G_CALLBACK (action_event_popup_new_cb) },
 
        { "event-move",
          NULL,
@@ -1419,12 +1399,12 @@ static GtkActionEntry calendar_entries[] = {
          NULL,  /* XXX Add a tooltip! */
          G_CALLBACK (action_event_move_cb) },
 
-       { "event-new",
+       { "event-popup-new",
          "appointment-new",
          N_("New _Appointment…"),
          NULL,
          N_("Create a new appointment"),
-         G_CALLBACK (action_event_new_cb) },
+         G_CALLBACK (action_event_popup_new_cb) },
 
        { "event-occurrence-movable",
          NULL,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]