[gedit/wip/gedit-next] GeditDocument: remove the deprecated API



commit eb8f80b7426aa0ecd6c4413d2e4f330642eb4bd5
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Sun Mar 27 14:14:35 2016 +0200

    GeditDocument: remove the deprecated API
    
    To have a clearer code.

 docs/reference/gedit-sections.txt |    9 --
 gedit/gedit-document.c            |  263 +------------------------------------
 gedit/gedit-document.h            |   38 +-----
 3 files changed, 5 insertions(+), 305 deletions(-)
---
diff --git a/docs/reference/gedit-sections.txt b/docs/reference/gedit-sections.txt
index 36a0f78..47140b7 100644
--- a/docs/reference/gedit-sections.txt
+++ b/docs/reference/gedit-sections.txt
@@ -55,24 +55,15 @@ gedit_commands_save_all_documents
 GeditDocument
 gedit_document_new
 gedit_document_get_file
-gedit_document_get_location
-gedit_document_set_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_get_readonly
-gedit_document_is_local
 gedit_document_is_untouched
 gedit_document_is_untitled
-gedit_document_get_deleted
 gedit_document_goto_line
 gedit_document_goto_line_offset
 gedit_document_set_language
-gedit_document_get_newline_type
-gedit_document_get_compression_type
 gedit_document_get_content_type
-gedit_document_set_content_type
 gedit_document_get_metadata
 gedit_document_set_metadata
 gedit_document_set_search_context
diff --git a/gedit/gedit-document.c b/gedit/gedit-document.c
index 36e91ff..2befb4d 100644
--- a/gedit/gedit-document.c
+++ b/gedit/gedit-document.c
@@ -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-2015 Sébastien Wilmet
+ * Copyright (C) 2014-2016 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
@@ -54,7 +54,6 @@ typedef struct
        GSettings   *editor_settings;
 
        gint         untitled_number;
-       gchar       *short_name;
 
        GFileInfo   *metadata_info;
 
@@ -90,7 +89,6 @@ enum
        PROP_SHORTNAME,
        PROP_CONTENT_TYPE,
        PROP_MIME_TYPE,
-       PROP_READ_ONLY,
        PROP_EMPTY_SEARCH,
        PROP_USE_GVFS_METADATA,
        LAST_PROP
@@ -234,7 +232,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);
 }
@@ -264,10 +261,6 @@ gedit_document_get_property (GObject    *object,
                        g_value_take_string (value, gedit_document_get_mime_type (doc));
                        break;
 
-               case PROP_READ_ONLY:
-                       g_value_set_boolean (value, gtk_source_file_is_readonly (priv->file));
-                       break;
-
                case PROP_EMPTY_SEARCH:
                        g_value_set_boolean (value, priv->empty_search);
                        break;
@@ -293,12 +286,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;
@@ -420,7 +407,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:
@@ -447,20 +434,6 @@ gedit_document_class_init (GeditDocumentClass *klass)
                                     G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
 
        /**
-        * GeditDocument:read-only:
-        *
-        * Whether the document is read-only or not.
-        *
-        * Deprecated: 3.18: Use the #GtkSourceFile API.
-        */
-       properties[PROP_READ_ONLY] =
-               g_param_spec_boolean ("read-only",
-                                     "Read Only",
-                                     "Whether the document is read-only or not",
-                                     FALSE,
-                                     G_PARAM_READABLE | G_PARAM_STATIC_STRINGS | G_PARAM_DEPRECATED);
-
-       /**
         * GeditDocument:empty-search:
         *
         * <warning>
@@ -714,10 +687,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,
@@ -775,10 +744,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
@@ -823,14 +789,6 @@ on_location_changed (GtkSourceFile *file,
 }
 
 static void
-on_readonly_changed (GtkSourceFile *file,
-                    GParamSpec    *pspec,
-                    GeditDocument *doc)
-{
-       g_object_notify_by_pspec (G_OBJECT (doc), properties[PROP_READ_ONLY]);
-}
-
-static void
 gedit_document_init (GeditDocument *doc)
 {
        GeditDocumentPrivate *priv;
@@ -857,12 +815,6 @@ gedit_document_init (GeditDocument *doc)
                                 doc,
                                 0);
 
-       g_signal_connect_object (priv->file,
-                                "notify::read-only",
-                                G_CALLBACK (on_readonly_changed),
-                                doc,
-                                0);
-
        g_settings_bind (priv->editor_settings,
                         GEDIT_SETTINGS_MAX_UNDO_ACTIONS,
                         doc,
@@ -1018,70 +970,6 @@ set_content_type (GeditDocument *doc,
 }
 
 /**
- * gedit_document_set_content_type:
- * @doc:
- * @content_type: (allow-none):
- *
- * Deprecated: 3.18: Unused function. The intent is to change the
- * #GeditDocument:content-type property to be read-only.
- */
-void
-gedit_document_set_content_type (GeditDocument *doc,
-                                 const gchar   *content_type)
-{
-       g_return_if_fail (GEDIT_IS_DOCUMENT (doc));
-
-       set_content_type (doc, content_type);
-}
-
-/**
- * gedit_document_get_location:
- * @doc: a #GeditDocument
- *
- * Returns: (allow-none) (transfer full): a copy of the internal #GFile
- *
- * Deprecated: 3.14: use gtk_source_file_get_location() instead. Attention,
- * gedit_document_get_location() has a transfer full for the return value, while
- * gtk_source_file_get_location() has a transfer none.
- */
-GFile *
-gedit_document_get_location (GeditDocument *doc)
-{
-       GeditDocumentPrivate *priv;
-       GFile *location;
-
-       priv = gedit_document_get_instance_private (doc);
-
-       g_return_val_if_fail (GEDIT_IS_DOCUMENT (doc), NULL);
-
-       location = gtk_source_file_get_location (priv->file);
-
-       return location != NULL ? g_object_ref (location) : NULL;
-}
-
-/**
- * gedit_document_set_location:
- * @doc: a #GeditDocument.
- * @location: the new location.
- *
- * Deprecated: 3.14: use gtk_source_file_set_location() instead.
- */
-void
-gedit_document_set_location (GeditDocument *doc,
-                            GFile         *location)
-{
-       GeditDocumentPrivate *priv;
-
-       g_return_if_fail (GEDIT_IS_DOCUMENT (doc));
-       g_return_if_fail (G_IS_FILE (location));
-
-       priv = gedit_document_get_instance_private (doc);
-
-       gtk_source_file_set_location (priv->file, location);
-       set_content_type (doc, NULL);
-}
-
-/**
  * gedit_document_get_uri_for_display:
  * @doc: a #GeditDocument.
  *
@@ -1128,11 +1016,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);
@@ -1143,30 +1027,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)
 {
@@ -1203,25 +1063,6 @@ gedit_document_get_mime_type (GeditDocument *doc)
        return g_strdup ("text/plain");
 }
 
-/**
- * gedit_document_get_readonly:
- * @doc: a #GeditDocument.
- *
- * Returns: whether the document is read-only.
- * Deprecated: 3.18: Use gtk_source_file_is_readonly() instead.
- */
-gboolean
-gedit_document_get_readonly (GeditDocument *doc)
-{
-       GeditDocumentPrivate *priv;
-
-       g_return_val_if_fail (GEDIT_IS_DOCUMENT (doc), TRUE);
-
-       priv = gedit_document_get_instance_private (doc);
-
-       return gtk_source_file_is_readonly (priv->file);
-}
-
 static void
 loaded_query_info_cb (GFile         *location,
                      GAsyncResult  *result,
@@ -1397,45 +1238,6 @@ gedit_document_is_untitled (GeditDocument *doc)
        return gtk_source_file_get_location (priv->file) == NULL;
 }
 
-/**
- * gedit_document_is_local:
- * @doc: a #GeditDocument.
- *
- * Returns: whether the document is local.
- * Deprecated: 3.18: Use gtk_source_file_is_local() instead.
- */
-gboolean
-gedit_document_is_local (GeditDocument *doc)
-{
-       GeditDocumentPrivate *priv;
-
-       g_return_val_if_fail (GEDIT_IS_DOCUMENT (doc), FALSE);
-
-       priv = gedit_document_get_instance_private (doc);
-
-       return gtk_source_file_is_local (priv->file);
-}
-
-/**
- * gedit_document_get_deleted:
- * @doc: a #GeditDocument.
- *
- * Returns: whether the file has been deleted.
- *
- * Deprecated: 3.18: Unused function.
- */
-gboolean
-gedit_document_get_deleted (GeditDocument *doc)
-{
-       GeditDocumentPrivate *priv;
-
-       g_return_val_if_fail (GEDIT_IS_DOCUMENT (doc), FALSE);
-
-       priv = gedit_document_get_instance_private (doc);
-
-       return gtk_source_file_is_deleted (priv->file);
-}
-
 /*
  * Deletion and external modification is only checked for local files.
  */
@@ -1538,25 +1340,6 @@ gedit_document_get_language (GeditDocument *doc)
        return gtk_source_buffer_get_language (GTK_SOURCE_BUFFER (doc));
 }
 
-/**
- * gedit_document_get_encoding:
- * @doc: a #GeditDocument.
- *
- * Returns: the encoding.
- * Deprecated: 3.14: use gtk_source_file_get_encoding() instead.
- */
-const GtkSourceEncoding *
-gedit_document_get_encoding (GeditDocument *doc)
-{
-       GeditDocumentPrivate *priv;
-
-       g_return_val_if_fail (GEDIT_IS_DOCUMENT (doc), NULL);
-
-       priv = gedit_document_get_instance_private (doc);
-
-       return gtk_source_file_get_encoding (priv->file);
-}
-
 glong
 _gedit_document_get_seconds_since_last_save_or_load (GeditDocument *doc)
 {
@@ -1573,44 +1356,6 @@ _gedit_document_get_seconds_since_last_save_or_load (GeditDocument *doc)
        return (current_time.tv_sec - priv->time_of_last_save_or_load.tv_sec);
 }
 
-/**
- * gedit_document_get_newline_type:
- * @doc: a #GeditDocument.
- *
- * Returns: the newline type.
- * Deprecated: 3.14: use gtk_source_file_get_newline_type() instead.
- */
-GtkSourceNewlineType
-gedit_document_get_newline_type (GeditDocument *doc)
-{
-       GeditDocumentPrivate *priv;
-
-       g_return_val_if_fail (GEDIT_IS_DOCUMENT (doc), 0);
-
-       priv = gedit_document_get_instance_private (doc);
-
-       return gtk_source_file_get_newline_type (priv->file);
-}
-
-/**
- * gedit_document_get_compression_type:
- * @doc: a #GeditDocument.
- *
- * Returns: the compression type.
- * Deprecated: 3.14: use gtk_source_file_get_compression_type() instead.
- */
-GtkSourceCompressionType
-gedit_document_get_compression_type (GeditDocument *doc)
-{
-       GeditDocumentPrivate *priv;
-
-       g_return_val_if_fail (GEDIT_IS_DOCUMENT (doc), 0);
-
-       priv = gedit_document_get_instance_private (doc);
-
-       return gtk_source_file_get_compression_type (priv->file);
-}
-
 static gchar *
 get_metadata_from_metadata_manager (GeditDocument *doc,
                                    const gchar   *key)
diff --git a/gedit/gedit-document.h b/gedit/gedit-document.h
index b169642..7b42a8c 100644
--- a/gedit/gedit-document.h
+++ b/gedit/gedit-document.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, 2016 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
@@ -52,42 +52,18 @@ GeditDocument   *gedit_document_new                         (void);
 
 GtkSourceFile  *gedit_document_get_file                        (GeditDocument       *doc);
 
-G_DEPRECATED_FOR (gtk_source_file_get_location)
-GFile          *gedit_document_get_location                    (GeditDocument       *doc);
-
-G_DEPRECATED_FOR (gtk_source_file_set_location)
-void            gedit_document_set_location                    (GeditDocument       *doc,
-                                                                GFile               *location);
-
 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);
 
-G_DEPRECATED
-void            gedit_document_set_content_type                (GeditDocument       *doc,
-                                                                const gchar         *content_type);
-
 gchar          *gedit_document_get_mime_type                   (GeditDocument       *doc);
 
-G_DEPRECATED_FOR (gtk_source_file_is_readonly)
-gboolean        gedit_document_get_readonly                    (GeditDocument       *doc);
-
 gboolean        gedit_document_is_untouched                    (GeditDocument       *doc);
 
 gboolean        gedit_document_is_untitled                     (GeditDocument       *doc);
 
-G_DEPRECATED_FOR (gtk_source_file_is_local)
-gboolean        gedit_document_is_local                        (GeditDocument       *doc);
-
-G_DEPRECATED
-gboolean        gedit_document_get_deleted                     (GeditDocument       *doc);
-
 gboolean        gedit_document_goto_line                       (GeditDocument       *doc,
                                                                gint                 line);
 
@@ -100,18 +76,6 @@ void                 gedit_document_set_language                    (GeditDocument       
*doc,
 GtkSourceLanguage
                *gedit_document_get_language                    (GeditDocument       *doc);
 
-G_DEPRECATED_FOR (gtk_source_file_get_encoding)
-const GtkSourceEncoding
-               *gedit_document_get_encoding                    (GeditDocument       *doc);
-
-G_DEPRECATED_FOR (gtk_source_file_get_newline_type)
-GtkSourceNewlineType
-                gedit_document_get_newline_type                (GeditDocument       *doc);
-
-G_DEPRECATED_FOR (gtk_source_file_get_compression_type)
-GtkSourceCompressionType
-                gedit_document_get_compression_type            (GeditDocument       *doc);
-
 gchar          *gedit_document_get_metadata                    (GeditDocument       *doc,
                                                                 const gchar         *key);
 


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