On showing the check names "select contact" dialog, filter properly case.
[modest] / src / modest-cache-mgr.h
1 /* Copyright (c) 2006, Nokia Corporation
2  * All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions are
6  * met:
7  *
8  * * Redistributions of source code must retain the above copyright
9  *   notice, this list of conditions and the following disclaimer.
10  * * Redistributions in binary form must reproduce the above copyright
11  *   notice, this list of conditions and the following disclaimer in the
12  *   documentation and/or other materials provided with the distribution.
13  * * Neither the name of the Nokia Corporation nor the names of its
14  *   contributors may be used to endorse or promote products derived from
15  *   this software without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
18  * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
19  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
20  * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
21  * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
22  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
23  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
24  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
25  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
26  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28  */
29
30
31 #ifndef __MODEST_CACHE_MGR_H__
32 #define __MODEST_CACHE_MGR_H__
33
34 #include <glib-object.h>
35 G_BEGIN_DECLS
36
37 /* convenience macros */
38 #define MODEST_TYPE_CACHE_MGR         (modest_cache_mgr_get_type())
39 #define MODEST_CACHE_MGR(obj)         (G_TYPE_CHECK_INSTANCE_CAST((obj),MODEST_TYPE_CACHE_MGR,ModestCacheMgr))
40 #define MODEST_CACHE_MGR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),MODEST_TYPE_CACHE_MGR,GObject))
41 #define MODEST_IS_CACHE_MGR(obj)          (G_TYPE_CHECK_INSTANCE_TYPE((obj),MODEST_TYPE_CACHE_MGR))
42 #define MODEST_IS_CACHE_MGR_CLASS(klass)  (G_TYPE_CHECK_CLASS_TYPE((klass),MODEST_TYPE_CACHE_MGR))
43 #define MODEST_CACHE_MGR_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS((obj),MODEST_TYPE_CACHE_MGR,ModestCacheMgrClass))
44
45 typedef struct _ModestCacheMgr      ModestCacheMgr;
46 typedef struct _ModestCacheMgrClass ModestCacheMgrClass;
47
48 struct _ModestCacheMgr {
49          GObject parent;
50         /* insert public members, if any */
51 };
52
53 struct _ModestCacheMgrClass {
54         GObjectClass parent_class;
55 };
56
57 /*
58  * the caches managed by this class
59  */
60 typedef enum {
61         MODEST_CACHE_MGR_CACHE_TYPE_DATE_STRING,       /* time_t => string */
62         MODEST_CACHE_MGR_CACHE_TYPE_DISPLAY_STRING,    /* gchar* => gchar* */
63         MODEST_CACHE_MGR_CACHE_TYPE_PIXBUF,            /* gchar* => GdkPixbuf */
64         MODEST_CACHE_MGR_CACHE_TYPE_SEND_QUEUE,        /* TnyAccount* => TnySendQueue* */
65
66         MODEST_CACHE_MGR_CACHE_TYPE_NUM
67 } ModestCacheMgrCacheType;
68
69
70 /**
71  * modest_cache_mgr_get_type:
72  * 
73  * get the GType for ModestCacheMgr
74  *  
75  * Returns: the GType
76  */
77 GType        modest_cache_mgr_get_type    (void) G_GNUC_CONST;
78
79
80 /**
81  * modest_cache_mgr_new:
82  *
83  * instantiate a new cache_mgr object
84  * 
85  * Returns: a new cache_mgr or NULL in case of error
86  */
87 ModestCacheMgr*    modest_cache_mgr_new          (void);
88
89 /**
90  * modest_cache_mgr_get_cache:
91  * @self: a valid cache mgr obj
92  * @type: a valid cache mgr cache type
93  * 
94  * get the cache (GHashTable) of the requested type
95  * 
96  * Returns: the requested cache (GHashTable)  
97  * the returned  hashtable should NOT be destroyed or unref'd.
98  */
99 GHashTable*     modest_cache_mgr_get_cache    (ModestCacheMgr* self, ModestCacheMgrCacheType type);
100
101
102 /**
103  * modest_cache_mgr_flush
104  * @self: a valid cache mgr obj
105  * @type: a valid cache mgr cache type
106  *
107  * flush the cache (hashtable) of the given type  
108  */
109 void            modest_cache_mgr_flush        (ModestCacheMgr *self, ModestCacheMgrCacheType type);
110
111
112 /**
113  * modest_cache_mgr_flush
114  * @self: a valid cache mgr obj
115  *
116  * flush all caches  
117  */
118 void            modest_cache_mgr_flush_all    (ModestCacheMgr *self);
119
120
121 /**
122  * modest_cache_mgr_get_size
123  * @self: a valid cache mgr obj
124  * @type: a valid cache mgr cache type
125  *
126  * get the size (number of [key,value]-pairs) in the cache
127  * 
128  * Returns: the size of the give cache type 
129  */
130 guint           modest_cache_mgr_get_size     (ModestCacheMgr *self, ModestCacheMgrCacheType type);
131
132 G_END_DECLS
133
134 #endif /* __MODEST_CACHE_MGR_H__ */
135