33 #include "search-core-type.h"
34 #include "search-string.h"
35 #include "search-reconciled.h"
36 #include "search-date.h"
37 #include "search-double.h"
38 #include "search-int64.h"
39 #include "search-numeric.h"
40 #include "search-boolean.h"
41 #include "search-account.h"
49 static void gnc_search_core_type_finalize (GObject *obj);
59 (G_TYPE_INSTANCE_GET_PRIVATE ((o), GNC_TYPE_SEARCH_CORE_TYPE, GNCSearchCoreTypePrivate))
61 static GtkObjectClass *parent_class;
63 static GHashTable *typeTable = NULL;
66 gnc_search_core_type_get_type (
void)
68 static GType type = 0;
77 (GClassInitFunc)gnc_search_core_type_class_init,
82 (GInstanceInitFunc)gnc_search_core_type_init
85 type = g_type_register_static (G_TYPE_OBJECT,
"GNCSearchCoreType", &type_info, 0);
94 GObjectClass *object_class;
96 object_class = G_OBJECT_CLASS (klass);
97 parent_class = g_type_class_peek_parent (klass);
99 object_class->finalize = gnc_search_core_type_finalize;
102 klass->validate = validate;
103 klass->grab_focus = grab_focus;
104 klass->editable_enters = editable_enters;
115 gnc_search_core_type_finalize (GObject *obj)
118 g_assert (GNC_IS_SEARCH_CORE_TYPE (o));
120 G_OBJECT_CLASS (parent_class)->finalize(obj);
131 gnc_search_core_type_new (
void)
135 o = g_object_new (GNC_TYPE_SEARCH_CORE_TYPE, NULL);
143 GNC_SEARCH_CORE_TYPE_GET_CLASS (fe)->editable_enters (fe);
149 GNC_SEARCH_CORE_TYPE_GET_CLASS (fe)->grab_focus (fe);
155 return GNC_SEARCH_CORE_TYPE_GET_CLASS (fe)->validate (fe);
169 return GNC_SEARCH_CORE_TYPE_GET_CLASS (fe)->clone(fe);
184 return GNC_SEARCH_CORE_TYPE_GET_CLASS (fe)->get_widget(fe);
198 return GNC_SEARCH_CORE_TYPE_GET_CLASS (fe)->get_predicate(fe);
210 gnc_search_core_type_new_type_name (
const char *type)
212 GNCSearchCoreNew fcn;
214 g_return_val_if_fail (typeTable != NULL, NULL);
219 fcn = g_hash_table_lookup (typeTable, type);
226 g_warning(
"Unknown search type '%s'", type);
251 gnc_search_core_register_type (
const char *type_name, GNCSearchCoreNew fcn)
253 g_return_if_fail (type_name || *type_name || fcn);
254 g_return_if_fail (typeTable);
256 g_hash_table_insert (typeTable, (
char *) type_name, (gpointer) fcn);
262 gnc_search_core_register_type (QOF_TYPE_STRING,
263 (GNCSearchCoreNew) gnc_search_string_new);
264 gnc_search_core_register_type (QOF_TYPE_DATE,
265 (GNCSearchCoreNew) gnc_search_date_new);
266 gnc_search_core_register_type (QOF_TYPE_INT64,
267 (GNCSearchCoreNew) gnc_search_int64_new);
268 gnc_search_core_register_type (QOF_TYPE_DOUBLE,
269 (GNCSearchCoreNew) gnc_search_double_new);
270 gnc_search_core_register_type (QOF_TYPE_NUMERIC,
271 (GNCSearchCoreNew) gnc_search_numeric_new);
272 gnc_search_core_register_type (QOF_TYPE_DEBCRED,
274 gnc_search_numeric_debcred_new);
275 gnc_search_core_register_type (QOF_TYPE_BOOLEAN,
276 (GNCSearchCoreNew) gnc_search_boolean_new);
277 gnc_search_core_register_type (GNC_ID_ACCOUNT,
278 (GNCSearchCoreNew) gnc_search_account_new);
281 gnc_search_account_matchall_new);
282 gnc_search_core_register_type (RECONCILED_MATCH_TYPE,
283 (GNCSearchCoreNew) gnc_search_reconciled_new);
287 gnc_search_core_initialize (
void)
289 g_return_if_fail (typeTable == NULL);
291 typeTable = g_hash_table_new (g_str_hash, g_str_equal);
296 gnc_search_core_finalize (
void)
298 g_return_if_fail (typeTable != NULL);
300 g_hash_table_destroy (typeTable);
Account handling public routines.
#define ACCOUNT_MATCH_ALL_TYPE
API for Transactions and Splits (journal entries)