[evolution-mapi] Use EDS_DISABLE_DEPRECATED for --enable-strict.
- From: Matthew Barnes <mbarnes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-mapi] Use EDS_DISABLE_DEPRECATED for --enable-strict.
- Date: Wed, 28 Nov 2012 22:39:51 +0000 (UTC)
commit dc6429fc9f76e5242366a0b1c172bc61ca86829d
Author: Matthew Barnes <mbarnes redhat com>
Date: Wed Nov 28 17:13:10 2012 -0500
Use EDS_DISABLE_DEPRECATED for --enable-strict.
E_BOOK_DISABLE_DEPRECATED and E_CAL_DISABLE_DEPRECATED are obsolete.
Also fix resulting build breakage from using deprecated E-D-S APIs.
configure.ac | 2 +-
src/addressbook/e-book-backend-mapi.c | 52 +++++++++++------------
src/addressbook/e-book-backend-mapi.h | 1 -
src/calendar/e-cal-backend-mapi.c | 72 ++++++++++++++++-----------------
4 files changed, 61 insertions(+), 66 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index fcb4c69..e4d0dc7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -100,7 +100,7 @@ fi
AC_MSG_RESULT([$enable_strict])
if test "x$enable_strict" = xyes; then
- CFLAGS="$CFLAGS -DG_DISABLE_DEPRECATED -DE_BOOK_DISABLE_DEPRECATED -DE_CAL_DISABLE_DEPRECATED"
+ CFLAGS="$CFLAGS -DG_DISABLE_DEPRECATED -DEDS_DISABLE_DEPRECATED"
fi
dnl Warn about GLib/GTK+ API usage that violates our minimum requirements.
diff --git a/src/addressbook/e-book-backend-mapi.c b/src/addressbook/e-book-backend-mapi.c
index f65675a..8ef0cfe 100644
--- a/src/addressbook/e-book-backend-mapi.c
+++ b/src/addressbook/e-book-backend-mapi.c
@@ -111,47 +111,41 @@ get_current_time_ms (void)
return tv.tv_sec * 1000 + tv.tv_usec / 1000;
}
-static gboolean
-pick_view_cb (EDataBookView *view, gpointer user_data)
-{
- EDataBookView **pick = user_data;
-
- g_return_val_if_fail (user_data != NULL, FALSE);
-
- /* just always use the first book view */
- *pick = view;
- return view == NULL;
-}
-
static EDataBookView *
ebbm_pick_book_view (EBookBackendMAPI *ebma)
{
EDataBookView *pick = NULL;
+ GList *list;
+
+ list = e_book_backend_list_views (E_BOOK_BACKEND (ebma));
- e_book_backend_foreach_view (E_BOOK_BACKEND (ebma), pick_view_cb, &pick);
+ if (list != NULL) {
+ /* Note we return a new reference. */
+ pick = g_object_ref (list->data);
+ }
+
+ g_list_free_full (list, (GDestroyNotify) g_object_unref);
return pick;
}
-static gboolean
-complete_view_cb (EDataBookView *view, gpointer user_data)
+static void
+complete_views (EBookBackendMAPI *ebma)
{
- EBookBackendMAPI *ebma = user_data;
+ GList *list, *link;
- g_return_val_if_fail (ebma != NULL, FALSE);
+ list = e_book_backend_list_views (E_BOOK_BACKEND (ebma));
- if (e_book_backend_mapi_book_view_is_running (ebma, view))
- e_book_backend_mapi_update_view_by_cache (ebma, view, NULL);
+ for (link = list; link != NULL; link = g_list_next (link)) {
+ EDataBookView *view = E_DATA_BOOK_VIEW (link->data);
- e_data_book_view_notify_complete (view, NULL);
+ if (e_book_backend_mapi_book_view_is_running (ebma, view))
+ e_book_backend_mapi_update_view_by_cache (ebma, view, NULL);
- return TRUE;
-}
+ e_data_book_view_notify_complete (view, NULL);
+ }
-static void
-complete_views (EBookBackendMAPI *ebma)
-{
- e_book_backend_foreach_view (E_BOOK_BACKEND (ebma), complete_view_cb, ebma);
+ g_list_free_full (list, (GDestroyNotify) g_object_unref);
}
static void
@@ -1557,8 +1551,10 @@ e_book_backend_mapi_notify_contact_update (EBookBackendMAPI *ebma,
book_view = ebbm_pick_book_view (ebma);
if (book_view) {
- if (!e_book_backend_mapi_book_view_is_running (ebma, book_view))
+ if (!e_book_backend_mapi_book_view_is_running (ebma, book_view)) {
+ g_object_unref (book_view);
return FALSE;
+ }
if (index > 0 && last_notification && current_time - *last_notification > 333) {
gchar *status_msg = NULL;
@@ -1574,6 +1570,8 @@ e_book_backend_mapi_notify_contact_update (EBookBackendMAPI *ebma,
*last_notification = current_time;
}
+
+ g_object_unref (book_view);
}
if (!pbook_view && g_cancellable_is_cancelled (priv->update_cache))
diff --git a/src/addressbook/e-book-backend-mapi.h b/src/addressbook/e-book-backend-mapi.h
index f5d232b..5751e32 100644
--- a/src/addressbook/e-book-backend-mapi.h
+++ b/src/addressbook/e-book-backend-mapi.h
@@ -66,7 +66,6 @@ typedef struct
void (*op_modify_contacts) (EBookBackendMAPI *ebma, GCancellable *cancellable, const GSList *vcards, GSList **modified_contacts, GError **error);
void (*op_get_contact) (EBookBackendMAPI *ebma, GCancellable *cancellable, const gchar *id, gchar **vcard, GError **error);
void (*op_get_contact_list) (EBookBackendMAPI *ebma, GCancellable *cancellable, const gchar *query, GSList **vCards, GError **error);
- void (*op_authenticate_user) (EBookBackendMAPI *ebma, GCancellable *cancellable, ECredentials *credentials, GError **error);
/* called when online state changes on the backend */
void (*op_connection_status_changed) (EBookBackendMAPI *ebma, gboolean is_online);
diff --git a/src/calendar/e-cal-backend-mapi.c b/src/calendar/e-cal-backend-mapi.c
index 9a61b18..1965bb6 100644
--- a/src/calendar/e-cal-backend-mapi.c
+++ b/src/calendar/e-cal-backend-mapi.c
@@ -398,64 +398,62 @@ get_element_type (icalcomponent_kind kind)
}
#endif
-struct EMAPIProgressData
-{
- gint percent;
- const gchar *msg;
-};
-
-static gboolean
-view_progress_cb (EDataCalView *view, gpointer user_data)
-{
- struct EMAPIProgressData *pd = user_data;
-
- g_return_val_if_fail (pd != NULL, FALSE);
-
- if (!e_data_cal_view_is_completed (view) && !e_data_cal_view_is_stopped (view))
- e_data_cal_view_notify_progress (view, pd->percent, pd->msg);
-
- /* continue with the next */
- return TRUE;
-}
-
static void
notify_view_progress (ECalBackendMAPI *cbmapi, guint index, guint total)
{
- struct EMAPIProgressData pd = { 0 };
+ GList *list, *link;
gchar *progress_string;
+ gint percent = -1;
if (total > 0)
- pd.percent = index * 100 / total;
- else
- pd.percent = -1;
+ percent = index * 100 / total;
- if (pd.percent > 100)
- pd.percent = 99;
+ if (percent > 100)
+ percent = 99;
/* To translators: This message is displayed on the status bar when calendar/tasks/memo items are being fetched from the server. */
progress_string = g_strdup_printf (_("Loading items in folder %s"),
e_source_get_display_name (e_backend_get_source (E_BACKEND (cbmapi))));
- pd.msg = progress_string;
+ list = e_cal_backend_list_views (E_CAL_BACKEND (cbmapi));
- e_cal_backend_foreach_view (E_CAL_BACKEND (cbmapi), view_progress_cb, &pd);
+ for (link = list; link != NULL; link = g_list_next (link)) {
+ EDataCalView *view = E_DATA_CAL_VIEW (link->data);
- g_free (progress_string);
-}
+ if (e_data_cal_view_is_completed (view))
+ continue;
-static gboolean
-view_completed_cb (EDataCalView *view, gpointer user_data)
-{
- if (!e_data_cal_view_is_completed (view) && !e_data_cal_view_is_stopped (view))
- e_data_cal_view_notify_complete (view, NULL);
+ if (e_data_cal_view_is_stopped (view))
+ continue;
- return TRUE;
+ e_data_cal_view_notify_progress (view, percent, progress_string);
+ }
+
+ g_list_free_full (list, (GDestroyNotify) g_object_unref);
+
+ g_free (progress_string);
}
static void
notify_view_completed (ECalBackendMAPI *cbmapi)
{
- e_cal_backend_foreach_view (E_CAL_BACKEND (cbmapi), view_completed_cb, NULL);
+ GList *list, *link;
+
+ list = e_cal_backend_list_views (E_CAL_BACKEND (cbmapi));
+
+ for (link = list; link != NULL; link = g_list_next (link)) {
+ EDataCalView *view = E_DATA_CAL_VIEW (link->data);
+
+ if (e_data_cal_view_is_completed (view))
+ continue;
+
+ if (e_data_cal_view_is_stopped (view))
+ continue;
+
+ e_data_cal_view_notify_complete (view, NULL);
+ }
+
+ g_list_free_full (list, (GDestroyNotify) g_object_unref);
}
static icaltimezone *
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]