[tepl] Utils: make decode_uri() public



commit f5b1a1009783b8ade6a2f10c83d32148b8849f18
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Mon Mar 23 13:35:19 2020 +0100

    Utils: make decode_uri() public
    
    It will be used by gedit.

 docs/reference/tepl-4.0-sections.txt |  1 +
 tepl/tepl-io-error-info-bar.c        |  2 +-
 tepl/tepl-utils.c                    | 17 +++++++++--------
 tepl/tepl-utils.h                    |  3 +--
 testsuite/test-utils.c               |  8 ++++----
 5 files changed, 16 insertions(+), 15 deletions(-)
---
diff --git a/docs/reference/tepl-4.0-sections.txt b/docs/reference/tepl-4.0-sections.txt
index 68c8ba9..f166bff 100644
--- a/docs/reference/tepl-4.0-sections.txt
+++ b/docs/reference/tepl-4.0-sections.txt
@@ -393,6 +393,7 @@ tepl_utils_str_replace
 tepl_utils_get_file_extension
 tepl_utils_get_file_shortname
 tepl_utils_replace_home_dir_with_tilde
+tepl_utils_decode_uri
 tepl_utils_show_warning_dialog
 </SECTION>
 
diff --git a/tepl/tepl-io-error-info-bar.c b/tepl/tepl-io-error-info-bar.c
index bda3a80..791a546 100644
--- a/tepl/tepl-io-error-info-bar.c
+++ b/tepl/tepl-io-error-info-bar.c
@@ -128,7 +128,7 @@ parse_error (const GError  *error,
 
                if (uri != NULL)
                {
-                       _tepl_utils_decode_uri (uri, NULL, NULL, &host, NULL, NULL);
+                       tepl_utils_decode_uri (uri, NULL, NULL, &host, NULL, NULL);
                }
 
                if (host != NULL)
diff --git a/tepl/tepl-utils.c b/tepl/tepl-utils.c
index 02c2db0..1e2718e 100644
--- a/tepl/tepl-utils.c
+++ b/tepl/tepl-utils.c
@@ -310,8 +310,8 @@ null_ptr (gchar **ptr)
        }
 }
 
-/*
- * _tepl_utils_decode_uri:
+/**
+ * tepl_utils_decode_uri:
  * @uri: the uri to decode
  * @scheme: (out) (optional): return value pointer for the uri's
  *     scheme (e.g. http, sftp, ...), or %NULL
@@ -326,14 +326,15 @@ null_ptr (gchar **ptr)
  * all return value pointers should be freed using g_free().
  *
  * Returns: %TRUE if the uri could be properly decoded, %FALSE otherwise.
+ * Since: 4.6
  */
 gboolean
-_tepl_utils_decode_uri (const gchar  *uri,
-                       gchar       **scheme,
-                       gchar       **user,
-                       gchar       **host,
-                       gchar       **port,
-                       gchar       **path)
+tepl_utils_decode_uri (const gchar  *uri,
+                      gchar       **scheme,
+                      gchar       **user,
+                      gchar       **host,
+                      gchar       **port,
+                      gchar       **path)
 {
        /* Largely copied from glib/gio/gdummyfile.c: _g_decode_uri().
         * This functionality is currently not in GLib/GIO, so for now we
diff --git a/tepl/tepl-utils.h b/tepl/tepl-utils.h
index 8440e1e..a586936 100644
--- a/tepl/tepl-utils.h
+++ b/tepl/tepl-utils.h
@@ -48,8 +48,7 @@ gchar *               tepl_utils_get_file_shortname                   (const gchar 
*filename);
 
 gchar *                tepl_utils_replace_home_dir_with_tilde          (const gchar *filename);
 
-G_GNUC_INTERNAL
-gboolean       _tepl_utils_decode_uri                          (const gchar  *uri,
+gboolean       tepl_utils_decode_uri                           (const gchar  *uri,
                                                                 gchar       **scheme,
                                                                 gchar       **user,
                                                                 gchar       **host,
diff --git a/testsuite/test-utils.c b/testsuite/test-utils.c
index 5d12509..4cf63d0 100644
--- a/testsuite/test-utils.c
+++ b/testsuite/test-utils.c
@@ -153,14 +153,14 @@ test_decode_uri (void)
        gboolean ret;
 
        /* Basic test, for what is used in Tepl (the host). */
-       ret = _tepl_utils_decode_uri ("smb://example.net/home/file.c",
-                                     NULL, NULL, &host, NULL, NULL);
+       ret = tepl_utils_decode_uri ("smb://example.net/home/file.c",
+                                    NULL, NULL, &host, NULL, NULL);
        g_assert_true (ret);
        g_assert_cmpstr (host, ==, "example.net");
        g_free (host);
 
-       ret = _tepl_utils_decode_uri ("smb://154.23.201.4/home/file.c",
-                                     NULL, NULL, &host, NULL, NULL);
+       ret = tepl_utils_decode_uri ("smb://154.23.201.4/home/file.c",
+                                    NULL, NULL, &host, NULL, NULL);
        g_assert_true (ret);
        g_assert_cmpstr (host, ==, "154.23.201.4");
        g_free (host);


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