2006-12-03 Dimitris Glezos <dimitris@glezos.com>
[dia.git] / lib / propregistry.c
blob4bfe839e1e349aeea069dc03ae97d6deede75969
1 /* Dia -- a diagram creation/manipulation program -*- c -*-
2 * Copyright (C) 1998 Alexander Larsson
4 * Property system for dia objects/shapes.
5 * Copyright (C) 2000 James Henstridge
6 * Copyright (C) 2001 Cyrille Chepelov
7 * Major restructuration done in August 2001 by C. Chepelov
9 * A Registry of property types.
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
25 #ifdef HAVE_CONFIG_H
26 #include <config.h>
27 #endif
29 #include <gtk/gtk.h>
30 #include "properties.h"
31 #include "propinternals.h"
33 static GHashTable *props_hash = NULL;
35 static void check_props_hash(void)
37 if (!props_hash) {
38 props_hash = g_hash_table_new(g_str_hash,g_str_equal);
42 void
43 prop_type_register(PropertyType type, const PropertyOps *ops)
45 check_props_hash();
46 g_hash_table_insert(props_hash,(gpointer)type,(gpointer)ops);
49 const PropertyOps *
50 prop_type_get_ops(PropertyType type)
52 check_props_hash();
53 return g_hash_table_lookup(props_hash,type);