Bug 555740 - gicon serialization Based on patch from David Zeuthen
[platform/upstream/glib.git] / gio / gicon.h
index f75dfbf..8f339f6 100644 (file)
@@ -48,6 +48,12 @@ typedef struct _GIconIface GIconIface;
  * @g_iface: The parent interface.
  * @hash: A hash for a given #GIcon.
  * @equal: Checks if two #GIcon<!-- -->s are equal.
+ * @to_tokens: Serializes a #GIcon into tokens. The tokens must not
+ * contain any whitespace. Don't implement if the #GIcon can't be
+ * serialized (Since 2.20).
+ * @from_tokens: Constructs a #GIcon from tokens. Set the #GError if
+ * the tokens are malformed. Don't implement if the #GIcon can't be
+ * serialized (Since 2.20).
  *
  * GIconIface is used to implement GIcon types for various
  * different systems. See #GThemedIcon and #GLoadableIcon for
@@ -59,16 +65,26 @@ struct _GIconIface
 
   /* Virtual Table */
 
-  guint    (* hash)  (GIcon *icon);
-  gboolean (* equal) (GIcon *icon1,
-                      GIcon *icon2);
+  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);
 };
 
-GType    g_icon_get_type (void) G_GNUC_CONST;
+GType    g_icon_get_type  (void) G_GNUC_CONST;
 
-guint    g_icon_hash     (gconstpointer  icon);
-gboolean g_icon_equal    (GIcon         *icon1,
-                          GIcon         *icon2);
+guint    g_icon_hash            (gconstpointer  icon);
+gboolean g_icon_equal           (GIcon         *icon1,
+                                 GIcon         *icon2);
+gchar   *g_icon_to_string       (GIcon         *icon);
+GIcon   *g_icon_new_for_string  (const gchar   *str,
+                                 GError       **error);
 
 G_END_DECLS