Show the IDN decoded form in the URL bar on GTK if the option is set.

This commit is contained in:
Chris Young 2015-07-17 19:44:26 +01:00
parent 5f5ca2c205
commit 6afda499c2
4 changed files with 12 additions and 3 deletions

View File

@ -185,6 +185,9 @@ NSOPTION_UINT(min_reflow_period, DEFAULT_REFLOW_PERIOD)
/* use core selection menu */
NSOPTION_BOOL(core_select_menu, false)
/* display decoded international domain names */
NSOPTION_BOOL(display_decoded_idn, false)
/******** Fetcher options ********/
/** Maximum simultaneous active fetchers */

View File

@ -2346,7 +2346,13 @@ nserror gui_window_set_url(struct gui_window *gw, nsurl *url)
g = nsgtk_get_scaffold(gw);
if (g->top_level == gw) {
gtk_entry_set_text(GTK_ENTRY(g->url_bar), nsurl_access(url));
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);
}
gtk_editable_set_position(GTK_EDITABLE(g->url_bar), -1);
}
return NSERROR_OK;

View File

@ -1698,7 +1698,7 @@ const char *nsurl_access(const nsurl *url)
return url->string;
}
const char *nsurl_access_utf8(const nsurl *url)
char *nsurl_access_utf8(const nsurl *url)
{
lwc_string *host;
char *idna_host;

View File

@ -191,7 +191,7 @@ const char *nsurl_access(const nsurl *url);
*
* The returned string has a trailing '\0'.
*/
const char *nsurl_access_utf8(const nsurl *url);
char *nsurl_access_utf8(const nsurl *url);
/**