[evolution-kolab/account-mgmt: 11/12] kolab_util_calendar_store(): Replace uri argument with ECalBackendSync.



commit daac9ce0e30fae90f1f0e85fa4679b6875962218
Author: Matthew Barnes <mbarnes redhat com>
Date:   Fri Jun 29 09:14:19 2012 -0400

    kolab_util_calendar_store(): Replace uri argument with ECalBackendSync.
    
    The "backend" parameter really only has to be an EBackend.  I made it
    ECalBackendSync just for calling convenience from ECalBackendKolab.
    
    The function calls kolab_util_backend_get_foldername() to obtain the
    Kolab IMAP foldername for the backend, instead of parsing URIs.

 src/calendar/e-cal-backend-kolab.c |   10 +++++-----
 src/calendar/kolab-util-calendar.c |   15 +++++++--------
 src/calendar/kolab-util-calendar.h |    2 +-
 3 files changed, 13 insertions(+), 14 deletions(-)
---
diff --git a/src/calendar/e-cal-backend-kolab.c b/src/calendar/e-cal-backend-kolab.c
index f028cd4..e92a6de 100644
--- a/src/calendar/e-cal-backend-kolab.c
+++ b/src/calendar/e-cal-backend-kolab.c
@@ -988,8 +988,8 @@ e_cal_backend_kolab_create_objects (ECalBackendSync *backend,
 	ok = kolab_util_calendar_store (ecalcomp,
 	                                tzcomp,
 	                                priv->default_zone,
+	                                backend,
 	                                priv->cal_koma,
-	                                priv->cal_uri,
 	                                cancellable,
 	                                &tmp_err);
 	if (! ok) {
@@ -1164,8 +1164,8 @@ e_cal_backend_kolab_modify_objects (ECalBackendSync *backend,
 		ok = kolab_util_calendar_store (newcomp,
 		                                oldtz,
 		                                priv->default_zone,
+		                                backend,
 		                                priv->cal_koma,
-		                                priv->cal_uri,
 		                                cancellable,
 		                                &tmp_err);
 		if (! ok) {
@@ -1192,8 +1192,8 @@ e_cal_backend_kolab_modify_objects (ECalBackendSync *backend,
 	ok = kolab_util_calendar_store (ecalcomp,
 	                                ecaltz,
 	                                priv->default_zone,
+	                                backend,
 	                                priv->cal_koma,
-	                                priv->cal_uri,
 	                                cancellable,
 	                                &tmp_err);
 	if (! ok) {
@@ -1324,8 +1324,8 @@ e_cal_backend_kolab_remove_objects (ECalBackendSync *backend,
 		ok = kolab_util_calendar_store (newcomp,
 		                                oldtz,
 		                                priv->default_zone,
+		                                backend,
 		                                priv->cal_koma,
-		                                priv->cal_uri,
 		                                cancellable,
 		                                &tmp_err);
 		if (oldtz != NULL)
@@ -1486,8 +1486,8 @@ e_cal_backend_kolab_receive_objects (ECalBackendSync *backend,
 	ok = kolab_util_calendar_store (ecalcomp,
 	                                tzcomp,
 	                                priv->default_zone,
+	                                backend,
 	                                priv->cal_koma,
-	                                priv->cal_uri,
 	                                cancellable,
 	                                &tmp_err);
 	if (! ok) {
diff --git a/src/calendar/kolab-util-calendar.c b/src/calendar/kolab-util-calendar.c
index d65a09b..096c7d9 100644
--- a/src/calendar/kolab-util-calendar.c
+++ b/src/calendar/kolab-util-calendar.c
@@ -299,12 +299,12 @@ gboolean
 kolab_util_calendar_store (ECalComponent *ecalcomp,
                            ECalComponent *ecaltz,
                            ECalComponent *default_tz,
+                           ECalBackendSync *backend,
                            KolabMailAccess *koma,
-                           const gchar *uri,
                            GCancellable *cancellable,
                            GError **error)
 {
-	gchar *sourcename = NULL;
+	const gchar *foldername;
 	KolabMailHandle *kmh = NULL;
 	KolabSettingsHandler *ksettings = NULL;
 	KolabMailAccessOpmodeID mode = KOLAB_MAIL_ACCESS_OPMODE_INVAL;
@@ -315,8 +315,8 @@ kolab_util_calendar_store (ECalComponent *ecalcomp,
 	g_assert (E_IS_CAL_COMPONENT (ecalcomp));
 	/* ecaltz may be NULL */
 	(void)default_tz; /* FIXME needed? */ /* default_tz may be NULL */
+	g_assert (E_IS_CAL_BACKEND_SYNC (backend));
 	g_assert (KOLAB_IS_MAIL_ACCESS (koma));
-	g_assert (uri != NULL);
 	/* cancellable may be NULL */
 	g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
 
@@ -326,14 +326,14 @@ kolab_util_calendar_store (ECalComponent *ecalcomp,
 		return FALSE;
 	}
 
-	sourcename = kolab_util_backend_get_relative_path_from_uri (uri);
+	foldername = kolab_util_backend_get_foldername (E_BACKEND (backend));
 
 	kolab_util_backend_modtime_set_on_ecalcomp (ecalcomp);
 	kmh = kolab_mail_handle_new_from_ecalcomponent (ecalcomp,
 	                                                ecaltz);
 	ok =  kolab_mail_access_store_handle (koma,
 	                                      kmh,
-	                                      sourcename,
+	                                      foldername,
 	                                      cancellable,
 	                                      &tmp_err);
 	if (! ok)
@@ -351,14 +351,14 @@ kolab_util_calendar_store (ECalComponent *ecalcomp,
 	}
 
 	do_trigger = kolab_mail_access_source_fbtrigger_needed (koma,
-	                                                        sourcename,
+	                                                        foldername,
 	                                                        &tmp_err);
 	if (tmp_err != NULL)
 		goto cleanup;
 
 	if (do_trigger == TRUE) {
 		(void) kolab_util_calendar_toggle_pfb_trigger (ksettings,
-		                                               sourcename,
+		                                               foldername,
 		                                               &tmp_err);
 		if (tmp_err != NULL) {
 			/* if triggering the XFB generation fails,
@@ -374,7 +374,6 @@ kolab_util_calendar_store (ECalComponent *ecalcomp,
 
  cleanup:
 	g_object_unref (ksettings);
-	g_free (sourcename);
 	if (tmp_err != NULL) {
 		g_propagate_error (error, tmp_err);
 		return FALSE;
diff --git a/src/calendar/kolab-util-calendar.h b/src/calendar/kolab-util-calendar.h
index f0a0940..6d4ab00 100644
--- a/src/calendar/kolab-util-calendar.h
+++ b/src/calendar/kolab-util-calendar.h
@@ -70,8 +70,8 @@ gboolean
 kolab_util_calendar_store (ECalComponent *ecalcomp,
                            ECalComponent *ecaltz,
                            ECalComponent *default_tz,
+                           ECalBackendSync *backend,
                            KolabMailAccess *koma,
-                           const gchar *uri,
                            GCancellable *cancellable,
                            GError **error);
 



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