[evolution-kolab/ek-wip-porting] E<Cal|Book>BackendKolab: completed previous commit (fixes #672631)



commit 80fc286cd4fd93e25f0548dda2da2b98c990edd6
Author: Christian Hilberg <hilberg kernelconcepts de>
Date:   Thu Mar 22 18:34:01 2012 +0100

    E<Cal|Book>BackendKolab: completed previous commit (fixes #672631)
    
    * keeping a local list of active views is
      as problematic as it is unneeded
    * removed

 src/addressbook/e-book-backend-kolab.c |   34 +++---------------------------
 src/calendar/e-cal-backend-kolab.c     |   35 +++----------------------------
 2 files changed, 8 insertions(+), 61 deletions(-)
---
diff --git a/src/addressbook/e-book-backend-kolab.c b/src/addressbook/e-book-backend-kolab.c
index 2fa8b25..a3b8765 100644
--- a/src/addressbook/e-book-backend-kolab.c
+++ b/src/addressbook/e-book-backend-kolab.c
@@ -52,7 +52,6 @@
 
 static GHashTable *koma_objects = NULL;
 static GMutex *koma_objects_lock = NULL;
-static GHashTable *active_book_views = NULL;
 static GMutex *active_book_views_lock = NULL;
 
 /*----------------------------------------------------------------------------*/
@@ -1074,7 +1073,6 @@ e_book_backend_kolab_start_book_view (EBookBackend *backend,
 	gboolean ok = FALSE;
 	GError *tmp_err = NULL;
 	GError *notify_err = NULL;
-	EDataBookView *bv = NULL;
 
 	g_return_if_fail (E_IS_BOOK_BACKEND_KOLAB (backend));
 	g_return_if_fail (E_IS_DATA_BOOK_VIEW (book_view));
@@ -1084,17 +1082,7 @@ e_book_backend_kolab_start_book_view (EBookBackend *backend,
 
 	g_mutex_lock (active_book_views_lock);
 
-	bv = g_hash_table_lookup (active_book_views, book_view);
-	if (bv != NULL) {
-		g_warning ("%s()[%u] book view already active!",
-		           __func__, __LINE__);
-		goto exit;
-	}
-
-	g_object_ref (book_view);
-	g_hash_table_insert (active_book_views,
-	                     book_view,
-	                     NULL);
+	g_object_ref (book_view); /* unref()d in stop_view() */
 
 	query = e_data_book_view_get_card_query (book_view);
 
@@ -1159,17 +1147,10 @@ e_book_backend_kolab_stop_book_view (EBookBackend *backend,
 
 	g_mutex_lock (active_book_views_lock);
 
-	bv = g_hash_table_lookup (active_book_views, book_view);
-	if (bv == NULL) {
-		g_warning ("%s()[%u] book view already stopped!",
-		           __func__, __LINE__);
-		goto exit;
-	}
-
 	e_data_book_view_notify_complete (book_view, NULL);
-	g_hash_table_remove (active_book_views, book_view);
 
- exit:
+	g_object_unref (book_view); /* ref()d in start_view() */
+
 	g_mutex_unlock (active_book_views_lock);
 }
 
@@ -1203,18 +1184,11 @@ e_book_backend_kolab_init (EBookBackendKolab *backend)
 		                                      g_object_unref);
 	g_mutex_unlock (koma_objects_lock);
 	/* active cal views are shared in the same way,
-	 * so we do the housekeeping for them analogous
+	 * so we do the locking for them analogous
 	 * to the KolabMailAccess instances
 	 */
 	if (active_book_views_lock == NULL)
 		active_book_views_lock = g_mutex_new ();
-	g_mutex_lock (active_book_views_lock);
-	if (active_book_views == NULL)
-		active_book_views = g_hash_table_new_full (g_direct_hash,
-		                                           g_direct_equal,
-		                                           g_object_unref,
-		                                           NULL);
-	g_mutex_unlock (active_book_views_lock);
 
 	g_debug ("%s()[%u] called.", __func__, __LINE__);
 
diff --git a/src/calendar/e-cal-backend-kolab.c b/src/calendar/e-cal-backend-kolab.c
index 61937b7..188fc6a 100644
--- a/src/calendar/e-cal-backend-kolab.c
+++ b/src/calendar/e-cal-backend-kolab.c
@@ -52,7 +52,6 @@
 
 static GHashTable *koma_objects = NULL;
 static GMutex *koma_objects_lock = NULL;
-static GHashTable *active_cal_views = NULL;
 static GMutex *active_cal_views_lock = NULL;
 
 /*----------------------------------------------------------------------------*/
@@ -1732,7 +1731,6 @@ e_cal_backend_kolab_start_view (ECalBackend *backend,
 {
 	ECalBackendKolab *self = NULL;
 	ECalBackendKolabPrivate *priv = NULL;
-	EDataCalView *cv = NULL;
 	GList *uid_list = NULL;
 	GList *it = NULL;
 	GSList *iCal_objects = NULL;
@@ -1750,17 +1748,7 @@ e_cal_backend_kolab_start_view (ECalBackend *backend,
 
 	g_mutex_lock (active_cal_views_lock);
 
-	cv = g_hash_table_lookup (active_cal_views, view);
-	if (cv != NULL) {
-		g_warning ("%s()[%u] cal view already active!",
-		           __func__, __LINE__);
-		goto exit;
-	}
-
-	g_object_ref (view);
-	g_hash_table_insert (active_cal_views,
-	                     view,
-	                     NULL);
+	g_object_ref (view); /* unref()d in stop_view() */
 
 	query = e_data_cal_view_get_text (view);
 
@@ -1844,7 +1832,6 @@ e_cal_backend_kolab_stop_view (ECalBackend *backend,
 {
 	ECalBackendKolab *self = NULL;
 	ECalBackendKolabPrivate *priv = NULL;
-	EDataCalView *cv = NULL;
 
 	g_return_if_fail (E_IS_CAL_BACKEND_KOLAB (backend));
 	g_return_if_fail (E_IS_DATA_CAL_VIEW (view));
@@ -1854,17 +1841,10 @@ e_cal_backend_kolab_stop_view (ECalBackend *backend,
 
 	g_mutex_lock (active_cal_views_lock);
 
-	cv = g_hash_table_lookup (active_cal_views, view);
-	if (cv == NULL) {
-		g_warning ("%s()[%u] cal view already stopped!",
-		           __func__, __LINE__);
-		goto exit;
-	}
-
 	e_data_cal_view_notify_complete (view, NULL);
-	g_hash_table_remove (active_cal_views, view);
 
- exit:
+	g_object_unref (view); /* ref()d in start_view() */
+
 	g_mutex_unlock (active_cal_views_lock);
 }
 
@@ -1917,18 +1897,11 @@ e_cal_backend_kolab_init (ECalBackendKolab *backend)
 		                                      g_object_unref);
 	g_mutex_unlock (koma_objects_lock);
 	/* active cal views are shared in the same way,
-	 * so we do the housekeeping for them analogous
+	 * so we do the locking for them analogous
 	 * to the KolabMailAccess instances
 	 */
 	if (active_cal_views_lock == NULL)
 		active_cal_views_lock = g_mutex_new ();
-	g_mutex_lock (active_cal_views_lock);
-	if (active_cal_views == NULL)
-		active_cal_views = g_hash_table_new_full (g_direct_hash,
-		                                          g_direct_equal,
-		                                          g_object_unref,
-		                                          NULL);
-	g_mutex_unlock (active_cal_views_lock);
 
 	g_debug ("%s()[%u] called.", __func__, __LINE__);
 



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