[gedit] Document: remove set_short_name_for_display() (deprecated)



commit e8d81fb365f8041259b088beebf075a9e9277cea
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Wed Nov 13 14:27:35 2019 +0100

    Document: remove set_short_name_for_display() (deprecated)
    
    And make the :shortname property read-only.
    
    There has been an API version bump for gedit, so we can remove the
    deprecated APIs.

 docs/reference/gedit-sections.txt |  1 -
 gedit/gedit-document.c            | 49 +++------------------------------------
 gedit/gedit-document.h            |  4 ----
 3 files changed, 3 insertions(+), 51 deletions(-)
---
diff --git a/docs/reference/gedit-sections.txt b/docs/reference/gedit-sections.txt
index ca3b17aef..d1de627c2 100644
--- a/docs/reference/gedit-sections.txt
+++ b/docs/reference/gedit-sections.txt
@@ -58,7 +58,6 @@ gedit_document_get_file
 gedit_document_get_location
 gedit_document_get_uri_for_display
 gedit_document_get_short_name_for_display
-gedit_document_set_short_name_for_display
 gedit_document_get_mime_type
 gedit_document_is_local
 gedit_document_is_untouched
diff --git a/gedit/gedit-document.c b/gedit/gedit-document.c
index e76134819..5eeb2602e 100644
--- a/gedit/gedit-document.c
+++ b/gedit/gedit-document.c
@@ -54,7 +54,6 @@ typedef struct
        GSettings   *editor_settings;
 
        gint         untitled_number;
-       gchar       *short_name;
 
        GFileInfo   *metadata_info;
 
@@ -236,7 +235,6 @@ gedit_document_finalize (GObject *object)
        }
 
        g_free (priv->content_type);
-       g_free (priv->short_name);
 
        G_OBJECT_CLASS (gedit_document_parent_class)->finalize (object);
 }
@@ -295,12 +293,6 @@ gedit_document_set_property (GObject      *object,
 
        switch (prop_id)
        {
-               case PROP_SHORTNAME:
-                       G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
-                       gedit_document_set_short_name_for_display (doc, g_value_get_string (value));
-                       G_GNUC_END_IGNORE_DEPRECATIONS;
-                       break;
-
                case PROP_CONTENT_TYPE:
                        set_content_type (doc, g_value_get_string (value));
                        break;
@@ -431,7 +423,7 @@ gedit_document_class_init (GeditDocumentClass *klass)
                                     "Short Name",
                                     "The document's short name",
                                     NULL,
-                                    G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
+                                    G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
 
        /**
         * GeditDocument:content-type:
@@ -725,10 +717,6 @@ guess_language (GeditDocument *doc)
                {
                        basename = g_file_get_basename (location);
                }
-               else if (priv->short_name != NULL)
-               {
-                       basename = g_strdup (priv->short_name);
-               }
 
                language = gtk_source_language_manager_guess_language (manager,
                                                                       basename,
@@ -786,10 +774,7 @@ on_location_changed (GtkSourceFile *file,
                priv->untitled_number = 0;
        }
 
-       if (priv->short_name == NULL)
-       {
-               g_object_notify_by_pspec (G_OBJECT (doc), properties[PROP_SHORTNAME]);
-       }
+       g_object_notify_by_pspec (G_OBJECT (doc), properties[PROP_SHORTNAME]);
 
        /* Load metadata for this location: we load sync since metadata is
         * always local so it should be fast and we need the information
@@ -1101,11 +1086,7 @@ gedit_document_get_short_name_for_display (GeditDocument *doc)
 
        location = gtk_source_file_get_location (priv->file);
 
-       if (priv->short_name != NULL)
-       {
-               return g_strdup (priv->short_name);
-       }
-       else if (location == NULL)
+       if (location == NULL)
        {
                return g_strdup_printf (_("Untitled Document %d"),
                                        priv->untitled_number);
@@ -1116,30 +1097,6 @@ gedit_document_get_short_name_for_display (GeditDocument *doc)
        }
 }
 
-/**
- * gedit_document_set_short_name_for_display:
- * @doc:
- * @short_name: (allow-none):
- *
- * Deprecated: 3.18: Unused function. The intent is to change the
- * #GeditDocument:shortname property to be read-only.
- */
-void
-gedit_document_set_short_name_for_display (GeditDocument *doc,
-                                           const gchar   *short_name)
-{
-       GeditDocumentPrivate *priv;
-
-       g_return_if_fail (GEDIT_IS_DOCUMENT (doc));
-
-       priv = gedit_document_get_instance_private (doc);
-
-       g_free (priv->short_name);
-       priv->short_name = g_strdup (short_name);
-
-       g_object_notify_by_pspec (G_OBJECT (doc), properties[PROP_SHORTNAME]);
-}
-
 gchar *
 gedit_document_get_content_type (GeditDocument *doc)
 {
diff --git a/gedit/gedit-document.h b/gedit/gedit-document.h
index 9bf4fcc2c..3db8663eb 100644
--- a/gedit/gedit-document.h
+++ b/gedit/gedit-document.h
@@ -59,10 +59,6 @@ gchar                *gedit_document_get_uri_for_display             (GeditDocument       
*doc);
 
 gchar          *gedit_document_get_short_name_for_display      (GeditDocument       *doc);
 
-G_DEPRECATED
-void            gedit_document_set_short_name_for_display      (GeditDocument       *doc,
-                                                                const gchar         *short_name);
-
 gchar          *gedit_document_get_content_type                (GeditDocument       *doc);
 
 gchar          *gedit_document_get_mime_type                   (GeditDocument       *doc);


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