From d9e7d5810678c1470808c3de63f7bde412b3d17b Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Thu, 11 Oct 2012 11:20:02 +0100 Subject: Fix up ripples from urldb change. --- gtk/completion.c | 7 ++++--- gtk/gui.c | 2 +- gtk/login.c | 29 ++++++++++++++--------------- gtk/thumbnail.c | 4 ++-- 4 files changed, 21 insertions(+), 21 deletions(-) (limited to 'gtk') diff --git a/gtk/completion.c b/gtk/completion.c index 8782c876e..d249db160 100644 --- a/gtk/completion.c +++ b/gtk/completion.c @@ -26,7 +26,7 @@ GtkListStore *nsgtk_completion_list; static void nsgtk_completion_empty(void); -static bool nsgtk_completion_udb_callback(const char *url, +static bool nsgtk_completion_udb_callback(nsurl *url, const struct url_data *data); void nsgtk_completion_init(void) @@ -56,13 +56,14 @@ void nsgtk_completion_empty(void) gtk_list_store_clear(nsgtk_completion_list); } -bool nsgtk_completion_udb_callback(const char *url, const struct url_data *data) +bool nsgtk_completion_udb_callback(nsurl *url, const struct url_data *data) { GtkTreeIter iter; if (data->visits != 0) { gtk_list_store_append(nsgtk_completion_list, &iter); - gtk_list_store_set(nsgtk_completion_list, &iter, 0, url, -1); + gtk_list_store_set(nsgtk_completion_list, &iter, 0, + nsurl_access(url), -1); } return true; } diff --git a/gtk/gui.c b/gtk/gui.c index 222c98202..b24fecfb8 100644 --- a/gtk/gui.c +++ b/gtk/gui.c @@ -702,7 +702,7 @@ void die(const char * const error) } -void gui_cert_verify(const char *url, const struct ssl_cert_info *certs, +void gui_cert_verify(nsurl *url, const struct ssl_cert_info *certs, unsigned long num, nserror (*cb)(bool proceed, void *pw), void *cbpw) { diff --git a/gtk/login.c b/gtk/login.c index 41f66de20..3b8d68254 100644 --- a/gtk/login.c +++ b/gtk/login.c @@ -35,8 +35,8 @@ #include "utils/utils.h" struct session_401 { - char *url; /**< URL being fetched */ - char *host; /**< Host for user display */ + nsurl *url; /**< URL being fetched */ + lwc_string *host; /**< Host for user display */ char *realm; /**< Authentication realm */ nserror (*cb)(bool proceed, void *pw); /**< Continuation callback */ void *cbpw; /**< Continuation data */ @@ -46,7 +46,7 @@ struct session_401 { GtkEntry *pass; /**< Widget with password */ }; -static void create_login_window(const char *url, const char *host, +static void create_login_window(nsurl *url, lwc_string *host, const char *realm, nserror (*cb)(bool proceed, void *pw), void *cbpw); static void destroy_login_window(struct session_401 *session); @@ -54,21 +54,20 @@ static void nsgtk_login_next(GtkWidget *w, gpointer data); static void nsgtk_login_ok_clicked(GtkButton *w, gpointer data); static void nsgtk_login_cancel_clicked(GtkButton *w, gpointer data); -void gui_401login_open(const char *url, const char *realm, +void gui_401login_open(nsurl *url, const char *realm, nserror (*cb)(bool proceed, void *pw), void *cbpw) { - char *host; - url_func_result res; + lwc_string *host; - res = url_host(url, &host); - assert(res == URL_FUNC_OK); + host = nsurl_get_component(url, NSURL_HOST); + assert(host != NULL); create_login_window(url, host, realm, cb, cbpw); - free(host); + lwc_string_unref(host); } -void create_login_window(const char *url, const char *host, const char *realm, +void create_login_window(nsurl *url, lwc_string *host, const char *realm, nserror (*cb)(bool proceed, void *pw), void *cbpw) { struct session_401 *session; @@ -101,8 +100,8 @@ void create_login_window(const char *url, const char *host, const char *realm, /* create and fill in our session structure */ session = calloc(1, sizeof(struct session_401)); - session->url = strdup(url); - session->host = strdup(host); + session->url = nsurl_ref(url); + session->host = lwc_string_ref(host); session->realm = strdup(realm ? realm : "Secure Area"); session->cb = cb; session->cbpw = cbpw; @@ -113,7 +112,7 @@ void create_login_window(const char *url, const char *host, const char *realm, /* fill in our new login window */ - gtk_label_set_text(GTK_LABEL(lhost), host); + gtk_label_set_text(GTK_LABEL(lhost), lwc_string_data(host)); gtk_label_set_text(lrealm, realm); gtk_entry_set_text(euser, ""); gtk_entry_set_text(epass, ""); @@ -145,8 +144,8 @@ void create_login_window(const char *url, const char *host, const char *realm, void destroy_login_window(struct session_401 *session) { - free(session->url); - free(session->host); + nsurl_unref(session->url); + lwc_string_unref(session->host); free(session->realm); gtk_widget_destroy(GTK_WIDGET(session->wnd)); g_object_unref(G_OBJECT(session->x)); diff --git a/gtk/thumbnail.c b/gtk/thumbnail.c index b09b8dd2f..19c5fc193 100644 --- a/gtk/thumbnail.c +++ b/gtk/thumbnail.c @@ -50,7 +50,7 @@ * \param url the URL the thumnail belongs to, or NULL */ bool thumbnail_create(hlcache_handle *content, struct bitmap *bitmap, - const char *url) + nsurl *url) { cairo_surface_t *dsurface = bitmap->surface; cairo_surface_t *surface; @@ -121,7 +121,7 @@ bool thumbnail_create(hlcache_handle *content, struct bitmap *bitmap, /* register the thumbnail with the URL */ if (url) - urldb_set_thumbnail(url, bitmap); + urldb_set_thumbnail(url, bitmap); return true; } -- cgit v1.2.3