evolution-data-server r8974 - in trunk: calendar calendar/backends/google servers/google/libgdata servers/google/libgdata-google
- From: jedywang svn gnome org
- To: svn-commits-list gnome org
- Subject: evolution-data-server r8974 - in trunk: calendar calendar/backends/google servers/google/libgdata servers/google/libgdata-google
- Date: Fri, 13 Jun 2008 05:36:46 +0000 (UTC)
Author: jedywang
Date: Fri Jun 13 05:36:46 2008
New Revision: 8974
URL: http://svn.gnome.org/viewvc/evolution-data-server?rev=8974&view=rev
Log:
2008-06-13 Wang Xin <jedy wang sun com>
** Fix for bug #527544.
* servers/google/libgdata-google/gdata-google-service.c:
* servers/google/libgdata/gdata-service-iface.c:
* servers/google/libgdata/gdata-service-iface.h:
* calendar/backends/google/e-cal-backend-google.c:
Modified:
trunk/calendar/ChangeLog
trunk/calendar/backends/google/e-cal-backend-google.c
trunk/servers/google/libgdata-google/ChangeLog
trunk/servers/google/libgdata-google/gdata-google-service.c
trunk/servers/google/libgdata/ChangeLog
trunk/servers/google/libgdata/gdata-service-iface.c
trunk/servers/google/libgdata/gdata-service-iface.h
Modified: trunk/calendar/backends/google/e-cal-backend-google.c
==============================================================================
--- trunk/calendar/backends/google/e-cal-backend-google.c (original)
+++ trunk/calendar/backends/google/e-cal-backend-google.c Fri Jun 13 05:36:46 2008
@@ -39,6 +39,7 @@
#include <libedataserver/e-data-server-util.h>
#include <libedataserver/e-xml-hash-utils.h>
+#include <libedataserver/e-proxy.h>
#include <libedata-cal/e-cal-backend-util.h>
@@ -82,6 +83,7 @@
gboolean read_only;
gboolean mode_changed;
+ EProxy *proxy;
};
gint compare_ids (gconstpointer cache_id, gconstpointer modified_cache_id);
@@ -1292,6 +1294,11 @@
priv->timeout_id = 0;
}
+ if (priv->proxy) {
+ g_object_unref (priv->proxy);
+ priv->proxy = NULL;
+ }
+
g_free (priv);
cbgo->priv = NULL;
@@ -1300,6 +1307,22 @@
}
}
+static void
+proxy_settings_changed (EProxy *proxy, gpointer user_data)
+{
+ SoupURI *proxy_uri = NULL;
+
+ ECalBackendGooglePrivate *priv = (ECalBackendGooglePrivate *)user_data;
+ if (!priv || !priv->uri)
+ return;
+
+ /* use proxy if necessary */
+ if (e_proxy_require_proxy_for_uri (proxy, priv->uri)) {
+ proxy_uri = e_proxy_peek_uri (proxy);
+ }
+ gdata_service_set_proxy (GDATA_SERVICE (priv->service), proxy_uri);
+}
+
/* Object initialisation function for google backend */
static void
e_cal_backend_google_init (ECalBackendGoogle *cbgo, ECalBackendGoogleClass *class)
@@ -1316,6 +1339,10 @@
priv->timeout_id = 0;
cbgo->priv = priv;
+ priv->proxy = e_proxy_new ();
+ e_proxy_setup_proxy (priv->proxy);
+ g_signal_connect (priv->proxy, "changed", G_CALLBACK (proxy_settings_changed), priv);
+
/* FIXME set a lock */
e_cal_backend_sync_set_lock (E_CAL_BACKEND_SYNC (cbgo), TRUE);
}
@@ -1479,6 +1506,13 @@
priv = cbgo->priv;
priv->uri = uri;
+
+ /* use proxy if necessary */
+ if (e_proxy_require_proxy_for_uri (priv->proxy, priv->uri)) {
+ SoupURI *proxy_uri = e_proxy_peek_uri (priv->proxy);
+
+ gdata_service_set_proxy (GDATA_SERVICE (priv->service), proxy_uri);
+ }
}
/**
Modified: trunk/servers/google/libgdata-google/gdata-google-service.c
==============================================================================
--- trunk/servers/google/libgdata-google/gdata-google-service.c (original)
+++ trunk/servers/google/libgdata-google/gdata-google-service.c Fri Jun 13 05:36:46 2008
@@ -37,6 +37,7 @@
static GDataFeed * gdata_google_service_get_feed (GDataService *service, const gchar *feed_url, GError **error);
static GDataEntry * gdata_google_service_update_entry (GDataService *service, GDataEntry *entry, GError **error);
static void gdata_google_service_set_credentials (GDataService *service, const gchar *username, const gchar *password);
+static void gdata_google_service_set_proxy (GDataService *service, SoupURI *proxy);
typedef struct _GDataGoogleServiceAuth GDataGoogleServiceAuth;
struct _GDataGoogleServiceAuth {
@@ -75,7 +76,20 @@
return error ? error : (error = g_quark_from_static_string ("gdata_google_error_quark"));
}
-void
+static void
+gdata_google_service_set_proxy (GDataService *service, SoupURI *proxy)
+{
+ GDataGoogleServicePrivate *priv;
+
+ g_return_if_fail (service != NULL);
+ g_return_if_fail (GDATA_IS_GOOGLE_SERVICE(service));
+
+ priv = GDATA_GOOGLE_SERVICE_GET_PRIVATE(GDATA_GOOGLE_SERVICE(service));
+ if (proxy && priv && priv->soup_session)
+ g_object_set (priv->soup_session, SOUP_SESSION_PROXY_URI, proxy, NULL);
+}
+
+static void
gdata_google_service_set_credentials (GDataService *service, const gchar *username, const gchar *password)
{
GDataGoogleServicePrivate *priv;
@@ -180,7 +194,7 @@
*
**/
-GDataFeed *
+static GDataFeed *
gdata_google_service_get_feed (GDataService *service, const gchar *feed_url, GError **error)
{
GDataFeed *feed = NULL;
@@ -240,7 +254,7 @@
* returns the newly inserted entry
*
**/
-GDataEntry *
+static GDataEntry *
gdata_google_service_insert_entry (GDataService *service, const gchar *feed_url, GDataEntry *entry, GError **error)
{
GDataGoogleServicePrivate *priv;
@@ -309,7 +323,7 @@
* Removes the entry
*
**/
-gboolean
+static gboolean
gdata_google_service_delete_entry (GDataService *service, GDataEntry *entry, GError **error)
{
GDataGoogleServiceAuth *auth;
@@ -448,6 +462,7 @@
{
GDataServiceIface *iface = (GDataServiceIface *)g_iface;
+ iface->set_proxy = gdata_google_service_set_proxy;
iface->set_credentials = gdata_google_service_set_credentials;
iface->get_feed = gdata_google_service_get_feed;
iface->insert_entry = gdata_google_service_insert_entry;
Modified: trunk/servers/google/libgdata/gdata-service-iface.c
==============================================================================
--- trunk/servers/google/libgdata/gdata-service-iface.c (original)
+++ trunk/servers/google/libgdata/gdata-service-iface.c Fri Jun 13 05:36:46 2008
@@ -26,6 +26,12 @@
#include <gdata-service-iface.h>
void
+gdata_service_set_proxy (GDataService *self, SoupURI *proxy)
+{
+ GDATA_SERVICE_GET_IFACE(self)->set_proxy(self, proxy);
+}
+
+void
gdata_service_set_credentials (GDataService *self, const char *username, const gchar *password)
{
GDATA_SERVICE_GET_IFACE(self)->set_credentials(self, username, password);
Modified: trunk/servers/google/libgdata/gdata-service-iface.h
==============================================================================
--- trunk/servers/google/libgdata/gdata-service-iface.h (original)
+++ trunk/servers/google/libgdata/gdata-service-iface.h Fri Jun 13 05:36:46 2008
@@ -27,6 +27,7 @@
#include <glib.h>
#include <glib-object.h>
+#include <libsoup/soup.h>
#include "gdata-feed.h"
#include "gdata-entry.h"
@@ -48,6 +49,7 @@
GTypeInterface parent;
/* Public Methods */
+ void (*set_proxy) (GDataService *self, SoupURI *proxy);
void (*set_credentials)(GDataService *self, const gchar *username, const gchar *password);
GDataFeed * (*get_feed) (GDataService *self, const gchar *feed_getURL, GError **error);
GDataEntry* (*insert_entry)(GDataService *self, const gchar *feed_postURL, GDataEntry *entry, GError **error);
@@ -60,6 +62,7 @@
GType gdata_service_get_type(void);
/* Function Prototypes */
+void gdata_service_set_proxy (GDataService *self, SoupURI *proxy);
void gdata_service_set_credentials(GDataService *self, const gchar *username, const gchar *password);
GDataFeed* gdata_service_get_feed(GDataService *self, const gchar *feed_getURL, GError **error);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]