summaryrefslogtreecommitdiff
path: root/browser.c
diff options
context:
space:
mode:
authorPeter Hofmann <scm@uninformativ.de>2020-08-16 07:53:37 +0200
committerPeter Hofmann <scm@uninformativ.de>2020-08-16 08:00:46 +0200
commit74bdc3ed21d74d464cd94c5ca461b9ba7d10616b (patch)
tree7a9759c65df1df276d6684b7881970987c104ad2 /browser.c
parent13ca54ace5c670f72745579852481f1a923d3d22 (diff)
downloadlariza-74bdc3ed21d74d464cd94c5ca461b9ba7d10616b.tar.gz
Fix opening links in new tabs (partially)
Also, no NULL guard needed for g_free().
Diffstat (limited to 'browser.c')
-rw-r--r--browser.c33
1 files changed, 14 insertions, 19 deletions
diff --git a/browser.c b/browser.c
index 8df0e33..3e0a4a7 100644
--- a/browser.c
+++ b/browser.c
@@ -767,28 +767,23 @@ hover_web_view(WebKitWebView *web_view, WebKitHitTestResult *ht, guint modifiers
gpointer data)
{
struct Client *c = (struct Client *)data;
+ const char *to_show;
- if (!gtk_widget_is_focus(c->location))
- {
- if (webkit_hit_test_result_context_is_link(ht))
- {
- gtk_entry_set_text(GTK_ENTRY(c->location),
- webkit_hit_test_result_get_link_uri(ht));
-
- if (c->hover_uri != NULL)
- g_free(c->hover_uri);
- c->hover_uri = g_strdup(webkit_hit_test_result_get_link_uri(ht));
- }
- else
- {
- gtk_entry_set_text(GTK_ENTRY(c->location),
- webkit_web_view_get_uri(WEBKIT_WEB_VIEW(c->web_view)));
+ g_free(c->hover_uri);
- if (c->hover_uri != NULL)
- g_free(c->hover_uri);
- c->hover_uri = NULL;
- }
+ if (webkit_hit_test_result_context_is_link(ht))
+ {
+ to_show = webkit_hit_test_result_get_link_uri(ht);
+ c->hover_uri = g_strdup(to_show);
}
+ else
+ {
+ to_show = webkit_web_view_get_uri(WEBKIT_WEB_VIEW(c->web_view));
+ c->hover_uri = NULL;
+ }
+
+ if (!gtk_widget_is_focus(c->location))
+ gtk_entry_set_text(GTK_ENTRY(c->location), to_show);
}
void