[gedit] Remove deprecated code



commit 6ad43c60097fa0e8a5b181720fd46f725a10e536
Author: Jordi Mas <jmas softcatala org>
Date:   Thu Apr 11 18:15:01 2019 +0200

    Remove deprecated code

 gedit/gedit-document.c |  83 ---------------
 gedit/gedit-document.h |  13 ---
 gedit/gedit-utils.c    | 283 -------------------------------------------------
 gedit/gedit-utils.h    |  24 -----
 4 files changed, 403 deletions(-)
---
diff --git a/gedit/gedit-document.c b/gedit/gedit-document.c
index 5f1a6ae32..a252e1e31 100644
--- a/gedit/gedit-document.c
+++ b/gedit/gedit-document.c
@@ -1016,70 +1016,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.
@@ -1202,25 +1138,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,
diff --git a/gedit/gedit-document.h b/gedit/gedit-document.h
index ac05261db..37f55d563 100644
--- a/gedit/gedit-document.h
+++ b/gedit/gedit-document.h
@@ -52,12 +52,6 @@ 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);
 
@@ -69,15 +63,8 @@ void          gedit_document_set_short_name_for_display      (GeditDocument       *doc,
 
 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);
diff --git a/gedit/gedit-utils.c b/gedit/gedit-utils.c
index d5c8783b0..10ff52337 100644
--- a/gedit/gedit-utils.c
+++ b/gedit/gedit-utils.c
@@ -214,55 +214,6 @@ gedit_warning (GtkWindow *parent, const gchar *format, ...)
        gtk_widget_show (dialog);
 }
 
-/**
- * gedit_utils_escape_underscores:
- * @text: some text.
- * @length: the length.
- *
- * Doubles underscore to avoid spurious menu accels.
- *
- * Returns: the text escaped.
- * Deprecated: 3.18
- */
-gchar *
-gedit_utils_escape_underscores (const gchar *text,
-                               gssize       length)
-{
-       GString *str;
-       const gchar *p;
-       const gchar *end;
-
-       g_return_val_if_fail (text != NULL, NULL);
-
-       if (length < 0)
-               length = strlen (text);
-
-       str = g_string_sized_new (length);
-
-       p = text;
-       end = text + length;
-
-       while (p != end)
-       {
-               const gchar *next;
-               next = g_utf8_next_char (p);
-
-               switch (*p)
-               {
-                       case '_':
-                               g_string_append (str, "__");
-                               break;
-                       default:
-                               g_string_append_len (str, p, next - p);
-                               break;
-               }
-
-               p = next;
-       }
-
-       return g_string_free (str, FALSE);
-}
-
 /* the following functions are taken from eel */
 
 static gchar *
@@ -408,21 +359,6 @@ uri_get_dirname (const gchar *uri)
        return res;
 }
 
-/**
- * gedit_utils_uri_get_dirname:
- * @uri: the URI.
- *
- * Note: this function replace home dir with ~.
- *
- * Returns: the directory name.
- * Deprecated: 3.18
- */
-gchar *
-gedit_utils_uri_get_dirname (const gchar *uri)
-{
-       return uri_get_dirname (uri);
-}
-
 /**
  * gedit_utils_location_get_dirname_for_display:
  * @location: the location
@@ -801,213 +737,6 @@ gedit_utils_is_valid_location (GFile *location)
        return is_valid;
 }
 
-static GtkWidget *handle_builder_error (const gchar *message, ...) G_GNUC_PRINTF (1, 2);
-
-static GtkWidget *
-handle_builder_error (const gchar *message, ...)
-{
-       GtkWidget *label;
-       gchar *msg;
-       gchar *msg_plain;
-       va_list args;
-
-       va_start (args, message);
-       msg_plain = g_strdup_vprintf (message, args);
-       va_end (args);
-
-       label = gtk_label_new (NULL);
-       gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
-
-       msg = g_strconcat ("<span size=\"large\" weight=\"bold\">",
-                          msg_plain, "</span>\n\n",
-                          _("Please check your installation."),
-                          NULL);
-
-       gtk_label_set_markup (GTK_LABEL (label), msg);
-
-       g_free (msg_plain);
-       g_free (msg);
-
-       gtk_widget_set_margin_start (label, 6);
-       gtk_widget_set_margin_end (label, 6);
-       gtk_widget_set_margin_top (label, 6);
-       gtk_widget_set_margin_bottom (label, 6);
-
-       return label;
-}
-
-/* TODO: just add a translation_doamin arg to get_ui_objects method */
-static gboolean
-get_ui_objects_with_translation_domain (const gchar  *filename,
-                                        const gchar  *translation_domain,
-                                        gchar       **root_objects,
-                                        GtkWidget   **error_widget,
-                                        const gchar  *object_name,
-                                        va_list       args)
-{
-       GtkBuilder *builder;
-       const gchar *name;
-       GError *error = NULL;
-       gchar *filename_markup;
-       gboolean ret = TRUE;
-
-       g_return_val_if_fail (filename != NULL, FALSE);
-       g_return_val_if_fail (error_widget != NULL, FALSE);
-       g_return_val_if_fail (object_name != NULL, FALSE);
-
-       filename_markup = g_markup_printf_escaped ("<i>%s</i>", filename);
-       *error_widget = NULL;
-
-       builder = gtk_builder_new ();
-
-       if (translation_domain != NULL)
-       {
-               gtk_builder_set_translation_domain (builder, translation_domain);
-       }
-
-       if (root_objects != NULL)
-       {
-               gtk_builder_add_objects_from_file (builder,
-                                                  filename,
-                                                  root_objects,
-                                                  &error);
-       }
-       else
-       {
-               gtk_builder_add_from_file (builder,
-                                          filename,
-                                          &error);
-       }
-
-       if (error != NULL)
-       {
-               *error_widget = handle_builder_error (_("Unable to open UI file %s. Error: %s"),
-                                                     filename_markup,
-                                                     error->message);
-               g_error_free (error);
-               g_free (filename_markup);
-               g_object_unref (builder);
-
-               return FALSE;
-       }
-
-       for (name = object_name; name; name = va_arg (args, const gchar *))
-       {
-               GObject **gobj;
-
-               gobj = va_arg (args, GObject **);
-               *gobj = gtk_builder_get_object (builder, name);
-
-               if (!*gobj)
-               {
-                       *error_widget = handle_builder_error (_("Unable to find the object ā€œ%sā€ inside file 
%s."),
-                                                             name,
-                                                             filename_markup),
-                       ret = FALSE;
-                       break;
-               }
-
-               /* we return a new ref for the root objects,
-                * the others are already reffed by their parent root object */
-               if (root_objects != NULL)
-               {
-                       gint i;
-
-                       for (i = 0; root_objects[i] != NULL; ++i)
-                       {
-                               if ((strcmp (name, root_objects[i]) == 0))
-                               {
-                                       g_object_ref (*gobj);
-                               }
-                       }
-               }
-       }
-
-       g_free (filename_markup);
-       g_object_unref (builder);
-
-       return ret;
-}
-
-/**
- * gedit_utils_get_ui_objects:
- * @filename: the path to the gtk builder file
- * @root_objects: a %NULL terminated list of root objects to load or NULL to
- *                load all objects
- * @error_widget: a pointer were a #GtkLabel
- * @object_name: the name of the first object
- * @...: a pointer were the first object is returned, followed by more
- *       name / object pairs and terminated by %NULL.
- *
- * This function gets the requested objects from a GtkBuilder ui file. In case
- * of error it returns %FALSE and sets error_widget to a GtkLabel containing
- * the error message to display.
- *
- * Returns: %FALSE if an error occurs, %TRUE on success.
- * Deprecated: 3.18
- */
-gboolean
-gedit_utils_get_ui_objects (const gchar  *filename,
-                           gchar       **root_objects,
-                           GtkWidget   **error_widget,
-                           const gchar  *object_name,
-                           ...)
-{
-       gboolean ret;
-       va_list args;
-
-       va_start (args, object_name);
-       ret = get_ui_objects_with_translation_domain (filename,
-                                                     NULL,
-                                                     root_objects,
-                                                     error_widget,
-                                                     object_name,
-                                                     args);
-       va_end (args);
-
-       return ret;
-}
-
-/**
- * gedit_utils_get_ui_objects_with_translation_domain:
- * @filename: the path to the gtk builder file
- * @translation_domain: the specific translation domain
- * @root_objects: a %NULL terminated list of root objects to load or NULL to
- *                load all objects
- * @error_widget: a pointer were a #GtkLabel
- * @object_name: the name of the first object
- * @...: a pointer were the first object is returned, followed by more
- *       name / object pairs and terminated by %NULL.
- *
- * This function gets the requested objects from a GtkBuilder ui file. In case
- * of error it returns %FALSE and sets error_widget to a GtkLabel containing
- * the error message to display.
- *
- * Returns: %FALSE if an error occurs, %TRUE on success.
- * Deprecated: 3.18
- */
-gboolean
-gedit_utils_get_ui_objects_with_translation_domain (const gchar  *filename,
-                                                    const gchar  *translation_domain,
-                                                    gchar       **root_objects,
-                                                    GtkWidget   **error_widget,
-                                                    const gchar  *object_name,
-                                                    ...)
-{
-       gboolean ret;
-       va_list args;
-
-       va_start (args, object_name);
-       ret = get_ui_objects_with_translation_domain (filename,
-                                                     translation_domain,
-                                                     root_objects,
-                                                     error_widget,
-                                                     object_name,
-                                                     args);
-       va_end (args);
-
-       return ret;
-}
 
 static gchar *
 make_canonical_uri_from_shell_arg (const gchar *str)
@@ -1048,18 +777,6 @@ make_canonical_uri_from_shell_arg (const gchar *str)
        return NULL;
 }
 
-/**
- * gedit_utils_make_canonical_uri_from_shell_arg:
- * @str: shell arg.
- *
- * Returns: canonical URI, or %NULL if @str is not a valid URI and/or filename.
- * Deprecated: 3.18
- */
-gchar *
-gedit_utils_make_canonical_uri_from_shell_arg (const gchar *str)
-{
-       return make_canonical_uri_from_shell_arg (str);
-}
 
 /**
  * gedit_utils_basename_for_display:
diff --git a/gedit/gedit-utils.h b/gedit/gedit-utils.h
index 3bf832870..5d992f1c1 100644
--- a/gedit/gedit-utils.h
+++ b/gedit/gedit-utils.h
@@ -51,9 +51,6 @@ void                       gedit_utils_menu_position_under_widget             (G
 gboolean                   gedit_utils_menu_position_under_tree_view          (GtkTreeView     *tree_view,
                                                                                GdkRectangle    *rect);
 
-G_DEPRECATED
-gchar                     *gedit_utils_escape_underscores                     (const gchar     *text,
-                                                                               gssize           length);
 gchar                     *gedit_utils_str_middle_truncate                    (const gchar     *string,
                                                                                guint            
truncate_length);
 gchar                     *gedit_utils_str_end_truncate                       (const gchar     *string,
@@ -70,9 +67,6 @@ void                       gedit_warning                                       (
 gchar                     *gedit_utils_make_valid_utf8                         (const char     *name);
 
 
-/* Note that this function replace home dir with ~ */
-G_DEPRECATED
-gchar                     *gedit_utils_uri_get_dirname                         (const char     *uri);
 gchar                     *gedit_utils_location_get_dirname_for_display        (GFile          *location);
 gchar                     *gedit_utils_replace_home_dir_with_tilde             (const gchar    *uri);
 guint                      gedit_utils_get_current_workspace                   (GdkScreen      *screen);
@@ -83,24 +77,6 @@ void                       gedit_utils_get_current_viewport                    (
 gboolean                   gedit_utils_is_valid_location                       (GFile          *location);
 
 
-G_DEPRECATED
-gboolean                   gedit_utils_get_ui_objects                          (const gchar    *filename,
-                                                                                gchar         **root_objects,
-                                                                                GtkWidget     **error_widget,
-                                                                                const gchar    *object_name,
-                                                                                ...) G_GNUC_NULL_TERMINATED;
-
-
-G_DEPRECATED
-gboolean                   gedit_utils_get_ui_objects_with_translation_domain  (const gchar  *filename,
-                                                                                const gchar  
*translation_domain,
-                                                                                gchar       **root_objects,
-                                                                                GtkWidget   **error_widget,
-                                                                                const gchar  *object_name,
-                                                                                ...) G_GNUC_NULL_TERMINATED;
-
-G_DEPRECATED
-gchar                     *gedit_utils_make_canonical_uri_from_shell_arg      (const gchar  *str);
 gchar                     *gedit_utils_basename_for_display                   (GFile        *location);
 gboolean                   gedit_utils_decode_uri                             (const gchar  *uri,
                                                                                gchar       **scheme,


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