From e5ecaf777659e8d3a625002826c4a1a3f8b31801 Mon Sep 17 00:00:00 2001 From: "Haelwenn (lanodan) Monnier" Date: Fri, 13 Dec 2019 14:06:33 +0100 Subject: badwolf.c: Use SoupURI instead of g_uri_parse_scheme() --- Makefile | 2 +- badwolf.c | 17 ++++++++++++++--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 0a58cda..cbd134e 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,7 @@ DATADIR = $(PREFIX)/share/badwolf APPSDIR = $(PREFIX)/share/applications PACKAGE = Badwolf -DEPS = gtk+-3.0 webkit2gtk-4.0 +DEPS = gtk+-3.0 webkit2gtk-4.0 libsoup-2.4 OBJS = keybindings.o badwolf.o EXE = badwolf TRANS = fr.mo diff --git a/badwolf.c b/badwolf.c index fe40193..e85f189 100644 --- a/badwolf.c +++ b/badwolf.c @@ -9,6 +9,7 @@ #include /* _() and other internationalization/localization helpers */ #include /* g_fprintf() */ +#include /* soup* */ #include /* LC_* */ #include /* realpath(), malloc() */ @@ -64,11 +65,21 @@ notebookCb_switch__page(GtkNotebook *notebook, GtkWidget *page, guint page_num, gchar * badwolf_ensure_uri_scheme(gchar *text, gboolean try_file) { - if(text == NULL) return "about:blank"; + SoupURI *uri = soup_uri_new(text); - char *scheme = g_uri_parse_scheme(text); + if(uri->path == NULL) + { + soup_uri_free(uri); + return "about:blank"; + } + + if(uri->scheme != NULL) + { + soup_uri_free(uri); + return text; + } - if(scheme != NULL) return text; + soup_uri_free(uri); if(try_file) { -- cgit v1.3.1-23-gd82d