aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2012-06-19 10:04:43 +0800
committerMatthew Barnes <mbarnes@redhat.com>2012-06-19 10:04:43 +0800
commit67b64140d5f429cc9bb4e8645ce9e6f9f2553162 (patch)
tree96c3c651d168c45f84311d18ad7068dc9eb0e03d
parent731122a46ec53fb5e470e5852e3a634da30bdfe1 (diff)
downloadgsoc2013-evolution-67b64140d5f429cc9bb4e8645ce9e6f9f2553162.tar.gz
gsoc2013-evolution-67b64140d5f429cc9bb4e8645ce9e6f9f2553162.tar.zst
gsoc2013-evolution-67b64140d5f429cc9bb4e8645ce9e6f9f2553162.zip
Use SoupURI instead of EUri.
EUri is now deprecated.
-rw-r--r--modules/addressbook/e-book-shell-backend.c14
-rw-r--r--modules/calendar/e-cal-shell-backend.c12
-rw-r--r--modules/calendar/e-memo-shell-backend.c12
-rw-r--r--modules/calendar/e-task-shell-backend.c12
-rw-r--r--plugins/publish-calendar/publish-calendar.c15
-rw-r--r--plugins/publish-calendar/publish-location.c16
-rw-r--r--plugins/publish-calendar/url-editor-dialog.c57
7 files changed, 84 insertions, 54 deletions
diff --git a/modules/addressbook/e-book-shell-backend.c b/modules/addressbook/e-book-shell-backend.c
index b2da5b9072..2475312832 100644
--- a/modules/addressbook/e-book-shell-backend.c
+++ b/modules/addressbook/e-book-shell-backend.c
@@ -321,7 +321,7 @@ static gboolean
book_shell_backend_handle_uri_cb (EShellBackend *shell_backend,
const gchar *uri)
{
- EUri *euri;
+ SoupURI *soup_uri;
const gchar *cp;
gchar *source_uid = NULL;
gchar *contact_uid = NULL;
@@ -329,11 +329,15 @@ book_shell_backend_handle_uri_cb (EShellBackend *shell_backend,
if (!g_str_has_prefix (uri, "contacts:"))
return FALSE;
- euri = e_uri_new (uri);
- cp = euri->query;
+ soup_uri = soup_uri_new (uri);
+
+ if (soup_uri == NULL)
+ return FALSE;
+
+ cp = soup_uri_get_query (soup_uri);
if (cp == NULL) {
- e_uri_free (euri);
+ soup_uri_free (soup_uri);
return FALSE;
}
@@ -378,7 +382,7 @@ book_shell_backend_handle_uri_cb (EShellBackend *shell_backend,
g_free (source_uid);
g_free (contact_uid);
- e_uri_free (euri);
+ soup_uri_free (soup_uri);
return TRUE;
}
diff --git a/modules/calendar/e-cal-shell-backend.c b/modules/calendar/e-cal-shell-backend.c
index 0cfe9b89fd..44179dc934 100644
--- a/modules/calendar/e-cal-shell-backend.c
+++ b/modules/calendar/e-cal-shell-backend.c
@@ -356,7 +356,7 @@ cal_shell_backend_handle_uri_cb (EShellBackend *shell_backend,
ESource *source;
ESourceRegistry *registry;
ECalClientSourceType source_type;
- EUri *euri;
+ SoupURI *soup_uri;
icalcomponent *icalcomp;
icalproperty *icalprop;
const gchar *cp;
@@ -378,8 +378,12 @@ cal_shell_backend_handle_uri_cb (EShellBackend *shell_backend,
if (strncmp (uri, "calendar:", 9) != 0)
return FALSE;
- euri = e_uri_new (uri);
- cp = euri->query;
+ soup_uri = soup_uri_new (uri);
+
+ if (soup_uri == NULL)
+ return FALSE;
+
+ cp = soup_uri_get_query (soup_uri);
if (cp == NULL)
goto exit;
@@ -534,7 +538,7 @@ exit:
g_free (comp_uid);
g_free (comp_rid);
- e_uri_free (euri);
+ soup_uri_free (soup_uri);
return handled;
}
diff --git a/modules/calendar/e-memo-shell-backend.c b/modules/calendar/e-memo-shell-backend.c
index db042cb88b..fa4884bfc6 100644
--- a/modules/calendar/e-memo-shell-backend.c
+++ b/modules/calendar/e-memo-shell-backend.c
@@ -234,7 +234,7 @@ memo_shell_backend_handle_uri_cb (EShellBackend *shell_backend,
ESource *source;
ESourceRegistry *registry;
ECalClientSourceType source_type;
- EUri *euri;
+ SoupURI *soup_uri;
icalcomponent *icalcomp;
const gchar *cp;
gchar *source_uid = NULL;
@@ -249,8 +249,12 @@ memo_shell_backend_handle_uri_cb (EShellBackend *shell_backend,
if (strncmp (uri, "memo:", 5) != 0)
return FALSE;
- euri = e_uri_new (uri);
- cp = euri->query;
+ soup_uri = soup_uri_new (uri);
+
+ if (soup_uri == NULL)
+ return FALSE;
+
+ cp = soup_uri_get_query (soup_uri);
if (cp == NULL)
goto exit;
@@ -370,7 +374,7 @@ exit:
g_free (comp_uid);
g_free (comp_rid);
- e_uri_free (euri);
+ soup_uri_free (soup_uri);
return handled;
}
diff --git a/modules/calendar/e-task-shell-backend.c b/modules/calendar/e-task-shell-backend.c
index dd6acb04b1..4d76e50b8b 100644
--- a/modules/calendar/e-task-shell-backend.c
+++ b/modules/calendar/e-task-shell-backend.c
@@ -231,7 +231,7 @@ task_shell_backend_handle_uri_cb (EShellBackend *shell_backend,
ESource *source;
ESourceRegistry *registry;
ECalClientSourceType source_type;
- EUri *euri;
+ SoupURI *soup_uri;
icalcomponent *icalcomp;
icalproperty *icalprop;
const gchar *cp;
@@ -247,8 +247,12 @@ task_shell_backend_handle_uri_cb (EShellBackend *shell_backend,
if (strncmp (uri, "task:", 5) != 0)
return FALSE;
- euri = e_uri_new (uri);
- cp = euri->query;
+ soup_uri = soup_uri_new (uri);
+
+ if (soup_uri == NULL)
+ return FALSE;
+
+ cp = soup_uri_get_query (soup_uri);
if (cp == NULL)
goto exit;
@@ -373,7 +377,7 @@ exit:
g_free (comp_uid);
g_free (comp_rid);
- e_uri_free (euri);
+ soup_uri_free (soup_uri);
return handled;
}
diff --git a/plugins/publish-calendar/publish-calendar.c b/plugins/publish-calendar/publish-calendar.c
index ff9814f795..681b1fbe7a 100644
--- a/plugins/publish-calendar/publish-calendar.c
+++ b/plugins/publish-calendar/publish-calendar.c
@@ -310,9 +310,10 @@ ask_password (GMountOperation *op,
gpointer user_data)
{
struct mnt_struct *ms = (struct mnt_struct *) user_data;
- gchar *username, *password;
+ const gchar *username;
+ gchar *password;
gboolean req_pass = FALSE;
- EUri *euri;
+ SoupURI *soup_uri;
g_return_if_fail (ms != NULL);
@@ -320,8 +321,10 @@ ask_password (GMountOperation *op,
if ((flags & G_ASK_PASSWORD_NEED_PASSWORD) == 0)
return;
- euri = e_uri_new (ms->uri->location);
- username = euri->user;
+ soup_uri = soup_uri_new (ms->uri->location);
+ g_return_if_fail (soup_uri != NULL);
+
+ username = soup_uri_get_user (soup_uri);
password = e_passwords_get_password (NULL, ms->uri->location);
req_pass = ((username && *username) && !(ms->uri->service_type == TYPE_ANON_FTP &&
!strcmp (username, "anonymous"))) ? TRUE:FALSE;
@@ -337,7 +340,7 @@ ask_password (GMountOperation *op,
if (!password) {
/* user canceled password dialog */
g_mount_operation_reply (op, G_MOUNT_OPERATION_ABORTED);
- e_uri_free (euri);
+ soup_uri_free (soup_uri);
return;
}
@@ -353,7 +356,7 @@ ask_password (GMountOperation *op,
g_mount_operation_reply (op, G_MOUNT_OPERATION_HANDLED);
- e_uri_free (euri);
+ soup_uri_free (soup_uri);
}
static void
diff --git a/plugins/publish-calendar/publish-location.c b/plugins/publish-calendar/publish-location.c
index c0d46c1cd9..44217c04ee 100644
--- a/plugins/publish-calendar/publish-location.c
+++ b/plugins/publish-calendar/publish-location.c
@@ -43,7 +43,7 @@ migrateURI (const gchar *xml,
xmlNodePtr root, p;
EPublishUri *uri;
gchar *password, *temp;
- EUri *euri;
+ SoupURI *soup_uri;
gint ii;
gboolean found = FALSE;
@@ -55,22 +55,20 @@ migrateURI (const gchar *xml,
frequency = xmlGetProp (root, (const guchar *)"frequency");
username = xmlGetProp (root, (const guchar *)"username");
- euri = e_uri_new ((const gchar *) location);
+ soup_uri = soup_uri_new ((gchar *) location);
- if (!euri) {
+ if (soup_uri == NULL) {
g_warning ("Could not form the uri for %s \n", location);
goto cleanup;
}
- if (euri->user)
- g_free (euri->user);
+ soup_uri_set_user (soup_uri, (gchar *) username);
- euri->user = g_strdup ((const gchar *) username);
-
- temp = e_uri_to_string (euri, FALSE);
+ temp = soup_uri_to_string (soup_uri, FALSE);
uri->location = g_strdup_printf ("dav://%s", strstr (temp, "//") + 2);
g_free (temp);
- e_uri_free (euri);
+
+ soup_uri_free (soup_uri);
if (enabled != NULL)
uri->enabled = atoi ((gchar *) enabled);
diff --git a/plugins/publish-calendar/url-editor-dialog.c b/plugins/publish-calendar/url-editor-dialog.c
index c5483d5e14..3e97756d03 100644
--- a/plugins/publish-calendar/url-editor-dialog.c
+++ b/plugins/publish-calendar/url-editor-dialog.c
@@ -299,51 +299,64 @@ static void
set_from_uri (UrlEditorDialog *dialog)
{
EPublishUri *uri;
- gchar *method;
- EUri *euri = NULL;
+ SoupURI *soup_uri;
+ const gchar *scheme;
+ const gchar *user;
+ const gchar *host;
+ const gchar *path;
+ guint port;
uri = dialog->uri;
- euri = e_uri_new (uri->location);
- /* determine our method */
- method = euri->protocol;
- if (strcmp ((const gchar *)method, "smb") == 0)
+ soup_uri = soup_uri_new (uri->location);
+ g_return_if_fail (soup_uri != NULL);
+
+ /* determine our service type */
+ scheme = soup_uri_get_scheme (soup_uri);
+ g_return_if_fail (scheme != NULL);
+
+ if (strcmp (scheme, "smb") == 0)
uri->service_type = TYPE_SMB;
- else if (strcmp ((const gchar *)method, "sftp") == 0)
+ else if (strcmp (scheme, "sftp") == 0)
uri->service_type = TYPE_SFTP;
- else if (strcmp ((const gchar *)method, "ftp") == 0)
+ else if (strcmp (scheme, "ftp") == 0)
/* we set TYPE_FTP here for now. if we don't find a
* username later, we'll change it to TYPE_ANON_FTP */
uri->service_type = TYPE_FTP;
- else if (strcmp ((const gchar *)method, "dav") == 0)
+ else if (strcmp (scheme, "dav") == 0)
uri->service_type = TYPE_DAV;
- else if (strcmp ((const gchar *)method, "davs") == 0)
+ else if (strcmp (scheme, "davs") == 0)
uri->service_type = TYPE_DAVS;
else
uri->service_type = TYPE_URI;
- if (euri->user)
- gtk_entry_set_text (GTK_ENTRY (dialog->username_entry), euri->user);
+ user = soup_uri_get_user (soup_uri);
+ host = soup_uri_get_host (soup_uri);
+ port = soup_uri_get_port (soup_uri);
+ path = soup_uri_get_path (soup_uri);
- if (euri->host)
- gtk_entry_set_text (GTK_ENTRY (dialog->server_entry), euri->host);
+ if (user != NULL)
+ gtk_entry_set_text (GTK_ENTRY (dialog->username_entry), user);
- if (euri->port) {
- gchar *port;
- port = g_strdup_printf ("%d", euri->port);
- gtk_entry_set_text (GTK_ENTRY (dialog->port_entry), port);
- g_free (port);
+ if (host != NULL)
+ gtk_entry_set_text (GTK_ENTRY (dialog->server_entry), host);
+
+ if (port > 0) {
+ gchar *port_str;
+ port_str = g_strdup_printf ("%d", port);
+ gtk_entry_set_text (GTK_ENTRY (dialog->port_entry), port_str);
+ g_free (port_str);
}
- if (euri->path)
- gtk_entry_set_text (GTK_ENTRY (dialog->file_entry), euri->path);
+ if (path != NULL)
+ gtk_entry_set_text (GTK_ENTRY (dialog->file_entry), path);
if (uri->service_type == TYPE_URI)
gtk_entry_set_text (GTK_ENTRY (dialog->server_entry), uri->location);
gtk_combo_box_set_active (GTK_COMBO_BOX (dialog->publish_service), uri->service_type);
- e_uri_free (euri);
+ soup_uri_free (soup_uri);
}
static gboolean