[evolution-ews] Use e_book_backend_foreach_view for notifying status messages to all the views.
- From: Chenthill Palanisamy <pchen src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-ews] Use e_book_backend_foreach_view for notifying status messages to all the views.
- Date: Fri, 9 Mar 2012 11:35:55 +0000 (UTC)
commit af615e835ea23b4fab7631bd98b48d71b22725f1
Author: Chenthill Palanisamy <pchenthill novell com>
Date: Thu Feb 23 19:09:38 2012 +0530
Use e_book_backend_foreach_view for notifying status messages to all the views.
src/addressbook/Makefile.am | 2 -
src/addressbook/e-book-backend-ews-utils.c | 72 ----------------------------
src/addressbook/e-book-backend-ews-utils.h | 25 ----------
src/addressbook/e-book-backend-ews.c | 35 +++++++-------
4 files changed, 17 insertions(+), 117 deletions(-)
---
diff --git a/src/addressbook/Makefile.am b/src/addressbook/Makefile.am
index 0393296..5b850c2 100644
--- a/src/addressbook/Makefile.am
+++ b/src/addressbook/Makefile.am
@@ -19,8 +19,6 @@ libebookbackendews_la_CPPFLAGS = \
libebookbackendews_la_SOURCES = \
e-book-backend-sqlitedb.c \
e-book-backend-sqlitedb.h \
- e-book-backend-ews-utils.c \
- e-book-backend-ews-utils.h \
ews-oab-props.h \
ews-oab-decoder.c \
ews-oab-decoder.h \
diff --git a/src/addressbook/e-book-backend-ews.c b/src/addressbook/e-book-backend-ews.c
index 5cc68dd..0dabf3b 100644
--- a/src/addressbook/e-book-backend-ews.c
+++ b/src/addressbook/e-book-backend-ews.c
@@ -46,7 +46,6 @@
#include "libedata-book/e-data-book-view.h"
#include "e-book-backend-ews.h"
#include "e-book-backend-sqlitedb.h"
-#include "e-book-backend-ews-utils.h"
#include "lzx/ews-oal-decompress.h"
#include "ews-oab-decoder.h"
#include "e-ews-item-change.h"
@@ -156,6 +155,19 @@ ews_remove_attachments (const gchar *attachment_dir)
return TRUE;
}
+static gboolean
+book_view_notify_status (EDataBookView *view,
+ gpointer user_data)
+{
+ const gchar *status = (const gchar *) user_data;
+
+ if (!view)
+ return TRUE;
+ e_data_book_view_notify_progress (view, -1, status);
+
+ return TRUE;
+}
+
static const struct phone_field_mapping {
EContactField field;
const gchar *element;
@@ -1658,13 +1670,12 @@ ews_gal_store_contact (EContact *contact,
if (data->collected_length == 1000 || percent >= 100) {
GSList *l;
gchar *status_message = NULL;
- EDataBookView *book_view = e_book_backend_ews_utils_get_book_view (E_BOOK_BACKEND (data->cbews));
d(g_print ("GAL adding contacts, percent complete : %d \n", percent);)
status_message = g_strdup_printf (_("Downloading contacts in %s %d%% completed... "), priv->folder_name, percent);
- if (book_view)
- e_data_book_view_notify_progress (book_view, -1, status_message);
+ e_book_backend_foreach_view (E_BOOK_BACKEND (data->cbews), book_view_notify_status, status_message);
+ g_free (status_message);
data->contact_collector = g_slist_reverse (data->contact_collector);
e_book_backend_sqlitedb_add_contacts (priv->ebsdb, priv->folder_id, data->contact_collector, FALSE, error);
@@ -1672,10 +1683,6 @@ ews_gal_store_contact (EContact *contact,
for (l = data->contact_collector; l != NULL; l = g_slist_next (l))
e_book_backend_notify_update (E_BOOK_BACKEND (data->cbews), E_CONTACT (l->data));
- /* reset data */
- if (book_view)
- e_data_book_view_unref (book_view);
- g_free (status_message);
g_slist_foreach (data->contact_collector, (GFunc) g_object_unref, NULL);
g_slist_free (data->contact_collector);
data->contact_collector = NULL;
@@ -2151,15 +2158,13 @@ ebews_start_sync (gpointer data)
gchar *sync_state, *status_message = NULL;
gboolean includes_last_item;
GError *error = NULL;
- EDataBookView *book_view;
ebews = (EBookBackendEws *) data;
priv = ebews->priv;
status_message = g_strdup (_("Syncing contacts..."));
- book_view = e_book_backend_ews_utils_get_book_view (E_BOOK_BACKEND (ebews));
- if (book_view)
- e_data_book_view_notify_progress (book_view, -1, status_message);
+ e_book_backend_foreach_view (E_BOOK_BACKEND (ebews), book_view_notify_status, status_message);
+ g_free (status_message);
sync_state = e_book_backend_sqlitedb_get_sync_data (priv->ebsdb, priv->folder_id, NULL);
do
@@ -2201,16 +2206,10 @@ ebews_start_sync (gpointer data)
e_book_backend_sqlitedb_set_sync_data (priv->ebsdb, priv->folder_id, sync_state, &error);
} while (!error && !includes_last_item);
- if (book_view) {
- e_data_book_view_notify_complete (book_view, error);
- e_data_book_view_unref (book_view);
- }
-
if (!error)
e_book_backend_sqlitedb_set_is_populated (priv->ebsdb, priv->folder_id, TRUE, &error);
g_free (sync_state);
- g_free (status_message);
if (error) {
g_warning ("Error Syncing Contacts: Folder %s Error: %s", priv->folder_id, error->message);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]