1 /*
2  * Copyright (C) 2016 Red Hat, Inc. (www.redhat.com)
3  *
4  * This program is free software: you can redistribute it and/or modify it
5  * under the terms of the GNU General Public License as published by
6  * the Free Software Foundation.
7  *
8  * This program is distributed in the hope that it will be useful, but
9  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
10  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
11  * for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  *
16  */
17 
18 #ifndef E_MAIL_TEMPLATES_STORE_H
19 #define E_MAIL_TEMPLATES_STORE_H
20 
21 #include <glib.h>
22 #include <gtk/gtk.h>
23 
24 #include <camel/camel.h>
25 #include <libedataserver/libedataserver.h>
26 #include <libemail-engine/libemail-engine.h>
27 #include <mail/e-mail-account-store.h>
28 #include <shell/e-shell-view.h>
29 
30 /* Standard GObject macros */
31 #define E_TYPE_MAIL_TEMPLATES_STORE \
32 	(e_mail_templates_store_get_type ())
33 #define E_MAIL_TEMPLATES_STORE(obj) \
34 	(G_TYPE_CHECK_INSTANCE_CAST \
35 	((obj), E_TYPE_MAIL_TEMPLATES_STORE, EMailTemplatesStore))
36 #define E_MAIL_TEMPLATES_STORE_CLASS(cls) \
37 	(G_TYPE_CHECK_CLASS_CAST \
38 	((cls), E_TYPE_MAIL_TEMPLATES_STORE, EMailTemplatesStoreClass))
39 #define E_IS_MAIL_TEMPLATES_STORE(obj) \
40 	(G_TYPE_CHECK_INSTANCE_TYPE \
41 	((obj), E_TYPE_MAIL_TEMPLATES_STORE))
42 #define E_IS_MAIL_TEMPLATES_STORE_CLASS(cls) \
43 	(G_TYPE_CHECK_CLASS_TYPE \
44 	((cls), E_TYPE_MAIL_TEMPLATES_STORE))
45 #define E_MAIL_TEMPLATES_STORE_GET_CLASS(obj) \
46 	(G_TYPE_INSTANCE_GET_CLASS \
47 	((obj), E_TYPE_MAIL_TEMPLATES_STORE, EMailTemplatesStoreClass))
48 
49 G_BEGIN_DECLS
50 
51 enum {
52 	E_MAIL_TEMPLATES_STORE_COLUMN_DISPLAY_NAME = 0,	/* gchar * */
53 	E_MAIL_TEMPLATES_STORE_COLUMN_FOLDER,		/* CamelFolder * */
54 	E_MAIL_TEMPLATES_STORE_COLUMN_MESSAGE_UID,		/* gchar * */
55 	E_MAIL_TEMPLATES_STORE_N_COLUMNS
56 };
57 
58 typedef struct _EMailTemplatesStore EMailTemplatesStore;
59 typedef struct _EMailTemplatesStoreClass EMailTemplatesStoreClass;
60 typedef struct _EMailTemplatesStorePrivate EMailTemplatesStorePrivate;
61 
62 /**
63  * EMailTemplatesStore:
64  *
65  * Contains only private data that should be read and manipulated using
66  * the functions below.
67  **/
68 struct _EMailTemplatesStore {
69 	GObject parent;
70 	EMailTemplatesStorePrivate *priv;
71 };
72 
73 struct _EMailTemplatesStoreClass {
74 	GObjectClass parent_class;
75 
76 	/* Signals */
77 	void		(*changed)		(EMailTemplatesStore *templates_store);
78 };
79 
80 typedef void	(* EMailTemplatesStoreActionFunc)	(EMailTemplatesStore *templates_store,
81 						 CamelFolder *folder,
82 						 const gchar *message_uid,
83 						 gpointer user_data);
84 
85 GType		e_mail_templates_store_get_type	(void) G_GNUC_CONST;
86 EMailTemplatesStore *
87 		e_mail_templates_store_ref_default
88 						(EMailAccountStore *account_store);
89 EMailAccountStore *
90 		e_mail_templates_store_ref_account_store
91 						(EMailTemplatesStore *templates_store);
92 void		e_mail_templates_store_build_menu
93 						(EMailTemplatesStore *templates_store,
94 						 EShellView *shell_view,
95 						 GtkUIManager *ui_manager,
96 						 GtkActionGroup *action_group,
97 						 const gchar *base_menu_path,
98 						 const gchar *base_popup_path,
99 						 guint merge_id,
100 						 EMailTemplatesStoreActionFunc action_cb,
101 						 gpointer action_cb_user_data);
102 GtkTreeStore *	e_mail_templates_store_build_model
103 						(EMailTemplatesStore *templates_store,
104 						 const gchar *find_folder_uri,
105 						 const gchar *find_message_uid,
106 						 gboolean *out_found_message,
107 						 GtkTreeIter *out_found_iter);
108 
109 G_END_DECLS
110 
111 #endif /* E_MAIL_TEMPLATES_STORE_H */
112