atk/Makefile.am, atk/atk.h Updated comments
authorPadraig O'Briain <padraigo@src.gnome.org>
Wed, 6 Jun 2001 08:38:01 +0000 (08:38 +0000)
committerPadraig O'Briain <padraigo@src.gnome.org>
Wed, 6 Jun 2001 08:38:01 +0000 (08:38 +0000)
* New files atk/atkstreamablecontent.[ch]
 Updated files: atk/Makefile.am, atk/atk.h
* atk/atkvalue.c: Updated comments

ChangeLog
atk/Makefile.am
atk/atk.h
atk/atkstreamablecontent.c [new file with mode: 0755]
atk/atkstreamablecontent.h [new file with mode: 0755]
atk/atkvalue.c

index e57e000..8cf89ef 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2001-06-06  Padraig O'Briain  <padraig.obriain@sun.com>
 
+       * New files atk/atkstreamablecontent.[ch]
+       Updated files: atk/Makefile.am, atk/atk.h
+       * atk/atkvalue.c: Updated comments
+
+2001-06-06  Padraig O'Briain  <padraig.obriain@sun.com>
+
        * atk/atkregistry.h: Add declaration for atk_registry_get_type()
 
 2001-06-05  Padraig O'Briain  <padraig.obriain@sun.com>
index 48151a5..4d9bddb 100644 (file)
@@ -20,6 +20,7 @@ libatk_la_SOURCES =           \
        atkselection.c          \
        atkstate.c              \
        atkstateset.c           \
+       atkstreamablecontent.c  \
        atktable.c              \
        atktext.c               \
        atkutil.c               \
@@ -57,6 +58,7 @@ libatkinclude_HEADERS =       \
         atkselection.h         \
         atkstate.h             \
         atkstateset.h          \
+        atkstreamablecontent.h \
         atktable.h             \
         atktext.h              \
         atkutil.h              \
index c92491f..15b9c83 100755 (executable)
--- a/atk/atk.h
+++ b/atk/atk.h
@@ -31,6 +31,7 @@
 #include <atk/atkselection.h>
 #include <atk/atkstate.h>
 #include <atk/atkstateset.h>
+#include <atk/atkstreamablecontent.h>
 #include <atk/atktable.h>
 #include <atk/atktext.h>
 #include <atk/atkutil.h>
diff --git a/atk/atkstreamablecontent.c b/atk/atkstreamablecontent.c
new file mode 100755 (executable)
index 0000000..676ca7c
--- /dev/null
@@ -0,0 +1,121 @@
+/* ATK -  Accessibility Toolkit
+ * Copyright 2001 Sun Microsystems Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include "atkstreamablecontent.h"
+
+GType
+atk_streamable_content_get_type ()
+{
+  static GType type = 0;
+
+  if (!type) {
+    GTypeInfo tinfo =
+    {
+      sizeof (AtkStreamableContentIface),
+      (GBaseInitFunc) NULL,
+      (GBaseFinalizeFunc) NULL,
+
+    };
+
+    type = g_type_register_static (G_TYPE_INTERFACE, "AtkStreamableContent", &tinfo, 0);
+  }
+
+  return type;
+}
+
+/**
+ * atk_streamable_content_get_n_mime_types:
+ * @obj: a GObject instance that implements AtkStreamableContentIface
+ *
+ * Gets the number of mime types supported by this object.
+ *
+ * Returns: a gint which is the number of mime types supported by the object.
+ **/
+gint
+atk_streamable_content_get_n_mime_types (AtkStreamableContent *obj)
+{
+  AtkStreamableContentIface *iface;
+
+  g_return_val_if_fail (obj != NULL, 0);
+  g_return_val_if_fail (ATK_IS_STREAMABLE_CONTENT (obj), 0);
+
+  iface = ATK_STREAMABLE_CONTENT_GET_IFACE (obj);
+
+  if (iface->get_n_mime_types)
+    return (iface->get_n_mime_types) (obj);
+  else
+    return 0;
+}
+
+/**
+ * atk_streamable_content_get_mime_type:
+ * @obj: a GObject instance that implements AtkStreamableContent
+ * @i: a gint representing the position of the mime type starting from 0
+ *
+ * Gets the character string of the specified mime type. The first mime
+ * type is at position 0, the second at position1, and so on.
+ *
+ * Returns : a gchar* respresenting the specified mime type; the caller
+ * should not free the character string.
+ **/
+G_CONST_RETURN gchar*
+atk_streamable_content_get_mime_type (AtkStreamableContent *obj,
+                                      gint                 i)
+{
+  AtkStreamableContentIface *iface;
+
+  g_return_val_if_fail (obj != NULL, NULL);
+  g_return_val_if_fail (i >= 0, NULL);
+  g_return_val_if_fail (ATK_IS_STREAMABLE_CONTENT (obj), NULL);
+
+  iface = ATK_STREAMABLE_CONTENT_GET_IFACE (obj);
+
+  if (iface->get_mime_type)
+    return (iface->get_mime_type) (obj, i);
+  else
+    return NULL;
+}
+
+/**
+ * atk_streamable_content_get_stream:
+ * @obj: a GObject instance that implements AtkStreamableContentIface
+ * @mime_type: a gchar* representing the mime type
+ *
+ * Gets the content in the specified mime type
+ *
+ * Returns: A #GIOChannel which contains the content in the specified mime
+ * type.
+ **/
+GIOChannel*
+atk_streamable_content_get_stream (AtkStreamableContent *obj,
+                                   const gchar          *mime_type)
+{
+  AtkStreamableContentIface *iface;
+
+  g_return_val_if_fail (obj != NULL, NULL);
+  g_return_val_if_fail (mime_type != NULL, NULL);
+  g_return_val_if_fail (ATK_IS_STREAMABLE_CONTENT (obj), NULL);
+
+  iface = ATK_STREAMABLE_CONTENT_GET_IFACE (obj);
+
+  if (iface->get_stream)
+    return (iface->get_stream) (obj, mime_type);
+  else
+    return NULL;
+}
diff --git a/atk/atkstreamablecontent.h b/atk/atkstreamablecontent.h
new file mode 100755 (executable)
index 0000000..a4249a1
--- /dev/null
@@ -0,0 +1,85 @@
+/* ATK -  Accessibility Toolkit
+ * Copyright 2001 Sun Microsystems Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __ATK_STREAMABLE_CONTENT_H__
+#define __ATK_STREAMABLE_CONTENT_H__
+
+#include <atk/atkobject.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#define ATK_TYPE_STREAMABLE_CONTENT           (atk_streamable_content_get_type ())
+#define ATK_IS_STREAMABLE_CONTENT(obj)        G_TYPE_CHECK_INSTANCE_TYPE ((obj), ATK_TYPE_STREAMABLE_CONTENT)
+#define ATK_STREAMABLE_CONTENT(obj)           G_TYPE_CHECK_INSTANCE_CAST ((obj), ATK_TYPE_STREAMABLE_CONTENT, AtkStreamableContent)
+#define ATK_STREAMABLE_CONTENT_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), ATK_TYPE_STREAMABLE_CONTENT, AtkStreamableContentIface))
+
+#ifndef _TYPEDEF_ATK_STREAMABLE_CONTENT
+#define _TYPEDEF_ATK_STREAMABLE_CONTENT
+typedef struct _AtkStreamableContent AtkStreamableContent;
+#endif
+typedef struct _AtkStreamableContentIface AtkStreamableContentIface;
+
+struct _AtkStreamableContentIface
+{
+  GTypeInterface parent;
+
+  /*
+   * Get the number of mime types supported by this object
+   */
+  gint                      (* get_n_mime_types)  (AtkStreamableContent     *streamable);
+  /*
+   * Gets the specified mime type supported by this object.
+   * The mime types are 0-based so the dirst mime type is 
+   * at index 0, the second at index 1 and so on.
+   *
+   * This assumes that the strings for the mime types are stored in the
+   * AtkStreamableContent. Alternatively the G_CONST_RETURN could be removed
+   * and the caller would be responsible for calling g_free() on the
+   * returned value.
+   */
+  G_CONST_RETURN gchar*     (* get_mime_type)     (AtkStreamableContent     *streamable,
+                                                   gint                     i);
+  /*
+   * Is one possible implementation for this method that it constructs the
+   * content appropriate for the mime type and then creates a temporary
+   * file containing the content, opens the file and then calls
+   * g_io_channel_unix_new_fd().
+   */
+  GIOChannel*               (* get_stream)        (AtkStreamableContent     *streamable,
+                                                   const gchar              *mime_type);
+
+};
+GType                  atk_streamable_content_get_type (void);
+
+gint                   atk_streamable_content_get_n_mime_types (AtkStreamableContent     *streamable);
+                                                       
+G_CONST_RETURN gchar*  atk_streamable_content_get_mime_type    (AtkStreamableContent     *streamable,
+                                                                gint                     i);
+GIOChannel*             atk_streamable_content_get_stream       (AtkStreamableContent     *streamable,
+                                                                 const gchar              *mime_type);
+
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+
+#endif /* __ATK_STREAMABLE_CONTENT_H__ */
index ac559f4..5ea64ee 100755 (executable)
@@ -45,10 +45,6 @@ atk_value_get_type ()
  * @value: a #GValue representing the current accessible value
  *
  * Gets the value of this object
- * Note: callers should not rely on %NULL or on a zero value for
- * indication of whether AtkValue is implemented, they should
- * use type checking/interface checking macros or the
- * atk_get_accessible_value() convenience method.
  **/
 void
 atk_value_get_current_value (AtkValue *obj,
@@ -72,10 +68,6 @@ atk_value_get_current_value (AtkValue *obj,
  * @value: a #GValue representing the maximum accessible value
  *
  * Gets the maximum value of this object
- * Note: callers should not rely on %NULL or on a zero value for
- * indication of whether AtkValue is implemented, they should
- * use type checking/interface checking macros or the
- * atk_get_accessible_value() convenience method.
  **/
 void
 atk_value_get_maximum_value  (AtkValue *obj,
@@ -98,11 +90,7 @@ atk_value_get_maximum_value  (AtkValue *obj,
  * @obj: a GObject instance that implements AtkValueIface
  * @value: a #GValue representing the minimum accessible value
  *
- * Gets the mimnimum value of this object
- * Note: callers should not rely on %NULL or on a zero value for
- * indication of whether AtkValue is implemented, they should
- * use type checking/interface checking macros or the
- * atk_get_accessible_value() convenience method.
+ * Gets the minimum value of this object
  **/
 void
 atk_value_get_minimum_value (AtkValue *obj,