[gnome-calendar] manager: pass ECalObjModType to update and remove



commit 9ffa913ad4373bb854ad6f772b6ff787b9be26ab
Author: Yash Singh <yashdev10p gmail com>
Date:   Sat May 27 02:04:24 2017 +0530

    manager: pass ECalObjModType to update and remove
    
    Currently, GcalManager always assumes E_CAL_OBJ_MOD_THIS
    when modifying or deleting events. Since we're landing
    the groundwork for recurrence management, we can't assume
    this anymore.
    
    This patch, then, allows GcalManager:modify_event() and
    :remove_event() receive the ECalObjModType instead of
    assuming E_CAL_OBJ_MOD_THIS. However, this commit does
    not add recurrence support yet, and every call to these
    functions are still passing E_CAL_OBJ_MOD_THIS.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=782755

 src/gcal-edit-dialog.c       |    2 +-
 src/gcal-manager.c           |   16 ++++++++++------
 src/gcal-manager.h           |    6 ++++--
 src/gcal-window.c            |    8 ++++----
 src/views/gcal-month-view.c  |    2 +-
 src/views/gcal-week-grid.c   |    2 +-
 src/views/gcal-week-header.c |    2 +-
 src/views/gcal-year-view.c   |    2 +-
 8 files changed, 23 insertions(+), 17 deletions(-)
---
diff --git a/src/gcal-edit-dialog.c b/src/gcal-edit-dialog.c
index 11664bf..85d0435 100644
--- a/src/gcal-edit-dialog.c
+++ b/src/gcal-edit-dialog.c
@@ -817,7 +817,7 @@ remove_button_clicked (GtkButton *button,
 
   gcal_event_remove_alarm (event, trigger_minutes);
 
-  gcal_manager_update_event (self->manager, event);
+  gcal_manager_update_event (self->manager, event, E_CAL_OBJ_MOD_THIS);
 
   gtk_widget_destroy (row);
 
diff --git a/src/gcal-manager.c b/src/gcal-manager.c
index 627908e..e9226ff 100644
--- a/src/gcal-manager.c
+++ b/src/gcal-manager.c
@@ -1748,12 +1748,14 @@ gcal_manager_create_event (GcalManager *manager,
  * gcal_manager_update_event:
  * @manager: a #GcalManager
  * @event: a #GcalEvent
+ * @mod: an #ECalObjModType
  *
  * Saves all changes made to @event persistently.
  */
 void
-gcal_manager_update_event (GcalManager *manager,
-                           GcalEvent   *event)
+gcal_manager_update_event (GcalManager    *manager,
+                           GcalEvent      *event,
+                           ECalObjModType  mod)
 {
   GcalManagerUnit *unit;
   ECalComponent *component;
@@ -1775,7 +1777,7 @@ gcal_manager_update_event (GcalManager *manager,
 
   e_cal_client_modify_object (unit->client,
                               e_cal_component_get_icalcomponent (component),
-                              E_CAL_OBJ_MOD_THIS,
+                              mod,
                               NULL,
                               on_event_updated,
                               component);
@@ -1787,12 +1789,14 @@ gcal_manager_update_event (GcalManager *manager,
  * gcal_manager_remove_event:
  * @manager: a #GcalManager
  * @event: a #GcalEvent
+ * @mod: an #ECalObjModType
  *
  * Deletes @event.
  */
 void
-gcal_manager_remove_event (GcalManager *manager,
-                           GcalEvent   *event)
+gcal_manager_remove_event (GcalManager    *manager,
+                           GcalEvent      *event,
+                           ECalObjModType  mod)
 {
   GcalManagerUnit *unit;
   ECalComponentId *id;
@@ -1817,7 +1821,7 @@ gcal_manager_remove_event (GcalManager *manager,
   e_cal_client_remove_object (unit->client,
                               id->uid,
                               id->rid,
-                              E_CAL_OBJ_MOD_THIS,
+                              mod,
                               manager->async_ops,
                               on_event_removed,
                               component);
diff --git a/src/gcal-manager.h b/src/gcal-manager.h
index 1d016dc..63a2f03 100644
--- a/src/gcal-manager.h
+++ b/src/gcal-manager.h
@@ -75,10 +75,12 @@ void                 gcal_manager_create_event                   (GcalManager
                                                                   GcalEvent          *event);
 
 void                 gcal_manager_update_event                   (GcalManager        *manager,
-                                                                  GcalEvent          *event);
+                                                                  GcalEvent          *event,
+                                                                  ECalObjModType      mod);
 
 void                 gcal_manager_remove_event                   (GcalManager        *manager,
-                                                                  GcalEvent          *event);
+                                                                  GcalEvent          *event,
+                                                                  ECalObjModType      mod);
 
 void                 gcal_manager_move_event_to_source           (GcalManager        *manager,
                                                                   GcalEvent          *event,
diff --git a/src/gcal-window.c b/src/gcal-window.c
index 3847808..dd4cc23 100644
--- a/src/gcal-window.c
+++ b/src/gcal-window.c
@@ -1102,13 +1102,13 @@ edit_dialog_closed (GtkDialog *dialog,
       break;
 
     case GCAL_RESPONSE_SAVE_EVENT:
-      gcal_manager_update_event (window->manager, event);
+      gcal_manager_update_event (window->manager, event, E_CAL_OBJ_MOD_THIS);
       break;
 
     case GCAL_RESPONSE_DELETE_EVENT:
       if (window->event_to_delete != NULL)
         {
-          gcal_manager_remove_event (window->manager, window->event_to_delete);
+          gcal_manager_remove_event (window->manager, window->event_to_delete, E_CAL_OBJ_MOD_THIS);
           g_clear_object (&window->event_to_delete);
 
           create_notification (GCAL_WINDOW (user_data), _("Another event deleted"), _("Undo"));
@@ -1209,7 +1209,7 @@ remove_event (GtkWidget  *notification,
 
   if (window->event_to_delete != NULL)
     {
-      gcal_manager_remove_event (window->manager, window->event_to_delete);
+      gcal_manager_remove_event (window->manager, window->event_to_delete, E_CAL_OBJ_MOD_THIS);
       g_clear_object (&window->event_to_delete);
     }
 }
@@ -1282,7 +1282,7 @@ gcal_window_finalize (GObject *object)
   /* If we have a queued event to delete, remove it now */
   if (window->event_to_delete)
     {
-      gcal_manager_remove_event (window->manager, window->event_to_delete);
+      gcal_manager_remove_event (window->manager, window->event_to_delete, E_CAL_OBJ_MOD_THIS);
       g_clear_object (&window->event_to_delete);
     }
 
diff --git a/src/views/gcal-month-view.c b/src/views/gcal-month-view.c
index 31459d2..c6c39c7 100644
--- a/src/views/gcal-month-view.c
+++ b/src/views/gcal-month-view.c
@@ -829,7 +829,7 @@ gcal_month_view_drag_drop (GtkWidget      *widget,
           g_clear_pointer (&new_end, g_date_time_unref);
         }
 
-      gcal_manager_update_event (self->manager, event);
+      gcal_manager_update_event (self->manager, event, E_CAL_OBJ_MOD_THIS);
 
       g_clear_pointer (&new_start, g_date_time_unref);
 
diff --git a/src/views/gcal-week-grid.c b/src/views/gcal-week-grid.c
index 20ddb48..a6d2ca2 100644
--- a/src/views/gcal-week-grid.c
+++ b/src/views/gcal-week-grid.c
@@ -1007,7 +1007,7 @@ gcal_week_grid_drag_drop (GtkWidget      *widget,
   gcal_event_set_date_end (event, new_end);
 
   /* Commit the changes */
-  gcal_manager_update_event (self->manager, event);
+  gcal_manager_update_event (self->manager, event, E_CAL_OBJ_MOD_THIS);
 
   /* Cancel the DnD */
   self->dnd_cell = -1;
diff --git a/src/views/gcal-week-header.c b/src/views/gcal-week-header.c
index d4bdd33..b0fbf90 100644
--- a/src/views/gcal-week-header.c
+++ b/src/views/gcal-week-header.c
@@ -1407,7 +1407,7 @@ gcal_week_header_drag_drop (GtkWidget      *widget,
     gcal_event_set_all_day (event, TRUE);
 
   /* Commit the changes */
-  gcal_manager_update_event (self->manager, event);
+  gcal_manager_update_event (self->manager, event, E_CAL_OBJ_MOD_THIS);
 
   /* Cancel the DnD */
   self->dnd_cell = -1;
diff --git a/src/views/gcal-year-view.c b/src/views/gcal-year-view.c
index 7d8c1f9..bd5effc 100644
--- a/src/views/gcal-year-view.c
+++ b/src/views/gcal-year-view.c
@@ -1512,7 +1512,7 @@ navigator_drag_drop_cb (GcalYearView   *self,
                   g_clear_pointer (&new_end, g_date_time_unref);
                 }
 
-              gcal_manager_update_event (self->manager, event);
+              gcal_manager_update_event (self->manager, event, E_CAL_OBJ_MOD_THIS);
 
               g_clear_pointer (&new_start, g_date_time_unref);
             }


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