Fix FSF address (Tobias Mueller, #470445)
[platform/upstream/evolution-data-server.git] / libedataserverui / e-name-selector-model.h
1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2
3 /* e-name-selector-model.h - Model for contact selection.
4  *
5  * Copyright (C) 2004 Novell, Inc.
6  *
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.
10  *
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.
15  *
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.
19  *
20  * Authors: Hans Petter Jansson <hpj@novell.com>
21  */
22
23 #ifndef E_NAME_SELECTOR_MODEL_H
24 #define E_NAME_SELECTOR_MODEL_H
25
26 #include <glib.h>
27 #include <libedataserverui/e-tree-model-generator.h>
28 #include <libedataserverui/e-contact-store.h>
29 #include <libedataserverui/e-destination-store.h>
30
31 G_BEGIN_DECLS
32
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))
38
39 typedef struct _ENameSelectorModel       ENameSelectorModel;
40 typedef struct _ENameSelectorModelClass  ENameSelectorModelClass;
41
42 struct _ENameSelectorModel {
43         GObject              parent;
44
45         /* Private */
46
47         GArray              *sections;
48         EContactStore       *contact_store;
49         ETreeModelGenerator *contact_filter;
50
51         GHashTable          *destination_uid_hash;
52 };
53
54 struct _ENameSelectorModelClass {
55         GObjectClass parent_class;
56
57         /* Signals */
58         void (* section_added)   (gchar *name);
59         void (* section_removed) (gchar *name);
60 };
61
62 GType                e_name_selector_model_get_type            (void);
63 ENameSelectorModel  *e_name_selector_model_new                 (void);
64
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);
67
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);
70
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,
79                                                                 const gchar *name);
80
81 G_END_DECLS
82
83 #endif /* E_NAME_SELECTOR_MODEL_H */