diff options
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/publish-calendar/publish-calendar.c | 15 | ||||
-rw-r--r-- | plugins/publish-calendar/publish-location.c | 16 | ||||
-rw-r--r-- | plugins/publish-calendar/url-editor-dialog.c | 57 |
3 files changed, 51 insertions, 37 deletions
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 |