[gedit] GeditDocument: use tepl_file_get_short_name()



commit 6e78a57c9386ffef0133137514a69f439448ae7c
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Fri Nov 20 05:58:40 2020 +0100

    GeditDocument: use tepl_file_get_short_name()
    
    The new tabs are now named "Untitled File", not "Untitled Document", but
    I think it's ok. One or the other is almost the same. However there are
    other places in the UI where the word "document" is used, and it may
    require to change them.

 gedit/gedit-document.c | 28 +++++++---------------------
 1 file changed, 7 insertions(+), 21 deletions(-)
---
diff --git a/gedit/gedit-document.c b/gedit/gedit-document.c
index e1e933f3a..bfb506fb0 100644
--- a/gedit/gedit-document.c
+++ b/gedit/gedit-document.c
@@ -892,19 +892,17 @@ set_content_type (GeditDocument *doc,
 gchar *
 _gedit_document_get_uri_for_display (GeditDocument *doc)
 {
-       GeditDocumentPrivate *priv;
+       TeplFile *file;
        GFile *location;
 
        g_return_val_if_fail (GEDIT_IS_DOCUMENT (doc), g_strdup (""));
 
-       priv = gedit_document_get_instance_private (doc);
-
-       location = gtk_source_file_get_location (priv->file);
+       file = tepl_buffer_get_file (TEPL_BUFFER (doc));
+       location = tepl_file_get_location (file);
 
        if (location == NULL)
        {
-               return g_strdup_printf (_("Untitled Document %d"),
-                                       priv->untitled_number);
+               return tepl_file_get_short_name (file);
        }
        else
        {
@@ -921,24 +919,12 @@ _gedit_document_get_uri_for_display (GeditDocument *doc)
 gchar *
 gedit_document_get_short_name_for_display (GeditDocument *doc)
 {
-       GeditDocumentPrivate *priv;
-       GFile *location;
+       TeplFile *file;
 
        g_return_val_if_fail (GEDIT_IS_DOCUMENT (doc), g_strdup (""));
 
-       priv = gedit_document_get_instance_private (doc);
-
-       location = gtk_source_file_get_location (priv->file);
-
-       if (location == NULL)
-       {
-               return g_strdup_printf (_("Untitled Document %d"),
-                                       priv->untitled_number);
-       }
-       else
-       {
-               return gedit_utils_basename_for_display (location);
-       }
+       file = tepl_buffer_get_file (TEPL_BUFFER (doc));
+       return tepl_file_get_short_name (file);
 }
 
 gchar *


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