Skip to content

Commit

Permalink
Use GUri instead of libsoup-2.4 and use webkit2gtk-4.1
Browse files Browse the repository at this point in the history
  • Loading branch information
oreo639 committed Apr 22, 2024
1 parent 1e859a0 commit 7ac8805
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
10 changes: 5 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,13 @@ endif()

pkg_check_modules (GTKMM3 REQUIRED gtkmm-3.0>=3.10)
pkg_check_modules (GLIBMM2 REQUIRED glibmm-2.4)
pkg_check_modules (WEBKIT2GTK REQUIRED webkit2gtk-4.0>=2.22)
pkg_check_modules (WEBKIT2GTK webkit2gtk-4.1)
if (NOT WEBKIT2GTK_FOUND)
pkg_check_modules (WEBKIT2GTK REQUIRED webkit2gtk-4.0>=2.22)
endif ()
pkg_check_modules (SASS REQUIRED libsass)
pkg_check_modules (GIOMM2 REQUIRED giomm-2.4)
pkg_check_modules (GIOUNIX REQUIRED gio-unix-2.0)
pkg_check_modules (LIBSOUP REQUIRED libsoup-2.4)
pkg_check_modules (GIOUNIX REQUIRED gio-unix-2.0>=2.66)

string (REGEX REPLACE "([0-9]+\.[0-9]+)\.[0-9]+" "\\1" GMIME_MAJOR_MINOR ${Notmuch_GMIME_VERSION})
pkg_check_modules (GMIME REQUIRED gmime-${GMIME_MAJOR_MINOR}>=${Notmuch_GMIME_VERSION})
Expand Down Expand Up @@ -167,7 +169,6 @@ add_compile_options (
${GLIBMM2_CFLAGS}
${GIOMM2_CFLAGS}
${GIOUNIX_CFLAGS}
${LIBSOUP_CFLAGS}
${GMIME_CFLAGS}
${WEBKIT2GTK_CFLAGS}
${VTE2_CFLAGS}
Expand Down Expand Up @@ -337,7 +338,6 @@ target_link_libraries (
${GLIBMM2_LDFLAGS}
${GIOMM2_LDFLAGS}
${GIOUINX_LDFLAGS}
${LIBSOUP_LDFLAGS}
${GMIME_LDFLAGS}
${VTE2_LDFLAGS}
${SASS_LDFLAGS}
Expand Down
17 changes: 9 additions & 8 deletions src/astroid.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
# include <gtkmm.h>
# include <gtkmm/window.h>

# include <glib.h>

/* program options */
# include <boost/program_options.hpp>
# include <boost/filesystem.hpp>
Expand Down Expand Up @@ -53,8 +55,6 @@
# include <gmime/gmime.h>
# include <utils/gmime/gmime-compat.h>

# include <libsoup/soup.h>

using namespace std;
using namespace boost::filesystem;

Expand Down Expand Up @@ -550,15 +550,16 @@ namespace Astroid {

MainWindow * mw = (MainWindow*) get_windows ()[0];

SoupURI *uri = soup_uri_new(url.c_str());
GUriFlags guriflags = (GUriFlags)(G_URI_FLAGS_HAS_PASSWORD | G_URI_FLAGS_ENCODED_PATH | G_URI_FLAGS_ENCODED_QUERY | G_URI_FLAGS_ENCODED_FRAGMENT | G_URI_FLAGS_SCHEME_NORMALIZE | G_URI_FLAGS_PARSE_RELAXED);
GUri *guri = g_uri_parse (url.c_str(), guriflags, NULL);

if (SOUP_URI_IS_VALID(uri)) {
if (guri) {
/* we got an mailto url */
ustring from, to, cc, bcc, subject, body;

to = soup_uri_decode (soup_uri_get_path (uri));
to = g_uri_unescape_string (g_uri_get_path (guri), NULL);

const char * soup_query = soup_uri_get_query (uri);
const char * soup_query = g_uri_get_query (guri);
if (soup_query) {
std::istringstream query_string (soup_query);
std::string keyval;
Expand All @@ -568,7 +569,7 @@ namespace Astroid {
ustring key = keyval.substr (0, pos);
key = key.lowercase ();

ustring val = soup_uri_decode (keyval.substr (pos+1).c_str());
ustring val = g_uri_unescape_string (keyval.substr (pos+1).c_str(), NULL);

if (key == "from") {
from = ustring (val);
Expand All @@ -591,7 +592,7 @@ namespace Astroid {
mw->add_mode (new EditMessage (mw, url));
}

soup_uri_free (uri);
g_uri_unref (guri);
}

int Astroid::hint_level () {
Expand Down

0 comments on commit 7ac8805

Please sign in to comment.