[gedit] No longer use gedit_utils_str_middle_truncate()



commit 6eefa74c254a7debabb67429c2537f939dd71fab
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Tue Nov 5 07:57:07 2019 +0100

    No longer use gedit_utils_str_middle_truncate()

 gedit/gedit-commands-file.c     |  5 +++--
 gedit/gedit-documents-panel.c   |  3 ++-
 gedit/gedit-io-error-info-bar.c | 41 +++++++++++++++++++++--------------------
 gedit/gedit-print-job.c         |  4 ++--
 gedit/gedit-tab.c               | 13 +++++++------
 gedit/gedit-window.c            |  9 +++++----
 6 files changed, 40 insertions(+), 35 deletions(-)
---
diff --git a/gedit/gedit-commands-file.c b/gedit/gedit-commands-file.c
index 65e32d705..7d1cb1849 100644
--- a/gedit/gedit-commands-file.c
+++ b/gedit/gedit-commands-file.c
@@ -31,6 +31,7 @@
 #include <glib/gi18n.h>
 #include <gio/gio.h>
 #include <gtk/gtk.h>
+#include <tepl/tepl.h>
 
 #include "gedit-debug.h"
 #include "gedit-document.h"
@@ -548,7 +549,7 @@ replace_read_only_file (GtkWindow *parent,
         * though the dialog uses wrapped text, if the name doesn't contain
         * white space then the text-wrapping code is too stupid to wrap it.
         */
-       name_for_display = gedit_utils_str_middle_truncate (parse_name, 50);
+       name_for_display = tepl_utils_str_middle_truncate (parse_name, 50);
        g_free (parse_name);
 
        dialog = gtk_message_dialog_new (parent,
@@ -600,7 +601,7 @@ change_compression (GtkWindow *parent,
         * though the dialog uses wrapped text, if the name doesn't contain
         * white space then the text-wrapping code is too stupid to wrap it.
         */
-       name_for_display = gedit_utils_str_middle_truncate (parse_name, 50);
+       name_for_display = tepl_utils_str_middle_truncate (parse_name, 50);
        g_free (parse_name);
 
        if (compressed)
diff --git a/gedit/gedit-documents-panel.c b/gedit/gedit-documents-panel.c
index ddd1436b7..b1fd22a3a 100644
--- a/gedit/gedit-documents-panel.c
+++ b/gedit/gedit-documents-panel.c
@@ -25,6 +25,7 @@
 #include "gedit-documents-panel.h"
 
 #include <glib/gi18n.h>
+#include <tepl/tepl.h>
 
 #include "gedit-debug.h"
 #include "gedit-document.h"
@@ -448,7 +449,7 @@ doc_get_name (GeditDocument *doc)
        name = gedit_document_get_short_name_for_display (doc);
 
        /* Truncate the name so it doesn't get insanely wide. */
-       docname = gedit_utils_str_middle_truncate (name, MAX_DOC_NAME_LENGTH);
+       docname = tepl_utils_str_middle_truncate (name, MAX_DOC_NAME_LENGTH);
 
        g_free (name);
 
diff --git a/gedit/gedit-io-error-info-bar.c b/gedit/gedit-io-error-info-bar.c
index d8d024f90..729d36397 100644
--- a/gedit/gedit-io-error-info-bar.c
+++ b/gedit/gedit-io-error-info-bar.c
@@ -28,6 +28,7 @@
 #include <string.h>
 #include <glib/gi18n.h>
 #include <gio/gio.h>
+#include <tepl/tepl.h>
 
 #include "gedit-encodings-combo-box.h"
 #include "gedit-settings.h"
@@ -330,8 +331,8 @@ gedit_unrecoverable_reverting_error_info_bar_new (GFile        *location,
         * though the dialog uses wrapped text, if the URI doesn't contain
         * white space then the text-wrapping code is too stupid to wrap it.
         */
-       temp_uri_for_display = gedit_utils_str_middle_truncate (full_formatted_uri,
-                                                               MAX_URI_IN_DIALOG_LENGTH);
+       temp_uri_for_display = tepl_utils_str_middle_truncate (full_formatted_uri,
+                                                              MAX_URI_IN_DIALOG_LENGTH);
        g_free (full_formatted_uri);
 
        uri_for_display = g_markup_escape_text (temp_uri_for_display, -1);
@@ -422,8 +423,8 @@ gedit_network_unavailable_info_bar_new (GFile *location)
 
        full_formatted_uri = g_file_get_parse_name (location);
 
-       temp_uri_for_display = gedit_utils_str_middle_truncate (full_formatted_uri,
-                                                               MAX_URI_IN_DIALOG_LENGTH);
+       temp_uri_for_display = tepl_utils_str_middle_truncate (full_formatted_uri,
+                                                              MAX_URI_IN_DIALOG_LENGTH);
        g_free (full_formatted_uri);
        uri_for_display = g_markup_printf_escaped ("<i>%s</i>", temp_uri_for_display);
        g_free (temp_uri_for_display);
@@ -575,8 +576,8 @@ gedit_io_loading_error_info_bar_new (GFile                   *location,
         * though the dialog uses wrapped text, if the URI doesn't contain
         * white space then the text-wrapping code is too stupid to wrap it.
         */
-       temp_uri_for_display = gedit_utils_str_middle_truncate (full_formatted_uri,
-                                                               MAX_URI_IN_DIALOG_LENGTH);
+       temp_uri_for_display = tepl_utils_str_middle_truncate (full_formatted_uri,
+                                                              MAX_URI_IN_DIALOG_LENGTH);
        g_free (full_formatted_uri);
 
        uri_for_display = g_markup_escape_text (temp_uri_for_display, -1);
@@ -681,8 +682,8 @@ gedit_conversion_error_while_saving_info_bar_new (GFile                   *locat
         * though the dialog uses wrapped text, if the URI doesn't contain
         * white space then the text-wrapping code is too stupid to wrap it.
         */
-       temp_uri_for_display = gedit_utils_str_middle_truncate (full_formatted_uri,
-                                                               MAX_URI_IN_DIALOG_LENGTH);
+       temp_uri_for_display = tepl_utils_str_middle_truncate (full_formatted_uri,
+                                                              MAX_URI_IN_DIALOG_LENGTH);
        g_free (full_formatted_uri);
 
        uri_for_display = g_markup_escape_text (temp_uri_for_display, -1);
@@ -750,8 +751,8 @@ gedit_file_already_open_warning_info_bar_new (GFile *location)
         * though the dialog uses wrapped text, if the URI doesn't contain
         * white space then the text-wrapping code is too stupid to wrap it.
         */
-       temp_uri_for_display = gedit_utils_str_middle_truncate (full_formatted_uri,
-                                                               MAX_URI_IN_DIALOG_LENGTH);
+       temp_uri_for_display = tepl_utils_str_middle_truncate (full_formatted_uri,
+                                                              MAX_URI_IN_DIALOG_LENGTH);
        g_free (full_formatted_uri);
 
        uri_for_display = g_markup_escape_text (temp_uri_for_display, -1);
@@ -836,8 +837,8 @@ gedit_externally_modified_saving_error_info_bar_new (GFile        *location,
         * though the dialog uses wrapped text, if the URI doesn't contain
         * white space then the text-wrapping code is too stupid to wrap it.
         */
-       temp_uri_for_display = gedit_utils_str_middle_truncate (full_formatted_uri,
-                                                               MAX_URI_IN_DIALOG_LENGTH);
+       temp_uri_for_display = tepl_utils_str_middle_truncate (full_formatted_uri,
+                                                              MAX_URI_IN_DIALOG_LENGTH);
        g_free (full_formatted_uri);
 
        uri_for_display = g_markup_escape_text (temp_uri_for_display, -1);
@@ -926,8 +927,8 @@ gedit_no_backup_saving_error_info_bar_new (GFile        *location,
         * though the dialog uses wrapped text, if the URI doesn't contain
         * white space then the text-wrapping code is too stupid to wrap it.
         */
-       temp_uri_for_display = gedit_utils_str_middle_truncate (full_formatted_uri,
-                                                               MAX_URI_IN_DIALOG_LENGTH);
+       temp_uri_for_display = tepl_utils_str_middle_truncate (full_formatted_uri,
+                                                              MAX_URI_IN_DIALOG_LENGTH);
        g_free (full_formatted_uri);
 
        uri_for_display = g_markup_escape_text (temp_uri_for_display, -1);
@@ -1024,8 +1025,8 @@ gedit_unrecoverable_saving_error_info_bar_new (GFile        *location,
         * though the dialog uses wrapped text, if the URI doesn't contain
         * white space then the text-wrapping code is too stupid to wrap it.
         */
-       temp_uri_for_display = gedit_utils_str_middle_truncate (full_formatted_uri,
-                                                               MAX_URI_IN_DIALOG_LENGTH);
+       temp_uri_for_display = tepl_utils_str_middle_truncate (full_formatted_uri,
+                                                              MAX_URI_IN_DIALOG_LENGTH);
        g_free (full_formatted_uri);
 
        uri_for_display = g_markup_escape_text (temp_uri_for_display, -1);
@@ -1147,8 +1148,8 @@ gedit_externally_modified_info_bar_new (GFile    *location,
         * though the dialog uses wrapped text, if the URI doesn't contain
         * white space then the text-wrapping code is too stupid to wrap it.
         */
-       temp_uri_for_display = gedit_utils_str_middle_truncate (full_formatted_uri,
-                                                               MAX_URI_IN_DIALOG_LENGTH);
+       temp_uri_for_display = tepl_utils_str_middle_truncate (full_formatted_uri,
+                                                              MAX_URI_IN_DIALOG_LENGTH);
        g_free (full_formatted_uri);
 
        uri_for_display = g_markup_escape_text (temp_uri_for_display, -1);
@@ -1216,8 +1217,8 @@ gedit_invalid_character_info_bar_new (GFile *location)
         * though the dialog uses wrapped text, if the URI doesn't contain
         * white space then the text-wrapping code is too stupid to wrap it.
         */
-       temp_uri_for_display = gedit_utils_str_middle_truncate (full_formatted_uri,
-                                                               MAX_URI_IN_DIALOG_LENGTH);
+       temp_uri_for_display = tepl_utils_str_middle_truncate (full_formatted_uri,
+                                                              MAX_URI_IN_DIALOG_LENGTH);
        g_free (full_formatted_uri);
 
        uri_for_display = g_markup_escape_text (temp_uri_for_display, -1);
diff --git a/gedit/gedit-print-job.c b/gedit/gedit-print-job.c
index 6d4afb2e0..6b0752584 100644
--- a/gedit/gedit-print-job.c
+++ b/gedit/gedit-print-job.c
@@ -23,7 +23,7 @@
 #include "gedit-print-job.h"
 
 #include <glib/gi18n.h>
-#include <gtksourceview/gtksource.h>
+#include <tepl/tepl.h>
 
 #include "gedit-debug.h"
 #include "gedit-print-preview.h"
@@ -534,7 +534,7 @@ create_compositor (GeditPrintJob *job)
                gchar *left;
 
                doc_name = gedit_document_get_uri_for_display (GEDIT_DOCUMENT (buf));
-               name_to_display = gedit_utils_str_middle_truncate (doc_name, 60);
+               name_to_display = tepl_utils_str_middle_truncate (doc_name, 60);
 
                left = g_strdup_printf (_("File: %s"), name_to_display);
 
diff --git a/gedit/gedit-tab.c b/gedit/gedit-tab.c
index 02d243714..3c0065a6b 100644
--- a/gedit/gedit-tab.c
+++ b/gedit/gedit-tab.c
@@ -24,6 +24,7 @@
 
 #include <stdlib.h>
 #include <glib/gi18n.h>
+#include <tepl/tepl.h>
 
 #include "gedit-app.h"
 #include "gedit-app-private.h"
@@ -785,7 +786,7 @@ show_loading_info_bar (GTask *loading_task)
        {
                gchar *str;
 
-               str = gedit_utils_str_middle_truncate (name, MAX_MSG_LENGTH);
+               str = tepl_utils_str_middle_truncate (name, MAX_MSG_LENGTH);
                g_free (name);
                name = str;
        }
@@ -804,8 +805,8 @@ show_loading_info_bar (GTask *loading_task)
                         * we have a title long 99 + 20, but I think it's a rare enough
                         * case to be acceptable. It's justa darn title afterall :)
                         */
-                       dirname = gedit_utils_str_middle_truncate (str,
-                                                                  MAX (20, MAX_MSG_LENGTH - len));
+                       dirname = tepl_utils_str_middle_truncate (str,
+                                                                 MAX (20, MAX_MSG_LENGTH - len));
                        g_free (str);
                }
        }
@@ -899,7 +900,7 @@ show_saving_info_bar (GTask *saving_task)
         */
        if (len > MAX_MSG_LENGTH)
        {
-               from = gedit_utils_str_middle_truncate (short_name, MAX_MSG_LENGTH);
+               from = tepl_utils_str_middle_truncate (short_name, MAX_MSG_LENGTH);
                g_free (short_name);
        }
        else
@@ -913,7 +914,7 @@ show_saving_info_bar (GTask *saving_task)
 
                from = short_name;
                to = g_file_get_parse_name (location);
-               str = gedit_utils_str_middle_truncate (to, MAX (20, MAX_MSG_LENGTH - len));
+               str = tepl_utils_str_middle_truncate (to, MAX (20, MAX_MSG_LENGTH - len));
                g_free (to);
 
                to = str;
@@ -1486,7 +1487,7 @@ _gedit_tab_get_name (GeditTab *tab)
        name = gedit_document_get_short_name_for_display (doc);
 
        /* Truncate the name so it doesn't get insanely wide. */
-       docname = gedit_utils_str_middle_truncate (name, MAX_DOC_NAME_LENGTH);
+       docname = tepl_utils_str_middle_truncate (name, MAX_DOC_NAME_LENGTH);
 
        if (gtk_text_buffer_get_modified (GTK_TEXT_BUFFER (doc)))
        {
diff --git a/gedit/gedit-window.c b/gedit/gedit-window.c
index 8f25e9526..62d5b34a7 100644
--- a/gedit/gedit-window.c
+++ b/gedit/gedit-window.c
@@ -30,6 +30,7 @@
 
 #include <glib/gi18n.h>
 #include <libpeas/peas-extension-set.h>
+#include <tepl/tepl.h>
 
 #include "gedit-window-private.h"
 #include "gedit-app.h"
@@ -1120,8 +1121,8 @@ set_title (GeditWindow *window)
        {
                gchar *tmp;
 
-               tmp = gedit_utils_str_middle_truncate (name,
-                                                      MAX_TITLE_LENGTH);
+               tmp = tepl_utils_str_middle_truncate (name,
+                                                     MAX_TITLE_LENGTH);
                g_free (name);
                name = tmp;
        }
@@ -1139,8 +1140,8 @@ set_title (GeditWindow *window)
                         * we have a title long 99 + 20, but I think it's a rare enough
                         * case to be acceptable. It's justa darn title afterall :)
                         */
-                       dirname = gedit_utils_str_middle_truncate (str,
-                                                                  MAX (20, MAX_TITLE_LENGTH - len));
+                       dirname = tepl_utils_str_middle_truncate (str,
+                                                                 MAX (20, MAX_TITLE_LENGTH - len));
                        g_free (str);
                }
        }


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