disable clickable_url when no browser configured

This commit is contained in:
Simon Gomizelj 2013-11-23 20:34:40 -05:00
parent f493b4c83e
commit 476a26c5f7
1 changed files with 14 additions and 12 deletions

View File

@ -1172,6 +1172,20 @@ static void set_config(GtkWindow *window, VteTerminal *vte, config_info *info,
info->clickable_url = cfg_bool("clickable_url", TRUE); info->clickable_url = cfg_bool("clickable_url", TRUE);
info->size_hints = cfg_bool("size_hints", FALSE); info->size_hints = cfg_bool("size_hints", FALSE);
g_free(info->browser);
info->browser = nullptr;
if (auto s = get_config_string(config, "options", "browser")) {
info->browser = *s;
} else {
info->browser = g_strdup(g_getenv("BROWSER"));
}
if (!info->browser) {
g_warning("There is no browser configured, disabling clickable_url and url hints");
info->clickable_url = false;
}
if (info->clickable_url) { if (info->clickable_url) {
info->tag = info->tag =
vte_terminal_match_add_gregex(vte, vte_terminal_match_add_gregex(vte,
@ -1186,18 +1200,6 @@ static void set_config(GtkWindow *window, VteTerminal *vte, config_info *info,
info->tag = -1; info->tag = -1;
} }
g_free(info->browser);
info->browser = nullptr;
if (auto s = get_config_string(config, "options", "browser")) {
info->browser = *s;
} else {
info->browser = g_strdup(g_getenv("BROWSER"));
}
if (!info->browser)
info->clickable_url = false;
if (auto s = get_config_string(config, "options", "font")) { if (auto s = get_config_string(config, "options", "font")) {
vte_terminal_set_font_from_string(vte, *s); vte_terminal_set_font_from_string(vte, *s);
g_free(*s); g_free(*s);