Github User Fetcher 1.0.0
C Application with Server and GUI
Loading...
Searching...
No Matches
gicon.h
Go to the documentation of this file.
1/* GIO - GLib Input, Output and Streaming Library
2 *
3 * Copyright (C) 2006-2007 Red Hat, Inc.
4 *
5 * SPDX-License-Identifier: LGPL-2.1-or-later
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General
18 * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
19 *
20 * Author: Alexander Larsson <alexl@redhat.com>
21 */
22
23#ifndef __G_ICON_H__
24#define __G_ICON_H__
25
26#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
27#error "Only <gio/gio.h> can be included directly."
28#endif
29
30#include <gio/giotypes.h>
31
33
34#define G_TYPE_ICON (g_icon_get_type ())
35#define G_ICON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), G_TYPE_ICON, GIcon))
36#define G_IS_ICON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G_TYPE_ICON))
37#define G_ICON_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), G_TYPE_ICON, GIconIface))
38
39typedef struct _GIconIface GIconIface;
40
41/**
42 * GIconIface:
43 * @g_iface: The parent interface.
44 * @hash: A hash for a given #GIcon.
45 * @equal: Checks if two #GIcons are equal.
46 * @to_tokens: Serializes a #GIcon into tokens. The tokens must not
47 * contain any whitespace. Don't implement if the #GIcon can't be
48 * serialized (Since 2.20).
49 * @from_tokens: Constructs a #GIcon from tokens. Set the #GError if
50 * the tokens are malformed. Don't implement if the #GIcon can't be
51 * serialized (Since 2.20).
52 * @serialize: Serializes a #GIcon into a #GVariant. Since: 2.38
53 *
54 * GIconIface is used to implement GIcon types for various
55 * different systems. See #GThemedIcon and #GLoadableIcon for
56 * examples of how to implement this interface.
57 */
59{
61
62 /* Virtual Table */
63
64 guint (* hash) (GIcon *icon);
65 gboolean (* equal) (GIcon *icon1,
66 GIcon *icon2);
67
68 /**
69 * GIconIface::to_tokens:
70 * @icon: The #GIcon
71 * @tokens: (element-type utf8) (out caller-allocates):
72 * The array to fill with tokens
73 * @out_version: (out): version of serialized tokens
74 *
75 * Serializes the @icon into string tokens.
76 * This is can be invoked when g_icon_new_for_string() is called.
77 *
78 * Returns: %TRUE if serialization took place, %FALSE otherwise
79 *
80 * Since: 2.20
81 */
83 GPtrArray *tokens,
84 gint *out_version);
85
86 /**
87 * GIconIface::from_tokens:
88 * @tokens: (array length=num_tokens): An array of tokens
89 * @num_tokens: The number of tokens in @tokens
90 * @version: Version of the serialized tokens
91 * @error: Return location for errors, or %NULL to ignore
92 *
93 * Constructs a #GIcon from a list of @tokens.
94 *
95 * Returns: (nullable) (transfer full): the #GIcon or %NULL on error
96 *
97 * Since: 2.20
98 */
99 GIcon * (* from_tokens) (gchar **tokens,
100 gint num_tokens,
101 gint version,
102 GError **error);
103
104 GVariant * (* serialize) (GIcon *icon);
105};
106
109
114 GIcon *icon2);
119 GError **error);
120
125
127
128#endif /* __G_ICON_H__ */
GIO_AVAILABLE_IN_ALL guint g_icon_hash(gconstpointer icon)
GIO_AVAILABLE_IN_ALL gboolean g_icon_equal(GIcon *icon1, GIcon *icon2)
GIO_AVAILABLE_IN_2_38 GIcon * g_icon_deserialize(GVariant *value)
GIO_AVAILABLE_IN_2_38 GVariant * g_icon_serialize(GIcon *icon)
GIO_AVAILABLE_IN_ALL GIcon * g_icon_new_for_string(const gchar *str, GError **error)
GIO_AVAILABLE_IN_ALL gchar * g_icon_to_string(GIcon *icon)
GIO_AVAILABLE_IN_ALL GType g_icon_get_type(void) G_GNUC_CONST
#define GIO_AVAILABLE_IN_ALL
#define GIO_AVAILABLE_IN_2_38
struct _GIcon GIcon
Definition giotypes.h:92
#define G_END_DECLS
Definition gmacros.h:910
#define G_BEGIN_DECLS
Definition gmacros.h:909
#define G_GNUC_CONST
Definition gmacros.h:637
gsize GType
Definition gtype.h:427
gint gboolean
Definition gtypes.h:56
G_BEGIN_DECLS typedef char gchar
Definition gtypes.h:52
int gint
Definition gtypes.h:55
const void * gconstpointer
Definition gtypes.h:110
unsigned int guint
Definition gtypes.h:61
typedefG_BEGIN_DECLS struct _GVariant GVariant
Definition gvariant.h:36
int value
Definition lsqlite3.c:2155
static void error(LoadState *S, const char *why)
gboolean(* to_tokens)(GIcon *icon, GPtrArray *tokens, gint *out_version)
Definition gicon.h:82
guint(* hash)(GIcon *icon)
Definition gicon.h:64
GTypeInterface g_iface
Definition gicon.h:60
gboolean(* equal)(GIcon *icon1, GIcon *icon2)
Definition gicon.h:65