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/>
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_
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))
64 COL_FOLLOWUP_FLAG_STATUS
,
67 COL_LOCATION
, /* vfolder location? */
74 /* subject with junk removed */
77 /* normalised strings */
84 /* Invisible columns */
90 #define MESSAGE_LIST_COLUMN_IS_ACTIVE(col) (col == COL_MESSAGE_STATUS || \
93 typedef struct _MessageList MessageList
;
94 typedef struct _MessageListClass MessageListClass
;
95 typedef struct _MessageListPrivate MessageListPrivate
;
100 MessageListPrivate
*priv
;
105 ETableExtras
*extras
;
107 /* The folder being shown. */
110 GHashTable
*uid_nodemap
; /* uid (from info) -> tree node mapping */
112 GHashTable
*normalised_hash
;
114 /* Current search string, or %NULL */
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 */
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? */
129 guint collapse_all
:1;
131 /* do we automatically hide deleted messages? */
132 guint hidedeleted
: 1;
134 /* do we automatically hide junk messages? */
140 /* Where the ETree cursor is. */
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 */
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
);
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
,
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
,
196 gboolean
message_list_select (MessageList
*message_list
,
197 MessageListSelectDirection direction
,
200 gboolean
message_list_can_select (MessageList
*message_list
,
201 MessageListSelectDirection direction
,
204 void message_list_select_uid (MessageList
*message_list
,
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
,
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
,
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
,
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)
237 #endif /* _MESSAGE_LIST_H_ */