1 /* GIO - GLib Input, Output and Streaming Library
3 * Copyright (C) 2006-2007 Red Hat, Inc.
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General
16 * Public License along with this library; if not, write to the
17 * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
18 * Boston, MA 02111-1307, USA.
20 * Author: Alexander Larsson <alexl@redhat.com>
28 static void g_icon_base_init (gpointer g_class);
29 static void g_icon_class_init (gpointer g_class,
33 g_icon_get_type (void)
35 static GType icon_type = 0;
39 static const GTypeInfo icon_info =
41 sizeof (GIconIface), /* class_size */
42 g_icon_base_init, /* base_init */
43 NULL, /* base_finalize */
45 NULL, /* class_finalize */
46 NULL, /* class_data */
53 g_type_register_static (G_TYPE_INTERFACE, I_("GIcon"),
56 g_type_interface_add_prerequisite (icon_type, G_TYPE_OBJECT);
63 g_icon_class_init (gpointer g_class,
69 g_icon_base_init (gpointer g_class)
75 * @icon: #gconstpointer to an icon object.
77 * Returns: a #guint containing a hash for the @icon, suitable for
78 * use in a #GHashTable or similar data structure.
81 g_icon_hash (gconstpointer icon)
85 g_return_val_if_fail (G_IS_ICON (icon), 0);
87 iface = G_ICON_GET_IFACE (icon);
89 return (* iface->hash) ((GIcon *)icon);
94 * @icon1: pointer to the first #GIcon.
95 * @icon2: pointer to the second #GIcon.
97 * Returns: %TRUE if @icon1 is equal to @icon2. %FALSE otherwise.
100 g_icon_equal (GIcon *icon1,
105 if (icon1 == NULL && icon2 == NULL)
108 if (icon1 == NULL || icon2 == NULL)
111 if (G_TYPE_FROM_INSTANCE (icon1) != G_TYPE_FROM_INSTANCE (icon2))
114 iface = G_ICON_GET_IFACE (icon1);
116 return (* iface->equal) (icon1, icon2);