[gedit] GeditDocument: make get_uri_for_display() private



commit 9487cb820483e20010a26bb5e8f4210b4009ba49
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Thu Nov 19 13:39:48 2020 +0100

    GeditDocument: make get_uri_for_display() private
    
    In preparation to use more of the TeplBuffer and TeplFile API.

 docs/reference/api-breaks.xml     |  6 ++++++
 docs/reference/gedit-sections.txt |  1 -
 gedit/gedit-commands-file.c       |  6 +++---
 gedit/gedit-document-private.h    | 22 +++++++++++++++-------
 gedit/gedit-document.c            |  9 ++-------
 gedit/gedit-document.h            |  2 --
 gedit/gedit-print-job.c           |  3 ++-
 gedit/gedit-tab.c                 |  2 +-
 8 files changed, 29 insertions(+), 22 deletions(-)
---
diff --git a/docs/reference/api-breaks.xml b/docs/reference/api-breaks.xml
index 0ca693d0c..c3cd11265 100644
--- a/docs/reference/api-breaks.xml
+++ b/docs/reference/api-breaks.xml
@@ -49,6 +49,12 @@
           instead.
         </para>
       </listitem>
+      <listitem>
+        <para>
+          The <code>gedit_document_get_uri_for_display()</code> function has
+          been removed from the public API.
+        </para>
+      </listitem>
     </itemizedlist>
   </refsect1>
 
diff --git a/docs/reference/gedit-sections.txt b/docs/reference/gedit-sections.txt
index 74be58c16..c7eca980c 100644
--- a/docs/reference/gedit-sections.txt
+++ b/docs/reference/gedit-sections.txt
@@ -52,7 +52,6 @@ gedit_commands_save_all_documents
 GeditDocument
 gedit_document_new
 gedit_document_get_file
-gedit_document_get_uri_for_display
 gedit_document_get_short_name_for_display
 gedit_document_get_mime_type
 gedit_document_is_untouched
diff --git a/gedit/gedit-commands-file.c b/gedit/gedit-commands-file.c
index 565ee44a8..17cb07945 100644
--- a/gedit/gedit-commands-file.c
+++ b/gedit/gedit-commands-file.c
@@ -250,7 +250,7 @@ load_file_list (GeditWindow             *window,
                g_return_val_if_fail (tab != NULL, loaded_files);
 
                doc = gedit_tab_get_document (tab);
-               uri_for_display = gedit_document_get_uri_for_display (doc);
+               uri_for_display = _gedit_document_get_uri_for_display (doc);
 
                gedit_statusbar_flash_message (GEDIT_STATUSBAR (window->priv->statusbar),
                                               window->priv->generic_message_cid,
@@ -958,7 +958,7 @@ gedit_commands_save_document_async (GeditDocument       *document,
                return;
        }
 
-       uri_for_display = gedit_document_get_uri_for_display (document);
+       uri_for_display = _gedit_document_get_uri_for_display (document);
        gedit_statusbar_flash_message (GEDIT_STATUSBAR (window->priv->statusbar),
                                       window->priv->generic_message_cid,
                                       _("Saving file “%s”\342\200\246"),
@@ -1285,7 +1285,7 @@ save_documents_list (GeditWindow *window,
 
                        gchar *uri_for_display;
 
-                       uri_for_display = gedit_document_get_uri_for_display (doc);
+                       uri_for_display = _gedit_document_get_uri_for_display (doc);
                        gedit_debug_message (DEBUG_COMMANDS,
                                             "File '%s' not saved. State: %d",
                                             uri_for_display,
diff --git a/gedit/gedit-document-private.h b/gedit/gedit-document-private.h
index 2cec9e301..62444cc76 100644
--- a/gedit/gedit-document-private.h
+++ b/gedit/gedit-document-private.h
@@ -5,7 +5,7 @@
  * Copyright (C) 1998, 1999 Alex Roberts, Evan Lawrence
  * Copyright (C) 2000, 2001 Chema Celorio, Paolo Maggi
  * Copyright (C) 2002-2005 Paolo Maggi
- * Copyright (C) 2014 Sébastien Wilmet
+ * Copyright (C) 2014, 2020 Sébastien Wilmet
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -32,16 +32,24 @@ G_BEGIN_DECLS
 #define GEDIT_METADATA_ATTRIBUTE_ENCODING "gedit-encoding"
 #define GEDIT_METADATA_ATTRIBUTE_LANGUAGE "gedit-language"
 
-glong           _gedit_document_get_seconds_since_last_save_or_load    (GeditDocument       *doc);
+G_GNUC_INTERNAL
+glong          _gedit_document_get_seconds_since_last_save_or_load     (GeditDocument *doc);
 
-gboolean        _gedit_document_needs_saving                           (GeditDocument       *doc);
+G_GNUC_INTERNAL
+gboolean       _gedit_document_needs_saving                            (GeditDocument *doc);
 
-gboolean        _gedit_document_get_empty_search                       (GeditDocument       *doc);
+G_GNUC_INTERNAL
+gboolean       _gedit_document_get_empty_search                        (GeditDocument *doc);
 
-void            _gedit_document_set_create                             (GeditDocument       *doc,
-                                                                        gboolean             create);
+G_GNUC_INTERNAL
+void           _gedit_document_set_create                              (GeditDocument *doc,
+                                                                        gboolean       create);
 
-gboolean        _gedit_document_get_create                             (GeditDocument       *doc);
+G_GNUC_INTERNAL
+gboolean       _gedit_document_get_create                              (GeditDocument *doc);
+
+G_GNUC_INTERNAL
+gchar *                _gedit_document_get_uri_for_display                     (GeditDocument *doc);
 
 G_END_DECLS
 
diff --git a/gedit/gedit-document.c b/gedit/gedit-document.c
index b95902751..e1e933f3a 100644
--- a/gedit/gedit-document.c
+++ b/gedit/gedit-document.c
@@ -888,14 +888,9 @@ set_content_type (GeditDocument *doc,
        }
 }
 
-/**
- * gedit_document_get_uri_for_display:
- * @doc: a #GeditDocument.
- *
- * Note: this never returns %NULL.
- **/
+/* Note: this never returns %NULL. */
 gchar *
-gedit_document_get_uri_for_display (GeditDocument *doc)
+_gedit_document_get_uri_for_display (GeditDocument *doc)
 {
        GeditDocumentPrivate *priv;
        GFile *location;
diff --git a/gedit/gedit-document.h b/gedit/gedit-document.h
index faa503f8b..1a759573c 100644
--- a/gedit/gedit-document.h
+++ b/gedit/gedit-document.h
@@ -51,8 +51,6 @@ GeditDocument   *gedit_document_new                           (void);
 
 GtkSourceFile  *gedit_document_get_file                        (GeditDocument       *doc);
 
-gchar          *gedit_document_get_uri_for_display             (GeditDocument       *doc);
-
 gchar          *gedit_document_get_short_name_for_display      (GeditDocument       *doc);
 
 gchar          *gedit_document_get_content_type                (GeditDocument       *doc);
diff --git a/gedit/gedit-print-job.c b/gedit/gedit-print-job.c
index 6b0752584..6083669f9 100644
--- a/gedit/gedit-print-job.c
+++ b/gedit/gedit-print-job.c
@@ -26,6 +26,7 @@
 #include <tepl/tepl.h>
 
 #include "gedit-debug.h"
+#include "gedit-document-private.h"
 #include "gedit-print-preview.h"
 #include "gedit-utils.h"
 #include "gedit-dirs.h"
@@ -533,7 +534,7 @@ create_compositor (GeditPrintJob *job)
                gchar *name_to_display;
                gchar *left;
 
-               doc_name = gedit_document_get_uri_for_display (GEDIT_DOCUMENT (buf));
+               doc_name = _gedit_document_get_uri_for_display (GEDIT_DOCUMENT (buf));
                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 94afbbb4e..aade51ef9 100644
--- a/gedit/gedit-tab.c
+++ b/gedit/gedit-tab.c
@@ -1461,7 +1461,7 @@ _gedit_tab_get_tooltip (GeditTab *tab)
 
        doc = gedit_tab_get_document (tab);
 
-       uri = gedit_document_get_uri_for_display (doc);
+       uri = _gedit_document_get_uri_for_display (doc);
        g_return_val_if_fail (uri != NULL, NULL);
 
        ruri =  tepl_utils_replace_home_dir_with_tilde (uri);


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