]> pilppa.org Git - familiar-h63xx-build.git/blob - org.handhelds.familiar/packages/gtk+/gtk+-2.6.4-1.osso7/gtkhashtable.c.diff
OE tree imported from monotone branch org.openembedded.oz354fam083 at revision 8b12e3...
[familiar-h63xx-build.git] / org.handhelds.familiar / packages / gtk+ / gtk+-2.6.4-1.osso7 / gtkhashtable.c.diff
1 --- gtk+-2.6.4/gtk/gtkhashtable.c       1970-01-01 02:00:00.000000000 +0200
2 +++ gtk+-2.6.4/gtk/gtkhashtable.c       2005-04-06 16:19:36.596974776 +0300
3 @@ -0,0 +1,99 @@
4 +/* GTK - The GIMP Toolkit
5 + * Copyright (C) 2005 Nokia
6 + * Author: Jorn Baayen <jbaayen@gnome.org>
7 + *
8 + * This library is free software; you can redistribute it and/or
9 + * modify it under the terms of the GNU Lesser General Public
10 + * License as published by the Free Software Foundation; either
11 + * version 2 of the License, or (at your option) any later version.
12 + *
13 + * This library is distributed in the hope that it will be useful,
14 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the GNU
16 + * Lesser General Public License for more details.
17 + *
18 + * You should have received a copy of the GNU Lesser General Public
19 + * License along with this library; if not, write to the
20 + * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21 + * Boston, MA 02111-1307, USA.
22 + */
23 +
24 +#include <config.h>
25 +#include "gtkhashtable.h"
26 +
27 +static gpointer parent_class = NULL;
28 +
29 +static void _gtk_hash_table_init       (GtkHashTable      *hash_table);
30 +static void _gtk_hash_table_class_init (GtkHashTableClass *klass);
31 +static void _gtk_hash_table_finalize   (GObject           *object);
32 +
33 +GType
34 +_gtk_hash_table_get_type (void)
35 +{
36 +  static GType hash_table_type = 0;
37 +
38 +  if (!hash_table_type)
39 +    {
40 +      static const GTypeInfo hash_table_info =
41 +      {
42 +        sizeof (GtkHashTableClass),
43 +        NULL,          /* base_init */
44 +        NULL,          /* base_finalize */
45 +        (GClassInitFunc) _gtk_hash_table_class_init,
46 +        NULL,           /* class_finalize */
47 +        NULL,           /* class_data */
48 +        sizeof (GtkHashTable),
49 +        0,              /* n_preallocs */
50 +        (GInstanceInitFunc) _gtk_hash_table_init,
51 +      };
52 +      
53 +      hash_table_type =
54 +       g_type_register_static (G_TYPE_OBJECT, "GtkHashTable",
55 +                               &hash_table_info, 0);
56 +    }
57 +  
58 +  return hash_table_type;
59 +}
60 +
61 +static void
62 +_gtk_hash_table_init (GtkHashTable *hash_table)
63 +{
64 +  hash_table->hash = g_hash_table_new_full (g_str_hash, g_str_equal,
65 +                                           g_free, g_free);
66 +}
67 +
68 +static void
69 +_gtk_hash_table_class_init (GtkHashTableClass *klass)
70 +{
71 +  GObjectClass *object_class = G_OBJECT_CLASS (klass);
72 +  
73 +  parent_class = g_type_class_peek_parent (klass);
74 +
75 +  object_class->finalize = _gtk_hash_table_finalize;
76 +}
77 +
78 +static void
79 +_gtk_hash_table_finalize (GObject *object)
80 +{
81 +  GtkHashTable *hash_table = GTK_HASH_TABLE (object);
82 +
83 +  g_hash_table_destroy (hash_table->hash);
84 +  
85 +  G_OBJECT_CLASS (parent_class)->finalize (object);
86 +}
87 +
88 +/**
89 + * _gtk_hash_table_new:
90 + *
91 + * Creates a new #GtkHashTable. This is a #GHashTable wrapped in a GObject,
92 + * thereby supporting refcounting.
93 + * 
94 + * Return value: a new #GtkHashTable
95 + **/
96 +GtkHashTable*
97 +_gtk_hash_table_new (void)
98 +{
99 +  return g_object_new (GTK_TYPE_HASH_TABLE, NULL);
100 +}
101 +
102 +