Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:59:56

0001 /* GIO - GLib Input, Output and Streaming Library
0002  *
0003  * Copyright (C) 2006-2007 Red Hat, Inc.
0004  *
0005  * SPDX-License-Identifier: LGPL-2.1-or-later
0006  *
0007  * This library is free software; you can redistribute it and/or
0008  * modify it under the terms of the GNU Lesser General Public
0009  * License as published by the Free Software Foundation; either
0010  * version 2.1 of the License, or (at your option) any later version.
0011  *
0012  * This library is distributed in the hope that it will be useful,
0013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0015  * Lesser General Public License for more details.
0016  *
0017  * You should have received a copy of the GNU Lesser General
0018  * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
0019  *
0020  * Author: Alexander Larsson <alexl@redhat.com>
0021  */
0022 
0023 #ifndef __G_ICON_H__
0024 #define __G_ICON_H__
0025 
0026 #if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
0027 #error "Only <gio/gio.h> can be included directly."
0028 #endif
0029 
0030 #include <gio/giotypes.h>
0031 
0032 G_BEGIN_DECLS
0033 
0034 #define G_TYPE_ICON            (g_icon_get_type ())
0035 #define G_ICON(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), G_TYPE_ICON, GIcon))
0036 #define G_IS_ICON(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G_TYPE_ICON))
0037 #define G_ICON_GET_IFACE(obj)  (G_TYPE_INSTANCE_GET_INTERFACE ((obj), G_TYPE_ICON, GIconIface))
0038 
0039 typedef struct _GIconIface GIconIface;
0040 
0041 /**
0042  * GIconIface:
0043  * @g_iface: The parent interface.
0044  * @hash: A hash for a given #GIcon.
0045  * @equal: Checks if two #GIcons are equal.
0046  * @to_tokens: Serializes a #GIcon into tokens. The tokens must not
0047  * contain any whitespace. Don't implement if the #GIcon can't be
0048  * serialized (Since 2.20).
0049  * @from_tokens: Constructs a #GIcon from tokens. Set the #GError if
0050  * the tokens are malformed. Don't implement if the #GIcon can't be
0051  * serialized (Since 2.20).
0052  * @serialize: Serializes a #GIcon into a #GVariant. Since: 2.38
0053  *
0054  * GIconIface is used to implement GIcon types for various
0055  * different systems. See #GThemedIcon and #GLoadableIcon for
0056  * examples of how to implement this interface.
0057  */
0058 struct _GIconIface
0059 {
0060   GTypeInterface g_iface;
0061 
0062   /* Virtual Table */
0063 
0064   guint       (* hash)        (GIcon   *icon);
0065   gboolean    (* equal)       (GIcon   *icon1,
0066                                GIcon   *icon2);
0067 
0068   /**
0069    * GIconIface::to_tokens:
0070    * @icon: The #GIcon
0071    * @tokens: (element-type utf8) (out caller-allocates):
0072    *   The array to fill with tokens
0073    * @out_version: (out): version of serialized tokens
0074    *
0075    * Serializes the @icon into string tokens.
0076    * This is can be invoked when g_icon_new_for_string() is called.
0077    *
0078    * Returns: %TRUE if serialization took place, %FALSE otherwise
0079    *
0080    * Since: 2.20
0081    */
0082   gboolean    (* to_tokens)   (GIcon   *icon,
0083                                GPtrArray *tokens,
0084                                gint    *out_version);
0085 
0086   /**
0087    * GIconIface::from_tokens:
0088    * @tokens: (array length=num_tokens): An array of tokens
0089    * @num_tokens: The number of tokens in @tokens
0090    * @version: Version of the serialized tokens
0091    * @error: Return location for errors, or %NULL to ignore
0092    *
0093    * Constructs a #GIcon from a list of @tokens.
0094    *
0095    * Returns: (nullable) (transfer full): the #GIcon or %NULL on error
0096    *
0097    * Since: 2.20
0098    */
0099   GIcon *     (* from_tokens) (gchar  **tokens,
0100                                gint     num_tokens,
0101                                gint     version,
0102                                GError **error);
0103 
0104   GVariant *  (* serialize)   (GIcon   *icon);
0105 };
0106 
0107 GIO_AVAILABLE_IN_ALL
0108 GType    g_icon_get_type  (void) G_GNUC_CONST;
0109 
0110 GIO_AVAILABLE_IN_ALL
0111 guint    g_icon_hash            (gconstpointer  icon);
0112 GIO_AVAILABLE_IN_ALL
0113 gboolean g_icon_equal           (GIcon         *icon1,
0114                                  GIcon         *icon2);
0115 GIO_AVAILABLE_IN_ALL
0116 gchar   *g_icon_to_string       (GIcon         *icon);
0117 GIO_AVAILABLE_IN_ALL
0118 GIcon   *g_icon_new_for_string  (const gchar   *str,
0119                                  GError       **error);
0120 
0121 GIO_AVAILABLE_IN_2_38
0122 GVariant * g_icon_serialize     (GIcon         *icon);
0123 GIO_AVAILABLE_IN_2_38
0124 GIcon *    g_icon_deserialize   (GVariant      *value);
0125 
0126 G_END_DECLS
0127 
0128 #endif /* __G_ICON_H__ */