[evolution-data-server/openismus-work: 8/10] Avoid sending the initial notifications if not flagged to from the file backend.



commit 92dc0ae2d82dc238e00e204bb66fa739e8233ac9
Author: Tristan Van Berkom <tristan van berkom gmail com>
Date:   Thu Jun 16 19:30:48 2011 +0900

    Avoid sending the initial notifications if not flagged to from the file backend.
    
    When starting a view for the file backend, check if the whole content needs
    to be sent to the client via the E_BOOK_VIEW_NOTIFY_INITIAL flag, if
    not flagged to notify then just notify the view is complete and return.

 addressbook/backends/file/e-book-backend-file.c |   17 +++++++++++++----
 1 files changed, 13 insertions(+), 4 deletions(-)
---
diff --git a/addressbook/backends/file/e-book-backend-file.c b/addressbook/backends/file/e-book-backend-file.c
index a65e126..efb7047 100644
--- a/addressbook/backends/file/e-book-backend-file.c
+++ b/addressbook/backends/file/e-book-backend-file.c
@@ -803,12 +803,21 @@ static void
 e_book_backend_file_start_book_view (EBookBackend  *backend,
 				     EDataBookView *book_view)
 {
-	FileBackendSearchClosure *closure = init_closure (book_view, E_BOOK_BACKEND_FILE (backend));
+	FileBackendSearchClosure *closure;
+	EBookViewFlags            flags;
+
+	/* Start a thread and send all the initial notifications if appropriate */
+	flags = e_data_book_view_get_flags (book_view);
+	if ((flags & E_BOOK_VIEW_NOTIFY_INITIAL) != 0) {
+		d(printf ("starting book view thread\n"));
 
-	d(printf ("starting book view thread\n"));
-	closure->thread = g_thread_create (book_view_thread, book_view, TRUE, NULL);
+		closure = init_closure (book_view, E_BOOK_BACKEND_FILE (backend));
+		closure->thread = g_thread_create (book_view_thread, book_view, TRUE, NULL);
 
-	e_flag_wait (closure->running);
+		e_flag_wait (closure->running);
+	}
+	else
+		e_data_book_view_notify_complete (book_view, NULL /* Success */);
 
 	/* at this point we know the book view thread is actually running */
 	d(printf ("returning from start_book_view\n"));



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