This commit is contained in:
Matthew Barnes 2011-07-04 17:30:49 -04:00
parent 68a07b0fef
commit 9b3c552d00
4 changed files with 25 additions and 294 deletions

1
.gitignore vendored
View File

@ -14,3 +14,4 @@ evolution-data-server-2.31.5.tar.bz2
/evolution-data-server-3.0.0.tar.bz2
/evolution-data-server-3.1.1.tar.bz2
/evolution-data-server-3.1.2.tar.bz2
/evolution-data-server-3.1.3.tar.bz2

View File

@ -1,273 +0,0 @@
diff --git a/addressbook/backends/google/e-book-backend-google.c b/addressbook/backends/google/e-book-backend-google.c
index 4f1804e..441100d 100644
--- a/addressbook/backends/google/e-book-backend-google.c
+++ b/addressbook/backends/google/e-book-backend-google.c
@@ -71,6 +71,9 @@ struct _EBookBackendGooglePrivate {
/* Time when the groups were last queried */
GTimeVal last_groups_update;
+ #ifdef HAVE_LIBGDATA_0_9
+ GDataAuthorizer *authorizer;
+ #endif
GDataService *service;
EProxy *proxy;
guint refresh_interval;
@@ -570,7 +573,11 @@ get_new_contacts (EBookBackend *backend)
GCancellable *cancellable;
__debug__ (G_STRFUNC);
+ #ifdef HAVE_LIBGDATA_0_9
+ g_return_if_fail (priv->service && gdata_service_is_authorized (priv->service));
+ #else
g_return_if_fail (priv->service && gdata_service_is_authenticated (priv->service));
+ #endif
/* Sort out update times */
last_updated = cache_get_last_update (backend);
@@ -696,7 +703,11 @@ get_groups (EBookBackend *backend)
GCancellable *cancellable;
__debug__ (G_STRFUNC);
+ #ifdef HAVE_LIBGDATA_0_9
+ g_return_if_fail (priv->service && gdata_service_is_authorized (priv->service));
+ #else
g_return_if_fail (priv->service && gdata_service_is_authenticated (priv->service));
+ #endif
/* Build our query */
query = GDATA_QUERY (gdata_contacts_query_new_with_limits (NULL, 0, G_MAXINT));
@@ -770,7 +781,11 @@ cache_refresh_if_needed (EBookBackend *backend)
__debug__ (G_STRFUNC);
+ #ifdef HAVE_LIBGDATA_0_9
+ if (!priv->is_online || !priv->service || !gdata_service_is_authorized (priv->service)) {
+ #else
if (!priv->is_online || !priv->service || !gdata_service_is_authenticated (priv->service)) {
+ #endif
__debug__ ("We are not connected to Google%s.", (!priv->is_online) ? " (offline mode)" : "");
return TRUE;
}
@@ -871,7 +886,11 @@ e_book_backend_google_create_contact (EBookBackend *backend, EDataBook *book, gu
return;
}
+ #ifdef HAVE_LIBGDATA_0_9
+ g_return_if_fail (priv->service && gdata_service_is_authorized (priv->service));
+ #else
g_return_if_fail (priv->service && gdata_service_is_authenticated (priv->service));
+ #endif
/* Build the GDataEntry from the vCard */
contact = e_contact_new_from_vcard (vcard_str);
@@ -953,7 +972,11 @@ e_book_backend_google_remove_contacts (EBookBackend *backend, EDataBook *book, g
return;
}
+ #ifdef HAVE_LIBGDATA_0_9
+ g_return_if_fail (priv->service && gdata_service_is_authorized (priv->service));
+ #else
g_return_if_fail (priv->service && gdata_service_is_authenticated (priv->service));
+ #endif
/* We make the assumption that the ID list we're passed is always exactly one element long, since we haven't specified "bulk-removes"
* in our static capability list. This simplifies a lot of the logic, especially around asynchronous results. */
@@ -982,7 +1005,12 @@ e_book_backend_google_remove_contacts (EBookBackend *backend, EDataBook *book, g
data->uid = g_strdup (uid);
cancellable = start_operation (backend, opid, cancellable, _("Deleting contact…"));
+ #ifdef HAVE_LIBGDATA_0_9
+ gdata_service_delete_entry_async (GDATA_SERVICE (priv->service), gdata_contacts_service_get_primary_authorization_domain (),
+ entry, cancellable, (GAsyncReadyCallback) remove_contact_cb, data);
+ #else
gdata_service_delete_entry_async (GDATA_SERVICE (priv->service), entry, cancellable, (GAsyncReadyCallback) remove_contact_cb, data);
+ #endif
g_object_unref (cancellable);
g_object_unref (entry);
}
@@ -1052,7 +1080,11 @@ e_book_backend_google_modify_contact (EBookBackend *backend, EDataBook *book, gu
return;
}
+ #ifdef HAVE_LIBGDATA_0_9
+ g_return_if_fail (priv->service && gdata_service_is_authorized (priv->service));
+ #else
g_return_if_fail (priv->service && gdata_service_is_authenticated (priv->service));
+ #endif
/* Get the new contact and its UID */
contact = e_contact_new_from_vcard (vcard_str);
@@ -1089,7 +1121,12 @@ e_book_backend_google_modify_contact (EBookBackend *backend, EDataBook *book, gu
data->opid = opid;
cancellable = start_operation (backend, opid, cancellable, _("Modifying contact…"));
+ #ifdef HAVE_LIBGDATA_0_9
+ gdata_service_update_entry_async (GDATA_SERVICE (priv->service), gdata_contacts_service_get_primary_authorization_domain (),
+ entry, cancellable, (GAsyncReadyCallback) modify_contact_cb, data);
+ #else
gdata_service_update_entry_async (GDATA_SERVICE (priv->service), entry, cancellable, (GAsyncReadyCallback) modify_contact_cb, data);
+ #endif
g_object_unref (cancellable);
g_object_unref (entry);
}
@@ -1237,7 +1274,11 @@ e_book_backend_google_start_book_view (EBookBackend *backend, EDataBookView *boo
/* Update the cache if necessary */
if (cache_needs_update (backend, NULL)) {
+ #ifdef HAVE_LIBGDATA_0_9
+ if (!priv->service || !gdata_service_is_authorized (priv->service)) {
+ #else
if (!priv->service || !gdata_service_is_authenticated (priv->service)) {
+ #endif
/* We need authorization first */
e_book_backend_notify_auth_required (backend, TRUE, NULL);
} else {
@@ -1306,7 +1347,11 @@ typedef struct {
} AuthenticateUserData;
static void
+#ifdef HAVE_LIBGDATA_0_9
+authenticate_user_cb (GDataClientLoginAuthorizer *authorizer, GAsyncResult *result, AuthenticateUserData *data)
+#else
authenticate_user_cb (GDataService *service, GAsyncResult *result, AuthenticateUserData *data)
+#endif
{
GError *gdata_error = NULL;
GError *book_error = NULL;
@@ -1314,7 +1359,11 @@ authenticate_user_cb (GDataService *service, GAsyncResult *result, AuthenticateU
__debug__ (G_STRFUNC);
/* Finish authenticating */
+ #ifdef HAVE_LIBGDATA_0_9
+ if (!gdata_client_login_authorizer_authenticate_finish (authorizer, result, &gdata_error)) {
+ #else
if (!gdata_service_authenticate_finish (service, result, &gdata_error)) {
+ #endif
data_book_error_from_gdata_error (&book_error, gdata_error);
__debug__ ("Authentication failed: %s", gdata_error->message);
g_error_free (gdata_error);
@@ -1344,7 +1393,11 @@ e_book_backend_google_authenticate_user (EBookBackend *backend, GCancellable *ca
return;
}
+ #ifdef HAVE_LIBGDATA_0_9
+ if (priv->service && gdata_service_is_authorized (priv->service)) {
+ #else
if (priv->service && gdata_service_is_authenticated (priv->service)) {
+ #endif
g_warning ("Connection to Google already established.");
e_book_backend_notify_readonly (backend, FALSE);
e_book_backend_notify_opened (backend, NULL);
@@ -1356,9 +1409,17 @@ e_book_backend_google_authenticate_user (EBookBackend *backend, GCancellable *ca
return;
}
+ #ifdef HAVE_LIBGDATA_0_9
+ /* Set up the service, authorizer and proxy */
+ if (!priv->service) {
+ priv->authorizer = GDATA_AUTHORIZER (gdata_client_login_authorizer_new ("evolution-client-0.1.0", GDATA_TYPE_CONTACTS_SERVICE));
+ priv->service = GDATA_SERVICE (gdata_contacts_service_new (priv->authorizer));
+ }
+ #else
/* Set up the service and proxy */
if (!priv->service)
priv->service = GDATA_SERVICE (gdata_contacts_service_new ("evolution-client-0.1.0"));
+ #endif
if (!priv->proxy) {
priv->proxy = e_proxy_new ();
@@ -1378,7 +1439,14 @@ e_book_backend_google_authenticate_user (EBookBackend *backend, GCancellable *ca
data->opid = opid;
cancellable = start_operation (backend, opid, cancellable, _("Authenticating with the server…"));
+ #ifdef HAVE_LIBGDATA_0_9
+ gdata_client_login_authorizer_authenticate_async (GDATA_CLIENT_LOGIN_AUTHORIZER (priv->authorizer),
+ e_credentials_peek (credentials, E_CREDENTIALS_KEY_USERNAME),
+ e_credentials_peek (credentials, E_CREDENTIALS_KEY_PASSWORD),
+ cancellable, (GAsyncReadyCallback) authenticate_user_cb, data);
+ #else
gdata_service_authenticate_async (priv->service, e_credentials_peek (credentials, E_CREDENTIALS_KEY_USERNAME), e_credentials_peek (credentials, E_CREDENTIALS_KEY_PASSWORD), cancellable, (GAsyncReadyCallback) authenticate_user_cb, data);
+ #endif
g_object_unref (cancellable);
}
@@ -1644,6 +1712,12 @@ e_book_backend_google_set_online (EBookBackend *backend, gboolean is_online)
g_object_unref (priv->service);
priv->service = NULL;
+ #ifdef HAVE_LIBGDATA_0_9
+ if (priv->authorizer != NULL)
+ g_object_unref (priv->authorizer);
+ priv->authorizer = NULL;
+ #endif
+
if (priv->proxy)
g_object_unref (priv->proxy);
priv->proxy = NULL;
@@ -1674,6 +1748,12 @@ e_book_backend_google_dispose (GObject *object)
g_object_unref (priv->service);
priv->service = NULL;
+ #ifdef HAVE_LIBGDATA_0_9
+ if (priv->authorizer != NULL)
+ g_object_unref (priv->authorizer);
+ priv->authorizer = NULL;
+ #endif
+
if (priv->proxy)
g_object_unref (priv->proxy);
priv->proxy = NULL;
@@ -1757,20 +1837,40 @@ data_book_error_from_gdata_error (GError **dest_err, GError *error)
/* only last error is used */
g_clear_error (dest_err);
+ #ifdef HAVE_LIBGDATA_0_9
+ if (error->domain == GDATA_CLIENT_LOGIN_AUTHORIZER_ERROR) {
+ #else
if (error->domain == GDATA_AUTHENTICATION_ERROR) {
+ #endif
/* Authentication errors */
switch (error->code) {
+ #ifdef HAVE_LIBGDATA_0_9
+ case GDATA_CLIENT_LOGIN_AUTHORIZER_ERROR_BAD_AUTHENTICATION:
+ #else
case GDATA_AUTHENTICATION_ERROR_BAD_AUTHENTICATION:
+ #endif
g_propagate_error (dest_err, EDB_ERROR (AUTHENTICATION_FAILED));
return;
+ #ifdef HAVE_LIBGDATA_0_9
+ case GDATA_CLIENT_LOGIN_AUTHORIZER_ERROR_NOT_VERIFIED:
+ case GDATA_CLIENT_LOGIN_AUTHORIZER_ERROR_TERMS_NOT_AGREED:
+ case GDATA_CLIENT_LOGIN_AUTHORIZER_ERROR_CAPTCHA_REQUIRED:
+ case GDATA_CLIENT_LOGIN_AUTHORIZER_ERROR_ACCOUNT_DELETED:
+ case GDATA_CLIENT_LOGIN_AUTHORIZER_ERROR_ACCOUNT_DISABLED:
+ #else
case GDATA_AUTHENTICATION_ERROR_NOT_VERIFIED:
case GDATA_AUTHENTICATION_ERROR_TERMS_NOT_AGREED:
case GDATA_AUTHENTICATION_ERROR_CAPTCHA_REQUIRED:
case GDATA_AUTHENTICATION_ERROR_ACCOUNT_DELETED:
case GDATA_AUTHENTICATION_ERROR_ACCOUNT_DISABLED:
+ #endif
g_propagate_error (dest_err, EDB_ERROR (PERMISSION_DENIED));
return;
+ #ifdef HAVE_LIBGDATA_0_9
+ case GDATA_CLIENT_LOGIN_AUTHORIZER_ERROR_SERVICE_DISABLED:
+ #else
case GDATA_AUTHENTICATION_ERROR_SERVICE_DISABLED:
+ #endif
g_propagate_error (dest_err, EDB_ERROR (REPOSITORY_OFFLINE));
return;
default:
diff --git a/configure.ac b/configure.ac
index cd3d8d4..9b3f341 100644
--- a/configure.ac
+++ b/configure.ac
@@ -339,7 +339,7 @@ PKG_CHECK_MODULES(GNOME_PLATFORM,
libgdata >= libgdata_minimum_version])
if `$PKG_CONFIG --atleast-version=0.9 libgdata`; then
- AC_MSG_ERROR([libgdata-0.9 is not yet supported. Use 0.8 instead.])
+ AC_DEFINE(HAVE_LIBGDATA_0_9,1,[libgdata is 0.9 or higher])
fi
if test x$os_win32 = xno; then

View File

@ -8,16 +8,15 @@
%define gtk3_version 3.0.0
%define gtk_doc_version 1.9
%define intltool_version 0.35.5
%define libgdata_version 0.7.0
%define libgdata_version 0.9.1
%define libgweather_version 2.91.0
%define libical_version 0.46
%define liboauth_version 0.9.4
%define soup_version 2.3.0
%define sqlite_version 3.5
%define eds_base_version 3.2
%define use_gnome_keyring 1
%define camel_provider_dir %{_libdir}/evolution-data-server/camel-providers
%define ebook_backends_dir %{_libdir}/evolution-data-server/addressbook-backends
%define ecal_backends_dir %{_libdir}/evolution-data-server/calendar-backends
@ -25,7 +24,7 @@
### Abstract ###
Name: evolution-data-server
Version: 3.1.2
Version: 3.1.3
Release: 1%{?dist}
Group: System Environment/Libraries
Summary: Backend data server for Evolution
@ -42,8 +41,6 @@ Obsoletes: evolution-webcal < 2.24.0
# RH bug #243296
Patch11: evolution-data-server-1.11.5-fix-64bit-acinclude.patch
Patch12: evolution-data-server-3.1.2-libgdata_0_9.patch
### Build Dependencies ###
BuildRequires: GConf2-devel
@ -52,17 +49,17 @@ BuildRequires: db4-devel
BuildRequires: gettext
BuildRequires: glib2-devel >= %{glib2_version}
BuildRequires: gnome-common
BuildRequires: gnome-keyring-devel
BuildRequires: gnome-online-accounts-devel
BuildRequires: gnutls-devel
BuildRequires: gperf
BuildRequires: gtk-doc >= %{gtk_doc_version}
BuildRequires: gtk3-devel >= %{gtk3_version}
BuildRequires: intltool >= %{intltool_version}
%if %{use_gnome_keyring}
BuildRequires: gnome-keyring-devel
%endif
BuildRequires: libgdata-devel >= %{libgdata_version}
BuildRequires: libgweather-devel >= %{libgweather_version}
BuildRequires: libical-devel >= %{libical_version}
BuildRequires: liboauth-devel >= %{liboauth_version}
BuildRequires: libsoup-devel >= %{soup_version}
BuildRequires: libtool
BuildRequires: nspr-devel
@ -97,12 +94,12 @@ Summary: Development files for building against %{name}
Group: Development/Libraries
Requires: %{name} = %{version}-%{release}
Requires: dbus-glib-devel
%if %{use_gnome_keyring}
Requires: gnome-keyring-devel
%endif
Requires: gnome-online-accounts-devel
Requires: libgdata-devel
Requires: libgweather-devel
Requires: libical-devel
Requires: liboauth-devel
Requires: libsoup-devel
Requires: sqlite-devel
@ -121,7 +118,6 @@ This package contains developer documentation for %{name}.
%setup -q
%patch11 -p1 -b .fix-64bit-acinclude
%patch12 -p1 -b .libgdata_0_9
mkdir -p krb5-fakeprefix/include
mkdir -p krb5-fakeprefix/lib
@ -179,12 +175,6 @@ if ! pkg-config --exists nss; then
exit 1
fi
%if %{use_gnome_keyring}
%define keyring_flags --enable-gnome-keyring
%else
%define keyring_flags --disable-gnome-keyring
%endif
export CPPFLAGS="-I%{_includedir}/et"
export CFLAGS="$RPM_OPT_FLAGS -DLDAP_DEPRECATED -fPIC -I%{_includedir}/et"
@ -205,9 +195,15 @@ autoconf
--enable-dot-locking=no \
--enable-gtk-doc \
%ldap_flags %krb5_flags %nntp_flags %ssl_flags \
%largetfile_flags %keyring_flags
%largetfile_flags
export tagname=CC
make %{?_smp_mflags} LIBTOOL=/usr/bin/libtool
# Do not build in parallel. The libedata-book and libedata-cal directories
# each produce a shared library and an executable binary that links to the
# shared library. If the executable binary finishes first the build fails.
# There may be other similar cases in the source tree.
#make %{?_smp_mflags} LIBTOOL=/usr/bin/libtool
make LIBTOOL=/usr/bin/libtool
%install
rm -rf $RPM_BUILD_ROOT
@ -337,6 +333,13 @@ rm -rf $RPM_BUILD_ROOT
%{_datadir}/gtk-doc/html/libedataserverui
%changelog
* Mon Jul 04 2011 Matthew Barnes <mbarnes@redhat.com> - 3.1.3-1
- Update to 3.1.3
- Remove patch for libgdata-0.9.0 (fixed upstream).
- Disable SMP flags; some source directories are racy.
- Remove keyring option; gnome-keyring is mandatory now.
- Add BR: gnome-online-accounts-devel and liboauth-devel
* Tue Jun 14 2011 Milan Crha <mcrha@redhat.com> - 3.1.2-1
- Update to 3.1.2
- Add patch by Philip Withnall to build against libgdata-0.9.0

View File

@ -1 +1 @@
c77886b37ff7ae0410339287ca60a5f8 evolution-data-server-3.1.2.tar.bz2
0b65f4452692a968e1de1bedfdbf1355 evolution-data-server-3.1.3.tar.bz2