[gnome-commander] Remove gnome_vfs_make_uri_from_input and replace with g_uri_parse



commit 066432a70626cbe6fb95e2c374101d352e63ecd3
Author: Uwe Scholz <u scholz83 gmx de>
Date:   Thu Sep 30 22:43:57 2021 +0200

    Remove gnome_vfs_make_uri_from_input and replace with g_uri_parse

 src/gnome-cmd-con.h | 11 ++++++++++-
 src/utils.h         |  9 +--------
 2 files changed, 11 insertions(+), 9 deletions(-)
---
diff --git a/src/gnome-cmd-con.h b/src/gnome-cmd-con.h
index 880e9056..dbff832f 100644
--- a/src/gnome-cmd-con.h
+++ b/src/gnome-cmd-con.h
@@ -465,7 +465,16 @@ std::string &__gnome_cmd_con_make_uri (std::string &s, const gchar *method, gboo
 
 inline std::string &gnome_cmd_con_make_custom_uri (std::string &s, const std::string &uri)
 {
-    stringify (s, gnome_vfs_make_uri_from_input (uri.c_str()));
+    GError *error = nullptr;
+    auto gUri = g_uri_parse (uri.c_str(), G_URI_FLAGS_NONE, &error);
+    if (error != nullptr)
+    {
+        g_warning ("g_uri_parse error of \"%s\": %s", uri.c_str(), error->message);
+        g_error_free(error);
+        s.erase();
+        return s;
+    }
+    stringify (s, g_uri_to_string(gUri));
 
     if (!uri_is_valid (s))
         s.erase();
diff --git a/src/utils.h b/src/utils.h
index 104b85e1..72459282 100644
--- a/src/utils.h
+++ b/src/utils.h
@@ -228,14 +228,7 @@ gboolean create_dir_if_needed (const gchar *dpath);
 
 inline gboolean uri_is_valid (const gchar *uri)
 {
-    GnomeVFSURI *vfs_uri = gnome_vfs_uri_new (uri);         //      gnome_vfs_uri_new() returns NULL for !uri
-
-    if (!vfs_uri)
-        return FALSE;
-
-    gnome_vfs_uri_unref (vfs_uri);
-
-    return TRUE;
+    return g_uri_is_valid (uri, G_URI_FLAGS_NONE, nullptr);
 }
 
 inline gboolean uri_is_valid (const std::string &uri)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]