logo

badwolf

Unnamed repository; edit this file 'description' to name the repository.
commit: f3555b1a429380abb99e3ad34818d8a1896ae765
parent: 1e6380d4fca4e8aa6fdcb6f507f0b9f7866e2eea
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Mon,  7 Jan 2019 23:54:13 +0100

badwolf.c: Add callback when GtkEntry location gets activated

Diffstat:

Mbadwolf.c13+++++++++++++
1 file changed, 13 insertions(+), 0 deletions(-)

diff --git a/badwolf.c b/badwolf.c @@ -70,6 +70,18 @@ WebViewCb_notify__title(WebKitWebView *webView, GParamSpec *pspec, gpointer user return TRUE; } +static gboolean locationCb_activate(GtkEntry *location, gpointer user_data) +{ + const char *target_url; + struct Client *browser = (struct Client *)user_data; + + target_url = gtk_entry_get_text(location); + + if(target_url != NULL) webkit_web_view_load_uri(browser->webView, target_url); + + return TRUE; +} + int main(int argc, char *argv[]) { struct Client *browser = calloc(1, sizeof(struct Client)); @@ -91,6 +103,7 @@ int main(int argc, char *argv[]) gtk_entry_set_text(GTK_ENTRY(browser->location), target_url); g_signal_connect(browser->main_window, "destroy", G_CALLBACK(gtk_main_quit), NULL); + g_signal_connect(browser->location, "activate", G_CALLBACK(locationCb_activate), browser); g_signal_connect(browser->webView, "close", G_CALLBACK(WebViewCb_close), browser->main_window); g_signal_connect(browser->webView, "web-process-terminated",