[tepl] Utils: make replace_home_dir_with_tilde() public



commit 4a20b2a91c70543babcaf9ef8a9155b69d631fde
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Mon Nov 18 13:46:42 2019 +0100

    Utils: make replace_home_dir_with_tilde() public

 docs/reference/tepl-4.0-sections.txt | 1 +
 tepl/tepl-buffer.c                   | 2 +-
 tepl/tepl-tab-label.c                | 2 +-
 tepl/tepl-utils.c                    | 7 ++++---
 tepl/tepl-utils.h                    | 3 +--
 testsuite/test-utils.c               | 6 +++---
 6 files changed, 11 insertions(+), 10 deletions(-)
---
diff --git a/docs/reference/tepl-4.0-sections.txt b/docs/reference/tepl-4.0-sections.txt
index e4795f5..76a0828 100644
--- a/docs/reference/tepl-4.0-sections.txt
+++ b/docs/reference/tepl-4.0-sections.txt
@@ -391,6 +391,7 @@ tepl_utils_str_middle_truncate
 tepl_utils_str_end_truncate
 tepl_utils_get_file_extension
 tepl_utils_get_file_shortname
+tepl_utils_replace_home_dir_with_tilde
 </SECTION>
 
 <SECTION>
diff --git a/tepl/tepl-buffer.c b/tepl/tepl-buffer.c
index 997fc7a..0e9b549 100644
--- a/tepl/tepl-buffer.c
+++ b/tepl/tepl-buffer.c
@@ -540,7 +540,7 @@ tepl_buffer_get_full_title (TeplBuffer *buffer)
 
                parent = g_file_get_parent (location);
                directory = g_file_get_parse_name (parent);
-               directory_tilde = _tepl_utils_replace_home_dir_with_tilde (directory);
+               directory_tilde = tepl_utils_replace_home_dir_with_tilde (directory);
 
                full_title = g_strdup_printf ("%s (%s)", short_title, directory_tilde);
                g_free (short_title);
diff --git a/tepl/tepl-tab-label.c b/tepl/tepl-tab-label.c
index e625406..2684c15 100644
--- a/tepl/tepl-tab-label.c
+++ b/tepl/tepl-tab-label.c
@@ -266,7 +266,7 @@ tepl_tab_label_get_tooltip_markup_default (TeplTabLabel *tab_label)
        }
 
        parse_name = g_file_get_parse_name (location);
-       parse_name_with_tilde = _tepl_utils_replace_home_dir_with_tilde (parse_name);
+       parse_name_with_tilde = tepl_utils_replace_home_dir_with_tilde (parse_name);
 
        tooltip_markup = g_markup_printf_escaped ("<b>%s</b> %s",
                                                  /* Translators: location of a file. */
diff --git a/tepl/tepl-utils.c b/tepl/tepl-utils.c
index cd94f1b..81ab2e5 100644
--- a/tepl/tepl-utils.c
+++ b/tepl/tepl-utils.c
@@ -204,18 +204,19 @@ tepl_utils_get_file_shortname (const gchar *filename)
        return g_strndup (filename, get_extension_position (filename));
 }
 
-/*
- * _tepl_utils_replace_home_dir_with_tilde:
+/**
+ * tepl_utils_replace_home_dir_with_tilde:
  * @filename: the filename.
  *
  * Replaces the home directory with a tilde, if the home directory is present in
  * the @filename.
  *
  * Returns: the new filename. Free with g_free().
+ * Since: 4.4
  */
 /* This function comes from gedit. */
 gchar *
-_tepl_utils_replace_home_dir_with_tilde (const gchar *filename)
+tepl_utils_replace_home_dir_with_tilde (const gchar *filename)
 {
        gchar *tmp;
        gchar *home;
diff --git a/tepl/tepl-utils.h b/tepl/tepl-utils.h
index b1b7342..093ce05 100644
--- a/tepl/tepl-utils.h
+++ b/tepl/tepl-utils.h
@@ -42,8 +42,7 @@ gchar *               tepl_utils_get_file_extension                   (const gchar 
*filename);
 
 gchar *                tepl_utils_get_file_shortname                   (const gchar *filename);
 
-G_GNUC_INTERNAL
-gchar *                _tepl_utils_replace_home_dir_with_tilde         (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,
diff --git a/testsuite/test-utils.c b/testsuite/test-utils.c
index 9dd17cd..4832cee 100644
--- a/testsuite/test-utils.c
+++ b/testsuite/test-utils.c
@@ -105,16 +105,16 @@ test_replace_home_dir_with_tilde (void)
        gchar *after;
 
        before = g_build_filename (homedir, "blah", NULL);
-       after = _tepl_utils_replace_home_dir_with_tilde (before);
+       after = tepl_utils_replace_home_dir_with_tilde (before);
        g_assert_cmpstr (after, ==, "~/blah");
        g_free (before);
        g_free (after);
 
-       after = _tepl_utils_replace_home_dir_with_tilde (homedir);
+       after = tepl_utils_replace_home_dir_with_tilde (homedir);
        g_assert_cmpstr (after, ==, "~");
        g_free (after);
 
-       after = _tepl_utils_replace_home_dir_with_tilde ("/blah");
+       after = tepl_utils_replace_home_dir_with_tilde ("/blah");
        g_assert_cmpstr (after, ==, "/blah");
        g_free (after);
 }


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