e-mail-shell-view-private.h 6 KB
Newer Older
Matthew Barnes's avatar
Matthew Barnes committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14
/*
 * e-mail-shell-view-private.h
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) version 3.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
15
 * License along with the program; if not, see <http://www.gnu.org/licenses/>
Matthew Barnes's avatar
Matthew Barnes committed
16 17 18 19 20 21 22 23 24 25 26 27
 *
 *
 * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
 *
 */

#ifndef E_MAIL_SHELL_VIEW_PRIVATE_H
#define E_MAIL_SHELL_VIEW_PRIVATE_H

#include "e-mail-shell-view.h"

#include <glib/gi18n.h>
28
#include <gtkhtml/gtkhtml.h>
29
#include <camel/camel-search-private.h>  /* for camel_search_word */
Matthew Barnes's avatar
Matthew Barnes committed
30

31
#include "e-util/e-util.h"
Matthew Barnes's avatar
Matthew Barnes committed
32
#include "e-util/gconf-bridge.h"
33
#include "e-util/e-account-utils.h"
34
#include "e-util/e-ui-manager.h"
35
#include "filter/e-filter-part.h"
Matthew Barnes's avatar
Matthew Barnes committed
36
#include "widgets/misc/e-web-view.h"
37
#include "widgets/misc/e-popup-action.h"
Matthew Barnes's avatar
Matthew Barnes committed
38 39
#include "widgets/menus/gal-view-instance.h"

40
#include "e-mail-label-action.h"
41 42
#include "e-mail-label-dialog.h"
#include "e-mail-label-list-store.h"
43
#include "e-mail-local.h"
44
#include "e-mail-reader.h"
45
#include "e-mail-session.h"
46
#include "e-mail-session-utils.h"
47
#include "e-mail-sidebar.h"
48
#include "e-mail-store.h"
49
#include "em-composer-utils.h"
50
#include "em-folder-properties.h"
51
#include "em-folder-selector.h"
52
#include "em-folder-utils.h"
53
#include "em-search-context.h"
54
#include "em-subscription-editor.h"
55
#include "em-utils.h"
56
#include "mail-autofilter.h"
57
#include "mail-folder-cache.h"
58
#include "mail-ops.h"
59
#include "mail-send-recv.h"
60
#include "mail-tools.h"
61
#include "mail-vfolder.h"
62
#include "message-list.h"
63

64
#include "e-mail-shell-backend.h"
Matthew Barnes's avatar
Matthew Barnes committed
65 66 67 68
#include "e-mail-shell-content.h"
#include "e-mail-shell-sidebar.h"
#include "e-mail-shell-view-actions.h"

69 70 71
/* backward-compatibility cruft */
#include "e-util/gtk-compat.h"

Matthew Barnes's avatar
Matthew Barnes committed
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
#define E_MAIL_SHELL_VIEW_GET_PRIVATE(obj) \
	(G_TYPE_INSTANCE_GET_PRIVATE \
	((obj), E_TYPE_MAIL_SHELL_VIEW, EMailShellViewPrivate))

/* Shorthand, requires a variable named "shell_window". */
#define ACTION(name) \
	(E_SHELL_WINDOW_ACTION_##name (shell_window))
#define ACTION_GROUP(name) \
	(E_SHELL_WINDOW_ACTION_GROUP_##name (shell_window))

/* For use in dispose() methods. */
#define DISPOSE(obj) \
	G_STMT_START { \
	if ((obj) != NULL) { g_object_unref (obj); (obj) = NULL; } \
	} G_STMT_END

/* ETable Specifications */
#define ETSPEC_FILENAME		"message-list.etspec"

91 92 93 94 95
/* State File Keys */
#define STATE_KEY_SEARCH_FILTER		"SearchFilter"
#define STATE_KEY_SEARCH_SCOPE		"SearchScope"
#define STATE_KEY_SEARCH_TEXT		"SearchText"

Matthew Barnes's avatar
Matthew Barnes committed
96 97
G_BEGIN_DECLS

98 99 100 101
/* Filter items are displayed in ascending order.
 * Labels are numbered from zero, so subsequent items must have
 * sufficiently large values.  Unfortunately this introduces an
 * arbitrary upper bound on labels. */
Matthew Barnes's avatar
Matthew Barnes committed
102
enum {
103 104 105 106 107 108 109 110 111 112
	MAIL_FILTER_ALL_MESSAGES		= -3,
	MAIL_FILTER_UNREAD_MESSAGES		= -2,
	MAIL_FILTER_NO_LABEL			= -1,
	/* Labels go here */
	MAIL_FILTER_READ_MESSAGES		= 5000,
	MAIL_FILTER_RECENT_MESSAGES		= 5001,
	MAIL_FILTER_LAST_5_DAYS_MESSAGES	= 5002,
	MAIL_FILTER_MESSAGES_WITH_ATTACHMENTS	= 5003,
	MAIL_FILTER_IMPORTANT_MESSAGES		= 5004,
	MAIL_FILTER_MESSAGES_NOT_JUNK		= 5005
Matthew Barnes's avatar
Matthew Barnes committed
113 114 115 116
};

/* Search items are displayed in ascending order. */
enum {
117
	MAIL_SEARCH_ADVANCED = -1,
118
	MAIL_SEARCH_SUBJECT_OR_ADDRESSES_CONTAIN,
Matthew Barnes's avatar
Matthew Barnes committed
119 120 121 122
	MAIL_SEARCH_RECIPIENTS_CONTAIN,
	MAIL_SEARCH_MESSAGE_CONTAINS,
	MAIL_SEARCH_SUBJECT_CONTAINS,
	MAIL_SEARCH_SENDER_CONTAINS,
123 124
	MAIL_SEARCH_BODY_CONTAINS,
	MAIL_NUM_SEARCH_RULES
Matthew Barnes's avatar
Matthew Barnes committed
125 126 127 128 129 130
};

/* Scope items are displayed in ascending order. */
enum {
	MAIL_SCOPE_CURRENT_FOLDER,
	MAIL_SCOPE_CURRENT_ACCOUNT,
131
	MAIL_SCOPE_ALL_ACCOUNTS
Matthew Barnes's avatar
Matthew Barnes committed
132 133
};

134 135 136 137 138 139
typedef enum  {
	E_MAIL_SEND_RECEIVE_BOTH,
	E_MAIL_SEND_RECEIVE_RECEIVE,
	E_MAIL_SEND_RECEIVE_SEND
} EMailSendReceiveMode;

Matthew Barnes's avatar
Matthew Barnes committed
140 141 142 143 144
struct _EMailShellViewPrivate {

	/*** Other Stuff ***/

	/* These are just for convenience. */
145
	EMailShellBackend *mail_shell_backend;
Matthew Barnes's avatar
Matthew Barnes committed
146 147
	EMailShellContent *mail_shell_content;
	EMailShellSidebar *mail_shell_sidebar;
148 149 150

	/* For UI merging and unmerging. */
	guint merge_id;
151
	guint label_merge_id;
152 153

	/* Filter rules correspond to the search entry menu. */
154
	EFilterRule *search_rules[MAIL_NUM_SEARCH_RULES];
155

156 157 158
	/* EShell::prepare-for-quit */
	gulong prepare_for_quit_handler_id;

159 160 161
	/* Search folders for interactive search. */
	CamelVeeFolder *search_account_all;
	CamelVeeFolder *search_account_current;
162
	GCancellable *search_account_cancel;
163

164
	guint show_deleted : 1;
165 166 167

	GtkToolItem *send_receive_tool_item;
	GtkToolItem *send_receive_tool_separator;
Matthew Barnes's avatar
Matthew Barnes committed
168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183
};

void		e_mail_shell_view_private_init
					(EMailShellView *mail_shell_view,
					 EShellViewClass *shell_view_class);
void		e_mail_shell_view_private_constructed
					(EMailShellView *mail_shell_view);
void		e_mail_shell_view_private_dispose
					(EMailShellView *mail_shell_view);
void		e_mail_shell_view_private_finalize
					(EMailShellView *mail_shell_view);

/* Private Utilities */

void		e_mail_shell_view_actions_init
					(EMailShellView *mail_shell_view);
184 185
void		e_mail_shell_view_restore_state
					(EMailShellView *mail_shell_view);
186 187 188 189 190 191
void		e_mail_shell_view_create_filter_from_selected
					(EMailShellView *mail_shell_view,
					 gint filter_type);
void		e_mail_shell_view_create_vfolder_from_selected
					(EMailShellView *mail_shell_view,
					 gint vfolder_type);
192
void		e_mail_shell_view_update_popup_labels
193 194 195
					(EMailShellView *mail_shell_view);
void		e_mail_shell_view_update_search_filter
					(EMailShellView *mail_shell_view);
196 197
void		e_mail_shell_view_update_sidebar
					(EMailShellView *mail_shell_view);
198 199 200 201 202 203
void		e_mail_shell_view_send_receive
					(EMailShellView *mail_shell_view,
					 EMailSendReceiveMode mode,
					 const gchar *account_uid);
void		e_mail_shell_view_update_send_receive_menus
					(EMailShellView *mail_shell_view);
Matthew Barnes's avatar
Matthew Barnes committed
204 205 206 207

G_END_DECLS

#endif /* E_MAIL_SHELL_VIEW_PRIVATE_H */