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