[glib/wip/3v1n0/termina-freebsd: 1/2] gicon: Add introspection for to_tokens / from_tokens vfunc's




commit 94b68d43a0a501122a772076087f3de1e25176be
Author: Marco Trevisan (TreviƱo) <mail 3v1n0 net>
Date:   Mon Oct 3 21:37:00 2022 +0200

    gicon: Add introspection for to_tokens / from_tokens vfunc's
    
    The GIconIface virtual functions were not introspectable as they use
    complex parameters that GI isn't able to compute alone.
    
    So provide introspection metadata using two function pointer
    definitions.

 gio/gicon.h | 42 +++++++++++++++++++++++++++++++++++-------
 1 file changed, 35 insertions(+), 7 deletions(-)
---
diff --git a/gio/gicon.h b/gio/gicon.h
index 58cf74a246..28cd6840bd 100644
--- a/gio/gicon.h
+++ b/gio/gicon.h
@@ -43,6 +43,39 @@ G_BEGIN_DECLS
  **/
 typedef struct _GIconIface GIconIface;
 
+/**
+ * GIconToTokensFunc:
+ * @icon: The #GIcon
+ * @tokens: (element-type utf8) (out caller-allocates):
+ *   The array to fill with tokens
+ * @out_version: (out): version of serialized tokens
+ *
+ * The prototype of the #GIconIface.to_tokens() virtual function.
+ *
+ * Since: 2.75
+ */
+typedef gboolean (*GIconToTokensFunc) (GIcon     *icon,
+                                       GPtrArray *tokens,
+                                       gint      *out_version);
+
+/**
+ * GIconFromTokensFunc:
+ * @tokens: (array length=num_tokens) (transfer none): The list of tokens
+ * @num_tokens: The number of tokens in @tokens
+ * @version: Version of the serialized tokens
+ * @error: Return location for errors, or %NULL to ignore
+ *
+ * The prototype of the #GIconIface.from_tokens() virtual function.
+ *
+ * Returns: (transfer full): the #GIcon or %NULL on error
+ *
+ * Since: 2.75
+ */
+typedef GIcon * (*GIconFromTokensFunc) (gchar  **tokens,
+                                        gint     num_tokens,
+                                        gint     version,
+                                        GError **error);
+
 /**
  * GIconIface:
  * @g_iface: The parent interface.
@@ -69,13 +102,8 @@ struct _GIconIface
   guint       (* hash)        (GIcon   *icon);
   gboolean    (* equal)       (GIcon   *icon1,
                                GIcon   *icon2);
-  gboolean    (* to_tokens)   (GIcon   *icon,
-                              GPtrArray *tokens,
-                               gint    *out_version);
-  GIcon *     (* from_tokens) (gchar  **tokens,
-                               gint     num_tokens,
-                               gint     version,
-                               GError **error);
+  GIconToTokensFunc to_tokens;
+  GIconFromTokensFunc from_tokens;
 
   GVariant *  (* serialize)   (GIcon   *icon);
 };


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