[evolution] Reuse WebDAV discovery dialog in Google and CalDAV calendar configs
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution] Reuse WebDAV discovery dialog in Google and CalDAV calendar configs
- Date: Mon, 23 Mar 2015 16:46:19 +0000 (UTC)
commit c85ac1fc8830087408cc334e0cb0737268e92b80
Author: Milan Crha <mcrha redhat com>
Date: Mon Mar 23 17:45:18 2015 +0100
Reuse WebDAV discovery dialog in Google and CalDAV calendar configs
e-util/Makefile.am | 2 -
e-util/e-cell-renderer-color.c | 241 ---
e-util/e-cell-renderer-color.h | 77 -
e-util/e-source-combo-box.c | 15 +-
e-util/e-source-selector.c | 13 +-
e-util/e-util.h | 1 -
modules/cal-config-caldav/Makefile.am | 6 +-
.../cal-config-caldav/e-caldav-chooser-dialog.c | 560 ------
.../cal-config-caldav/e-caldav-chooser-dialog.h | 67 -
modules/cal-config-caldav/e-caldav-chooser.c | 1854 -------------------
modules/cal-config-caldav/e-caldav-chooser.h | 109 --
.../evolution-cal-config-caldav.c | 112 +-
modules/cal-config-google/Makefile.am | 4 -
modules/cal-config-google/e-cal-config-google.c | 3 +-
.../cal-config-google/e-google-chooser-button.c | 155 ++-
.../cal-config-google/e-google-chooser-button.h | 5 +-
.../cal-config-google/e-google-chooser-dialog.c | 560 ------
.../cal-config-google/e-google-chooser-dialog.h | 67 -
modules/cal-config-google/e-google-chooser.c | 1891 --------------------
modules/cal-config-google/e-google-chooser.h | 112 --
.../cal-config-google/module-cal-config-google.c | 3 -
po/POTFILES.in | 4 -
22 files changed, 255 insertions(+), 5606 deletions(-)
---
diff --git a/e-util/Makefile.am b/e-util/Makefile.am
index 42e1fc8..6118801 100644
--- a/e-util/Makefile.am
+++ b/e-util/Makefile.am
@@ -156,7 +156,6 @@ evolution_util_include_HEADERS = \
e-cell-percent.h \
e-cell-pixbuf.h \
e-cell-popup.h \
- e-cell-renderer-color.h \
e-cell-size.h \
e-cell-text.h \
e-cell-toggle.h \
@@ -429,7 +428,6 @@ libevolution_util_la_SOURCES = \
e-cell-percent.c \
e-cell-pixbuf.c \
e-cell-popup.c \
- e-cell-renderer-color.c \
e-cell-size.c \
e-cell-text.c \
e-cell-toggle.c \
diff --git a/e-util/e-source-combo-box.c b/e-util/e-source-combo-box.c
index 48f5324..61dd756 100644
--- a/e-util/e-source-combo-box.c
+++ b/e-util/e-source-combo-box.c
@@ -20,8 +20,9 @@
#include <config.h>
#endif
+#include <libedataserverui/libedataserverui.h>
+
#include "e-source-combo-box.h"
-#include "e-cell-renderer-color.h"
#define E_SOURCE_COMBO_BOX_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE \
@@ -47,7 +48,7 @@ enum {
};
enum {
- COLUMN_COLOR, /* GDK_TYPE_COLOR */
+ COLUMN_COLOR, /* GDK_TYPE_RGBA */
COLUMN_NAME, /* G_TYPE_STRING */
COLUMN_SENSITIVE, /* G_TYPE_BOOLEAN */
COLUMN_UID, /* G_TYPE_STRING */
@@ -65,7 +66,7 @@ source_combo_box_traverse (GNode *node,
GtkTreeModel *model;
GtkTreeIter iter;
GString *indented;
- GdkColor color;
+ GdkRGBA rgba;
const gchar *ext_name;
const gchar *display_name;
const gchar *uid;
@@ -104,12 +105,12 @@ source_combo_box_traverse (GNode *node,
color_spec = e_source_selectable_get_color (extension);
if (color_spec != NULL && *color_spec != '\0')
- use_color = gdk_color_parse (color_spec, &color);
+ use_color = gdk_rgba_parse (&rgba, color_spec);
}
gtk_list_store_set (
GTK_LIST_STORE (model), &iter,
- COLUMN_COLOR, use_color ? &color : NULL,
+ COLUMN_COLOR, use_color ? &rgba : NULL,
COLUMN_NAME, indented->str,
COLUMN_SENSITIVE, sensitive,
COLUMN_UID, uid,
@@ -326,7 +327,7 @@ source_combo_box_constructed (GObject *object)
store = gtk_list_store_new (
NUM_COLUMNS,
- GDK_TYPE_COLOR, /* COLUMN_COLOR */
+ GDK_TYPE_RGBA, /* COLUMN_COLOR */
G_TYPE_STRING, /* COLUMN_NAME */
G_TYPE_BOOLEAN, /* COLUMN_SENSITIVE */
G_TYPE_STRING); /* COLUMN_UID */
@@ -343,7 +344,7 @@ source_combo_box_constructed (GObject *object)
gtk_cell_layout_pack_start (layout, renderer, FALSE);
gtk_cell_layout_set_attributes (
layout, renderer,
- "color", COLUMN_COLOR,
+ "rgba", COLUMN_COLOR,
"sensitive", COLUMN_SENSITIVE,
NULL);
diff --git a/e-util/e-source-selector.c b/e-util/e-source-selector.c
index fe2c79d..cb53789 100644
--- a/e-util/e-source-selector.c
+++ b/e-util/e-source-selector.c
@@ -24,7 +24,8 @@
#include <string.h>
-#include "e-cell-renderer-color.h"
+#include <libedataserverui/libedataserverui.h>
+
#include "e-source-selector.h"
#define E_SOURCE_SELECTOR_GET_PRIVATE(obj) \
@@ -1707,7 +1708,7 @@ e_source_selector_init (ESourceSelector *selector)
tree_store = gtk_tree_store_new (
NUM_COLUMNS,
G_TYPE_STRING, /* COLUMN_NAME */
- GDK_TYPE_COLOR, /* COLUMN_COLOR */
+ GDK_TYPE_RGBA, /* COLUMN_COLOR */
G_TYPE_BOOLEAN, /* COLUMN_ACTIVE */
G_TYPE_STRING, /* COLUMN_ICON_NAME */
G_TYPE_BOOLEAN, /* COLUMN_SHOW_COLOR */
@@ -1730,7 +1731,7 @@ e_source_selector_init (ESourceSelector *selector)
GTK_CELL_RENDERER_MODE_ACTIVATABLE, NULL);
gtk_tree_view_column_pack_start (column, renderer, FALSE);
gtk_tree_view_column_add_attribute (
- column, renderer, "color", COLUMN_COLOR);
+ column, renderer, "rgba", COLUMN_COLOR);
gtk_tree_view_column_add_attribute (
column, renderer, "visible", COLUMN_SHOW_COLOR);
@@ -2571,7 +2572,7 @@ e_source_selector_update_row (ESourceSelector *selector,
extension = e_source_get_extension (source, extension_name);
if (extension != NULL) {
- GdkColor color;
+ GdkRGBA rgba;
const gchar *color_spec = NULL;
const gchar *icon_name;
gboolean show_color;
@@ -2587,7 +2588,7 @@ e_source_selector_update_row (ESourceSelector *selector,
E_SOURCE_SELECTABLE (extension));
if (color_spec != NULL && *color_spec != '\0')
- show_color = gdk_color_parse (color_spec, &color);
+ show_color = gdk_rgba_parse (&rgba, color_spec);
show_icons = e_source_selector_get_show_icons (selector);
icon_name = source_selector_get_icon_name (selector, source);
@@ -2597,7 +2598,7 @@ e_source_selector_update_row (ESourceSelector *selector,
gtk_tree_store_set (
GTK_TREE_STORE (model), &iter,
COLUMN_NAME, display_name,
- COLUMN_COLOR, show_color ? &color : NULL,
+ COLUMN_COLOR, show_color ? &rgba : NULL,
COLUMN_ACTIVE, selected,
COLUMN_ICON_NAME, icon_name,
COLUMN_SHOW_COLOR, show_color,
diff --git a/e-util/e-util.h b/e-util/e-util.h
index e2481eb..c849dc1 100644
--- a/e-util/e-util.h
+++ b/e-util/e-util.h
@@ -69,7 +69,6 @@
#include <e-util/e-cell-percent.h>
#include <e-util/e-cell-pixbuf.h>
#include <e-util/e-cell-popup.h>
-#include <e-util/e-cell-renderer-color.h>
#include <e-util/e-cell-size.h>
#include <e-util/e-cell-text.h>
#include <e-util/e-cell-toggle.h>
diff --git a/modules/cal-config-caldav/Makefile.am b/modules/cal-config-caldav/Makefile.am
index 95ffc2a..3b3ed83 100644
--- a/modules/cal-config-caldav/Makefile.am
+++ b/modules/cal-config-caldav/Makefile.am
@@ -11,11 +11,7 @@ module_cal_config_caldav_la_CPPFLAGS = \
$(NULL)
module_cal_config_caldav_la_SOURCES = \
- evolution-cal-config-caldav.c \
- e-caldav-chooser.c \
- e-caldav-chooser.h \
- e-caldav-chooser-dialog.c \
- e-caldav-chooser-dialog.h
+ evolution-cal-config-caldav.c
module_cal_config_caldav_la_LIBADD = \
$(top_builddir)/e-util/libevolution-util.la \
diff --git a/modules/cal-config-caldav/evolution-cal-config-caldav.c
b/modules/cal-config-caldav/evolution-cal-config-caldav.c
index 652ab9e..75f5355 100644
--- a/modules/cal-config-caldav/evolution-cal-config-caldav.c
+++ b/modules/cal-config-caldav/evolution-cal-config-caldav.c
@@ -19,12 +19,10 @@
#include <glib/gi18n-lib.h>
#include <libebackend/libebackend.h>
+#include <libedataserverui/libedataserverui.h>
#include <e-util/e-util.h>
-#include "e-caldav-chooser.h"
-#include "e-caldav-chooser-dialog.h"
-
#define HTTP_PORT 80
#define HTTPS_PORT 443
@@ -92,12 +90,15 @@ cal_config_caldav_run_dialog (GtkButton *button,
{
ESourceConfig *config;
ESourceRegistry *registry;
- ECalClientSourceType source_type;
+ ESourceWebdav *webdav_extension;
ECredentialsPrompter *prompter;
- GtkWidget *dialog;
- GtkWidget *widget;
+ SoupURI *uri;
+ gchar *base_url;
+ GtkDialog *dialog;
gpointer parent;
gulong handler_id;
+ guint supports_filter = 0;
+ const gchar *title = NULL;
config = e_source_config_backend_get_config (context->backend);
registry = e_source_config_get_registry (config);
@@ -105,14 +106,32 @@ cal_config_caldav_run_dialog (GtkButton *button,
parent = gtk_widget_get_toplevel (GTK_WIDGET (config));
parent = gtk_widget_is_toplevel (parent) ? parent : NULL;
- source_type = e_cal_source_config_get_source_type (
- E_CAL_SOURCE_CONFIG (config));
+ switch (e_cal_source_config_get_source_type (E_CAL_SOURCE_CONFIG (config))) {
+ case E_CAL_CLIENT_SOURCE_TYPE_EVENTS:
+ supports_filter = E_WEBDAV_DISCOVER_SUPPORTS_EVENTS;
+ title = _("Choose a Calendar");
+ break;
+ case E_CAL_CLIENT_SOURCE_TYPE_MEMOS:
+ supports_filter = E_WEBDAV_DISCOVER_SUPPORTS_MEMOS;
+ title = _("Choose a Memo List");
+ break;
+ case E_CAL_CLIENT_SOURCE_TYPE_TASKS:
+ supports_filter = E_WEBDAV_DISCOVER_SUPPORTS_TASKS;
+ title = _("Choose a Task List");
+ break;
+ default:
+ g_return_if_reached ();
+ }
- widget = e_caldav_chooser_new (
- registry, context->scratch_source, source_type);
+ webdav_extension = e_source_get_extension (context->scratch_source,
E_SOURCE_EXTENSION_WEBDAV_BACKEND);
- dialog = e_caldav_chooser_dialog_new (
- E_CALDAV_CHOOSER (widget), parent);
+ uri = e_source_webdav_dup_soup_uri (webdav_extension);
+
+ prompter = e_credentials_prompter_new (registry);
+ e_credentials_prompter_set_auto_prompt (prompter, FALSE);
+ base_url = soup_uri_to_string (uri, FALSE);
+
+ dialog = e_webdav_discover_dialog_new (parent, title, prompter, context->scratch_source, base_url,
supports_filter);
if (parent != NULL)
e_binding_bind_property (
@@ -120,16 +139,75 @@ cal_config_caldav_run_dialog (GtkButton *button,
dialog, "icon-name",
G_BINDING_SYNC_CREATE);
- prompter = e_caldav_chooser_get_prompter (E_CALDAV_CHOOSER (widget));
-
handler_id = g_signal_connect (prompter, "get-dialog-parent",
G_CALLBACK (caldav_config_get_dialog_parent_cb), dialog);
- gtk_dialog_run (GTK_DIALOG (dialog));
+ e_webdav_discover_dialog_refresh (dialog);
+
+ if (gtk_dialog_run (dialog) == GTK_RESPONSE_ACCEPT) {
+ gchar *href = NULL, *display_name = NULL, *color = NULL, *email;
+ guint supports = 0;
+ GtkWidget *content;
+
+ content = e_webdav_discover_dialog_get_content (dialog);
+
+ if (e_webdav_discover_content_get_selected (content, 0, &href, &supports, &display_name,
&color)) {
+ soup_uri_free (uri);
+ uri = soup_uri_new (href);
+
+ if (uri) {
+ e_source_set_display_name (context->scratch_source, display_name);
+
+ e_source_webdav_set_display_name (webdav_extension, display_name);
+ e_source_webdav_set_soup_uri (webdav_extension, uri);
+
+ if (color && *color) {
+ ESourceSelectable *selectable_extension;
+ const gchar *extension_name;
+
+ switch (e_cal_source_config_get_source_type (E_CAL_SOURCE_CONFIG
(config))) {
+ case E_CAL_CLIENT_SOURCE_TYPE_EVENTS:
+ extension_name = E_SOURCE_EXTENSION_CALENDAR;
+ break;
+ case E_CAL_CLIENT_SOURCE_TYPE_MEMOS:
+ extension_name = E_SOURCE_EXTENSION_MEMO_LIST;
+ break;
+ case E_CAL_CLIENT_SOURCE_TYPE_TASKS:
+ extension_name = E_SOURCE_EXTENSION_TASK_LIST;
+ break;
+ default:
+ g_return_if_reached ();
+ }
+
+ selectable_extension = e_source_get_extension
(context->scratch_source, extension_name);
+
+ e_source_selectable_set_color (selectable_extension, color);
+ }
+ }
+
+ g_free (href);
+ g_free (display_name);
+ g_free (color);
+
+ href = NULL;
+ display_name = NULL;
+ color = NULL;
+ }
+
+ email = e_webdav_discover_content_get_user_address (content);
+ if (email && *email)
+ e_source_webdav_set_email_address (webdav_extension, email);
+ g_free (email);
+ }
g_signal_handler_disconnect (prompter, handler_id);
- gtk_widget_destroy (dialog);
+ gtk_widget_destroy (GTK_WIDGET (dialog));
+
+ g_object_unref (prompter);
+ if (uri)
+ soup_uri_free (uri);
+ g_free (base_url);
}
static gboolean
@@ -363,8 +441,6 @@ e_cal_config_caldav_init (ESourceConfigBackend *backend)
G_MODULE_EXPORT void
e_module_load (GTypeModule *type_module)
{
- e_caldav_chooser_type_register (type_module);
- e_caldav_chooser_dialog_type_register (type_module);
e_cal_config_caldav_register_type (type_module);
}
diff --git a/modules/cal-config-google/Makefile.am b/modules/cal-config-google/Makefile.am
index bb83eb6..bee9e4a 100644
--- a/modules/cal-config-google/Makefile.am
+++ b/modules/cal-config-google/Makefile.am
@@ -15,10 +15,6 @@ module_cal_config_google_la_SOURCES = \
e-cal-config-gtasks.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 \
module-cal-config-google.c \
module-cal-config-google.h
diff --git a/modules/cal-config-google/e-cal-config-google.c b/modules/cal-config-google/e-cal-config-google.c
index 85c45a8..97fe87f 100644
--- a/modules/cal-config-google/e-cal-config-google.c
+++ b/modules/cal-config-google/e-cal-config-google.c
@@ -23,7 +23,6 @@
#include <e-util/e-util.h>
#include "e-google-chooser-button.h"
-#include "e-google-chooser-dialog.h"
#include "module-cal-config-google.h"
typedef ESourceConfigBackend ECalConfigGoogle;
@@ -123,7 +122,7 @@ cal_config_google_commit_changes (ESourceConfigBackend *backend,
ESourceAuthentication *authentication_extension
= e_source_get_extension (scratch_source, E_SOURCE_EXTENSION_AUTHENTICATION);
- e_google_chooser_construct_default_uri (
+ e_google_chooser_button_construct_default_uri (
soup_uri,
e_source_authentication_get_user (authentication_extension));
}
diff --git a/modules/cal-config-google/e-google-chooser-button.c
b/modules/cal-config-google/e-google-chooser-button.c
index d173f96..f56612a 100644
--- a/modules/cal-config-google/e-google-chooser-button.c
+++ b/modules/cal-config-google/e-google-chooser-button.c
@@ -20,7 +20,9 @@
#include <config.h>
#include <glib/gi18n-lib.h>
-#include "e-google-chooser-dialog.h"
+#include <libedataserverui/libedataserverui.h>
+
+#define CALDAV_EVENTS_PATH_FORMAT "/calendar/dav/%s/events"
#define E_GOOGLE_CHOOSER_BUTTON_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE \
@@ -173,14 +175,15 @@ google_chooser_button_clicked (GtkButton *button)
EGoogleChooserButtonPrivate *priv;
gpointer parent;
ESourceRegistry *registry;
- ECalClientSourceType source_type;
ECredentialsPrompter *prompter;
ESourceWebdav *webdav_extension;
ESourceAuthentication *authentication_extension;
SoupURI *uri;
- GtkWidget *dialog;
- GtkWidget *widget;
+ gchar *base_url;
+ GtkDialog *dialog;
gulong handler_id;
+ guint supports_filter = 0;
+ const gchar *title = NULL;
priv = E_GOOGLE_CHOOSER_BUTTON_GET_PRIVATE (button);
@@ -189,14 +192,12 @@ google_chooser_button_clicked (GtkButton *button)
registry = e_source_config_get_registry (priv->config);
- source_type = e_cal_source_config_get_source_type (E_CAL_SOURCE_CONFIG (priv->config));
-
authentication_extension = e_source_get_extension (priv->source, E_SOURCE_EXTENSION_AUTHENTICATION);
webdav_extension = e_source_get_extension (priv->source, E_SOURCE_EXTENSION_WEBDAV_BACKEND);
uri = e_source_webdav_dup_soup_uri (webdav_extension);
- e_google_chooser_construct_default_uri (uri, e_source_authentication_get_user
(authentication_extension));
+ e_google_chooser_button_construct_default_uri (uri, e_source_authentication_get_user
(authentication_extension));
/* The host name is fixed, obviously. */
soup_uri_set_host (uri, "www.google.com");
@@ -206,9 +207,31 @@ google_chooser_button_clicked (GtkButton *button)
e_source_webdav_set_soup_uri (webdav_extension, uri);
- widget = e_google_chooser_new (registry, priv->source, source_type);
+ switch (e_cal_source_config_get_source_type (E_CAL_SOURCE_CONFIG (priv->config))) {
+ case E_CAL_CLIENT_SOURCE_TYPE_EVENTS:
+ supports_filter = E_WEBDAV_DISCOVER_SUPPORTS_EVENTS;
+ title = _("Choose a Calendar");
+ break;
+ case E_CAL_CLIENT_SOURCE_TYPE_MEMOS:
+ supports_filter = E_WEBDAV_DISCOVER_SUPPORTS_MEMOS;
+ title = _("Choose a Memo List");
+ break;
+ case E_CAL_CLIENT_SOURCE_TYPE_TASKS:
+ supports_filter = E_WEBDAV_DISCOVER_SUPPORTS_TASKS;
+ title = _("Choose a Task List");
+ break;
+ default:
+ g_return_if_reached ();
+ }
- dialog = e_google_chooser_dialog_new (E_GOOGLE_CHOOSER (widget), parent);
+ prompter = e_credentials_prompter_new (registry);
+ e_credentials_prompter_set_auto_prompt (prompter, FALSE);
+
+ /* To find also calendar email, not only calendars */
+ soup_uri_set_path (uri, "/calendar/dav/");
+ base_url = soup_uri_to_string (uri, FALSE);
+
+ dialog = e_webdav_discover_dialog_new (parent, title, prompter, priv->source, base_url,
supports_filter);
if (parent != NULL)
e_binding_bind_property (
@@ -216,18 +239,75 @@ google_chooser_button_clicked (GtkButton *button)
dialog, "icon-name",
G_BINDING_SYNC_CREATE);
- prompter = e_google_chooser_get_prompter (E_GOOGLE_CHOOSER (widget));
-
handler_id = g_signal_connect (prompter, "get-dialog-parent",
G_CALLBACK (google_config_get_dialog_parent_cb), dialog);
- gtk_dialog_run (GTK_DIALOG (dialog));
+ e_webdav_discover_dialog_refresh (dialog);
+
+ if (gtk_dialog_run (dialog) == GTK_RESPONSE_ACCEPT) {
+ gchar *href = NULL, *display_name = NULL, *color = NULL, *email;
+ guint supports = 0;
+ GtkWidget *content;
+
+ content = e_webdav_discover_dialog_get_content (dialog);
+
+ if (e_webdav_discover_content_get_selected (content, 0, &href, &supports, &display_name,
&color)) {
+ soup_uri_free (uri);
+ uri = soup_uri_new (href);
+
+ if (uri) {
+ e_source_set_display_name (priv->source, display_name);
+
+ e_source_webdav_set_display_name (webdav_extension, display_name);
+ e_source_webdav_set_soup_uri (webdav_extension, uri);
+
+ if (color && *color) {
+ ESourceSelectable *selectable_extension;
+ const gchar *extension_name;
+
+ switch (e_cal_source_config_get_source_type (E_CAL_SOURCE_CONFIG
(priv->config))) {
+ case E_CAL_CLIENT_SOURCE_TYPE_EVENTS:
+ extension_name = E_SOURCE_EXTENSION_CALENDAR;
+ break;
+ case E_CAL_CLIENT_SOURCE_TYPE_MEMOS:
+ extension_name = E_SOURCE_EXTENSION_MEMO_LIST;
+ break;
+ case E_CAL_CLIENT_SOURCE_TYPE_TASKS:
+ extension_name = E_SOURCE_EXTENSION_TASK_LIST;
+ break;
+ default:
+ g_return_if_reached ();
+ }
+
+ selectable_extension = e_source_get_extension (priv->source,
extension_name);
+
+ e_source_selectable_set_color (selectable_extension, color);
+ }
+ }
+
+ g_free (href);
+ g_free (display_name);
+ g_free (color);
+
+ href = NULL;
+ display_name = NULL;
+ color = NULL;
+ }
+
+ email = e_webdav_discover_content_get_user_address (content);
+ if (email && *email)
+ e_source_webdav_set_email_address (webdav_extension, email);
+ g_free (email);
+ }
g_signal_handler_disconnect (prompter, handler_id);
- gtk_widget_destroy (dialog);
+ gtk_widget_destroy (GTK_WIDGET (dialog));
- soup_uri_free (uri);
+ g_object_unref (prompter);
+ if (uri)
+ soup_uri_free (uri);
+ g_free (base_url);
}
static void
@@ -317,3 +397,50 @@ e_google_chooser_button_get_config (EGoogleChooserButton *button)
return button->priv->config;
}
+
+static gchar *
+google_chooser_decode_user (const gchar *user)
+{
+ gchar *decoded_user;
+
+ 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;
+}
+
+void
+e_google_chooser_button_construct_default_uri (SoupURI *soup_uri,
+ const gchar *username)
+{
+ gchar *decoded_user, *path;
+
+ decoded_user = google_chooser_decode_user (username);
+ if (!decoded_user)
+ return;
+
+ path = g_strdup_printf (CALDAV_EVENTS_PATH_FORMAT, decoded_user);
+
+ soup_uri_set_user (soup_uri, decoded_user);
+ soup_uri_set_path (soup_uri, path);
+
+ g_free (decoded_user);
+ g_free (path);
+}
diff --git a/modules/cal-config-google/e-google-chooser-button.h
b/modules/cal-config-google/e-google-chooser-button.h
index ea04fc9..eccdf6d 100644
--- a/modules/cal-config-google/e-google-chooser-button.h
+++ b/modules/cal-config-google/e-google-chooser-button.h
@@ -20,8 +20,6 @@
#include <e-util/e-util.h>
-#include "e-google-chooser.h"
-
/* Standard GObject macros */
#define E_TYPE_GOOGLE_CHOOSER_BUTTON \
(e_google_chooser_button_get_type ())
@@ -65,6 +63,9 @@ ESource * e_google_chooser_button_get_source
(EGoogleChooserButton *button);
ESourceConfig * e_google_chooser_button_get_config
(EGoogleChooserButton *button);
+void e_google_chooser_button_construct_default_uri
+ (SoupURI *soup_uri,
+ const gchar *username);
G_END_DECLS
diff --git a/modules/cal-config-google/module-cal-config-google.c
b/modules/cal-config-google/module-cal-config-google.c
index 94dc549..10b33ae 100644
--- a/modules/cal-config-google/module-cal-config-google.c
+++ b/modules/cal-config-google/module-cal-config-google.c
@@ -20,7 +20,6 @@
#include <libebackend/libebackend.h>
#include "e-google-chooser-button.h"
-#include "e-google-chooser-dialog.h"
#include "module-cal-config-google.h"
/* Module Entry Points */
@@ -30,9 +29,7 @@ void e_module_unload (GTypeModule *type_module);
G_MODULE_EXPORT void
e_module_load (GTypeModule *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_type_register (type_module);
#ifdef HAVE_GDATA_0_15_1
e_cal_config_gtasks_type_register (type_module);
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 291f38b..32f342e 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -410,14 +410,10 @@ modules/bogofilter/evolution-bogofilter.metainfo.xml.in
modules/book-config-google/evolution-book-config-google.c
modules/book-config-ldap/evolution-book-config-ldap.c
modules/book-config-webdav/evolution-book-config-webdav.c
-modules/cal-config-caldav/e-caldav-chooser.c
-modules/cal-config-caldav/e-caldav-chooser-dialog.c
modules/cal-config-caldav/evolution-cal-config-caldav.c
modules/cal-config-contacts/evolution-cal-config-contacts.c
modules/cal-config-google/e-cal-config-google.c
modules/cal-config-google/e-google-chooser-button.c
-modules/cal-config-google/e-google-chooser.c
-modules/cal-config-google/e-google-chooser-dialog.c
modules/cal-config-local/evolution-cal-config-local.c
modules/cal-config-weather/evolution-cal-config-weather.c
modules/cal-config-webcal/evolution-cal-config-webcal.c
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]