Updated Indonesian translation
[evolution.git] / mail / message-list.h
blobdaa27f2c1a4d55cf9ce09a88110836ea3f64f0aa
1 /*
2 * This program is free software; you can redistribute it and/or
3 * modify it under the terms of the GNU Lesser General Public
4 * License as published by the Free Software Foundation; either
5 * version 2 of the License, or (at your option) version 3.
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10 * Lesser General Public License for more details.
12 * You should have received a copy of the GNU Lesser General Public
13 * License along with the program; if not, see <http://www.gnu.org/licenses/>
16 * Authors:
17 * Jeffrey Stedfast <fejj@ximian.com>
19 * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
23 #ifndef _MESSAGE_LIST_H_
24 #define _MESSAGE_LIST_H_
26 #include <gtk/gtk.h>
27 #include <camel/camel.h>
29 #include <e-util/e-util.h>
30 #include <libemail-engine/e-mail-session.h>
32 /* Standard GObject macros */
33 #define MESSAGE_LIST_TYPE \
34 (message_list_get_type ())
35 #define MESSAGE_LIST(obj) \
36 (G_TYPE_CHECK_INSTANCE_CAST \
37 ((obj), MESSAGE_LIST_TYPE, MessageList))
38 #define MESSAGE_LIST_CLASS(cls) \
39 (G_TYPE_CHECK_CLASS_CAST \
40 ((cls), MESSAGE_LIST_TYPE, MessageListClass))
41 #define IS_MESSAGE_LIST(obj) \
42 (G_TYPE_CHECK_INSTANCE_TYPE \
43 ((obj), MESSAGE_LIST_TYPE))
44 #define IS_MESSAGE_LIST_CLASS(cls) \
45 (G_TYPE_CHECK_CLASS_TYPE \
46 ((cls), MESSAGE_LIST_TYPE))
47 #define MESSAGE_LIST_GET_CLASS(obj) \
48 (G_TYPE_INSTANCE_GET_CLASS \
49 ((obj), MESSAGE_LIST_TYPE, MessageListClass))
51 G_BEGIN_DECLS
53 enum {
54 COL_MESSAGE_STATUS,
55 COL_FLAGGED,
56 COL_SCORE,
57 COL_ATTACHMENT,
58 COL_FROM,
59 COL_SUBJECT,
60 COL_SENT,
61 COL_RECEIVED,
62 COL_TO,
63 COL_SIZE,
64 COL_FOLLOWUP_FLAG_STATUS,
65 COL_FOLLOWUP_FLAG,
66 COL_FOLLOWUP_DUE_BY,
67 COL_LOCATION, /* vfolder location? */
68 COL_SENDER,
69 COL_RECIPIENTS,
70 COL_MIXED_SENDER,
71 COL_MIXED_RECIPIENTS,
72 COL_LABELS,
74 /* subject with junk removed */
75 COL_SUBJECT_TRIMMED,
77 /* normalised strings */
78 COL_FROM_NORM,
79 COL_SUBJECT_NORM,
80 COL_TO_NORM,
82 COL_LAST,
84 /* Invisible columns */
85 COL_DELETED,
86 COL_UNREAD,
87 COL_COLOUR
90 #define MESSAGE_LIST_COLUMN_IS_ACTIVE(col) (col == COL_MESSAGE_STATUS || \
91 col == COL_FLAGGED)
93 typedef struct _MessageList MessageList;
94 typedef struct _MessageListClass MessageListClass;
95 typedef struct _MessageListPrivate MessageListPrivate;
97 struct _MessageList {
98 ETree parent;
100 MessageListPrivate *priv;
102 /* The table */
103 ETreeModel *model;
104 ETreePath tree_root;
105 ETableExtras *extras;
107 /* The folder being shown. */
108 CamelFolder *folder;
110 GHashTable *uid_nodemap; /* uid (from info) -> tree node mapping */
112 GHashTable *normalised_hash;
114 /* Current search string, or %NULL */
115 gchar *search;
117 /* which message uid should be left in the list even not in a
118 * search after rebuild; rebuild will clear the value to NULL */
119 gchar *ensure_uid;
121 /* are we regenerating the message_list because set_folder
122 * was just called? */
123 guint just_set_folder : 1;
125 /* Are we displaying threaded view? */
126 guint threaded : 1;
128 guint expand_all :1;
129 guint collapse_all :1;
131 /* do we automatically hide deleted messages? */
132 guint hidedeleted : 1;
134 /* do we automatically hide junk messages? */
135 guint hidejunk : 1;
137 /* frozen count */
138 guint frozen : 16;
140 /* Where the ETree cursor is. */
141 gchar *cursor_uid;
143 /* whether the last selection was on a single row or none/multi */
144 gboolean last_sel_single;
146 /* Row-selection and seen-marking timers */
147 guint idle_id, seen_id;
149 /* list of outstanding regeneration requests */
150 GList *regen;
151 GMutex regen_lock; /* when writing to the regen, guard with this lock too */
152 gchar *pending_select_uid; /* set if we were busy regnerating
153 * while we had a select come in */
154 gboolean pending_select_fallback;
155 guint regen_timeout_id;
156 gpointer regen_timeout_msg;
158 gchar *frozen_search; /* to save search took place while we were frozen */
160 /* the current camel folder thread tree, if any */
161 CamelFolderThread *thread_tree;
164 struct _MessageListClass {
165 ETreeClass parent_class;
167 /* signals - select a message */
168 void (*message_selected) (MessageList *message_list, const gchar *uid);
169 void (*message_list_built) (MessageList *message_list);
170 void (*message_list_scrolled) (MessageList *message_list);
173 typedef enum {
174 MESSAGE_LIST_SELECT_NEXT = 0,
175 MESSAGE_LIST_SELECT_PREVIOUS = 1,
176 MESSAGE_LIST_SELECT_DIRECTION = 1, /* direction mask */
177 MESSAGE_LIST_SELECT_WRAP = 1<<1 /* option bit */
178 } MessageListSelectDirection;
180 GType message_list_get_type (void);
181 GtkWidget * message_list_new (EMailSession *session);
182 EMailSession * message_list_get_session (MessageList *message_list);
183 void message_list_set_folder (MessageList *message_list,
184 CamelFolder *folder,
185 gboolean outgoing);
186 GtkTargetList * message_list_get_copy_target_list
187 (MessageList *message_list);
188 GtkTargetList * message_list_get_paste_target_list
189 (MessageList *message_list);
190 void message_list_freeze (MessageList *message_list);
191 void message_list_thaw (MessageList *message_list);
192 GPtrArray * message_list_get_uids (MessageList *message_list);
193 GPtrArray * message_list_get_selected (MessageList *message_list);
194 void message_list_set_selected (MessageList *message_list,
195 GPtrArray *uids);
196 gboolean message_list_select (MessageList *message_list,
197 MessageListSelectDirection direction,
198 guint32 flags,
199 guint32 mask);
200 gboolean message_list_can_select (MessageList *message_list,
201 MessageListSelectDirection direction,
202 guint32 flags,
203 guint32 mask);
204 void message_list_select_uid (MessageList *message_list,
205 const gchar *uid,
206 gboolean with_fallback);
207 void message_list_select_next_thread (MessageList *message_list);
208 void message_list_select_prev_thread (MessageList *message_list);
209 void message_list_select_all (MessageList *message_list);
210 void message_list_select_thread (MessageList *message_list);
211 void message_list_select_subthread (MessageList *message_list);
212 void message_list_invert_selection (MessageList *message_list);
213 void message_list_copy (MessageList *message_list,
214 gboolean cut);
215 void message_list_paste (MessageList *message_list);
216 guint message_list_count (MessageList *message_list);
217 guint message_list_selected_count (MessageList *message_list);
218 void message_list_set_threaded (MessageList *message_list,
219 gboolean threaded);
220 void message_list_set_threaded_expand_all
221 (MessageList *message_list);
222 void message_list_set_threaded_collapse_all
223 (MessageList *message_list);
224 void message_list_set_hidedeleted (MessageList *message_list,
225 gboolean hidedeleted);
226 void message_list_set_search (MessageList *message_list,
227 const gchar *search);
228 void message_list_ensure_message (MessageList *message_list,
229 const gchar *uid);
230 void message_list_save_state (MessageList *message_list);
232 #define MESSAGE_LIST_LOCK(m, l) g_mutex_lock(((MessageList *)m)->l)
233 #define MESSAGE_LIST_UNLOCK(m, l) g_mutex_unlock(((MessageList *)m)->l)
235 G_END_DECLS
237 #endif /* _MESSAGE_LIST_H_ */