[gedit] Configure Tepl to show "Untitled Document" instead of "Untitled File"



commit 13bf23603997d24b6d8def866f11eabd198e50ad
Author: Sébastien Wilmet <swilmet informatique-libre be>
Date:   Sun Jul 17 20:50:01 2022 +0200

    Configure Tepl to show "Untitled Document" instead of "Untitled File"
    
    Some time ago, gedit showed "Unsaved Document", then it was changed to
    "Untitled Document". Tepl has "Untitled File" by default, but "document"
    is used a bit everywhere in the gedit UI, docs, etc.

 gedit/gedit-factory.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
---
diff --git a/gedit/gedit-factory.c b/gedit/gedit-factory.c
index 409b3beb2..f1d70ad3e 100644
--- a/gedit/gedit-factory.c
+++ b/gedit/gedit-factory.c
@@ -18,10 +18,28 @@
  */
 
 #include "gedit-factory.h"
+#include <glib/gi18n.h>
 #include "gedit-dirs.h"
 
 G_DEFINE_TYPE (GeditFactory, gedit_factory, TEPL_TYPE_ABSTRACT_FACTORY)
 
+static gchar *
+untitled_file_cb (gint untitled_file_number)
+{
+       return g_strdup_printf (_("Untitled Document %d"), untitled_file_number);
+}
+
+static TeplFile *
+gedit_factory_create_file (TeplAbstractFactory *factory)
+{
+       TeplFile *file;
+
+       file = tepl_file_new ();
+       tepl_file_set_untitled_file_callback (file, untitled_file_cb);
+
+       return file;
+}
+
 static GFile *
 gedit_factory_create_metadata_manager_file (TeplAbstractFactory *factory)
 {
@@ -35,6 +53,7 @@ gedit_factory_class_init (GeditFactoryClass *klass)
 {
        TeplAbstractFactoryClass *factory_class = TEPL_ABSTRACT_FACTORY_CLASS (klass);
 
+       factory_class->create_file = gedit_factory_create_file;
        factory_class->create_metadata_manager_file = gedit_factory_create_metadata_manager_file;
 }
 


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