Update gtk frontend to new API

This commit is contained in:
Chris Young 2015-07-26 18:09:25 +01:00
parent 65b510fbc3
commit 27adf07fb7
3 changed files with 14 additions and 8 deletions

View File

@ -4898,7 +4898,7 @@ static nserror gui_window_set_url(struct gui_window *g, nsurl *url)
if(!g) return NSERROR_OK;
if (g == g->shared->gw) {
if(g == g->shared->gw) {
if(nsoption_bool(display_decoded_idn) == true) {
if (nsurl_access_utf8(url, &idn_url_s, &idn_url_l) == NSERROR_OK) {
url_lc = ami_utf8_easy(idn_url_s);

View File

@ -2343,16 +2343,22 @@ void nsgtk_window_set_title(struct gui_window *gw, const char *title)
nserror gui_window_set_url(struct gui_window *gw, nsurl *url)
{
struct nsgtk_scaffolding *g;
size_t idn_url_l;
char *idn_url_s = NULL;
nserror err;
g = nsgtk_get_scaffold(gw);
if (g->top_level == gw) {
if (nsoption_bool(display_decoded_idn) == false) {
gtk_entry_set_text(GTK_ENTRY(g->url_bar), nsurl_access(url));
} else {
char *idn_url = nsurl_access_utf8(url);
gtk_entry_set_text(GTK_ENTRY(g->url_bar), idn_url);
free(idn_url);
if (nsoption_bool(display_decoded_idn) == true) {
if (nsurl_access_utf8(url, &idn_url_s, &idn_url_l) != NSERROR_OK)
idn_url_s = NULL;
}
gtk_entry_set_text(GTK_ENTRY(g->url_bar), idn_url_s ? idn_url_s : nsurl_access(url));
if(idn_url_s)
free(idn_url_s);
gtk_editable_set_position(GTK_EDITABLE(g->url_bar), -1);
}
return NSERROR_OK;

View File

@ -183,7 +183,7 @@ const char *nsurl_access(const nsurl *url);
/**
* Access a NetSurf URL object as a UTF-8 string (for human readable IDNs)
*
* \param url NetSurf URL to retrieve a string pointer for.
* \param url NetSurf URL object
* \param url_s Returns a url string
* \param url_l Returns length of url_s
* \return NSERROR_OK on success, appropriate error otherwise