1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 /* Evolution calendar client interface object
4 * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
6 * Authors: Federico Mena-Quintero <federico@ximian.com>
7 * Rodrigo Moya <rodrigo@ximian.com>
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of version 2 of the GNU Lesser General Public
11 * License as published by the Free Software Foundation.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
27 #include <libedata-cal/e-data-cal-common.h>
28 #include <libedata-cal/e-data-cal-view.h>
29 #include <libedata-cal/e-data-cal-types.h>
35 #define E_TYPE_DATA_CAL (e_data_cal_get_type ())
36 #define E_DATA_CAL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_DATA_CAL, EDataCal))
37 #define E_DATA_CAL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_DATA_CAL, EDataCalClass))
38 #define E_IS_DATA_CAL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_DATA_CAL))
39 #define E_IS_DATA_CAL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), E_TYPE_DATA_CAL))
41 GQuark e_data_cal_error_quark (void);
48 #define E_DATA_CAL_ERROR e_data_cal_error_quark ()
51 * e_data_cal_create_error:
52 * @status: #EDataCalStatus code
53 * @custom_msg: Custom message to use for the error. When NULL,
54 * then uses a default message based on the @status code.
56 * Returns: NULL, when the @status is Success,
57 * or a newly allocated GError, which should be freed
58 * with g_error_free() call.
60 GError *e_data_cal_create_error (EDataCalCallStatus status, const gchar *custom_msg);
63 * e_data_cal_create_error_fmt:
65 * Similar as e_data_cal_create_error(), only here, instead of custom_msg,
66 * is used a printf() format to create a custom_msg for the error.
68 GError *e_data_cal_create_error_fmt (EDataCalCallStatus status, const gchar *custom_msg_fmt, ...) G_GNUC_PRINTF (2, 3);
70 const gchar *e_data_cal_status_to_string (EDataCalCallStatus status);
73 * e_return_data_cal_error_if_fail:
77 #define e_return_data_cal_error_if_fail(expr, _code) \
79 if (G_LIKELY (expr)) { \
81 g_log (G_LOG_DOMAIN, \
82 G_LOG_LEVEL_CRITICAL, \
83 "file %s: line %d (%s): assertion `%s' failed", \
84 __FILE__, __LINE__, G_STRFUNC, #expr); \
85 g_set_error (error, E_DATA_CAL_ERROR, (_code), \
86 "file %s: line %d (%s): assertion `%s' failed", \
87 __FILE__, __LINE__, G_STRFUNC, #expr); \
93 * e_return_data_cal_error_val_if_fail:
95 * Same as e_return_data_cal_error_if_fail(), only returns FALSE on a failure
99 #define e_return_data_cal_error_val_if_fail(expr, _code) \
101 if (G_LIKELY (expr)) { \
103 g_log (G_LOG_DOMAIN, \
104 G_LOG_LEVEL_CRITICAL, \
105 "file %s: line %d (%s): assertion `%s' failed", \
106 __FILE__, __LINE__, G_STRFUNC, #expr); \
107 g_set_error (error, E_DATA_CAL_ERROR, (_code), \
108 "file %s: line %d (%s): assertion `%s' failed", \
109 __FILE__, __LINE__, G_STRFUNC, #expr); \
114 typedef struct _EDataCalPrivate EDataCalPrivate;
118 EDataCalPrivate *priv;
121 struct _EDataCalClass {
122 GObjectClass parent_class;
125 GType e_data_cal_get_type (void);
127 EDataCal * e_data_cal_new (ECalBackend *backend);
128 ECalBackend * e_data_cal_get_backend (EDataCal *cal);
129 guint e_data_cal_register_gdbus_object (EDataCal *cal, GDBusConnection *connection, const gchar *object_path, GError **error);
131 void e_data_cal_respond_open (EDataCal *cal, guint32 opid, GError *error);
132 void e_data_cal_respond_remove (EDataCal *cal, guint32 opid, GError *error);
133 void e_data_cal_respond_refresh (EDataCal *cal, guint32 opid, GError *error);
134 void e_data_cal_respond_get_backend_property (EDataCal *cal, guint32 opid, GError *error, const gchar *prop_value);
135 void e_data_cal_respond_set_backend_property (EDataCal *cal, guint32 opid, GError *error);
136 void e_data_cal_respond_get_object (EDataCal *cal, guint32 opid, GError *error, const gchar *object);
137 void e_data_cal_respond_get_object_list (EDataCal *cal, guint32 opid, GError *error, const GSList *objects);
138 void e_data_cal_respond_get_free_busy (EDataCal *cal, guint32 opid, GError *error);
139 void e_data_cal_respond_create_objects (EDataCal *cal, guint32 opid, GError *error, const GSList *uids, /*const */ GSList *new_components);
140 void e_data_cal_respond_modify_objects (EDataCal *cal, guint32 opid, GError *error, /* const */ GSList *old_components, /* const */ GSList *new_components);
141 void e_data_cal_respond_remove_objects (EDataCal *cal, guint32 opid, GError *error, const GSList *ids, /* const */ GSList *old_components, /* const */ GSList *new_components);
142 void e_data_cal_respond_receive_objects (EDataCal *cal, guint32 opid, GError *error);
143 void e_data_cal_respond_send_objects (EDataCal *cal, guint32 opid, GError *error, const GSList *users, const gchar *calobj);
144 void e_data_cal_respond_get_attachment_uris (EDataCal *cal, guint32 opid, GError *error, const GSList *attachment_uris);
145 void e_data_cal_respond_discard_alarm (EDataCal *cal, guint32 opid, GError *error);
146 void e_data_cal_respond_get_view (EDataCal *cal, guint32 opid, GError *error, const gchar *view_path);
147 void e_data_cal_respond_get_timezone (EDataCal *cal, guint32 opid, GError *error, const gchar *tzobject);
148 void e_data_cal_respond_add_timezone (EDataCal *cal, guint32 opid, GError *error);
150 void e_data_cal_report_error (EDataCal *cal, const gchar *message);
151 void e_data_cal_report_readonly (EDataCal *cal, gboolean is_readonly);
152 void e_data_cal_report_online (EDataCal *cal, gboolean is_online);
153 void e_data_cal_report_opened (EDataCal *cal, const GError *error);
154 void e_data_cal_report_free_busy_data (EDataCal *cal, const GSList *freebusy);
155 void e_data_cal_report_backend_property_changed (EDataCal *cal, const gchar *prop_name, const gchar *prop_value);