aboutsummaryrefslogtreecommitdiffstats
path: root/modules/itip-formatter/itip-view.h
blob: ab8b0b8e20065f241bbe5c57b598280b94f6252d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
/*
 *
 * 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
 * License along with the program; if not, see <http://www.gnu.org/licenses/>
 *
 *
 * Authors:
 *      JP Rosevear <jpr@novell.com>
 *
 * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
 *
 */

#ifndef _ITIP_VIEW_H_
#define _ITIP_VIEW_H_

#include <stdarg.h>
#include <unistd.h>
#include <gtk/gtk.h>
#include <webkit/webkitdom.h>
#include <libecal/libecal.h>
#include <libedataserver/libedataserver.h>
#include <em-format/e-mail-formatter.h>

G_BEGIN_DECLS

#define ITIP_TYPE_VIEW            (itip_view_get_type ())
#define ITIP_VIEW(object)         (G_TYPE_CHECK_INSTANCE_CAST ((object), ITIP_TYPE_VIEW, ItipView))
#define ITIP_VIEW_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), ITIP_TYPE_VIEW, ItipViewClass))
#define ITIP_IS_VIEW(object)      (G_TYPE_CHECK_INSTANCE_TYPE ((object), ITIP_TYPE_VIEW))
#define ITIP_IS_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), ITIP_TYPE_VIEW))
#define ITIP_VIEW_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), ITIP_TYPE_VIEW, ItipViewClass))

typedef struct _ItipView        ItipView;
typedef struct _ItipViewPrivate ItipViewPrivate;
typedef struct _ItipViewClass   ItipViewClass;

struct _EMailPartItip;

typedef enum {
    ITIP_VIEW_MODE_NONE,
    ITIP_VIEW_MODE_PUBLISH,
    ITIP_VIEW_MODE_REQUEST,
    ITIP_VIEW_MODE_COUNTER,
    ITIP_VIEW_MODE_DECLINECOUNTER,
    ITIP_VIEW_MODE_ADD,
    ITIP_VIEW_MODE_REPLY,
    ITIP_VIEW_MODE_REFRESH,
    ITIP_VIEW_MODE_CANCEL,
    ITIP_VIEW_MODE_HIDE_ALL
} ItipViewMode;

typedef enum {
    ITIP_VIEW_RESPONSE_NONE,
    ITIP_VIEW_RESPONSE_ACCEPT,
    ITIP_VIEW_RESPONSE_TENTATIVE,
    ITIP_VIEW_RESPONSE_DECLINE,
    ITIP_VIEW_RESPONSE_UPDATE,
    ITIP_VIEW_RESPONSE_CANCEL,
    ITIP_VIEW_RESPONSE_REFRESH,
    ITIP_VIEW_RESPONSE_OPEN,
    ITIP_VIEW_RESPONSE_SAVE
} ItipViewResponse;

typedef enum {
    ITIP_VIEW_INFO_ITEM_TYPE_NONE,
    ITIP_VIEW_INFO_ITEM_TYPE_INFO,
    ITIP_VIEW_INFO_ITEM_TYPE_WARNING,
    ITIP_VIEW_INFO_ITEM_TYPE_ERROR,
    ITIP_VIEW_INFO_ITEM_TYPE_PROGRESS
} ItipViewInfoItemType;

struct _ItipView {
    GObject parent_instance;

    ItipViewPrivate *priv;
};

struct _ItipViewClass {
    GObjectClass parent_class;

    void    (* source_selected)             (ItipView *view,
                                                 ESource *selected_source);

    void    (* response)                    (ItipView *view,
                                                 gint response);
};

GType           itip_view_get_type              (void);

ItipView *      itip_view_new                   (struct _EMailPartItip *puri,
                         ESourceRegistry *registry);
void        itip_view_init_view     (ItipView *view);

void            itip_view_write                 (EMailFormatter *formatter,
                         GString *buffer);

void            itip_view_write_for_printing    (ItipView *view,
                                                 GString *buffer);

void            itip_view_create_dom_bindings   (ItipView *view,
                                                 WebKitDOMElement *element);

struct _EMailPartItip *
        itip_view_get_mail_part     (ItipView *view);
ESourceRegistry *
        itip_view_get_registry      (ItipView *view);
const gchar *   itip_view_get_extension_name    (ItipView *view);
void        itip_view_set_extension_name    (ItipView *view,
                         const gchar *extension_name);

void            itip_view_set_mode              (ItipView *view,
                                                 ItipViewMode mode);
ItipViewMode    itip_view_get_mode              (ItipView *view);

void            itip_view_set_item_type         (ItipView *view,
                                                 ECalClientSourceType type);
ECalClientSourceType
                itip_view_get_item_type         (ItipView *view);

void            itip_view_set_organizer         (ItipView *view,
                                                 const gchar *organizer);
const gchar *    itip_view_get_organizer         (ItipView *view);

void            itip_view_set_organizer_sentby  (ItipView *view,
                                                 const gchar *sentby);
const gchar *    itip_view_get_organizer_sentby  (ItipView *view);

void            itip_view_set_attendee          (ItipView *view,
                                                 const gchar *attendee);
const gchar *    itip_view_get_attendee          (ItipView *view);

void            itip_view_set_attendee_sentby   (ItipView *view,
                                                 const gchar *sentby);
const gchar *    itip_view_get_attendee_sentby   (ItipView *view);

void            itip_view_set_delegator         (ItipView *view,
                                                 const gchar *delegator);
const gchar *    itip_view_get_delegator         (ItipView *view);

void            itip_view_set_proxy             (ItipView *view,
                                                 const gchar *proxy);
const gchar *    itip_view_get_proxy             (ItipView *view);

void            itip_view_set_summary           (ItipView *view,
                                                 const gchar *summary);
const gchar *    itip_view_get_summary           (ItipView *view);

void            itip_view_set_location          (ItipView *view,
                                                 const gchar *location);
const gchar *    itip_view_get_location          (ItipView *view);

void            itip_view_set_status            (ItipView *view,
                                                 const gchar *status);
const gchar *    itip_view_get_status            (ItipView *view);

void            itip_view_set_comment           (ItipView *view,
                                                 const gchar *comment);
const gchar *    itip_view_get_comment           (ItipView *view);

void            itip_view_set_description       (ItipView *view,
                                                 const gchar *description);
const gchar *    itip_view_get_description       (ItipView *view);

void            itip_view_set_start             (ItipView *view,
                                                 struct tm *start,
                                                 gboolean is_date);
const struct tm *
                itip_view_get_start             (ItipView *view,
                                                 gboolean *is_date);

void            itip_view_set_end               (ItipView *view,
                                                 struct tm *end,
                                                 gboolean is_date);
const struct tm *
                itip_view_get_end               (ItipView *view,
                                                 gboolean *is_date);

guint           itip_view_add_upper_info_item   (ItipView *view,
                                                 ItipViewInfoItemType type,
                                                 const gchar *message);
guint           itip_view_add_upper_info_item_printf
                                                (ItipView *view,
                                                 ItipViewInfoItemType,
                                                 const gchar *format, ...) G_GNUC_PRINTF (3, 4);
void            itip_view_remove_upper_info_item
                                                (ItipView *view,
                                                 guint id);
void            itip_view_clear_upper_info_items
                                                (ItipView *view);

guint           itip_view_add_lower_info_item   (ItipView *view,
                                                 ItipViewInfoItemType type,
                                                 const gchar *message);
guint           itip_view_add_lower_info_item_printf
                                                (ItipView *view,
                                                 ItipViewInfoItemType type,
                                                 const gchar *format, ...) G_GNUC_PRINTF (3, 4);
void            itip_view_remove_lower_info_item
                                                (ItipView *view,
                                                 guint id);
void            itip_view_clear_lower_info_items
                                                (ItipView *view);

void            itip_view_set_source            (ItipView *view,
                                                 ESource *source);
ESource *        itip_view_ref_source       (ItipView *view);

void            itip_view_set_rsvp              (ItipView *view,
                                                 gboolean rsvp);
gboolean        itip_view_get_rsvp              (ItipView *view);

void            itip_view_set_show_rsvp_check   (ItipView *view,
                                                 gboolean show);
gboolean        itip_view_get_show_rsvp_check   (ItipView *view);

void            itip_view_set_update            (ItipView *view,
                                                 gboolean update);
gboolean        itip_view_get_update            (ItipView *view);

void            itip_view_set_show_update_check (ItipView *view,
                                                 gboolean show);
gboolean        itip_view_get_show_update_check (ItipView *view);

void            itip_view_set_rsvp_comment      (ItipView *view,
                                                 const gchar *comment);
gchar *          itip_view_get_rsvp_comment      (ItipView *view);

void            itip_view_set_buttons_sensitive (ItipView *view,
                                                 gboolean sensitive);
gboolean        itip_view_get_buttons_sensitive (ItipView *view);

void            itip_view_set_show_recur_check  (ItipView *view,
                                                 gboolean show);
gboolean        itip_view_get_recur_check_state (ItipView *view);

void            itip_view_set_needs_decline     (ItipView *view,
                                                 gboolean needs_decline);

void            itip_view_set_show_free_time_check
                                                (ItipView *view,
                                                 gboolean show);
gboolean        itip_view_get_free_time_check_state
                                                (ItipView *view);

void            itip_view_set_show_keep_alarm_check
                                                (ItipView *view,
                                                 gboolean show);
gboolean        itip_view_get_keep_alarm_check_state
                                                (ItipView *view);

void            itip_view_set_show_inherit_alarm_check
                                                (ItipView *view,
                                                 gboolean show);
gboolean        itip_view_get_inherit_alarm_check_state
                                                (ItipView *view);

void            itip_view_set_error             (ItipView *view,
                                                 const gchar *error_html,
                                                 gboolean show_save_btn);

G_END_DECLS

#endif