diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2012-06-19 10:04:43 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2012-06-19 10:04:43 +0800 |
commit | 67b64140d5f429cc9bb4e8645ce9e6f9f2553162 (patch) | |
tree | 96c3c651d168c45f84311d18ad7068dc9eb0e03d /plugins/publish-calendar/url-editor-dialog.c | |
parent | 731122a46ec53fb5e470e5852e3a634da30bdfe1 (diff) | |
download | gsoc2013-evolution-67b64140d5f429cc9bb4e8645ce9e6f9f2553162.tar gsoc2013-evolution-67b64140d5f429cc9bb4e8645ce9e6f9f2553162.tar.gz gsoc2013-evolution-67b64140d5f429cc9bb4e8645ce9e6f9f2553162.tar.bz2 gsoc2013-evolution-67b64140d5f429cc9bb4e8645ce9e6f9f2553162.tar.lz gsoc2013-evolution-67b64140d5f429cc9bb4e8645ce9e6f9f2553162.tar.xz gsoc2013-evolution-67b64140d5f429cc9bb4e8645ce9e6f9f2553162.tar.zst gsoc2013-evolution-67b64140d5f429cc9bb4e8645ce9e6f9f2553162.zip |
Use SoupURI instead of EUri.
EUri is now deprecated.
Diffstat (limited to 'plugins/publish-calendar/url-editor-dialog.c')
-rw-r--r-- | plugins/publish-calendar/url-editor-dialog.c | 57 |
1 files changed, 35 insertions, 22 deletions
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 |