[gtk+] a11y: Remove AtkStreamableContent implementation



commit 138abdbc475f90b5d731d3a27c12f8649837ad6d
Author: Benjamin Otte <otte redhat com>
Date:   Mon Nov 27 02:15:53 2017 +0100

    a11y: Remove AtkStreamableContent implementation
    
    That is some old code that still uses IOChannels, and the only
    pseudouser is at-spi-atk's commented out code that is still using
    CORBA types.
    
    So get rid of it now before I need to start adapting it to the new
    clipboard.

 gtk/a11y/gtktextviewaccessible.c |  144 +-------------------------------------
 testsuite/a11y/text.txt          |    2 -
 2 files changed, 1 insertions(+), 145 deletions(-)
---
diff --git a/gtk/a11y/gtktextviewaccessible.c b/gtk/a11y/gtktextviewaccessible.c
index 085f628..bfc3662 100644
--- a/gtk/a11y/gtktextviewaccessible.c
+++ b/gtk/a11y/gtktextviewaccessible.c
@@ -56,13 +56,11 @@ static void       mark_set_cb          (GtkTextBuffer    *buffer,
 
 static void atk_editable_text_interface_init      (AtkEditableTextIface      *iface);
 static void atk_text_interface_init               (AtkTextIface              *iface);
-static void atk_streamable_content_interface_init (AtkStreamableContentIface *iface);
 
 G_DEFINE_TYPE_WITH_CODE (GtkTextViewAccessible, gtk_text_view_accessible, GTK_TYPE_CONTAINER_ACCESSIBLE,
                          G_ADD_PRIVATE (GtkTextViewAccessible)
                          G_IMPLEMENT_INTERFACE (ATK_TYPE_EDITABLE_TEXT, atk_editable_text_interface_init)
-                         G_IMPLEMENT_INTERFACE (ATK_TYPE_TEXT, atk_text_interface_init)
-                         G_IMPLEMENT_INTERFACE (ATK_TYPE_STREAMABLE_CONTENT, 
atk_streamable_content_interface_init))
+                         G_IMPLEMENT_INTERFACE (ATK_TYPE_TEXT, atk_text_interface_init))
 
 
 static void
@@ -1826,146 +1824,6 @@ mark_set_cb (GtkTextBuffer *buffer,
     }
 }
 
-static gint
-gail_streamable_content_get_n_mime_types (AtkStreamableContent *streamable)
-{
-  GtkWidget *widget;
-  GtkTextBuffer *buffer;
-  gint n_mime_types = 0;
-
-  widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (streamable));
-  if (widget == NULL)
-    return 0;
-
-  buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (widget));
-  if (buffer)
-    {
-      gint i;
-      gboolean advertises_plaintext = FALSE;
-      GdkAtom *atoms;
-
-      atoms = gtk_text_buffer_get_serialize_formats (buffer, &n_mime_types);
-      for (i = 0; i < n_mime_types-1; ++i)
-        if (!strcmp ("text/plain", gdk_atom_name (atoms[i])))
-            advertises_plaintext = TRUE;
-      if (!advertises_plaintext)
-        n_mime_types++;
-    }
-
-  return n_mime_types;
-}
-
-static const gchar *
-gail_streamable_content_get_mime_type (AtkStreamableContent *streamable,
-                                       gint                  i)
-{
-  GtkWidget *widget;
-  GtkTextBuffer *buffer;
-
-  widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (streamable));
-  if (widget == NULL)
-    return 0;
-
-  buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (widget));
-  if (buffer)
-    {
-      gint n_mime_types = 0;
-      GdkAtom *atoms;
-
-      atoms = gtk_text_buffer_get_serialize_formats (buffer, &n_mime_types);
-      if (i < n_mime_types)
-        return gdk_atom_name (atoms [i]);
-      else if (i == n_mime_types)
-        return "text/plain";
-    }
-
-  return NULL;
-}
-
-static GIOChannel *
-gail_streamable_content_get_stream (AtkStreamableContent *streamable,
-                                    const gchar          *mime_type)
-{
-  GtkWidget *widget;
-  GtkTextBuffer *buffer;
-  gint i, n_mime_types = 0;
-  GdkAtom *atoms;
-
-  widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (streamable));
-  if (widget == NULL)
-    return 0;
-
-  buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (widget));
-  if (!buffer)
-    return NULL;
-
-  atoms = gtk_text_buffer_get_serialize_formats (buffer, &n_mime_types);
-
-  for (i = 0; i < n_mime_types; ++i)
-    {
-      if (!strcmp ("text/plain", mime_type) ||
-          !strcmp (gdk_atom_name (atoms[i]), mime_type))
-        {
-          guint8 *cbuf;
-          GError *err = NULL;
-          gsize len, written;
-          gchar tname[80];
-          GtkTextIter start, end;
-          GIOChannel *gio = NULL;
-          int fd;
-
-          gtk_text_buffer_get_iter_at_offset (buffer, &start, 0);
-          gtk_text_buffer_get_iter_at_offset (buffer, &end, -1);
-          if (!strcmp ("text/plain", mime_type))
-            {
-              cbuf = (guint8*) gtk_text_buffer_get_text (buffer, &start, &end, FALSE);
-              len = strlen ((const char *) cbuf);
-            }
-          else
-            {
-              cbuf = gtk_text_buffer_serialize (buffer, buffer, atoms[i], &start, &end, &len);
-            }
-          g_snprintf (tname, 20, "streamXXXXXX");
-          fd = g_mkstemp (tname);
-          gio = g_io_channel_unix_new (fd);
-          g_io_channel_set_encoding (gio, NULL, &err);
-          if (!err)
-            g_io_channel_write_chars (gio, (const char *) cbuf, (gssize) len, &written, &err);
-          else
-            g_message ("%s", err->message);
-          if (!err)
-            g_io_channel_seek_position (gio, 0, G_SEEK_SET, &err);
-          else
-            g_message ("%s", err->message);
-          if (!err)
-            g_io_channel_flush (gio, &err);
-          else
-            g_message ("%s", err->message);
-          if (err)
-            {
-              g_message ("<error writing to stream [%s]>", tname);
-              g_error_free (err);
-            }
-          /* make sure the file is removed on unref of the giochannel */
-          else
-            {
-              g_unlink (tname);
-              return gio;
-            }
-        }
-    }
-
-  return NULL;
-}
-
-static void
-atk_streamable_content_interface_init (AtkStreamableContentIface *iface)
-{
-  iface->get_n_mime_types = gail_streamable_content_get_n_mime_types;
-  iface->get_mime_type = gail_streamable_content_get_mime_type;
-  iface->get_stream = gail_streamable_content_get_stream;
-}
-
 void
 _gtk_text_view_accessible_set_buffer (GtkTextView   *textview,
                                       GtkTextBuffer *old_buffer)
diff --git a/testsuite/a11y/text.txt b/testsuite/a11y/text.txt
index d64f850..f69dfca 100644
--- a/testsuite/a11y/text.txt
+++ b/testsuite/a11y/text.txt
@@ -46,5 +46,3 @@ Did gyre and gimple in the wabe
                         variant: <omitted>
                         weight: <omitted>
                         wrap-mode: none
-    <AtkStreamableContent>
-    mime types: application/x-gtk-text-buffer-rich-text text/plain


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