1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
3 /* e-name-selector-model.h - Model for contact selection.
5 * Copyright (C) 2004 Novell, Inc.
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of version 2 of the GNU Lesser General Public
9 * License as published by the Free Software Foundation.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 * Authors: Hans Petter Jansson <hpj@novell.com>
23 #ifndef E_NAME_SELECTOR_MODEL_H
24 #define E_NAME_SELECTOR_MODEL_H
27 #include <libedataserverui/e-tree-model-generator.h>
28 #include <libedataserverui/e-contact-store.h>
29 #include <libedataserverui/e-destination-store.h>
33 #define E_TYPE_NAME_SELECTOR_MODEL (e_name_selector_model_get_type ())
34 #define E_NAME_SELECTOR_MODEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_NAME_SELECTOR_MODEL, ENameSelectorModel))
35 #define E_NAME_SELECTOR_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_NAME_SELECTOR_MODEL, ENameSelectorModelClass))
36 #define E_IS_NAME_SELECTOR_MODEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_NAME_SELECTOR_MODEL))
37 #define E_IS_NAME_SELECTOR_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), E_TYPE_NAME_SELECTOR_MODEL))
39 typedef struct _ENameSelectorModel ENameSelectorModel;
40 typedef struct _ENameSelectorModelClass ENameSelectorModelClass;
42 struct _ENameSelectorModel {
48 EContactStore *contact_store;
49 ETreeModelGenerator *contact_filter;
51 GHashTable *destination_uid_hash;
54 struct _ENameSelectorModelClass {
55 GObjectClass parent_class;
58 void (* section_added) (gchar *name);
59 void (* section_removed) (gchar *name);
62 GType e_name_selector_model_get_type (void);
63 ENameSelectorModel *e_name_selector_model_new (void);
65 EContactStore *e_name_selector_model_peek_contact_store (ENameSelectorModel *name_selector_model);
66 ETreeModelGenerator *e_name_selector_model_peek_contact_filter (ENameSelectorModel *name_selector_model);
68 /* Deep copy of section names; free strings and list when you're done */
69 GList *e_name_selector_model_list_sections (ENameSelectorModel *name_selector_model);
71 /* pretty_name will be newly allocated, but destination_store must be reffed if you keep it */
72 gboolean e_name_selector_model_peek_section (ENameSelectorModel *name_selector_model,
73 const gchar *name, gchar **pretty_name,
74 EDestinationStore **destination_store);
75 void e_name_selector_model_add_section (ENameSelectorModel *name_selector_model,
76 const gchar *name, const gchar *pretty_name,
77 EDestinationStore *destination_store);
78 void e_name_selector_model_remove_section (ENameSelectorModel *name_selector_model,
83 #endif /* E_NAME_SELECTOR_MODEL_H */