[gtk+/wip/otte/clipboard: 113/117] textview: Remove serialization API



commit 33f5354bf8818489a41b923995de7c86a13850c3
Author: Benjamin Otte <otte redhat com>
Date:   Mon Nov 27 04:17:36 2017 +0100

    textview: Remove serialization API
    
    It's unused. Plain text is not using that framework, neither is
    in-process same-display transmission.
    
    So it was only useful for sharing text with custom tags across
    applications, and nobody is doing that.

 docs/reference/gtk/gtk4-sections.txt |   19 -
 gtk/gtk.h                            |    1 -
 gtk/gtkclipboard.c                   |  185 ----
 gtk/gtkclipboard.h                   |    8 -
 gtk/gtkselection.c                   |  132 ---
 gtk/gtkselection.h                   |   11 -
 gtk/gtktextbuffer.c                  |  123 +---
 gtk/gtktextbufferrichtext.c          |  830 ----------------
 gtk/gtktextbufferrichtext.h          |  138 ---
 gtk/gtktextbufferserialize.c         | 1804 ----------------------------------
 gtk/gtktextbufferserialize.h         |   41 -
 gtk/gtktextview.c                    |   67 --
 gtk/meson.build                      |    3 -
 tests/meson.build                    |    1 -
 tests/testrichtext.c                 |  190 ----
 15 files changed, 6 insertions(+), 3547 deletions(-)
---
diff --git a/docs/reference/gtk/gtk4-sections.txt b/docs/reference/gtk/gtk4-sections.txt
index 82cfbb1..df6e174 100644
--- a/docs/reference/gtk/gtk4-sections.txt
+++ b/docs/reference/gtk/gtk4-sections.txt
@@ -2884,25 +2884,6 @@ gtk_text_buffer_end_user_action
 gtk_text_buffer_add_selection_clipboard
 gtk_text_buffer_remove_selection_clipboard
 
-<SUBSECTION Serialization>
-GtkTextBufferTargetInfo
-GtkTextBufferDeserializeFunc
-gtk_text_buffer_deserialize
-gtk_text_buffer_deserialize_get_can_create_tags
-gtk_text_buffer_deserialize_set_can_create_tags
-gtk_text_buffer_get_copy_target_list
-gtk_text_buffer_get_deserialize_formats
-gtk_text_buffer_get_paste_target_list
-gtk_text_buffer_get_serialize_formats
-gtk_text_buffer_register_deserialize_format
-gtk_text_buffer_register_deserialize_tagset
-gtk_text_buffer_register_serialize_format
-gtk_text_buffer_register_serialize_tagset
-GtkTextBufferSerializeFunc
-gtk_text_buffer_serialize
-gtk_text_buffer_unregister_deserialize_format
-gtk_text_buffer_unregister_serialize_format
-
 <SUBSECTION Standard>
 GTK_TEXT_BUFFER
 GTK_IS_TEXT_BUFFER
diff --git a/gtk/gtk.h b/gtk/gtk.h
index 3af47c8..9571edf 100644
--- a/gtk/gtk.h
+++ b/gtk/gtk.h
@@ -207,7 +207,6 @@
 #include <gtk/gtkstyleprovider.h>
 #include <gtk/gtkswitch.h>
 #include <gtk/gtktextbuffer.h>
-#include <gtk/gtktextbufferrichtext.h>
 #include <gtk/gtktextchild.h>
 #include <gtk/gtktextiter.h>
 #include <gtk/gtktextmark.h>
diff --git a/gtk/gtkclipboard.c b/gtk/gtkclipboard.c
index e08cf55..fd43e12 100644
--- a/gtk/gtkclipboard.c
+++ b/gtk/gtkclipboard.c
@@ -27,7 +27,6 @@
 #include "gtkmain.h"
 #include "gtkmarshalers.h"
 #include "gtkselectionprivate.h"
-#include "gtktextbufferrichtext.h"
 #include "gtkintl.h"
 
 #include "gdk/gdk-private.h"
@@ -1065,80 +1064,6 @@ gtk_clipboard_request_text (GtkClipboard                *clipboard,
                                  info);
 }
 
-static void
-request_rich_text_received_func (GtkClipboard     *clipboard,
-                                 GtkSelectionData *selection_data,
-                                 gpointer          data)
-{
-  RequestRichTextInfo *info = data;
-  guint8 *result = NULL;
-  gsize length = 0;
-
-  result = (guint8 *) gtk_selection_data_get_data (selection_data);
-  length = gtk_selection_data_get_length (selection_data);
-
-  info->current_atom++;
-
-  if ((!result || length < 1) && (info->current_atom < info->n_atoms))
-    {
-      gtk_clipboard_request_contents (clipboard, info->atoms[info->current_atom],
-                                      request_rich_text_received_func,
-                                      info);
-      return;
-    }
-
-  info->callback (clipboard, gtk_selection_data_get_target (selection_data),
-                  result, length,
-                  info->user_data);
-  g_free (info->atoms);
-  g_free (info);
-}
-
-/**
- * gtk_clipboard_request_rich_text:
- * @clipboard: a #GtkClipboard
- * @buffer: a #GtkTextBuffer
- * @callback: (scope async): a function to call when the text is received,
- *     or the retrieval fails. (It will always be called one way or the other.)
- * @user_data: user data to pass to @callback.
- *
- * Requests the contents of the clipboard as rich text. When the rich
- * text is later received, @callback will be called.
- *
- * The @text parameter to @callback will contain the resulting rich
- * text if the request succeeded, or %NULL if it failed. The @length
- * parameter will contain @text’s length. This function can fail for
- * various reasons, in particular if the clipboard was empty or if the
- * contents of the clipboard could not be converted into rich text form.
- *
- * Since: 2.10
- **/
-void
-gtk_clipboard_request_rich_text (GtkClipboard                    *clipboard,
-                                 GtkTextBuffer                   *buffer,
-                                 GtkClipboardRichTextReceivedFunc callback,
-                                 gpointer                         user_data)
-{
-  RequestRichTextInfo *info;
-
-  g_return_if_fail (clipboard != NULL);
-  g_return_if_fail (GTK_IS_TEXT_BUFFER (buffer));
-  g_return_if_fail (callback != NULL);
-
-  info = g_new (RequestRichTextInfo, 1);
-  info->callback = callback;
-  info->atoms = NULL;
-  info->n_atoms = 0;
-  info->current_atom = 0;
-  info->user_data = user_data;
-
-  info->atoms = gtk_text_buffer_get_deserialize_formats (buffer, &info->n_atoms);
-
-  gtk_clipboard_request_contents (clipboard, info->atoms[info->current_atom],
-                                 request_rich_text_received_func,
-                                 info);
-}
-
 static void 
 request_image_received_func (GtkClipboard     *clipboard,
                             GtkSelectionData *selection_data,
@@ -1455,77 +1380,6 @@ gtk_clipboard_wait_for_text (GtkClipboard *clipboard)
   return results.data;
 }
 
-static void
-clipboard_rich_text_received_func (GtkClipboard *clipboard,
-                                   GdkAtom       format,
-                                   const guint8 *text,
-                                   gsize         length,
-                                   gpointer      data)
-{
-  WaitResults *results = data;
-
-  results->data = g_memdup (text, length);
-  results->format = format;
-  results->length = length;
-  g_main_loop_quit (results->loop);
-}
-
-/**
- * gtk_clipboard_wait_for_rich_text:
- * @clipboard: a #GtkClipboard
- * @buffer: a #GtkTextBuffer
- * @format: (out): return location for the format of the returned data
- * @length: (out): return location for the length of the returned data
- *
- * Requests the contents of the clipboard as rich text.  This function
- * waits for the data to be received using the main loop, so events,
- * timeouts, etc, may be dispatched during the wait.
- *
- * Returns: (nullable) (array length=length) (transfer full): a
- *               newly-allocated binary block of data which must be
- *               freed with g_free(), or %NULL if retrieving the
- *               selection data failed. (This could happen for various
- *               reasons, in particular if the clipboard was empty or
- *               if the contents of the clipboard could not be
- *               converted into text form.)
- *
- * Since: 2.10
- **/
-guint8 *
-gtk_clipboard_wait_for_rich_text (GtkClipboard  *clipboard,
-                                  GtkTextBuffer *buffer,
-                                  GdkAtom       *format,
-                                  gsize         *length)
-{
-  WaitResults results;
-
-  g_return_val_if_fail (clipboard != NULL, NULL);
-  g_return_val_if_fail (GTK_IS_TEXT_BUFFER (buffer), NULL);
-  g_return_val_if_fail (format != NULL, NULL);
-  g_return_val_if_fail (length != NULL, NULL);
-
-  results.data = NULL;
-  results.loop = g_main_loop_new (NULL, TRUE);
-
-  gtk_clipboard_request_rich_text (clipboard, buffer,
-                                   clipboard_rich_text_received_func,
-                                   &results);
-
-  if (g_main_loop_is_running (results.loop))
-    {
-      gdk_threads_leave ();
-      g_main_loop_run (results.loop);
-      gdk_threads_enter ();
-    }
-
-  g_main_loop_unref (results.loop);
-
-  *format = results.format;
-  *length = results.length;
-
-  return results.data;
-}
-
 static void 
 clipboard_image_received_func (GtkClipboard *clipboard,
                               GdkPixbuf    *pixbuf,
@@ -1745,45 +1599,6 @@ gtk_clipboard_wait_is_text_available (GtkClipboard *clipboard)
 }
 
 /**
- * gtk_clipboard_wait_is_rich_text_available:
- * @clipboard: a #GtkClipboard
- * @buffer: a #GtkTextBuffer
- *
- * Test to see if there is rich text available to be pasted
- * This is done by requesting the TARGETS atom and checking
- * if it contains any of the supported rich text formats. This function
- * waits for the data to be received using the main loop, so events,
- * timeouts, etc, may be dispatched during the wait.
- *
- * This function is a little faster than calling
- * gtk_clipboard_wait_for_rich_text() since it doesn’t need to retrieve
- * the actual text.
- *
- * Returns: %TRUE is there is rich text available, %FALSE otherwise.
- *
- * Since: 2.10
- **/
-gboolean
-gtk_clipboard_wait_is_rich_text_available (GtkClipboard  *clipboard,
-                                           GtkTextBuffer *buffer)
-{
-  GtkSelectionData *data;
-  gboolean result = FALSE;
-
-  g_return_val_if_fail (GTK_IS_CLIPBOARD (clipboard), FALSE);
-  g_return_val_if_fail (GTK_IS_TEXT_BUFFER (buffer), FALSE);
-
-  data = gtk_clipboard_wait_for_contents (clipboard, gdk_atom_intern_static_string ("TARGETS"));
-  if (data)
-    {
-      result = gtk_selection_data_targets_include_rich_text (data, buffer);
-      gtk_selection_data_free (data);
-    }
-
-  return result;
-}
-
-/**
  * gtk_clipboard_wait_is_image_available:
  * @clipboard: a #GtkClipboard
  * 
diff --git a/gtk/gtkclipboard.h b/gtk/gtkclipboard.h
index ecc49be..ee04824 100644
--- a/gtk/gtkclipboard.h
+++ b/gtk/gtkclipboard.h
@@ -229,11 +229,6 @@ void gtk_clipboard_request_text      (GtkClipboard                     *clipboar
                                       GtkClipboardTextReceivedFunc      callback,
                                       gpointer                          user_data);
 GDK_AVAILABLE_IN_ALL
-void gtk_clipboard_request_rich_text (GtkClipboard                     *clipboard,
-                                      GtkTextBuffer                    *buffer,
-                                      GtkClipboardRichTextReceivedFunc  callback,
-                                      gpointer                          user_data);
-GDK_AVAILABLE_IN_ALL
 void gtk_clipboard_request_image     (GtkClipboard                     *clipboard,
                                       GtkClipboardImageReceivedFunc     callback,
                                       gpointer                          user_data);
@@ -270,9 +265,6 @@ cairo_surface_t * gtk_clipboard_wait_for_surface   (GtkClipboard  *clipboard);
 GDK_AVAILABLE_IN_ALL
 gboolean gtk_clipboard_wait_is_text_available      (GtkClipboard  *clipboard);
 GDK_AVAILABLE_IN_ALL
-gboolean gtk_clipboard_wait_is_rich_text_available (GtkClipboard  *clipboard,
-                                                    GtkTextBuffer *buffer);
-GDK_AVAILABLE_IN_ALL
 gboolean gtk_clipboard_wait_is_image_available     (GtkClipboard  *clipboard);
 GDK_AVAILABLE_IN_ALL
 gboolean gtk_clipboard_wait_is_uris_available      (GtkClipboard  *clipboard);
diff --git a/gtk/gtkselection.c b/gtk/gtkselection.c
index cd4b213..2dc3def 100644
--- a/gtk/gtkselection.c
+++ b/gtk/gtkselection.c
@@ -86,7 +86,6 @@
 
 #include "gtkmain.h"
 #include "gtkdebug.h"
-#include "gtktextbufferrichtext.h"
 #include "gtkintl.h"
 #include "gdk-pixbuf/gdk-pixbuf.h"
 
@@ -287,50 +286,6 @@ gtk_content_formats_add_text_targets (GdkContentFormats *list)
 }
 
 /**
- * gtk_content_formats_add_rich_text_targets:
- * @list: a #GdkContentFormats
- * @deserializable: if %TRUE, then deserializable rich text formats
- *                  will be added, serializable formats otherwise.
- * @buffer: a #GtkTextBuffer.
- *
- * Appends the rich text targets registered with
- * gtk_text_buffer_register_serialize_format() or
- * gtk_text_buffer_register_deserialize_format() to the target list. All
- * targets are added with the same @info.
- *
- * Since: 2.10
- **/
-GdkContentFormats *
-gtk_content_formats_add_rich_text_targets (GdkContentFormats *list,
-                                           gboolean           deserializable,
-                                           GtkTextBuffer     *buffer)
-{
-  GdkContentFormatsBuilder *builder;
-  GdkAtom *atoms;
-  gint     n_atoms;
-  gint     i;
-
-  g_return_val_if_fail (list != NULL, NULL);
-  g_return_val_if_fail (GTK_IS_TEXT_BUFFER (buffer), NULL);
-
-  builder = gdk_content_formats_builder_new ();
-  gdk_content_formats_builder_add_formats (builder, list);
-  gdk_content_formats_unref (list);
-
-  if (deserializable)
-    atoms = gtk_text_buffer_get_deserialize_formats (buffer, &n_atoms);
-  else
-    atoms = gtk_text_buffer_get_serialize_formats (buffer, &n_atoms);
-
-  for (i = 0; i < n_atoms; i++)
-    gdk_content_formats_builder_add_mime_type (builder, atoms[i]);
-
-  g_free (atoms);
-
-  return gdk_content_formats_builder_free (builder);
-}
-
-/**
  * gtk_content_formats_add_image_targets:
  * @list: a #GdkContentFormats
  * @writable: whether to add only targets for which GTK+ knows
@@ -1784,56 +1739,6 @@ gtk_targets_include_text (GdkAtom *targets,
 }
 
 /**
- * gtk_targets_include_rich_text:
- * @targets: (array length=n_targets): an array of #GdkAtoms
- * @n_targets: the length of @targets
- * @buffer: a #GtkTextBuffer
- *
- * Determines if any of the targets in @targets can be used to
- * provide rich text.
- *
- * Returns: %TRUE if @targets include a suitable target for rich text,
- *               otherwise %FALSE.
- *
- * Since: 2.10
- **/
-gboolean
-gtk_targets_include_rich_text (GdkAtom       *targets,
-                               gint           n_targets,
-                               GtkTextBuffer *buffer)
-{
-  GdkAtom *rich_targets;
-  gint n_rich_targets;
-  gint i, j;
-  gboolean result = FALSE;
-
-  g_return_val_if_fail (targets != NULL || n_targets == 0, FALSE);
-  g_return_val_if_fail (GTK_IS_TEXT_BUFFER (buffer), FALSE);
-
-  init_atoms ();
-
-  rich_targets = gtk_text_buffer_get_deserialize_formats (buffer,
-                                                          &n_rich_targets);
-
-  for (i = 0; i < n_targets; i++)
-    {
-      for (j = 0; j < n_rich_targets; j++)
-        {
-          if (targets[i] == rich_targets[j])
-            {
-              result = TRUE;
-              goto done;
-            }
-        }
-    }
-
- done:
-  g_free (rich_targets);
-
-  return result;
-}
-
-/**
  * gtk_selection_data_targets_include_text:
  * @selection_data: a #GtkSelectionData object
  * 
@@ -1865,43 +1770,6 @@ gtk_selection_data_targets_include_text (const GtkSelectionData *selection_data)
 }
 
 /**
- * gtk_selection_data_targets_include_rich_text:
- * @selection_data: a #GtkSelectionData object
- * @buffer: a #GtkTextBuffer
- *
- * Given a #GtkSelectionData object holding a list of targets,
- * determines if any of the targets in @targets can be used to
- * provide rich text.
- *
- * Returns: %TRUE if @selection_data holds a list of targets,
- *               and a suitable target for rich text is included,
- *               otherwise %FALSE.
- *
- * Since: 2.10
- **/
-gboolean
-gtk_selection_data_targets_include_rich_text (const GtkSelectionData *selection_data,
-                                              GtkTextBuffer          *buffer)
-{
-  GdkAtom *targets;
-  gint n_targets;
-  gboolean result = FALSE;
-
-  g_return_val_if_fail (selection_data != NULL, FALSE);
-  g_return_val_if_fail (GTK_IS_TEXT_BUFFER (buffer), FALSE);
-
-  init_atoms ();
-
-  if (gtk_selection_data_get_targets (selection_data, &targets, &n_targets))
-    {
-      result = gtk_targets_include_rich_text (targets, n_targets, buffer);
-      g_free (targets);
-    }
-
-  return result;
-}
-
-/**
  * gtk_targets_include_image:
  * @targets: (array length=n_targets): an array of #GdkAtoms
  * @n_targets: the length of @targets
diff --git a/gtk/gtkselection.h b/gtk/gtkselection.h
index d597871..3f0d69b 100644
--- a/gtk/gtkselection.h
+++ b/gtk/gtkselection.h
@@ -39,10 +39,6 @@ G_BEGIN_DECLS
 GDK_AVAILABLE_IN_ALL
 GdkContentFormats *     gtk_content_formats_add_text_targets      (GdkContentFormats *list) 
G_GNUC_WARN_UNUSED_RESULT;
 GDK_AVAILABLE_IN_ALL
-GdkContentFormats *     gtk_content_formats_add_rich_text_targets (GdkContentFormats *list,
-                                                                   gboolean           deserializable,
-                                                                   GtkTextBuffer     *buffer) 
G_GNUC_WARN_UNUSED_RESULT;
-GDK_AVAILABLE_IN_ALL
 GdkContentFormats *     gtk_content_formats_add_image_targets     (GdkContentFormats *list,
                                                                    gboolean           writable) 
G_GNUC_WARN_UNUSED_RESULT;
 GDK_AVAILABLE_IN_ALL
@@ -132,9 +128,6 @@ gboolean gtk_selection_data_get_targets          (const GtkSelectionData  *selec
 GDK_AVAILABLE_IN_ALL
 gboolean gtk_selection_data_targets_include_text (const GtkSelectionData  *selection_data);
 GDK_AVAILABLE_IN_ALL
-gboolean gtk_selection_data_targets_include_rich_text (const GtkSelectionData *selection_data,
-                                                       GtkTextBuffer    *buffer);
-GDK_AVAILABLE_IN_ALL
 gboolean gtk_selection_data_targets_include_image (const GtkSelectionData  *selection_data,
                                                    gboolean           writable);
 GDK_AVAILABLE_IN_ALL
@@ -143,10 +136,6 @@ GDK_AVAILABLE_IN_ALL
 gboolean gtk_targets_include_text                (GdkAtom       *targets,
                                                   gint           n_targets);
 GDK_AVAILABLE_IN_ALL
-gboolean gtk_targets_include_rich_text           (GdkAtom       *targets,
-                                                  gint           n_targets,
-                                                  GtkTextBuffer *buffer);
-GDK_AVAILABLE_IN_ALL
 gboolean gtk_targets_include_image               (GdkAtom       *targets,
                                                   gint           n_targets,
                                                   gboolean       writable);
diff --git a/gtk/gtktextbuffer.c b/gtk/gtktextbuffer.c
index 0102194..c55b895 100644
--- a/gtk/gtktextbuffer.c
+++ b/gtk/gtktextbuffer.c
@@ -33,7 +33,6 @@
 #include "gtkmarshalers.h"
 #include "gtktextbuffer.h"
 #include "gtktextbufferprivate.h"
-#include "gtktextbufferrichtext.h"
 #include "gtktextbtree.h"
 #include "gtktextiterprivate.h"
 #include "gtktexttagprivate.h"
@@ -644,9 +643,6 @@ gtk_text_buffer_init (GtkTextBuffer *buffer)
   buffer->priv = gtk_text_buffer_get_instance_private (buffer);
   buffer->priv->clipboard_contents_buffers = NULL;
   buffer->priv->tag_table = NULL;
-
-  /* allow copying of arbiatray stuff in the internal rich text format */
-  gtk_text_buffer_register_serialize_tagset (buffer, NULL);
 }
 
 static void
@@ -3222,21 +3218,6 @@ clipboard_get_selection_cb (GtkClipboard     *clipboard,
                                   (void*)&buffer,
                                   sizeof (buffer));
         }
-      else if (gtk_selection_data_targets_include_rich_text (selection_data, buffer))
-        {
-          guint8 *str;
-          gsize   len;
-
-          str = gtk_text_buffer_serialize (buffer, buffer,
-                                           gtk_selection_data_get_target (selection_data),
-                                           &start, &end, &len);
-
-          gtk_selection_data_set (selection_data,
-                                  gtk_selection_data_get_target (selection_data),
-                                  8, /* bytes */
-                                  str, len);
-          g_free (str);
-        }
       else if (gtk_selection_data_targets_include_text (selection_data))
         {
           gchar *str;
@@ -3291,28 +3272,6 @@ clipboard_get_contents_cb (GtkClipboard     *clipboard,
                               (void*)&contents,
                               sizeof (contents));
     }
-  else if (gtk_selection_data_targets_include_rich_text (selection_data, contents))
-    {
-      GtkTextBuffer *clipboard_source_buffer;
-      GtkTextIter start, end;
-      guint8 *str;
-      gsize   len;
-
-      clipboard_source_buffer = g_object_get_data (G_OBJECT (contents),
-                                                   "gtk-text-buffer-clipboard-source");
-
-      gtk_text_buffer_get_bounds (contents, &start, &end);
-
-      str = gtk_text_buffer_serialize (clipboard_source_buffer, contents,
-                                       gtk_selection_data_get_target (selection_data),
-                                       &start, &end, &len);
-
-      gtk_selection_data_set (selection_data,
-                             gtk_selection_data_get_target (selection_data),
-                             8, /* bytes */
-                             str, len);
-      g_free (str);
-    }
   else
     {
       gchar *str;
@@ -3515,58 +3474,6 @@ restore_iter (const GtkTextIter *iter,
 #endif
 
 static void
-clipboard_rich_text_received (GtkClipboard *clipboard,
-                              GdkAtom       format,
-                              const guint8 *text,
-                              gsize         length,
-                              gpointer      data)
-{
-  ClipboardRequest *request_data = data;
-  GtkTextIter insert_point;
-  gboolean retval = TRUE;
-  GError *error = NULL;
-
-  if (text != NULL && length > 0)
-    {
-      if (request_data->interactive)
-        gtk_text_buffer_begin_user_action (request_data->buffer);
-
-      pre_paste_prep (request_data, &insert_point);
-
-      if (!request_data->interactive ||
-          gtk_text_iter_can_insert (&insert_point,
-                                    request_data->default_editable))
-        {
-          retval = gtk_text_buffer_deserialize (request_data->buffer,
-                                                request_data->buffer,
-                                                format,
-                                                &insert_point,
-                                                text, length,
-                                                &error);
-        }
-
-      if (!retval)
-        {
-          g_warning ("error pasting: %s\n", error->message);
-          g_clear_error (&error);
-        }
-
-      if (request_data->interactive)
-        gtk_text_buffer_end_user_action (request_data->buffer);
-
-      emit_paste_done (request_data->buffer, clipboard);
-
-      if (retval)
-        return;
-    }
-
-  /* Request the text selection instead */
-  gtk_clipboard_request_text (clipboard,
-                              clipboard_text_received,
-                              data);
-}
-
-static void
 paste_from_buffer (GtkClipboard      *clipboard,
                    ClipboardRequest  *request_data,
                    GtkTextBuffer     *src_buffer,
@@ -3646,22 +3553,10 @@ clipboard_clipboard_buffer_received (GtkClipboard     *clipboard,
     }
   else
     {
-      if (gtk_clipboard_wait_is_rich_text_available (clipboard,
-                                                     request_data->buffer))
-        {
-          /* Request rich text */
-          gtk_clipboard_request_rich_text (clipboard,
-                                           request_data->buffer,
-                                           clipboard_rich_text_received,
-                                           data);
-        }
-      else
-        {
-          /* Request the text selection instead */
-          gtk_clipboard_request_text (clipboard,
-                                      clipboard_text_received,
-                                      data);
-        }
+      /* Request the text selection instead */
+      gtk_clipboard_request_text (clipboard,
+                                  clipboard_text_received,
+                                  data);
     }
 }
 
@@ -4016,10 +3911,6 @@ gtk_text_buffer_get_target_list (GtkTextBuffer   *buffer,
   else
     target_list = gdk_content_formats_new (NULL, 0);
 
-  target_list = gtk_content_formats_add_rich_text_targets (target_list,
-                                                           deserializable,
-                                                           buffer);
-
   target_list = gtk_content_formats_add_text_targets (target_list);
 
   return target_list;
@@ -4224,8 +4115,7 @@ gtk_text_buffer_end_user_action (GtkTextBuffer *buffer)
  * This function returns the list of targets this text buffer can
  * provide for copying and as DND source. The targets in the list are
  * added with @info values from the #GtkTextBufferTargetInfo enum,
- * using gdk_content_formats_add_rich_text_targets() and
- * gdk_content_formats_add_text_targets().
+ * using gdk_content_formats_add_text_targets().
  *
  * Returns: (transfer none): the #GdkContentFormats
  *
@@ -4254,8 +4144,7 @@ gtk_text_buffer_get_copy_target_list (GtkTextBuffer *buffer)
  * This function returns the list of targets this text buffer supports
  * for pasting and as DND destination. The targets in the list are
  * added with @info values from the #GtkTextBufferTargetInfo enum,
- * using gtk_content_formats_add_rich_text_targets() and
- * gtk_content_formats_add_text_targets().
+ * using gtk_content_formats_add_text_targets().
  *
  * Returns: (transfer none): the #GdkContentFormats
  *
diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c
index 5b2ee9a..f8c5376 100644
--- a/gtk/gtktextview.c
+++ b/gtk/gtktextview.c
@@ -42,7 +42,6 @@
 #include "gtkseparatormenuitem.h"
 #include "gtksettings.h"
 #include "gtkselectionprivate.h"
-#include "gtktextbufferrichtext.h"
 #include "gtktextdisplayprivate.h"
 #include "gtktextiterprivate.h"
 #include "gtkimmulticontext.h"
@@ -7882,31 +7881,6 @@ gtk_text_view_drag_data_get (GtkWidget        *widget,
                               (void*)&buffer,
                               sizeof (buffer));
     }
-  else if (gtk_selection_data_targets_include_rich_text (selection_data, buffer))
-    {
-      GtkTextIter start;
-      GtkTextIter end;
-      guint8 *str = NULL;
-      gsize len;
-
-      if (gtk_text_buffer_get_selection_bounds (buffer, &start, &end))
-        {
-          /* Extract the selected text */
-          str = gtk_text_buffer_serialize (buffer, buffer,
-                                           gtk_selection_data_get_target (selection_data),
-                                           &start, &end,
-                                           &len);
-        }
-
-      if (str)
-        {
-          gtk_selection_data_set (selection_data,
-                                  gtk_selection_data_get_target (selection_data),
-                                  8, /* bytes */
-                                  (guchar *) str, len);
-          g_free (str);
-        }
-    }
   else
     {
       GtkTextIter start;
@@ -8177,29 +8151,7 @@ gtk_text_view_drag_data_received (GtkWidget        *widget,
       if (gtk_text_buffer_get_tag_table (src_buffer) !=
           gtk_text_buffer_get_tag_table (buffer))
         {
-          /*  try to find a suitable rich text target instead  */
-          GdkAtom *atoms;
-          gint     n_atoms;
-          GdkContentFormats *dnd_formats, *buffer_formats;
-          const char *target = NULL;
-
           copy_tags = FALSE;
-
-          atoms = gtk_text_buffer_get_deserialize_formats (buffer, &n_atoms);
-          buffer_formats = gdk_content_formats_new (atoms, n_atoms);
-          dnd_formats = gdk_drag_context_get_formats (context);
-
-          target = gdk_content_formats_match_mime_type (dnd_formats, buffer_formats);
-
-          gdk_content_formats_unref (buffer_formats);
-          g_free (atoms);
-
-          if (target != NULL)
-            {
-              gtk_drag_get_data (widget, context, target, time);
-              gtk_text_buffer_end_user_action (buffer);
-              return;
-            }
         }
 
       if (gtk_text_buffer_get_selection_bounds (src_buffer,
@@ -8224,25 +8176,6 @@ gtk_text_view_drag_data_received (GtkWidget        *widget,
             }
         }
     }
-  else if (gtk_selection_data_get_length (selection_data) > 0 &&
-           gtk_selection_data_targets_include_rich_text (selection_data, buffer))
-    {
-      gboolean retval;
-      GError *error = NULL;
-
-      retval = gtk_text_buffer_deserialize (buffer, buffer,
-                                            gtk_selection_data_get_target (selection_data),
-                                            &drop_point,
-                                            (guint8 *) gtk_selection_data_get_data (selection_data),
-                                            gtk_selection_data_get_length (selection_data),
-                                            &error);
-
-      if (!retval)
-        {
-          g_warning ("error pasting: %s", error->message);
-          g_clear_error (&error);
-        }
-    }
   else
     insert_text_data (text_view, &drop_point, selection_data);
 
diff --git a/gtk/meson.build b/gtk/meson.build
index c961f29..090f891 100644
--- a/gtk/meson.build
+++ b/gtk/meson.build
@@ -312,8 +312,6 @@ gtk_public_sources = files([
   'gtktextattributes.c',
   'gtktextbtree.c',
   'gtktextbuffer.c',
-  'gtktextbufferrichtext.c',
-  'gtktextbufferserialize.c',
   'gtktextchild.c',
   'gtktextdisplay.c',
   'gtktexthandle.c',
@@ -554,7 +552,6 @@ gtk_public_headers = files([
   'gtkswitch.h',
   'gtktestutils.h',
   'gtktextbuffer.h',
-  'gtktextbufferrichtext.h',
   'gtktextchild.h',
   'gtktextiter.h',
   'gtktextmark.h',
diff --git a/tests/meson.build b/tests/meson.build
index d2f2c0f..69f871b 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -74,7 +74,6 @@ gtk_tests = [
   ['testprint', ['testprintfileoperation.c']],
   ['testrecentchooser'],
   ['testrecentchoosermenu'],
-  ['testrichtext'],
   ['testscale'],
   ['testselection'],
   ['testselectionmode'],


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