summaryrefslogtreecommitdiff
path: root/gtk
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2014-05-08 17:54:44 +0100
committerVincent Sanders <vince@kyllikki.org>2014-05-08 17:54:44 +0100
commitcd7f1eceea81a69e5b4dcdef90d45aab44f8a11f (patch)
treeaa9ac5ffab173f59b590b39f665356e7127e02bf /gtk
parent096bd47ab0018e7b9c3affd58b6134463e2aaa65 (diff)
downloadnetsurf-cd7f1eceea81a69e5b4dcdef90d45aab44f8a11f.tar.gz
netsurf-cd7f1eceea81a69e5b4dcdef90d45aab44f8a11f.tar.bz2
make download_context_get_url() return an nsurl and adapt callers to cope
Diffstat (limited to 'gtk')
-rw-r--r--gtk/download.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/gtk/download.c b/gtk/download.c
index 2f7250b5f..3a321ec5f 100644
--- a/gtk/download.c
+++ b/gtk/download.c
@@ -25,7 +25,7 @@
#include "utils/log.h"
#include "utils/utils.h"
-#include "utils/url.h"
+#include "utils/nsurl.h"
#include "utils/messages.h"
#include "utils/nsoption.h"
#include "desktop/download.h"
@@ -717,7 +717,7 @@ static void nsgtk_download_store_create_item (struct gui_download_window *dl)
static struct gui_download_window *
gui_download_window_create(download_context *ctx, struct gui_window *gui)
{
- const char *url = download_context_get_url(ctx);
+ nsurl *url = download_context_get_url(ctx);
unsigned long total_size = download_context_get_total_length(ctx);
gchar *domain;
gchar *destination;
@@ -730,17 +730,22 @@ gui_download_window_create(download_context *ctx, struct gui_window *gui)
nsgtk_scaffolding_window(nsgtk_get_scaffold(gui));
struct gui_download_window *download = malloc(sizeof *download);
- if (download == NULL)
+ if (download == NULL) {
return NULL;
+ }
- if (url_host(url, &domain) != NSERROR_OK) {
+ /* set the domain to the host component of the url if it exists */
+ if (nsurl_has_component(url, NSURL_HOST)) {
+ domain = g_strdup(lwc_string_data(nsurl_get_component(url, NSURL_HOST)));
+ } else {
domain = g_strdup(messages_get("gtkUnknownHost"));
- if (domain == NULL) {
- free(download);
- return NULL;
- }
+ }
+ if (domain == NULL) {
+ free(download);
+ return NULL;
}
+ /* show the dialog */
destination = nsgtk_download_dialog_show(
download_context_get_filename(ctx), domain, size);
if (destination == NULL) {