generic-poky/openembedded/packages/gtk+/gtk+-2.6.4-1.osso7/gtkhashtable.c.diff

103 lines
2.9 KiB
Diff

--- 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);
+}
+
+