[evolution/account-mgmt: 34/50] Add 'cal-config-google' module.



commit dd361273c775a942339740ad6803669046418a7d
Author: Matthew Barnes <mbarnes redhat com>
Date:   Fri Feb 4 08:52:28 2011 -0500

    Add 'cal-config-google' module.
    
    Registers the "Google" backend in ECalSourceConfig widgets.
    
    Replaces the 'google-account-setup' plugin.

 configure.ac                                       |    4 +-
 modules/Makefile.am                                |    1 +
 modules/cal-config-google/Makefile.am              |   34 +
 .../cal-config-google/e-google-chooser-button.c    |  243 +++++++
 .../cal-config-google/e-google-chooser-button.h    |   67 ++
 .../cal-config-google/e-google-chooser-dialog.c    |  387 ++++++++++
 .../cal-config-google/e-google-chooser-dialog.h    |   68 ++
 modules/cal-config-google/e-google-chooser.c       |  625 ++++++++++++++++
 modules/cal-config-google/e-google-chooser.h       |   76 ++
 modules/cal-config-google/e-source-caldav.c        |  201 ++++++
 modules/cal-config-google/e-source-caldav.h        |   71 ++
 .../evolution-cal-config-google.c                  |  214 ++++++
 plugins/google-account-setup/Makefile.am           |   36 -
 .../google-account-setup/google-contacts-source.c  |  419 -----------
 .../google-account-setup/google-contacts-source.h  |   37 -
 plugins/google-account-setup/google-source.c       |  748 --------------------
 .../org-gnome-evolution-google.eplug.xml           |   24 -
 17 files changed, 1989 insertions(+), 1266 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 1d2c728..6d65ce3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1351,7 +1351,7 @@ AC_ARG_ENABLE([plugins],
 	[enable_plugins="$enableval"],[enable_plugins=all])
 
 dnl Add any new plugins here
-plugins_base_always="calendar-http itip-formatter default-source mark-all-read publish-calendar imap-features google-account-setup"
+plugins_base_always="calendar-http itip-formatter default-source mark-all-read publish-calendar imap-features"
 
 plugins_base="$plugins_base_always"
 dist_plugins_base="$plugins_base_always calendar-weather"
@@ -1680,6 +1680,7 @@ modules/book-config-local/Makefile
 modules/book-config-webdav/Makefile
 modules/cal-config-caldav/Makefile
 modules/cal-config-contacts/Makefile
+modules/cal-config-google/Makefile
 modules/cal-config-local/Makefile
 modules/composer-autosave/Makefile
 modules/connman/Makefile
@@ -1707,7 +1708,6 @@ plugins/default-source/Makefile
 plugins/email-custom-header/Makefile
 plugins/external-editor/Makefile
 plugins/face/Makefile
-plugins/google-account-setup/Makefile
 plugins/image-inline/Makefile
 plugins/imap-features/Makefile
 plugins/itip-formatter/Makefile
diff --git a/modules/Makefile.am b/modules/Makefile.am
index 5b64505..0d62dcb 100644
--- a/modules/Makefile.am
+++ b/modules/Makefile.am
@@ -37,6 +37,7 @@ SUBDIRS = \
 	book-config-webdav \
 	cal-config-caldav \
 	cal-config-contacts \
+	cal-config-google \
 	cal-config-local \
 	composer-autosave \
 	mailto-handler \
diff --git a/modules/cal-config-google/Makefile.am b/modules/cal-config-google/Makefile.am
new file mode 100644
index 0000000..4fe7221
--- /dev/null
+++ b/modules/cal-config-google/Makefile.am
@@ -0,0 +1,34 @@
+module_LTLIBRARIES = libevolution-module-cal-config-google.la
+
+libevolution_module_cal_config_google_la_CPPFLAGS =		\
+	$(AM_CPPFLAGS)						\
+	-I$(top_srcdir)						\
+	-I$(top_srcdir)/widgets					\
+	-DG_LOG_DOMAIN=\"evolution-cal-config-google\"		\
+	$(EVOLUTION_DATA_SERVER_CFLAGS)				\
+	$(GNOME_PLATFORM_CFLAGS)				\
+	$(GDATA_CFLAGS)
+
+libevolution_module_cal_config_google_la_SOURCES =		\
+	evolution-cal-config-google.c				\
+	e-google-chooser-button.c				\
+	e-google-chooser-button.h				\
+	e-google-chooser-dialog.c				\
+	e-google-chooser-dialog.h				\
+	e-google-chooser.c					\
+	e-google-chooser.h					\
+	e-source-caldav.c					\
+	e-source-caldav.h
+
+libevolution_module_cal_config_google_la_LIBADD =		\
+	$(top_builddir)/e-util/libeutil.la			\
+	$(top_builddir)/widgets/misc/libemiscwidgets.la		\
+	$(top_builddir)/calendar/gui/libevolution-calendar.la	\
+	$(EVOLUTION_DATA_SERVER_LIBS)				\
+	$(GNOME_PLATFORM_LIBS)					\
+	$(GDATA_LIBS)
+
+libevolution_module_cal_config_google_la_LDFLAGS =		\
+	-module -avoid-version $(NO_UNDEFINED)
+
+-include $(top_srcdir)/git.mk
diff --git a/modules/cal-config-google/e-google-chooser-button.c b/modules/cal-config-google/e-google-chooser-button.c
new file mode 100644
index 0000000..9e5f331
--- /dev/null
+++ b/modules/cal-config-google/e-google-chooser-button.c
@@ -0,0 +1,243 @@
+/*
+ * e-google-chooser-button.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <webcal://www.gnu.org/licenses/>
+ *
+ */
+
+#include "e-google-chooser-button.h"
+
+#include <config.h>
+#include <glib/gi18n-lib.h>
+
+#include "e-google-chooser-dialog.h"
+#include "e-source-caldav.h"
+
+#define E_GOOGLE_CHOOSER_BUTTON_GET_PRIVATE(obj) \
+	(G_TYPE_INSTANCE_GET_PRIVATE \
+	((obj), E_TYPE_GOOGLE_CHOOSER_BUTTON, EGoogleChooserButtonPrivate))
+
+struct _EGoogleChooserButtonPrivate {
+	ESource *source;
+	GtkWidget *label;
+};
+
+enum {
+	PROP_0,
+	PROP_DISPLAY_NAME,
+	PROP_SOURCE
+};
+
+G_DEFINE_DYNAMIC_TYPE (
+	EGoogleChooserButton,
+	e_google_chooser_button,
+	GTK_TYPE_BUTTON)
+
+static void
+google_chooser_button_set_source (EGoogleChooserButton *button,
+                                  ESource *source)
+{
+	g_return_if_fail (E_IS_SOURCE (source));
+	g_return_if_fail (button->priv->source == NULL);
+
+	button->priv->source = g_object_ref (source);
+}
+
+static void
+google_chooser_button_set_property (GObject *object,
+                                    guint property_id,
+                                    const GValue *value,
+                                    GParamSpec *pspec)
+{
+	switch (property_id) {
+		case PROP_SOURCE:
+			google_chooser_button_set_source (
+				E_GOOGLE_CHOOSER_BUTTON (object),
+				g_value_get_object (value));
+			return;
+	}
+
+	G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+google_chooser_button_get_property (GObject *object,
+                                    guint property_id,
+                                    GValue *value,
+                                    GParamSpec *pspec)
+{
+	switch (property_id) {
+		case PROP_SOURCE:
+			g_value_set_object (
+				value,
+				e_google_chooser_button_get_source (
+				E_GOOGLE_CHOOSER_BUTTON (object)));
+			return;
+	}
+
+	G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+google_chooser_button_dispose (GObject *object)
+{
+	EGoogleChooserButtonPrivate *priv;
+
+	priv = E_GOOGLE_CHOOSER_BUTTON_GET_PRIVATE (object);
+
+	if (priv->source != NULL) {
+		g_object_unref (priv->source);
+		priv->source = NULL;
+	}
+
+	if (priv->label != NULL) {
+		g_object_unref (priv->label);
+		priv->label = NULL;
+	}
+
+	/* Chain up to parent's dispose() method. */
+	G_OBJECT_CLASS (e_google_chooser_button_parent_class)->dispose (object);
+}
+
+static void
+google_chooser_button_constructed (GObject *object)
+{
+	EGoogleChooserButton *button;
+	ESourceWebdav *webdav_extension;
+	GBindingFlags binding_flags;
+	GtkWidget *widget;
+	const gchar *display_name;
+
+	button = E_GOOGLE_CHOOSER_BUTTON (object);
+
+	/* Chain up to parent's constructed() method. */
+	G_OBJECT_CLASS (e_google_chooser_button_parent_class)->
+		constructed (object);
+
+	widget = gtk_label_new (_("Default User Calendar"));
+	gtk_misc_set_alignment (GTK_MISC (widget), 0.0, 0.5);
+	gtk_container_add (GTK_CONTAINER (button), widget);
+	button->priv->label = g_object_ref (widget);
+	gtk_widget_show (widget);
+
+	webdav_extension = e_source_get_extension (
+		button->priv->source, E_SOURCE_EXTENSION_CALDAV_BACKEND);
+	display_name = e_source_webdav_get_display_name (webdav_extension);
+
+	binding_flags = G_BINDING_DEFAULT;
+	if (display_name != NULL && *display_name != '\0')
+		binding_flags |= G_BINDING_SYNC_CREATE;
+
+	g_object_bind_property (
+		webdav_extension, "display-name",
+		button->priv->label, "label",
+		binding_flags);
+}
+
+static void
+google_chooser_button_clicked (GtkButton *button)
+{
+	EGoogleChooserButtonPrivate *priv;
+	GtkWidget *chooser;
+	GtkWidget *dialog;
+	gpointer parent;
+
+	priv = E_GOOGLE_CHOOSER_BUTTON_GET_PRIVATE (button);
+
+	parent = gtk_widget_get_toplevel (GTK_WIDGET (button));
+	parent = gtk_widget_is_toplevel (parent) ? parent : NULL;
+
+	chooser = e_google_chooser_new (priv->source);
+
+	dialog = e_google_chooser_dialog_new (
+		E_GOOGLE_CHOOSER (chooser), parent);
+
+	if (parent != NULL)
+		g_object_bind_property (
+			parent, "icon-name",
+			dialog, "icon-name",
+			G_BINDING_SYNC_CREATE);
+
+	gtk_dialog_run (GTK_DIALOG (dialog));
+
+	gtk_widget_destroy (dialog);
+}
+
+static void
+e_google_chooser_button_class_init (EGoogleChooserButtonClass *class)
+{
+	GObjectClass *object_class;
+	GtkButtonClass *button_class;
+
+	g_type_class_add_private (class, sizeof (EGoogleChooserButtonPrivate));
+
+	object_class = G_OBJECT_CLASS (class);
+	object_class->set_property = google_chooser_button_set_property;
+	object_class->get_property = google_chooser_button_get_property;
+	object_class->dispose = google_chooser_button_dispose;
+	object_class->constructed = google_chooser_button_constructed;
+
+	button_class = GTK_BUTTON_CLASS (class);
+	button_class->clicked = google_chooser_button_clicked;
+
+	g_object_class_install_property (
+		object_class,
+		PROP_SOURCE,
+		g_param_spec_object (
+			"source",
+			NULL,
+			NULL,
+			E_TYPE_SOURCE,
+			G_PARAM_READWRITE |
+			G_PARAM_CONSTRUCT_ONLY));
+}
+
+static void
+e_google_chooser_button_class_finalize (EGoogleChooserButtonClass *class)
+{
+}
+
+static void
+e_google_chooser_button_init (EGoogleChooserButton *button)
+{
+	button->priv = E_GOOGLE_CHOOSER_BUTTON_GET_PRIVATE (button);
+}
+
+void
+e_google_chooser_button_type_register (GTypeModule *type_module)
+{
+	/* XXX G_DEFINE_DYNAMIC_TYPE declares a static type registration
+	 *     function, so we have to wrap it with a public function in
+	 *     order to register types from a separate compilation unit. */
+	e_google_chooser_button_register_type (type_module);
+}
+
+GtkWidget *
+e_google_chooser_button_new (ESource *source)
+{
+	g_return_val_if_fail (E_IS_SOURCE (source), NULL);
+
+	return g_object_new (
+		E_TYPE_GOOGLE_CHOOSER_BUTTON,
+		"source", source, NULL);
+}
+
+ESource *
+e_google_chooser_button_get_source (EGoogleChooserButton *button)
+{
+	g_return_val_if_fail (E_IS_GOOGLE_CHOOSER_BUTTON (button), NULL);
+
+	return button->priv->source;
+}
+
diff --git a/modules/cal-config-google/e-google-chooser-button.h b/modules/cal-config-google/e-google-chooser-button.h
new file mode 100644
index 0000000..29d2db0
--- /dev/null
+++ b/modules/cal-config-google/e-google-chooser-button.h
@@ -0,0 +1,67 @@
+/*
+ * e-google-chooser-button.h
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <webcal://www.gnu.org/licenses/>
+ *
+ */
+
+#ifndef E_GOOGLE_CHOOSER_BUTTON_H
+#define E_GOOGLE_CHOOSER_BUTTON_H
+
+#include "e-google-chooser.h"
+
+/* Standard GObject macros */
+#define E_TYPE_GOOGLE_CHOOSER_BUTTON \
+	(e_google_chooser_button_get_type ())
+#define E_GOOGLE_CHOOSER_BUTTON(obj) \
+	(G_TYPE_CHECK_INSTANCE_CAST \
+	((obj), E_TYPE_GOOGLE_CHOOSER_BUTTON, EGoogleChooserButton))
+#define E_GOOGLE_CHOOSER_BUTTON_CLASS(cls) \
+	(G_TYPE_CHECK_CLASS_CAST \
+	((cls), E_TYPE_GOOGLE_CHOOSER_BUTTON, EGoogleChooserButtonClass))
+#define E_IS_GOOGLE_CHOOSER_BUTTON(obj) \
+	(G_TYPE_CHECK_INSTANCE_TYPE \
+	((obj), E_TYPE_GOOGLE_CHOOSER_BUTTON))
+#define E_IS_GOOGLE_CHOOSER_BUTTON_CLASS(cls) \
+	(G_TYPE_CHECK_CLASS_TYPE \
+	((cls), E_TYPE_GOOGLE_CHOOSER_BUTTON))
+#define E_GOOGLE_CHOOSER_BUTTON_GET_CLASS(obj) \
+	(G_TYPE_INSTANCE_GET_CLASS \
+	((obj), E_TYPE_GOOGLE_CHOOSER_BUTTON, EGoogleChooserButtonClass))
+
+G_BEGIN_DECLS
+
+typedef struct _EGoogleChooserButton EGoogleChooserButton;
+typedef struct _EGoogleChooserButtonClass EGoogleChooserButtonClass;
+typedef struct _EGoogleChooserButtonPrivate EGoogleChooserButtonPrivate;
+
+struct _EGoogleChooserButton {
+	GtkButton parent;
+	EGoogleChooserButtonPrivate *priv;
+};
+
+struct _EGoogleChooserButtonClass {
+	GtkButtonClass parent_class;
+};
+
+GType		e_google_chooser_button_get_type (void);
+void		e_google_chooser_button_type_register
+						(GTypeModule *type_module);
+GtkWidget *	e_google_chooser_button_new	(ESource *source);
+ESource *	e_google_chooser_button_get_source
+						(EGoogleChooserButton *button);
+
+G_END_DECLS
+
+#endif /* E_GOOGLE_CHOOSER_BUTTON_H */
diff --git a/modules/cal-config-google/e-google-chooser-dialog.c b/modules/cal-config-google/e-google-chooser-dialog.c
new file mode 100644
index 0000000..acf11f2
--- /dev/null
+++ b/modules/cal-config-google/e-google-chooser-dialog.c
@@ -0,0 +1,387 @@
+/*
+ * e-google-chooser-dialog.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <webcal://www.gnu.org/licenses/>
+ *
+ */
+
+#include "e-google-chooser-dialog.h"
+
+#include <config.h>
+#include <glib/gi18n-lib.h>
+
+#define E_GOOGLE_CHOOSER_DIALOG_GET_PRIVATE(obj) \
+	(G_TYPE_INSTANCE_GET_PRIVATE \
+	((obj), E_TYPE_GOOGLE_CHOOSER_DIALOG, EGoogleChooserDialogPrivate))
+
+struct _EGoogleChooserDialogPrivate {
+	EGoogleChooser *chooser;
+	GCancellable *cancellable;
+
+	GtkWidget *info_bar;		/* not referenced */
+	GtkWidget *info_bar_label;	/* not referenced */
+};
+
+enum {
+	PROP_0,
+	PROP_CHOOSER
+};
+
+G_DEFINE_DYNAMIC_TYPE (
+	EGoogleChooserDialog,
+	e_google_chooser_dialog,
+	GTK_TYPE_DIALOG)
+
+static void
+google_chooser_dialog_populated_cb (EGoogleChooser *chooser,
+                                    GAsyncResult *result,
+                                    EGoogleChooserDialog *dialog)
+{
+	GdkWindow *window;
+	GError *error = NULL;
+
+	e_google_chooser_populate_finish (chooser, result, &error);
+
+	/* Ignore cancellations, and leave the mouse cursor alone
+	 * since the GdkWindow may have already been destroyed. */
+	if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
+		goto exit;
+
+	/* Reset the mouse cursor to normal. */
+	window = gtk_widget_get_window (GTK_WIDGET (dialog));
+	gdk_window_set_cursor (window, NULL);
+
+	if (error != NULL) {
+		GtkLabel *label;
+
+		label = GTK_LABEL (dialog->priv->info_bar_label);
+		gtk_label_set_text (label, error->message);
+		gtk_widget_show (dialog->priv->info_bar);
+
+		g_error_free (error);
+		goto exit;
+	}
+
+exit:
+	g_object_unref (dialog);
+}
+
+static void
+google_chooser_dialog_row_activated_cb (GtkTreeView *tree_view,
+                                        GtkTreePath *path,
+                                        GtkTreeViewColumn *column,
+                                        GtkDialog *dialog)
+{
+	gtk_dialog_response (dialog, GTK_RESPONSE_APPLY);
+}
+
+static void
+google_chooser_dialog_selection_changed_cb (GtkTreeSelection *selection,
+                                            GtkDialog *dialog)
+{
+	gboolean sensitive;
+
+	sensitive = (gtk_tree_selection_count_selected_rows (selection) > 0);
+
+	gtk_dialog_set_response_sensitive (
+		dialog, GTK_RESPONSE_APPLY, sensitive);
+}
+
+static void
+google_chooser_dialog_set_chooser (EGoogleChooserDialog *dialog,
+                                   EGoogleChooser *chooser)
+{
+	g_return_if_fail (E_IS_GOOGLE_CHOOSER (chooser));
+	g_return_if_fail (dialog->priv->chooser == NULL);
+
+	dialog->priv->chooser = g_object_ref_sink (chooser);
+}
+
+static void
+google_chooser_dialog_set_property (GObject *object,
+                                    guint property_id,
+                                    const GValue *value,
+                                    GParamSpec *pspec)
+{
+	switch (property_id) {
+		case PROP_CHOOSER:
+			google_chooser_dialog_set_chooser (
+				E_GOOGLE_CHOOSER_DIALOG (object),
+				g_value_get_object (value));
+			return;
+	}
+
+	G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+google_chooser_dialog_get_property (GObject *object,
+                                    guint property_id,
+                                    GValue *value,
+                                    GParamSpec *pspec)
+{
+	switch (property_id) {
+		case PROP_CHOOSER:
+			g_value_set_object (
+				value,
+				e_google_chooser_dialog_get_chooser (
+				E_GOOGLE_CHOOSER_DIALOG (object)));
+			return;
+	}
+
+	G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+google_chooser_dialog_dispose (GObject *object)
+{
+	EGoogleChooserDialogPrivate *priv;
+
+	priv = E_GOOGLE_CHOOSER_DIALOG_GET_PRIVATE (object);
+
+	if (priv->chooser != NULL) {
+		g_signal_handlers_disconnect_by_func (
+			priv->chooser, google_chooser_dialog_row_activated_cb,
+			object);
+		g_object_unref (priv->chooser);
+		priv->chooser = NULL;
+	}
+
+	if (priv->cancellable != NULL) {
+		g_cancellable_cancel (priv->cancellable);
+		g_object_unref (priv->cancellable);
+		priv->cancellable = NULL;
+	}
+
+	/* Chain up to parent's dispose() method. */
+	G_OBJECT_CLASS (e_google_chooser_dialog_parent_class)->dispose (object);
+}
+
+static void
+google_chooser_dialog_constructed (GObject *object)
+{
+	EGoogleChooserDialog *dialog;
+	GtkTreeSelection *selection;
+	GtkWidget *container;
+	GtkWidget *widget;
+	GtkWidget *vbox;
+	const gchar *title;
+
+	dialog = E_GOOGLE_CHOOSER_DIALOG (object);
+
+	/* Chain up to parent's constructed() method. */
+	G_OBJECT_CLASS (e_google_chooser_dialog_parent_class)->
+		constructed (object);
+
+	gtk_dialog_add_button (
+		GTK_DIALOG (dialog),
+		GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL);
+
+	gtk_dialog_add_button (
+		GTK_DIALOG (dialog),
+		GTK_STOCK_APPLY, GTK_RESPONSE_APPLY);
+
+	gtk_dialog_set_default_response (
+		GTK_DIALOG (dialog), GTK_RESPONSE_APPLY);
+	gtk_dialog_set_response_sensitive (
+		GTK_DIALOG (dialog), GTK_RESPONSE_APPLY, FALSE);
+
+	title = _("Choose a Calendar");
+	gtk_window_set_title (GTK_WINDOW (dialog), title);
+	gtk_window_set_default_size (GTK_WINDOW (dialog), 400, 400);
+	gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
+
+	container = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
+
+	widget = gtk_vbox_new (FALSE, 6);
+	gtk_container_set_border_width (GTK_CONTAINER (widget), 5);
+	gtk_box_pack_start (GTK_BOX (container), widget, TRUE, TRUE, 0);
+	gtk_widget_show (widget);
+
+	container = vbox = widget;
+
+	widget = gtk_scrolled_window_new (NULL, NULL);
+	gtk_scrolled_window_set_policy (
+		GTK_SCROLLED_WINDOW (widget),
+		GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+	gtk_scrolled_window_set_shadow_type (
+		GTK_SCROLLED_WINDOW (widget), GTK_SHADOW_IN);
+	gtk_box_pack_start (GTK_BOX (container), widget, TRUE, TRUE, 0);
+	gtk_widget_show (widget);
+
+	container = widget;
+
+	widget = GTK_WIDGET (dialog->priv->chooser);
+	gtk_container_add (GTK_CONTAINER (container), widget);
+	gtk_widget_show (widget);
+
+	g_signal_connect (
+		widget, "row-activated",
+		G_CALLBACK (google_chooser_dialog_row_activated_cb), dialog);
+
+	/* Build the info bar, but hide it initially. */
+
+	container = vbox;
+
+	widget = gtk_info_bar_new ();
+	gtk_info_bar_set_message_type (
+		GTK_INFO_BAR (widget), GTK_MESSAGE_WARNING);
+	gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0);
+	dialog->priv->info_bar = widget;  /* do not reference */
+	gtk_widget_hide (widget);
+
+	container = gtk_info_bar_get_content_area (GTK_INFO_BAR (widget));
+
+	widget = gtk_hbox_new (FALSE, 6);
+	gtk_box_pack_start (GTK_BOX (container), widget, TRUE, TRUE, 0);
+	gtk_widget_show (widget);
+
+	container = widget;
+
+	widget = gtk_image_new_from_stock (
+		GTK_STOCK_DIALOG_WARNING, GTK_ICON_SIZE_MENU);
+	gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0);
+	gtk_widget_show (widget);
+
+	widget = gtk_label_new ("");
+	gtk_misc_set_alignment (GTK_MISC (widget), 0.0, 0.5);
+	gtk_box_pack_start (GTK_BOX (container), widget, TRUE, TRUE, 0);
+	dialog->priv->info_bar_label = widget;  /* do not reference */
+	gtk_widget_show (widget);
+
+	/* Listen for tree view selection changes. */
+
+	selection = gtk_tree_view_get_selection (
+		GTK_TREE_VIEW (dialog->priv->chooser));
+
+	g_signal_connect (
+		selection, "changed",
+		G_CALLBACK (google_chooser_dialog_selection_changed_cb),
+		dialog);
+}
+
+static void
+google_chooser_dialog_realize (GtkWidget *widget)
+{
+	EGoogleChooserDialogPrivate *priv;
+	GdkCursor *cursor;
+	GdkWindow *window;
+	GdkDisplay *display;
+
+	priv = E_GOOGLE_CHOOSER_DIALOG_GET_PRIVATE (widget);
+
+	/* Chain up to parent's realize() method. */
+	GTK_WIDGET_CLASS (e_google_chooser_dialog_parent_class)->
+		realize (widget);
+
+	g_return_if_fail (priv->cancellable == NULL);
+	priv->cancellable = g_cancellable_new ();
+
+	/* Show a busy mouse cursor while populating. */
+	window = gtk_widget_get_window (widget);
+	display = gtk_widget_get_display (widget);
+	cursor = gdk_cursor_new_for_display (display, GDK_WATCH);
+	gdk_window_set_cursor (window, cursor);
+	gdk_cursor_unref (cursor);
+
+	e_google_chooser_populate (
+		priv->chooser, priv->cancellable, (GAsyncReadyCallback)
+		google_chooser_dialog_populated_cb, g_object_ref (widget));
+}
+
+static void
+google_chooser_dialog_response (GtkDialog *dialog,
+                                gint response_id)
+{
+	EGoogleChooserDialogPrivate *priv;
+
+	priv = E_GOOGLE_CHOOSER_DIALOG_GET_PRIVATE (dialog);
+
+	if (response_id == GTK_RESPONSE_APPLY)
+		e_google_chooser_apply_selected (priv->chooser);
+}
+
+static void
+e_google_chooser_dialog_class_init (EGoogleChooserDialogClass *class)
+{
+	GObjectClass *object_class;
+	GtkWidgetClass *widget_class;
+	GtkDialogClass *dialog_class;
+
+	g_type_class_add_private (class, sizeof (EGoogleChooserDialogPrivate));
+
+	object_class = G_OBJECT_CLASS (class);
+	object_class->set_property = google_chooser_dialog_set_property;
+	object_class->get_property = google_chooser_dialog_get_property;
+	object_class->dispose = google_chooser_dialog_dispose;
+	object_class->constructed = google_chooser_dialog_constructed;
+
+	widget_class = GTK_WIDGET_CLASS (class);
+	widget_class->realize = google_chooser_dialog_realize;
+
+	dialog_class = GTK_DIALOG_CLASS (class);
+	dialog_class->response = google_chooser_dialog_response;
+
+	g_object_class_install_property (
+		object_class,
+		PROP_CHOOSER,
+		g_param_spec_object (
+			"chooser",
+			NULL,
+			NULL,
+			E_TYPE_GOOGLE_CHOOSER,
+			G_PARAM_READWRITE |
+			G_PARAM_CONSTRUCT_ONLY));
+}
+
+static void
+e_google_chooser_dialog_class_finalize (EGoogleChooserDialogClass *class)
+{
+}
+
+static void
+e_google_chooser_dialog_init (EGoogleChooserDialog *dialog)
+{
+	dialog->priv = E_GOOGLE_CHOOSER_DIALOG_GET_PRIVATE (dialog);
+}
+
+void
+e_google_chooser_dialog_type_register (GTypeModule *type_module)
+{
+	/* XXX G_DEFINE_DYNAMIC_TYPE declares a static type registration
+	 *     function, so we have to wrap it with a public function in
+	 *     order to register types from a separate compilation unit. */
+	e_google_chooser_dialog_register_type (type_module);
+}
+
+GtkWidget *
+e_google_chooser_dialog_new (EGoogleChooser *chooser,
+                             GtkWindow *parent)
+{
+	g_return_val_if_fail (E_IS_GOOGLE_CHOOSER (chooser), NULL);
+	g_return_val_if_fail (parent == NULL || GTK_IS_WINDOW (parent), NULL);
+
+	return g_object_new (
+		E_TYPE_GOOGLE_CHOOSER_DIALOG,
+		"chooser", chooser, "transient-for", parent, NULL);
+}
+
+EGoogleChooser *
+e_google_chooser_dialog_get_chooser (EGoogleChooserDialog *dialog)
+{
+	g_return_val_if_fail (E_IS_GOOGLE_CHOOSER_DIALOG (dialog), NULL);
+
+	return dialog->priv->chooser;
+}
+
diff --git a/modules/cal-config-google/e-google-chooser-dialog.h b/modules/cal-config-google/e-google-chooser-dialog.h
new file mode 100644
index 0000000..d7e3e37
--- /dev/null
+++ b/modules/cal-config-google/e-google-chooser-dialog.h
@@ -0,0 +1,68 @@
+/*
+ * e-google-chooser-dialog.h
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <webcal://www.gnu.org/licenses/>
+ *
+ */
+
+#ifndef E_GOOGLE_CHOOSER_DIALOG_H
+#define E_GOOGLE_CHOOSER_DIALOG_H
+
+#include "e-google-chooser.h"
+
+/* Standard GObject macros */
+#define E_TYPE_GOOGLE_CHOOSER_DIALOG \
+	(e_google_chooser_dialog_get_type ())
+#define E_GOOGLE_CHOOSER_DIALOG(obj) \
+	(G_TYPE_CHECK_INSTANCE_CAST \
+	((obj), E_TYPE_GOOGLE_CHOOSER_DIALOG, EGoogleChooserDialog))
+#define E_GOOGLE_CHOOSER_DIALOG_CLASS(cls) \
+	(G_TYPE_CHECK_CLASS_CAST \
+	((cls), E_TYPE_GOOGLE_CHOOSER_DIALOG, EGoogleChooserDialogClass))
+#define E_IS_GOOGLE_CHOOSER_DIALOG(obj) \
+	(G_TYPE_CHECK_INSTANCE_TYPE \
+	((obj), E_TYPE_GOOGLE_CHOOSER_DIALOG))
+#define E_IS_GOOGLE_CHOOSER_DIALOG_CLASS(cls) \
+	(G_TYPE_CHECK_CLASS_TYPE \
+	((cls), E_TYPE_GOOGLE_CHOOSER_DIALOG))
+#define E_GOOGLE_CHOOSER_DIALOG_GET_CLASS(obj) \
+	(G_TYPE_INSTANCE_GET_CLASS \
+	((obj), E_TYPE_GOOGLE_CHOOSER_DIALOG, EGoogleChooserDialogClass))
+
+G_BEGIN_DECLS
+
+typedef struct _EGoogleChooserDialog EGoogleChooserDialog;
+typedef struct _EGoogleChooserDialogClass EGoogleChooserDialogClass;
+typedef struct _EGoogleChooserDialogPrivate EGoogleChooserDialogPrivate;
+
+struct _EGoogleChooserDialog {
+	GtkDialog parent;
+	EGoogleChooserDialogPrivate *priv;
+};
+
+struct _EGoogleChooserDialogClass {
+	GtkDialogClass parent_class;
+};
+
+GType		e_google_chooser_dialog_get_type (void);
+void		e_google_chooser_dialog_type_register
+						(GTypeModule *type_module);
+GtkWidget *	e_google_chooser_dialog_new	(EGoogleChooser *chooser,
+						 GtkWindow *parent);
+EGoogleChooser *e_google_chooser_dialog_get_chooser
+						(EGoogleChooserDialog *dialog);
+
+G_END_DECLS
+
+#endif /* E_GOOGLE_CHOOSER_DIALOG_H */
diff --git a/modules/cal-config-google/e-google-chooser.c b/modules/cal-config-google/e-google-chooser.c
new file mode 100644
index 0000000..282258e
--- /dev/null
+++ b/modules/cal-config-google/e-google-chooser.c
@@ -0,0 +1,625 @@
+/*
+ * e-google-chooser.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <webcal://www.gnu.org/licenses/>
+ *
+ */
+
+#include "e-google-chooser.h"
+
+#include <config.h>
+#include <string.h>
+#include <gdata/gdata.h>
+#include <glib/gi18n-lib.h>
+
+#include <libedataserver/e-source-authentication.h>
+#include <libedataserver/e-source-calendar.h>
+#include <libedataserver/e-source-password.h>
+#include <libedataserverui/e-cell-renderer-color.h>
+#include <libedataserverui/e-passwords.h>
+
+#include "e-source-caldav.h"
+
+#define E_GOOGLE_CHOOSER_GET_PRIVATE(obj) \
+	(G_TYPE_INSTANCE_GET_PRIVATE \
+	((obj), E_TYPE_GOOGLE_CHOOSER, EGoogleChooserPrivate))
+
+#define CALDAV_EVENTS_PATH_FORMAT "/calendar/dav/%s/events"
+
+typedef struct _Context Context;
+
+struct _EGoogleChooserPrivate {
+	ESource *source;
+};
+
+struct _Context {
+	GCancellable *cancellable;
+	GDataCalendarService *service;
+	GDataClientLoginAuthorizer *authorizer;
+	ESource *source;
+};
+
+enum {
+	PROP_0,
+	PROP_SOURCE
+};
+
+enum {
+	COLUMN_COLOR,
+	COLUMN_PATH,
+	COLUMN_TITLE,
+	COLUMN_WRITABLE,
+	NUM_COLUMNS
+};
+
+G_DEFINE_DYNAMIC_TYPE (
+	EGoogleChooser,
+	e_google_chooser,
+	GTK_TYPE_TREE_VIEW)
+
+static void
+context_free (Context *context)
+{
+	if (context->cancellable != NULL)
+		g_object_unref (context->cancellable);
+
+	if (context->service != NULL)
+		g_object_unref (context->service);
+
+	if (context->authorizer != NULL)
+		g_object_unref (context->authorizer);
+
+	if (context->source != NULL)
+		g_object_unref (context->source);
+
+	g_slice_free (Context, context);
+}
+
+static gchar *
+google_chooser_extract_caldav_events_path (const gchar *uri)
+{
+	SoupURI *soup_uri;
+	gchar *resource_name;
+	gchar *path;
+	gchar *cp;
+
+	soup_uri = soup_uri_new (uri);
+	g_return_val_if_fail (soup_uri != NULL, NULL);
+
+	/* Isolate the resource name in the "feeds" URI. */
+
+	cp = strstr (soup_uri->path, "/feeds/");
+	g_return_val_if_fail (cp != NULL, NULL);
+
+	/* strlen("/feeds/) == 7 */
+	resource_name = g_strdup (cp + 7);
+	cp = strchr (resource_name, '/');
+	if (cp != NULL)
+		*cp = '\0';
+
+	/* Decode any encoded 'at' symbols ('%40' -> '@'). */
+	if (strstr (resource_name, "%40") != NULL) {
+		gchar **segments;
+
+		segments = g_strsplit (resource_name, "%40", 0);
+		g_free (resource_name);
+		resource_name = g_strjoinv ("@", segments);
+		g_strfreev (segments);
+	}
+
+	/* Use the decoded resource name in the CalDAV events path. */
+	path = g_strdup_printf (CALDAV_EVENTS_PATH_FORMAT, resource_name);
+
+	g_free (resource_name);
+
+	soup_uri_free (soup_uri);
+
+	return path;
+}
+
+static void
+google_chooser_set_source (EGoogleChooser *chooser,
+                           ESource *source)
+{
+	g_return_if_fail (E_IS_SOURCE (source));
+	g_return_if_fail (chooser->priv->source == NULL);
+
+	chooser->priv->source = g_object_ref (source);
+}
+
+static void
+google_chooser_set_property (GObject *object,
+                             guint property_id,
+                             const GValue *value,
+                             GParamSpec *pspec)
+{
+	switch (property_id) {
+		case PROP_SOURCE:
+			google_chooser_set_source (
+				E_GOOGLE_CHOOSER (object),
+				g_value_get_object (value));
+			return;
+	}
+
+	G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+google_chooser_get_property (GObject *object,
+                             guint property_id,
+                             GValue *value,
+                             GParamSpec *pspec)
+{
+	switch (property_id) {
+		case PROP_SOURCE:
+			g_value_set_object (
+				value, e_google_chooser_get_source (
+				E_GOOGLE_CHOOSER (object)));
+			return;
+	}
+
+	G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+google_chooser_dispose (GObject *object)
+{
+	EGoogleChooserPrivate *priv;
+
+	priv = E_GOOGLE_CHOOSER_GET_PRIVATE (object);
+
+	if (priv->source != NULL) {
+		g_object_unref (priv->source);
+		priv->source = NULL;
+	}
+
+	/* Chain up parent's dispose() method. */
+	G_OBJECT_CLASS (e_google_chooser_parent_class)->dispose (object);
+}
+
+static void
+google_chooser_constructed (GObject *object)
+{
+	GtkTreeView *tree_view;
+	GtkListStore *list_store;
+	GtkCellRenderer *renderer;
+	GtkTreeViewColumn *column;
+
+	tree_view = GTK_TREE_VIEW (object);
+
+	/* Chain up to parent's constructed() method. */
+	G_OBJECT_CLASS (e_google_chooser_parent_class)->constructed (object);
+
+	list_store = gtk_list_store_new (
+		NUM_COLUMNS,
+		GDK_TYPE_COLOR,		/* COLUMN_COLOR */
+		G_TYPE_STRING,		/* COLUMN_PATH */
+		G_TYPE_STRING,		/* COLUMN_TITLE */
+		G_TYPE_BOOLEAN);	/* COLUMN_WRITABLE */
+
+	gtk_tree_view_set_model (tree_view, GTK_TREE_MODEL (list_store));
+
+	column = gtk_tree_view_column_new ();
+	gtk_tree_view_column_set_expand (column, TRUE);
+	gtk_tree_view_column_set_title (column, _("Name"));
+	gtk_tree_view_insert_column (tree_view, column, -1);
+
+	renderer = e_cell_renderer_color_new ();
+	gtk_tree_view_column_pack_start (column, renderer, FALSE);
+	gtk_tree_view_column_add_attribute (
+		column, renderer, "color", COLUMN_COLOR);
+
+	renderer = gtk_cell_renderer_text_new ();
+	gtk_tree_view_column_pack_start (column, renderer, TRUE);
+	gtk_tree_view_column_add_attribute (
+		column, renderer, "text", COLUMN_TITLE);
+}
+
+static void
+e_google_chooser_class_init (EGoogleChooserClass *class)
+{
+	GObjectClass *object_class;
+
+	g_type_class_add_private (class, sizeof (EGoogleChooserPrivate));
+
+	object_class = G_OBJECT_CLASS (class);
+	object_class->set_property = google_chooser_set_property;
+	object_class->get_property = google_chooser_get_property;
+	object_class->dispose = google_chooser_dispose;
+	object_class->constructed = google_chooser_constructed;
+
+	g_object_class_install_property (
+		object_class,
+		PROP_SOURCE,
+		g_param_spec_object (
+			"source",
+			"Source",
+			"Google data source",
+			E_TYPE_SOURCE,
+			G_PARAM_READWRITE |
+			G_PARAM_CONSTRUCT_ONLY));
+}
+
+static void
+e_google_chooser_class_finalize (EGoogleChooserClass *class)
+{
+}
+
+static void
+e_google_chooser_init (EGoogleChooser *chooser)
+{
+	chooser->priv = E_GOOGLE_CHOOSER_GET_PRIVATE (chooser);
+}
+
+void
+e_google_chooser_type_register (GTypeModule *type_module)
+{
+	/* XXX G_DEFINE_DYNAMIC_TYPE declares a static type registration
+	 *     function, so we have to wrap it with a public function in
+	 *     order to register types from a separate compilation unit. */
+	e_google_chooser_register_type (type_module);
+}
+
+GtkWidget *
+e_google_chooser_new (ESource *source)
+{
+	g_return_val_if_fail (E_IS_SOURCE (source), NULL);
+
+	return g_object_new (E_TYPE_GOOGLE_CHOOSER, "source", source, NULL);
+}
+
+ESource *
+e_google_chooser_get_source (EGoogleChooser *chooser)
+{
+	g_return_val_if_fail (E_IS_GOOGLE_CHOOSER (chooser), NULL);
+
+	return chooser->priv->source;
+}
+
+gchar *
+e_google_chooser_get_decoded_user (EGoogleChooser *chooser)
+{
+	ESource *source;
+	ESourceAuthentication *authentication_extension;
+	const gchar *user;
+	gchar *decoded_user;
+
+	g_return_val_if_fail (E_IS_GOOGLE_CHOOSER (chooser), NULL);
+
+	source = e_google_chooser_get_source (chooser);
+
+	authentication_extension = e_source_get_extension (
+		source, E_SOURCE_EXTENSION_AUTHENTICATION);
+
+	user = e_source_authentication_get_user (authentication_extension);
+	if (user == NULL || *user == '\0')
+		return NULL;
+
+	/* Decode any encoded 'at' symbols ('%40' -> '@'). */
+	if (strstr (user, "%40") != NULL) {
+		gchar **segments;
+
+		segments = g_strsplit (user, "%40", 0);
+		decoded_user = g_strjoinv ("@", segments);
+		g_strfreev (segments);
+
+	/* If no domain is given, append "@gmail.com". */
+	} else if (strstr (user, "@") == NULL) {
+		decoded_user = g_strconcat (user, "@gmail.com", NULL);
+
+	/* Otherwise the user name should be fine as is. */
+	} else {
+		decoded_user = g_strdup (user);
+	}
+
+	return decoded_user;
+}
+
+static void
+google_chooser_query_cb (GDataService *service,
+                         GAsyncResult *result,
+                         GSimpleAsyncResult *simple)
+{
+	GObject *object;
+	GDataFeed *feed;
+	GList *list, *link;
+	GtkTreeView *tree_view;
+	GtkListStore *list_store;
+	GtkTreeModel *tree_model;
+	GError *error = NULL;
+
+	feed = gdata_service_query_finish (service, result, &error);
+
+	if (error != NULL) {
+		g_warn_if_fail (feed == NULL);
+		g_simple_async_result_set_from_error (simple, error);
+		g_simple_async_result_complete (simple);
+		g_object_unref (simple);
+		return;
+	}
+
+	g_return_if_fail (GDATA_IS_FEED (feed));
+
+	list = gdata_feed_get_entries (feed);
+
+	/* This returns a new reference, for reasons passing understanding. */
+	object = g_async_result_get_source_object (G_ASYNC_RESULT (simple));
+
+	tree_view = GTK_TREE_VIEW (object);
+	tree_model = gtk_tree_view_get_model (tree_view);
+	list_store = GTK_LIST_STORE (tree_model);
+
+	gtk_list_store_clear (list_store);
+
+	for (link = list; link != NULL; link = g_list_next (link)) {
+		GDataCalendarCalendar *calendar;
+		GDataEntry *entry;
+		GDataLink *alt;
+		GDataColor color;
+		GdkColor gdkcolor;
+		GtkTreeIter iter;
+		const gchar *uri;
+		const gchar *title;
+		const gchar *access;
+		gboolean writable;
+		gchar *path;
+
+		entry = GDATA_ENTRY (link->data);
+		calendar = GDATA_CALENDAR_CALENDAR (entry);
+
+		/* Skip hidden entries. */
+		if (gdata_calendar_calendar_is_hidden (calendar))
+			continue;
+
+		/* Look up the alternate link, skip if there is none. */
+		alt = gdata_entry_look_up_link (entry, GDATA_LINK_ALTERNATE);
+		if (alt == NULL)
+			continue;
+
+		uri = gdata_link_get_uri (alt);
+		title = gdata_entry_get_title (entry);
+		gdata_calendar_calendar_get_color (calendar, &color);
+		access = gdata_calendar_calendar_get_access_level (calendar);
+
+		if (uri == NULL || *uri == '\0')
+			continue;
+
+		if (title == NULL || *title == '\0')
+			continue;
+
+		path = google_chooser_extract_caldav_events_path (uri);
+
+		gdkcolor.pixel = 0;
+		gdkcolor.red = color.red * 256;
+		gdkcolor.green = color.green * 256;
+		gdkcolor.blue = color.blue * 256;
+
+		if (access == NULL)
+			writable = TRUE;
+		else if (g_ascii_strcasecmp (access, "owner") == 0)
+			writable = TRUE;
+		else if (g_ascii_strcasecmp (access, "contributor") == 0)
+			writable = TRUE;
+		else
+			writable = FALSE;
+
+		gtk_list_store_append (list_store, &iter);
+
+		gtk_list_store_set (
+			list_store, &iter,
+			COLUMN_COLOR, &gdkcolor,
+			COLUMN_PATH, path,
+			COLUMN_TITLE, title,
+			COLUMN_WRITABLE, writable,
+			-1);
+
+		g_free (path);
+	}
+
+	g_object_unref (object);
+	g_object_unref (feed);
+
+	g_simple_async_result_complete (simple);
+	g_object_unref (simple);
+}
+
+static void
+google_chooser_authenticate_cb (GDataClientLoginAuthorizer *authorizer,
+                                GAsyncResult *result,
+                                GSimpleAsyncResult *simple)
+{
+	Context *context;
+	GError *error = NULL;
+
+	context = g_simple_async_result_get_op_res_gpointer (simple);
+
+	gdata_client_login_authorizer_authenticate_finish (
+		authorizer, result, &error);
+
+	if (error != NULL) {
+		g_simple_async_result_set_from_error (simple, error);
+		g_simple_async_result_complete (simple);
+		g_object_unref (simple);
+		return;
+	}
+
+	/* We're authenticated, now query for all calendars. */
+
+	gdata_calendar_service_query_all_calendars_async (
+		context->service, NULL, context->cancellable,
+		NULL, NULL, NULL, (GAsyncReadyCallback)
+		google_chooser_query_cb, simple);
+}
+
+void
+e_google_chooser_populate (EGoogleChooser *chooser,
+                           GCancellable *cancellable,
+                           GAsyncReadyCallback callback,
+                           gpointer user_data)
+{
+	GDataClientLoginAuthorizer *authorizer;
+	GDataCalendarService *service;
+	GSimpleAsyncResult *simple;
+	Context *context;
+	ESource *source;
+	gpointer parent;
+	gchar *password;
+	gchar *prompt;
+	gchar *user;
+
+	g_return_if_fail (E_IS_GOOGLE_CHOOSER (chooser));
+
+	source = e_google_chooser_get_source (chooser);
+
+	authorizer = gdata_client_login_authorizer_new (
+		PACKAGE_NAME, GDATA_TYPE_CALENDAR_SERVICE);
+
+	service = gdata_calendar_service_new (GDATA_AUTHORIZER (authorizer));
+
+	context = g_slice_new0 (Context);
+	context->service = service;  /* takes ownership */
+	context->source = g_object_ref (source);
+
+	if (G_IS_CANCELLABLE (cancellable))
+		context->cancellable = g_object_ref (cancellable);
+	else
+		context->cancellable = g_cancellable_new ();
+
+	simple = g_simple_async_result_new (
+		G_OBJECT (chooser), callback,
+		user_data, e_google_chooser_populate);
+
+	g_simple_async_result_set_op_res_gpointer (
+		simple, context, (GDestroyNotify) context_free);
+
+	/* Prompt for a password. */
+
+	user = e_google_chooser_get_decoded_user (chooser);
+
+	parent = gtk_widget_get_toplevel (GTK_WIDGET (chooser));
+	parent = gtk_widget_is_toplevel (parent) ? parent : NULL;
+
+	prompt = g_strdup_printf (
+		_("Enter Google password for user '%s'."), user);
+
+	/* XXX The 'key' (3rd) argument doesn't matter since we're
+	 *     passing E_PASSWORDS_REMEMBER_NEVER, it just needs to
+	 *     be non-NULL.  This API is degenerating rapidly. */
+	password = e_passwords_ask_password (
+		"", NULL, "bogus key", prompt,
+		E_PASSWORDS_REMEMBER_NEVER |
+		E_PASSWORDS_DISABLE_REMEMBER |
+		E_PASSWORDS_SECRET, NULL, parent);
+
+	g_free (prompt);
+
+	if (password == NULL) {
+		g_cancellable_cancel (context->cancellable);
+		g_simple_async_result_set_error (
+			simple, G_IO_ERROR, G_IO_ERROR_CANCELLED,
+			"%s", _("User declined to provide a password"));
+		g_simple_async_result_complete (simple);
+		g_object_unref (authorizer);
+		g_object_unref (simple);
+		g_free (user);
+		return;
+	}
+
+	/* Try authenticating. */
+
+	gdata_client_login_authorizer_authenticate_async (
+		authorizer, user, password,
+		context->cancellable, (GAsyncReadyCallback)
+		google_chooser_authenticate_cb, simple);
+
+	g_free (password);
+	g_free (user);
+
+	g_object_unref (authorizer);
+}
+
+gboolean
+e_google_chooser_populate_finish (EGoogleChooser *chooser,
+                                  GAsyncResult *result,
+                                  GError **error)
+{
+	GSimpleAsyncResult *simple;
+
+	g_return_val_if_fail (
+		g_simple_async_result_is_valid (
+		result, G_OBJECT (chooser),
+		e_google_chooser_populate), FALSE);
+
+	simple = G_SIMPLE_ASYNC_RESULT (result);
+
+	/* Assume success unless a GError is set. */
+	return !g_simple_async_result_propagate_error (simple, error);
+}
+
+gboolean
+e_google_chooser_apply_selected (EGoogleChooser *chooser)
+{
+	ESourceSelectable *selectable_extension;
+	ESourceWebdav *webdav_extension;
+	GtkTreeSelection *selection;
+	GtkTreeModel *model;
+	GtkTreeIter iter;
+	ESource *source;
+	GdkColor *color;
+	SoupURI *soup_uri;
+	gchar *color_spec;
+	gchar *title;
+	gchar *path;
+
+	g_return_val_if_fail (E_IS_GOOGLE_CHOOSER (chooser), FALSE);
+
+	source = e_google_chooser_get_source (chooser);
+	selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (chooser));
+
+	if (!gtk_tree_selection_get_selected (selection, &model, &iter))
+		return FALSE;
+
+	gtk_tree_model_get (
+		model, &iter,
+		COLUMN_COLOR, &color,
+		COLUMN_PATH, &path,
+		COLUMN_TITLE, &title,
+		-1);
+
+	selectable_extension = e_source_get_extension (
+		source, E_SOURCE_EXTENSION_CALENDAR);
+
+	webdav_extension = e_source_get_extension (
+		source, E_SOURCE_EXTENSION_CALDAV_BACKEND);
+
+	e_source_set_display_name (source, title);
+
+	e_source_webdav_set_display_name (webdav_extension, title);
+
+	/* XXX Might be easier to expose get/set_path functions? */
+	soup_uri = e_source_webdav_get_soup_uri (webdav_extension);
+	soup_uri_set_path (soup_uri, path);
+	e_source_webdav_set_soup_uri (webdav_extension, soup_uri);
+	soup_uri_free (soup_uri);
+
+	color_spec = gdk_color_to_string (color);
+	e_source_selectable_set_color (selectable_extension, color_spec);
+	g_free (color_spec);
+
+	gdk_color_free (color);
+	g_free (title);
+	g_free (path);
+
+	return TRUE;
+}
diff --git a/modules/cal-config-google/e-google-chooser.h b/modules/cal-config-google/e-google-chooser.h
new file mode 100644
index 0000000..f2cd28a
--- /dev/null
+++ b/modules/cal-config-google/e-google-chooser.h
@@ -0,0 +1,76 @@
+/*
+ * e-google-chooser.h
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <webcal://www.gnu.org/licenses/>
+ *
+ */
+
+#ifndef E_GOOGLE_CHOOSER_H
+#define E_GOOGLE_CHOOSER_H
+
+#include <gtk/gtk.h>
+#include <libedataserver/e-source.h>
+
+/* Standard GObject macros */
+#define E_TYPE_GOOGLE_CHOOSER \
+	(e_google_chooser_get_type ())
+#define E_GOOGLE_CHOOSER(obj) \
+	(G_TYPE_CHECK_INSTANCE_CAST \
+	((obj), E_TYPE_GOOGLE_CHOOSER, EGoogleChooser))
+#define E_GOOGLE_CHOOSER_CLASS(cls) \
+	(G_TYPE_CHECK_CLASS_CAST \
+	((cls), E_TYPE_GOOGLE_CHOOSER, EGoogleChooserClass))
+#define E_IS_GOOGLE_CHOOSER(obj) \
+	(G_TYPE_CHECK_INSTANCE_TYPE \
+	((obj), E_TYPE_GOOGLE_CHOOSER))
+#define E_IS_GOOGLE_CHOOSER_CLASS(cls) \
+	(G_TYPE_CHECK_CLASS_TYPE \
+	((cls), E_TYPE_GOOGLE_CHOOSER))
+#define E_GOOGLE_CHOOSER_GET_CLASS(obj) \
+	(G_TYPE_INSTANCE_GET_CLASS \
+	((obj), E_TYPE_GOOGLE_CHOOSER, EGoogleChooserClass))
+
+G_BEGIN_DECLS
+
+typedef struct _EGoogleChooser EGoogleChooser;
+typedef struct _EGoogleChooserClass EGoogleChooserClass;
+typedef struct _EGoogleChooserPrivate EGoogleChooserPrivate;
+
+struct _EGoogleChooser {
+	GtkTreeView parent;
+	EGoogleChooserPrivate *priv;
+};
+
+struct _EGoogleChooserClass {
+	GtkTreeViewClass parent_class;
+};
+
+GType		e_google_chooser_get_type	(void);
+void		e_google_chooser_type_register
+						(GTypeModule *type_module);
+GtkWidget *	e_google_chooser_new		(ESource *source);
+ESource *	e_google_chooser_get_source	(EGoogleChooser *chooser);
+gchar *		e_google_chooser_get_decoded_user
+						(EGoogleChooser *chooser);
+void		e_google_chooser_populate	(EGoogleChooser *chooser,
+						 GCancellable *cancellable,
+						 GAsyncReadyCallback callback,
+						 gpointer user_data);
+gboolean	e_google_chooser_populate_finish
+						(EGoogleChooser *chooser,
+						 GAsyncResult *result,
+						 GError **error);
+gboolean	e_google_chooser_apply_selected	(EGoogleChooser *chooser);
+
+#endif /* E_GOOGLE_CHOOSER_H */
diff --git a/modules/cal-config-google/e-source-caldav.c b/modules/cal-config-google/e-source-caldav.c
new file mode 100644
index 0000000..d6e1462
--- /dev/null
+++ b/modules/cal-config-google/e-source-caldav.c
@@ -0,0 +1,201 @@
+/*
+ * e-source-caldav.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <webcal://www.gnu.org/licenses/>
+ *
+ */
+
+#include "e-source-caldav.h"
+
+#define E_SOURCE_CALDAV_GET_PRIVATE(obj) \
+	(G_TYPE_INSTANCE_GET_PRIVATE \
+	((obj), E_TYPE_SOURCE_CALDAV, ESourceCaldavPrivate))
+
+struct _ESourceCaldavPrivate {
+	gboolean autoschedule;
+	gchar *email;
+};
+
+enum {
+	PROP_0,
+	PROP_AUTOSCHEDULE,
+	PROP_EMAIL
+};
+
+G_DEFINE_DYNAMIC_TYPE (
+	ESourceCaldav,
+	e_source_caldav,
+	E_TYPE_SOURCE_WEBDAV)
+
+static void
+source_caldav_set_property (GObject *object,
+                            guint property_id,
+                            const GValue *value,
+                            GParamSpec *pspec)
+{
+	switch (property_id) {
+		case PROP_AUTOSCHEDULE:
+			e_source_caldav_set_autoschedule (
+				E_SOURCE_CALDAV (object),
+				g_value_get_boolean (value));
+			return;
+
+		case PROP_EMAIL:
+			e_source_caldav_set_email (
+				E_SOURCE_CALDAV (object),
+				g_value_get_string (value));
+			return;
+	}
+
+	G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+source_caldav_get_property (GObject *object,
+                            guint property_id,
+                            GValue *value,
+                            GParamSpec *pspec)
+{
+	switch (property_id) {
+		case PROP_AUTOSCHEDULE:
+			g_value_set_boolean (
+				value,
+				e_source_caldav_get_autoschedule (
+				E_SOURCE_CALDAV (object)));
+			return;
+
+		case PROP_EMAIL:
+			g_value_set_string (
+				value,
+				e_source_caldav_get_email (
+				E_SOURCE_CALDAV (object)));
+			return;
+	}
+
+	G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+source_caldav_finalize (GObject *object)
+{
+	ESourceCaldavPrivate *priv;
+
+	priv = E_SOURCE_CALDAV_GET_PRIVATE (object);
+
+	g_free (priv->email);
+
+	/* Chain up to parent's finalize() method. */
+	G_OBJECT_CLASS (e_source_caldav_parent_class)->finalize (object);
+}
+
+static void
+e_source_caldav_class_init (ESourceCaldavClass *class)
+{
+	GObjectClass *object_class;
+	ESourceExtensionClass *extension_class;
+
+	g_type_class_add_private (class, sizeof (ESourceCaldavPrivate));
+
+	object_class = G_OBJECT_CLASS (class);
+	object_class->set_property = source_caldav_set_property;
+	object_class->get_property = source_caldav_get_property;
+	object_class->finalize = source_caldav_finalize;
+
+	extension_class = E_SOURCE_EXTENSION_CLASS (class);
+	extension_class->name = E_SOURCE_EXTENSION_CALDAV_BACKEND;
+
+	g_object_class_install_property (
+		object_class,
+		PROP_AUTOSCHEDULE,
+		g_param_spec_boolean (
+			"autoschedule",
+			"Auto-Schedule",
+			"Server handles meeting invitations",
+			FALSE,
+			G_PARAM_READWRITE |
+			G_PARAM_CONSTRUCT |
+			E_SOURCE_PARAM_SETTING));
+
+	g_object_class_install_property (
+		object_class,
+		PROP_EMAIL,
+		g_param_spec_string (
+			"email",
+			"Email",
+			"User's email address",
+			"",
+			G_PARAM_READWRITE |
+			G_PARAM_CONSTRUCT |
+			E_SOURCE_PARAM_SETTING));
+}
+
+static void
+e_source_caldav_class_finalize (ESourceCaldavClass *class)
+{
+}
+
+static void
+e_source_caldav_init (ESourceCaldav *extension)
+{
+	extension->priv = E_SOURCE_CALDAV_GET_PRIVATE (extension);
+}
+
+void
+e_source_caldav_type_register (GTypeModule *type_module)
+{
+	/* XXX G_DEFINE_DYNAMIC_TYPE declares a static type registration
+	 *     function, so we have to wrap it with a public function in
+	 *     order to register types from a separate compilation unit. */
+	e_source_caldav_register_type (type_module);
+}
+
+gboolean
+e_source_caldav_get_autoschedule (ESourceCaldav *extension)
+{
+	g_return_val_if_fail (E_IS_SOURCE_CALDAV (extension), FALSE);
+
+	return extension->priv->autoschedule;
+}
+
+void
+e_source_caldav_set_autoschedule (ESourceCaldav *extension,
+                                  gboolean autoschedule)
+{
+	g_return_if_fail (E_IS_SOURCE_CALDAV (extension));
+
+	extension->priv->autoschedule = autoschedule;
+
+	g_object_notify (G_OBJECT (extension), "autoschedule");
+}
+
+const gchar *
+e_source_caldav_get_email (ESourceCaldav *extension)
+{
+	g_return_val_if_fail (E_IS_SOURCE_CALDAV (extension), NULL);
+
+	return extension->priv->email;
+}
+
+void
+e_source_caldav_set_email (ESourceCaldav *extension,
+                           const gchar *email)
+{
+	g_return_if_fail (E_IS_SOURCE_CALDAV (extension));
+
+	g_free (extension->priv->email);
+	extension->priv->email = g_strdup (email);
+
+	g_object_notify (G_OBJECT (extension), "email");
+}
+
diff --git a/modules/cal-config-google/e-source-caldav.h b/modules/cal-config-google/e-source-caldav.h
new file mode 100644
index 0000000..7e46d52
--- /dev/null
+++ b/modules/cal-config-google/e-source-caldav.h
@@ -0,0 +1,71 @@
+/*
+ * e-source-caldav.h
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <webcal://www.gnu.org/licenses/>
+ *
+ */
+
+#ifndef E_SOURCE_CALDAV_H
+#define E_SOURCE_CALDAV_H
+
+#include <libedataserver/e-source-webdav.h>
+
+/* Standard GObject macros */
+#define E_TYPE_SOURCE_CALDAV \
+	(e_source_caldav_get_type ())
+#define E_SOURCE_CALDAV(obj) \
+	(G_TYPE_CHECK_INSTANCE_CAST \
+	((obj), E_TYPE_SOURCE_CALDAV, ESourceCaldav))
+#define E_SOURCE_CALDAV_CLASS(cls) \
+	(G_TYPE_CHECK_CLASS_CAST \
+	((cls), E_TYPE_SOURCE_CALDAV, ESourceCaldavClass))
+#define E_IS_SOURCE_CALDAV(obj) \
+	(G_TYPE_CHECK_INSTANCE_TYPE \
+	((obj), E_TYPE_SOURCE_CALDAV))
+#define E_IS_SOURCE_CALDAV_CLASS(cls) \
+	(G_TYPE_CHECK_CLASS_TYPE \
+	((cls), E_TYPE_SOURCE_CALDAV))
+#define E_SOURCE_CALDAV_GET_CLASS(obj) \
+	(G_TYPE_INSTANCE_GET_CLASS \
+	((obj), E_TYPE_SOURCE_CALDAV, ESourceCaldavClass))
+
+#define E_SOURCE_EXTENSION_CALDAV_BACKEND "CalDAV Backend"
+
+G_BEGIN_DECLS
+
+typedef struct _ESourceCaldav ESourceCaldav;
+typedef struct _ESourceCaldavClass ESourceCaldavClass;
+typedef struct _ESourceCaldavPrivate ESourceCaldavPrivate;
+
+struct _ESourceCaldav {
+	ESourceWebdav parent;
+	ESourceCaldavPrivate *priv;
+};
+
+struct _ESourceCaldavClass {
+	ESourceWebdavClass parent_class;
+};
+
+GType		e_source_caldav_get_type	(void);
+void		e_source_caldav_type_register	(GTypeModule *type_module);
+gboolean	e_source_caldav_get_autoschedule
+						(ESourceCaldav *extension);
+void		e_source_caldav_set_autoschedule
+						(ESourceCaldav *extension,
+						 gboolean autoschedule);
+const gchar *	e_source_caldav_get_email	(ESourceCaldav *extension);
+void		e_source_caldav_set_email	(ESourceCaldav *extension,
+						 const gchar *email);
+
+#endif /* E_SOURCE_CALDAV_H */
diff --git a/modules/cal-config-google/evolution-cal-config-google.c b/modules/cal-config-google/evolution-cal-config-google.c
new file mode 100644
index 0000000..d7e262f
--- /dev/null
+++ b/modules/cal-config-google/evolution-cal-config-google.c
@@ -0,0 +1,214 @@
+/*
+ * evolution-cal-config-google.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ */
+
+#include <config.h>
+#include <glib/gi18n-lib.h>
+
+#include <libebackend/e-extension.h>
+#include <libedataserver/e-source-authentication.h>
+#include <libedataserver/e-source-calendar.h>
+
+#include <misc/e-source-config-backend.h>
+#include <calendar/gui/e-cal-source-config.h>
+
+#include "e-google-chooser-button.h"
+#include "e-google-chooser-dialog.h"
+#include "e-source-caldav.h"
+
+typedef ESourceConfigBackend ECalConfigGoogle;
+typedef ESourceConfigBackendClass ECalConfigGoogleClass;
+
+typedef struct _Context Context;
+
+struct _Context {
+	GtkWidget *user_entry;
+	GtkWidget *google_button;
+};
+
+/* Module Entry Points */
+void e_module_load (GTypeModule *type_module);
+void e_module_unload (GTypeModule *type_module);
+
+/* Forward Declarations */
+GType e_cal_config_google_get_type (void);
+
+G_DEFINE_DYNAMIC_TYPE (
+	ECalConfigGoogle,
+	e_cal_config_google,
+	E_TYPE_SOURCE_CONFIG_BACKEND)
+
+static void
+cal_config_google_context_free (Context *context)
+{
+	g_object_unref (context->user_entry);
+	g_object_unref (context->google_button);
+
+	g_slice_free (Context, context);
+}
+
+static gboolean
+cal_config_google_allow_creation (ESourceConfigBackend *backend)
+{
+	ESourceConfig *config;
+	ECalClientSourceType source_type;
+
+	config = e_source_config_backend_get_config (backend);
+
+	source_type = e_cal_source_config_get_source_type (
+		E_CAL_SOURCE_CONFIG (config));
+
+	/* XXX Google's CalDAV interface doesn't support tasks. */
+	return (source_type == E_CAL_CLIENT_SOURCE_TYPE_EVENTS);
+}
+
+static void
+cal_config_google_insert_widgets (ESourceConfigBackend *backend,
+                                  ESource *scratch_source)
+{
+	ESourceConfig *config;
+	ESourceExtension *extension;
+	GtkWidget *widget;
+	Context *context;
+	const gchar *extension_name;
+	const gchar *uid;
+
+	context = g_slice_new0 (Context);
+	uid = e_source_get_uid (scratch_source);
+	config = e_source_config_backend_get_config (backend);
+
+	g_object_set_data_full (
+		G_OBJECT (backend), uid, context,
+		(GDestroyNotify) cal_config_google_context_free);
+
+	e_cal_source_config_add_offline_toggle (
+		E_CAL_SOURCE_CONFIG (config), scratch_source);
+
+	widget = gtk_entry_new ();
+	e_source_config_insert_widget (
+		config, scratch_source, _("User:"), widget);
+	context->user_entry = g_object_ref (widget);
+	gtk_widget_show (widget);
+
+	widget = e_google_chooser_button_new (scratch_source);
+	e_source_config_insert_widget (
+		config, scratch_source, _("Calendar:"), widget);
+	context->google_button = g_object_ref (widget);
+	gtk_widget_show (widget);
+
+	e_source_config_add_refresh_interval (config, scratch_source);
+
+	extension_name = E_SOURCE_EXTENSION_AUTHENTICATION;
+	extension = e_source_get_extension (scratch_source, extension_name);
+
+	g_object_bind_property (
+		extension, "user",
+		context->user_entry, "text",
+		G_BINDING_BIDIRECTIONAL |
+		G_BINDING_SYNC_CREATE);
+}
+
+static void
+cal_config_google_commit_changes (ESourceConfigBackend *backend,
+                                  ESource *scratch_source)
+{
+	ESourceBackend *calendar_extension;
+	ESourceWebdav *webdav_extension;
+	SoupURI *soup_uri;
+
+	/* We need to hard-code a few settings. */
+
+	calendar_extension = e_source_get_extension (
+		scratch_source, E_SOURCE_EXTENSION_CALENDAR);
+
+	webdav_extension = e_source_get_extension (
+		scratch_source, E_SOURCE_EXTENSION_CALDAV_BACKEND);
+
+	/* The backend name is actually "caldav" even though the
+	 * ESource is a child of the built-in "Google" source. */
+	e_source_backend_set_backend_name (calendar_extension, "caldav");
+
+	soup_uri = e_source_webdav_get_soup_uri (webdav_extension);
+
+	/* The host name is fixed, obviously. */
+	soup_uri_set_host (soup_uri, "www.google.com");
+
+	/* Google's CalDAV interface requires a secure connection. */
+	soup_uri_set_scheme (soup_uri, SOUP_URI_SCHEME_HTTPS);
+
+	e_source_webdav_set_soup_uri (webdav_extension, soup_uri);
+
+	soup_uri_free (soup_uri);
+}
+
+static gboolean
+cal_config_google_check_complete (ESourceConfigBackend *backend,
+                                  ESource *scratch_source)
+{
+	Context *context;
+	const gchar *uid;
+	const gchar *user;
+
+	uid = e_source_get_uid (scratch_source);
+	context = g_object_get_data (G_OBJECT (backend), uid);
+	g_return_val_if_fail (context != NULL, FALSE);
+
+	user = gtk_entry_get_text (GTK_ENTRY (context->user_entry));
+
+	return (user != NULL && *user != '\0');
+}
+
+static void
+e_cal_config_google_class_init (ESourceConfigBackendClass *class)
+{
+	EExtensionClass *extension_class;
+
+	extension_class = E_EXTENSION_CLASS (class);
+	extension_class->extensible_type = E_TYPE_CAL_SOURCE_CONFIG;
+
+	class->parent_uid = "google-stub";
+	class->backend_name = "google";
+	class->allow_creation = cal_config_google_allow_creation;
+	class->insert_widgets = cal_config_google_insert_widgets;
+	class->check_complete = cal_config_google_check_complete;
+	class->commit_changes = cal_config_google_commit_changes;
+}
+
+static void
+e_cal_config_google_class_finalize (ESourceConfigBackendClass *class)
+{
+}
+
+static void
+e_cal_config_google_init (ESourceConfigBackend *backend)
+{
+}
+
+G_MODULE_EXPORT void
+e_module_load (GTypeModule *type_module)
+{
+	/*e_source_caldav_type_register (type_module);*/
+	e_google_chooser_type_register (type_module);
+	e_google_chooser_button_type_register (type_module);
+	e_google_chooser_dialog_type_register (type_module);
+	e_cal_config_google_register_type (type_module);
+}
+
+G_MODULE_EXPORT void
+e_module_unload (GTypeModule *type_module)
+{
+}



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