"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/calendar/libedata-cal/e-data-cal.c" between
evolution-data-server-3.32.4.tar.xz and evolution-data-server-3.34.0.tar.xz

About: Evolution-Data-Server manages access to the calendar, tasks and addressbook information available for Evolution and other applications.

e-data-cal.c  (evolution-data-server-3.32.4.tar.xz):e-data-cal.c  (evolution-data-server-3.34.0.tar.xz)
skipping to change at line 29 skipping to change at line 29
* SECTION: e-data-cal * SECTION: e-data-cal
* @include: libedata-cal/libedata-cal.h * @include: libedata-cal/libedata-cal.h
* @short_description: Server side D-Bus layer to communicate with calendars * @short_description: Server side D-Bus layer to communicate with calendars
* *
* This class communicates with #ECalClients over the bus and accesses * This class communicates with #ECalClients over the bus and accesses
* an #ECalBackend to satisfy client requests. * an #ECalBackend to satisfy client requests.
**/ **/
#include "evolution-data-server-config.h" #include "evolution-data-server-config.h"
#include <libical/ical.h>
#include <glib/gi18n-lib.h> #include <glib/gi18n-lib.h>
#include <unistd.h> #include <unistd.h>
/* Private D-Bus classes. */ /* Private D-Bus classes. */
#include <e-dbus-calendar.h> #include <e-dbus-calendar.h>
#include <libedataserver/libedataserver.h> #include <libedataserver/libedataserver.h>
#include "e-data-cal.h" #include "e-data-cal.h"
#include "e-cal-backend.h" #include "e-cal-backend.h"
#include "e-cal-backend-sexp.h" #include "e-cal-backend-sexp.h"
#define E_DATA_CAL_GET_PRIVATE(obj) \ #define E_DATA_CAL_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE \ (G_TYPE_INSTANCE_GET_PRIVATE \
((obj), E_TYPE_DATA_CAL, EDataCalPrivate)) ((obj), E_TYPE_DATA_CAL, EDataCalPrivate))
#define EDC_ERROR(_code) e_data_cal_create_error (_code, NULL)
#define EDC_ERROR_EX(_code, _msg) e_data_cal_create_error (_code, _msg)
typedef struct _AsyncContext AsyncContext; typedef struct _AsyncContext AsyncContext;
struct _EDataCalPrivate { struct _EDataCalPrivate {
GDBusConnection *connection; GDBusConnection *connection;
EDBusCalendar *dbus_interface; EDBusCalendar *dbus_interface;
GWeakRef backend; GWeakRef backend;
gchar *object_path; gchar *object_path;
GMutex sender_lock; GMutex sender_lock;
GHashTable *sender_table; GHashTable *sender_table;
skipping to change at line 223 skipping to change at line 219
static void static void
data_cal_convert_to_client_error (GError *error) data_cal_convert_to_client_error (GError *error)
{ {
g_return_if_fail (error != NULL); g_return_if_fail (error != NULL);
/* Data-Factory returns common error for unknown/broken ESource-s */ /* Data-Factory returns common error for unknown/broken ESource-s */
if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND)) { if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND)) {
error->domain = E_CAL_CLIENT_ERROR; error->domain = E_CAL_CLIENT_ERROR;
error->code = E_CAL_CLIENT_ERROR_NO_SUCH_CALENDAR; error->code = E_CAL_CLIENT_ERROR_NO_SUCH_CALENDAR;
return;
} }
if (error->domain != E_DATA_CAL_ERROR)
return;
switch (error->code) {
case RepositoryOffline:
error->domain = E_CLIENT_ERROR;
error->code = E_CLIENT_ERROR_REPOSITORY_OFFLINE;
break;
case PermissionDenied:
error->domain = E_CLIENT_ERROR;
error->code = E_CLIENT_ERROR_PERMISSION_DENIED;
break;
case InvalidRange:
error->domain = E_CAL_CLIENT_ERROR;
error->code = E_CAL_CLIENT_ERROR_INVALID_RANGE;
break;
case ObjectNotFound:
error->domain = E_CAL_CLIENT_ERROR;
error->code = E_CAL_CLIENT_ERROR_OBJECT_NOT_FOUND;
break;
case InvalidObject:
error->domain = E_CAL_CLIENT_ERROR;
error->code = E_CAL_CLIENT_ERROR_INVALID_OBJECT;
break;
case ObjectIdAlreadyExists:
error->domain = E_CAL_CLIENT_ERROR;
error->code = E_CAL_CLIENT_ERROR_OBJECT_ID_ALREADY_EXISTS
;
break;
case AuthenticationFailed:
error->domain = E_CLIENT_ERROR;
error->code = E_CLIENT_ERROR_AUTHENTICATION_FAILED;
break;
case AuthenticationRequired:
error->domain = E_CLIENT_ERROR;
error->code = E_CLIENT_ERROR_AUTHENTICATION_REQUIRED;
break;
case UnsupportedAuthenticationMethod:
error->domain = E_CLIENT_ERROR;
error->code = E_CLIENT_ERROR_UNSUPPORTED_AUTHENTICATION_M
ETHOD;
break;
case TLSNotAvailable:
error->domain = E_CLIENT_ERROR;
error->code = E_CLIENT_ERROR_TLS_NOT_AVAILABLE;
break;
case NoSuchCal:
error->domain = E_CAL_CLIENT_ERROR;
error->code = E_CAL_CLIENT_ERROR_NO_SUCH_CALENDAR;
break;
case UnknownUser:
error->domain = E_CAL_CLIENT_ERROR;
error->code = E_CAL_CLIENT_ERROR_UNKNOWN_USER;
break;
case OfflineUnavailable:
error->domain = E_CLIENT_ERROR;
error->code = E_CLIENT_ERROR_OFFLINE_UNAVAILABLE;
break;
case SearchSizeLimitExceeded:
error->domain = E_CLIENT_ERROR;
error->code = E_CLIENT_ERROR_SEARCH_SIZE_LIMIT_EXCEEDED;
break;
case SearchTimeLimitExceeded:
error->domain = E_CLIENT_ERROR;
error->code = E_CLIENT_ERROR_SEARCH_TIME_LIMIT_EXCEEDED;
break;
case InvalidQuery:
error->domain = E_CLIENT_ERROR;
error->code = E_CLIENT_ERROR_INVALID_QUERY;
break;
case QueryRefused:
error->domain = E_CLIENT_ERROR;
error->code = E_CLIENT_ERROR_QUERY_REFUSED;
break;
case CouldNotCancel:
error->domain = E_CLIENT_ERROR;
error->code = E_CLIENT_ERROR_COULD_NOT_CANCEL;
break;
case InvalidArg:
error->domain = E_CLIENT_ERROR;
error->code = E_CLIENT_ERROR_INVALID_ARG;
break;
case NotSupported:
error->domain = E_CLIENT_ERROR;
error->code = E_CLIENT_ERROR_NOT_SUPPORTED;
break;
case NotOpened:
error->domain = E_CLIENT_ERROR;
error->code = E_CLIENT_ERROR_NOT_OPENED;
break;
case UnsupportedField:
case UnsupportedMethod:
case OtherError:
case InvalidServerVersion:
error->domain = E_CLIENT_ERROR;
error->code = E_CLIENT_ERROR_OTHER_ERROR;
break;
default:
g_warn_if_reached ();
}
}
/* Create the EDataCal error quark */
GQuark
e_data_cal_error_quark (void)
{
#define ERR_PREFIX "org.gnome.evolution.dataserver.Calendar."
static const GDBusErrorEntry entries[] = {
{ Success, ERR_PREFIX "Success" },
{ Busy, ERR_PREFIX "Busy" },
{ RepositoryOffline, ERR_PREFIX "RepositoryOff
line" },
{ PermissionDenied, ERR_PREFIX "PermissionDen
ied" },
{ InvalidRange, ERR_PREFIX "InvalidRange"
},
{ ObjectNotFound, ERR_PREFIX "ObjectNotFoun
d" },
{ InvalidObject, ERR_PREFIX "InvalidObject
" },
{ ObjectIdAlreadyExists, ERR_PREFIX "ObjectIdAlrea
dyExists" },
{ AuthenticationFailed, ERR_PREFIX "Authenticatio
nFailed" },
{ AuthenticationRequired, ERR_PREFIX "Authenticatio
nRequired" },
{ UnsupportedField, ERR_PREFIX "UnsupportedFi
eld" },
{ UnsupportedMethod, ERR_PREFIX "UnsupportedMe
thod" },
{ UnsupportedAuthenticationMethod, ERR_PREFIX "UnsupportedAu
thenticationMethod" },
{ TLSNotAvailable, ERR_PREFIX "TLSNotAvailab
le" },
{ NoSuchCal, ERR_PREFIX "NoSuchCal" },
{ UnknownUser, ERR_PREFIX "UnknownUser"
},
{ OfflineUnavailable, ERR_PREFIX "OfflineUnavai
lable" },
{ SearchSizeLimitExceeded, ERR_PREFIX "SearchSizeLim
itExceeded" },
{ SearchTimeLimitExceeded, ERR_PREFIX "SearchTimeLim
itExceeded" },
{ InvalidQuery, ERR_PREFIX "InvalidQuery"
},
{ QueryRefused, ERR_PREFIX "QueryRefused"
},
{ CouldNotCancel, ERR_PREFIX "CouldNotCance
l" },
{ OtherError, ERR_PREFIX "OtherError" }
,
{ InvalidServerVersion, ERR_PREFIX "InvalidServer
Version" },
{ InvalidArg, ERR_PREFIX "InvalidArg" }
,
{ NotSupported, ERR_PREFIX "NotSupported"
},
{ NotOpened, ERR_PREFIX "NotOpened" }
};
#undef ERR_PREFIX
static volatile gsize quark_volatile = 0;
g_dbus_error_register_error_domain ("e-data-cal-error", &quark_volatile,
entries, G_N_ELEMENTS (entries));
return (GQuark) quark_volatile;
}
/**
* e_data_cal_status_to_string:
* @status: an #EDataCalCallStatus
*
* Returns: A localized text representation of the @status.
*
* Since: 2.32
**/
const gchar *
e_data_cal_status_to_string (EDataCalCallStatus status)
{
gint i;
static struct _statuses {
EDataCalCallStatus status;
const gchar *msg;
} statuses[] = {
{ Success, N_("Success") },
{ Busy, N_("Backend is busy") },
{ RepositoryOffline, N_("Repository offline")
},
{ PermissionDenied, N_("Permission denied") }
,
{ InvalidRange, N_("Invalid range") },
{ ObjectNotFound, N_("Object not found") },
{ InvalidObject, N_("Invalid object") },
{ ObjectIdAlreadyExists, N_("Object ID already exi
sts") },
{ AuthenticationFailed, N_("Authentication Failed
") },
{ AuthenticationRequired, N_("Authentication Requir
ed") },
{ UnsupportedField, N_("Unsupported field") }
,
{ UnsupportedMethod, N_("Unsupported method")
},
{ UnsupportedAuthenticationMethod, N_("Unsupported authentic
ation method") },
{ TLSNotAvailable, N_("TLS not available") }
,
{ NoSuchCal, N_("Calendar does not exi
st") },
{ UnknownUser, N_("Unknown user") },
{ OfflineUnavailable, N_("Not available in offl
ine mode") },
{ SearchSizeLimitExceeded, N_("Search size limit exc
eeded") },
{ SearchTimeLimitExceeded, N_("Search time limit exc
eeded") },
{ InvalidQuery, N_("Invalid query") },
{ QueryRefused, N_("Query refused") },
{ CouldNotCancel, N_("Could not cancel") },
/* { OtherError, N_("Other error") }, */
{ InvalidServerVersion, N_("Invalid server versio
n") },
{ InvalidArg, N_("Invalid argument") },
/* Translators: The string for NOT_SUPPORTED error */
{ NotSupported, N_("Not supported") },
{ NotOpened, N_("Backend is not opened
yet") }
};
for (i = 0; i < G_N_ELEMENTS (statuses); i++) {
if (statuses[i].status == status)
return _(statuses[i].msg);
}
return _("Other error");
}
/**
* e_data_cal_create_error:
* @status: #EDataCalCallStatus code
* @custom_msg: Custom message to use for the error. When NULL,
* then uses a default message based on the @status code.
*
* Returns: (nullable) (transfer full): %NULL, when the @status is Success,
* or a newly allocated GError, which should be freed
* with g_error_free() call.
*
* Since: 2.32
**/
GError *
e_data_cal_create_error (EDataCalCallStatus status,
const gchar *custom_msg)
{
if (status == Success)
return NULL;
return g_error_new_literal (E_DATA_CAL_ERROR, status, custom_msg ? custom
_msg : e_data_cal_status_to_string (status));
}
/**
* e_data_cal_create_error_fmt:
* @status: an #EDataCalCallStatus
* @custom_msg_fmt: (nullable): message format, or %NULL to use the default mess
age for the @status
* @...: arguments for the format
*
* Similar as e_data_cal_create_error(), only here, instead of custom_msg,
* is used a printf() format to create a custom message for the error.
*
* Returns: (nullable) (transfer full): %NULL, when the @status is Success,
* or a newly allocated #GError, which should be freed with g_error_free() cal
l.
* The #GError has set the custom message, or the default message for
* @status, when @custom_msg_fmt is %NULL.
*
* Since: 2.32
**/
GError *
e_data_cal_create_error_fmt (EDataCalCallStatus status,
const gchar *custom_msg_fmt,
...)
{
GError *error;
gchar *custom_msg;
va_list ap;
if (!custom_msg_fmt)
return e_data_cal_create_error (status, NULL);
va_start (ap, custom_msg_fmt);
custom_msg = g_strdup_vprintf (custom_msg_fmt, ap);
va_end (ap);
error = e_data_cal_create_error (status, custom_msg);
g_free (custom_msg);
return error;
} }
static GPtrArray * static GPtrArray *
data_cal_encode_properties (EDBusCalendar *dbus_interface) data_cal_encode_properties (EDBusCalendar *dbus_interface)
{ {
GPtrArray *properties_array; GPtrArray *properties_array;
g_warn_if_fail (E_DBUS_IS_CALENDAR (dbus_interface)); g_warn_if_fail (E_DBUS_IS_CALENDAR (dbus_interface));
properties_array = g_ptr_array_new_with_free_func (g_free); properties_array = g_ptr_array_new_with_free_func (g_free);
skipping to change at line 955 skipping to change at line 668
async_context->invocation, error); async_context->invocation, error);
} }
async_context_free (async_context); async_context_free (async_context);
} }
static gboolean static gboolean
data_cal_handle_create_objects_cb (EDBusCalendar *dbus_interface, data_cal_handle_create_objects_cb (EDBusCalendar *dbus_interface,
GDBusMethodInvocation *invocation, GDBusMethodInvocation *invocation,
const gchar * const *in_calobjs, const gchar * const *in_calobjs,
guint32 in_opflags,
EDataCal *data_cal) EDataCal *data_cal)
{ {
ECalBackend *backend; ECalBackend *backend;
AsyncContext *async_context; AsyncContext *async_context;
backend = e_data_cal_ref_backend (data_cal); backend = e_data_cal_ref_backend (data_cal);
g_return_val_if_fail (backend != NULL, FALSE); g_return_val_if_fail (backend != NULL, FALSE);
async_context = async_context_new (data_cal, invocation); async_context = async_context_new (data_cal, invocation);
e_cal_backend_create_objects ( e_cal_backend_create_objects (
backend, backend,
in_calobjs, in_calobjs,
in_opflags,
async_context->cancellable, async_context->cancellable,
data_cal_complete_create_objects_cb, data_cal_complete_create_objects_cb,
async_context); async_context);
g_object_unref (backend); g_object_unref (backend);
return TRUE; return TRUE;
} }
static void static void
skipping to change at line 1006 skipping to change at line 721
} }
async_context_free (async_context); async_context_free (async_context);
} }
static gboolean static gboolean
data_cal_handle_modify_objects_cb (EDBusCalendar *dbus_interface, data_cal_handle_modify_objects_cb (EDBusCalendar *dbus_interface,
GDBusMethodInvocation *invocation, GDBusMethodInvocation *invocation,
const gchar * const *in_ics_objects, const gchar * const *in_ics_objects,
const gchar *in_mod_type, const gchar *in_mod_type,
guint32 in_opflags,
EDataCal *data_cal) EDataCal *data_cal)
{ {
ECalBackend *backend; ECalBackend *backend;
AsyncContext *async_context; AsyncContext *async_context;
GFlagsClass *flags_class; GFlagsClass *flags_class;
ECalObjModType mod = 0; ECalObjModType mod = 0;
gchar **flags_strv; gchar **flags_strv;
gint ii; gint ii;
backend = e_data_cal_ref_backend (data_cal); backend = e_data_cal_ref_backend (data_cal);
skipping to change at line 1040 skipping to change at line 756
G_STRFUNC, flags_strv[ii]); G_STRFUNC, flags_strv[ii]);
} }
} }
g_strfreev (flags_strv); g_strfreev (flags_strv);
g_type_class_unref (flags_class); g_type_class_unref (flags_class);
async_context = async_context_new (data_cal, invocation); async_context = async_context_new (data_cal, invocation);
e_cal_backend_modify_objects ( e_cal_backend_modify_objects (
backend, backend,
in_ics_objects, mod, in_ics_objects, mod, in_opflags,
async_context->cancellable, async_context->cancellable,
data_cal_complete_modify_objects_cb, data_cal_complete_modify_objects_cb,
async_context); async_context);
g_object_unref (backend); g_object_unref (backend);
return TRUE; return TRUE;
} }
static void static void
skipping to change at line 1079 skipping to change at line 795
} }
async_context_free (async_context); async_context_free (async_context);
} }
static gboolean static gboolean
data_cal_handle_remove_objects_cb (EDBusCalendar *dbus_interface, data_cal_handle_remove_objects_cb (EDBusCalendar *dbus_interface,
GDBusMethodInvocation *invocation, GDBusMethodInvocation *invocation,
GVariant *in_uid_rid_array, GVariant *in_uid_rid_array,
const gchar *in_mod_type, const gchar *in_mod_type,
guint32 in_opflags,
EDataCal *data_cal) EDataCal *data_cal)
{ {
ECalBackend *backend; ECalBackend *backend;
AsyncContext *async_context; AsyncContext *async_context;
GFlagsClass *flags_class; GFlagsClass *flags_class;
ECalObjModType mod = 0; ECalObjModType mod = 0;
GQueue component_ids = G_QUEUE_INIT; GQueue component_ids = G_QUEUE_INIT;
gchar **flags_strv; gchar **flags_strv;
gsize n_children, ii; gsize n_children, ii;
skipping to change at line 1112 skipping to change at line 829
g_warning ( g_warning (
"%s: Unknown flag: %s", "%s: Unknown flag: %s",
G_STRFUNC, flags_strv[ii]); G_STRFUNC, flags_strv[ii]);
} }
} }
g_strfreev (flags_strv); g_strfreev (flags_strv);
g_type_class_unref (flags_class); g_type_class_unref (flags_class);
n_children = g_variant_n_children (in_uid_rid_array); n_children = g_variant_n_children (in_uid_rid_array);
for (ii = 0; ii < n_children; ii++) { for (ii = 0; ii < n_children; ii++) {
ECalComponentId *id; gchar *uid = NULL, *rid = NULL;
/* e_cal_component_free_id() uses g_free(),
* not g_slice_free(). Therefore allocate
* with g_malloc(), not g_slice_new(). */
id = g_malloc0 (sizeof (ECalComponentId));
g_variant_get_child ( g_variant_get_child (in_uid_rid_array, ii, "(ss)", &uid, &rid);
in_uid_rid_array, ii, "(ss)", &id->uid, &id->rid);
if (id->uid != NULL && *id->uid == '\0') { if (!uid || !*uid) {
e_cal_component_free_id (id); g_free (uid);
g_free (rid);
continue; continue;
} }
/* Recurrence ID is optional. Its omission is denoted g_queue_push_tail (&component_ids, e_cal_component_id_new_take (u
* via D-Bus by an empty string. Convert it to NULL. */ id, rid));
if (id->rid != NULL && *id->rid == '\0') {
g_free (id->rid);
id->rid = NULL;
}
g_queue_push_tail (&component_ids, id);
} }
async_context = async_context_new (data_cal, invocation); async_context = async_context_new (data_cal, invocation);
e_cal_backend_remove_objects ( e_cal_backend_remove_objects (
backend, backend,
component_ids.head, mod, component_ids.head, mod, in_opflags,
async_context->cancellable, async_context->cancellable,
data_cal_complete_remove_objects_cb, data_cal_complete_remove_objects_cb,
async_context); async_context);
while (!g_queue_is_empty (&component_ids)) while (!g_queue_is_empty (&component_ids))
e_cal_component_free_id (g_queue_pop_head (&component_ids)); e_cal_component_id_free (g_queue_pop_head (&component_ids));
g_object_unref (backend); g_object_unref (backend);
return TRUE; return TRUE;
} }
static void static void
data_cal_complete_receive_objects_cb (GObject *source_object, data_cal_complete_receive_objects_cb (GObject *source_object,
GAsyncResult *result, GAsyncResult *result,
gpointer user_data) gpointer user_data)
skipping to change at line 1182 skipping to change at line 887
async_context->invocation, error); async_context->invocation, error);
} }
async_context_free (async_context); async_context_free (async_context);
} }
static gboolean static gboolean
data_cal_handle_receive_objects_cb (EDBusCalendar *dbus_interface, data_cal_handle_receive_objects_cb (EDBusCalendar *dbus_interface,
GDBusMethodInvocation *invocation, GDBusMethodInvocation *invocation,
const gchar *in_calobj, const gchar *in_calobj,
guint32 in_opflags,
EDataCal *data_cal) EDataCal *data_cal)
{ {
ECalBackend *backend; ECalBackend *backend;
AsyncContext *async_context; AsyncContext *async_context;
backend = e_data_cal_ref_backend (data_cal); backend = e_data_cal_ref_backend (data_cal);
g_return_val_if_fail (backend != NULL, FALSE); g_return_val_if_fail (backend != NULL, FALSE);
async_context = async_context_new (data_cal, invocation); async_context = async_context_new (data_cal, invocation);
e_cal_backend_receive_objects ( e_cal_backend_receive_objects (
backend, backend,
in_calobj, in_calobj,
in_opflags,
async_context->cancellable, async_context->cancellable,
data_cal_complete_receive_objects_cb, data_cal_complete_receive_objects_cb,
async_context); async_context);
g_object_unref (backend); g_object_unref (backend);
return TRUE; return TRUE;
} }
static void static void
skipping to change at line 1262 skipping to change at line 969
async_context->invocation, error); async_context->invocation, error);
} }
async_context_free (async_context); async_context_free (async_context);
} }
static gboolean static gboolean
data_cal_handle_send_objects_cb (EDBusCalendar *dbus_interface, data_cal_handle_send_objects_cb (EDBusCalendar *dbus_interface,
GDBusMethodInvocation *invocation, GDBusMethodInvocation *invocation,
const gchar *in_calobj, const gchar *in_calobj,
guint32 in_opflags,
EDataCal *data_cal) EDataCal *data_cal)
{ {
ECalBackend *backend; ECalBackend *backend;
AsyncContext *async_context; AsyncContext *async_context;
backend = e_data_cal_ref_backend (data_cal); backend = e_data_cal_ref_backend (data_cal);
g_return_val_if_fail (backend != NULL, FALSE); g_return_val_if_fail (backend != NULL, FALSE);
async_context = async_context_new (data_cal, invocation); async_context = async_context_new (data_cal, invocation);
e_cal_backend_send_objects ( e_cal_backend_send_objects (
backend, backend,
in_calobj, in_calobj,
in_opflags,
async_context->cancellable, async_context->cancellable,
data_cal_complete_send_objects_cb, data_cal_complete_send_objects_cb,
async_context); async_context);
g_object_unref (backend); g_object_unref (backend);
return TRUE; return TRUE;
} }
static void static void
skipping to change at line 1387 skipping to change at line 1096
async_context_free (async_context); async_context_free (async_context);
} }
static gboolean static gboolean
data_cal_handle_discard_alarm_cb (EDBusCalendar *dbus_interface, data_cal_handle_discard_alarm_cb (EDBusCalendar *dbus_interface,
GDBusMethodInvocation *invocation, GDBusMethodInvocation *invocation,
const gchar *in_uid, const gchar *in_uid,
const gchar *in_rid, const gchar *in_rid,
const gchar *in_alarm_uid, const gchar *in_alarm_uid,
guint32 in_opflags,
EDataCal *data_cal) EDataCal *data_cal)
{ {
ECalBackend *backend; ECalBackend *backend;
AsyncContext *async_context; AsyncContext *async_context;
/* Recurrence ID is optional. Its omission is denoted /* Recurrence ID is optional. Its omission is denoted
* via D-Bus by an empty string. Convert it to NULL. */ * via D-Bus by an empty string. Convert it to NULL. */
if (in_rid != NULL && *in_rid == '\0') if (in_rid != NULL && *in_rid == '\0')
in_rid = NULL; in_rid = NULL;
backend = e_data_cal_ref_backend (data_cal); backend = e_data_cal_ref_backend (data_cal);
g_return_val_if_fail (backend != NULL, FALSE); g_return_val_if_fail (backend != NULL, FALSE);
async_context = async_context_new (data_cal, invocation); async_context = async_context_new (data_cal, invocation);
e_cal_backend_discard_alarm ( e_cal_backend_discard_alarm (
backend, backend,
in_uid, in_rid, in_alarm_uid, in_uid, in_rid, in_alarm_uid, in_opflags,
async_context->cancellable, async_context->cancellable,
data_cal_complete_discard_alarm_cb, data_cal_complete_discard_alarm_cb,
async_context); async_context);
g_object_unref (backend); g_object_unref (backend);
return TRUE; return TRUE;
} }
static gboolean static gboolean
skipping to change at line 1762 skipping to change at line 1472
g_object_unref (simple); g_object_unref (simple);
g_object_unref (backend); g_object_unref (backend);
} }
/** /**
* e_data_cal_respond_get_object_list: * e_data_cal_respond_get_object_list:
* @cal: A calendar client interface. * @cal: A calendar client interface.
* @opid: associated operation id * @opid: associated operation id
* @error: Operation error, if any, automatically freed if passed it. * @error: Operation error, if any, automatically freed if passed it.
* @objects: List of retrieved objects. * @objects: (element-type utf8): List of retrieved objects.
* *
* Notifies listeners of the completion of the get_object_list method call. * Notifies listeners of the completion of the get_object_list method call.
* *
* Since: 3.2 * Since: 3.2
*/ */
void void
e_data_cal_respond_get_object_list (EDataCal *cal, e_data_cal_respond_get_object_list (EDataCal *cal,
guint32 opid, guint32 opid,
GError *error, GError *error,
const GSList *objects) const GSList *objects)
skipping to change at line 1817 skipping to change at line 1527
g_object_unref (simple); g_object_unref (simple);
g_object_unref (backend); g_object_unref (backend);
} }
/** /**
* e_data_cal_respond_get_free_busy: * e_data_cal_respond_get_free_busy:
* @cal: A calendar client interface. * @cal: A calendar client interface.
* @opid: associated operation id * @opid: associated operation id
* @error: Operation error, if any, automatically freed if passed it. * @error: Operation error, if any, automatically freed if passed it.
* @freebusy: a #GSList of iCalendar strings with all gathered free/busy compone nts. * @freebusy: (element-type utf8): a #GSList of iCalendar strings with all gathe red free/busy components.
* *
* Notifies listeners of the completion of the get_free_busy method call. * Notifies listeners of the completion of the get_free_busy method call.
* To pass actual free/busy objects to the client asynchronously * To pass actual free/busy objects to the client asynchronously
* use e_data_cal_report_free_busy_data(), but the @freebusy should contain * use e_data_cal_report_free_busy_data(), but the @freebusy should contain
* all the objects being used in e_data_cal_report_free_busy_data(). * all the objects being used in e_data_cal_report_free_busy_data().
* *
* Since: 3.2 * Since: 3.2
*/ */
void void
e_data_cal_respond_get_free_busy (EDataCal *cal, e_data_cal_respond_get_free_busy (EDataCal *cal,
skipping to change at line 1869 skipping to change at line 1579
g_object_unref (simple); g_object_unref (simple);
g_object_unref (backend); g_object_unref (backend);
} }
/** /**
* e_data_cal_respond_create_objects: * e_data_cal_respond_create_objects:
* @cal: A calendar client interface. * @cal: A calendar client interface.
* @opid: associated operation id * @opid: associated operation id
* @error: Operation error, if any, automatically freed if passed it. * @error: Operation error, if any, automatically freed if passed it.
* @uids: UIDs of the objects created. * @uids: (element-type utf8): UIDs of the objects created.
* @new_components: The newly created #ECalComponent objects. * @new_components: (element-type ECalComponent): The newly created #ECalCompone
nt objects.
* *
* Notifies listeners of the completion of the create_objects method call. * Notifies listeners of the completion of the create_objects method call.
* *
* Since: 3.6 * Since: 3.6
*/ */
void void
e_data_cal_respond_create_objects (EDataCal *cal, e_data_cal_respond_create_objects (EDataCal *cal,
guint32 opid, guint32 opid,
GError *error, GError *error,
const GSList *uids, const GSList *uids,
skipping to change at line 1938 skipping to change at line 1648
g_object_unref (simple); g_object_unref (simple);
g_object_unref (backend); g_object_unref (backend);
} }
/** /**
* e_data_cal_respond_modify_objects: * e_data_cal_respond_modify_objects:
* @cal: A calendar client interface. * @cal: A calendar client interface.
* @opid: associated operation id * @opid: associated operation id
* @error: Operation error, if any, automatically freed if passed it. * @error: Operation error, if any, automatically freed if passed it.
* @old_components: The old #ECalComponent(s). * @old_components: (element-type ECalComponent): The old #ECalComponent(s).
* @new_components: The new #ECalComponent(s). * @new_components: (element-type ECalComponent): The new #ECalComponent(s).
* *
* Notifies listeners of the completion of the modify_objects method call. * Notifies listeners of the completion of the modify_objects method call.
* *
* Since: 3.6 * Since: 3.6
*/ */
void void
e_data_cal_respond_modify_objects (EDataCal *cal, e_data_cal_respond_modify_objects (EDataCal *cal,
guint32 opid, guint32 opid,
GError *error, GError *error,
GSList *old_components, GSList *old_components,
skipping to change at line 2014 skipping to change at line 1724
g_object_unref (simple); g_object_unref (simple);
g_object_unref (backend); g_object_unref (backend);
} }
/** /**
* e_data_cal_respond_remove_objects: * e_data_cal_respond_remove_objects:
* @cal: A calendar client interface. * @cal: A calendar client interface.
* @opid: associated operation id * @opid: associated operation id
* @error: Operation error, if any, automatically freed if passed it. * @error: Operation error, if any, automatically freed if passed it.
* @ids: (element-type: utf8) IDs of the removed objects. * @ids: (element-type ECalComponentId): IDs of the removed objects.
* @old_components: (element-type ECalComponent): The old #ECalComponent(s). * @old_components: (element-type ECalComponent): The old #ECalComponent(s).
* @new_components: (element-type ECalComponent): The new #ECalComponent(s). * @new_components: (element-type ECalComponent): The new #ECalComponent(s).
* They will not be NULL only when removing instances of recurring appointmen ts. * They will not be NULL only when removing instances of recurring appointmen ts.
* *
* Notifies listeners of the completion of the remove_objects method call. * Notifies listeners of the completion of the remove_objects method call.
* *
* Since: 3.6 * Since: 3.6
*/ */
void void
e_data_cal_respond_remove_objects (EDataCal *cal, e_data_cal_respond_remove_objects (EDataCal *cal,
skipping to change at line 2148 skipping to change at line 1858
g_object_unref (simple); g_object_unref (simple);
g_object_unref (backend); g_object_unref (backend);
} }
/** /**
* e_data_cal_respond_send_objects: * e_data_cal_respond_send_objects:
* @cal: A calendar client interface. * @cal: A calendar client interface.
* @opid: associated operation id * @opid: associated operation id
* @error: Operation error, if any, automatically freed if passed it. * @error: Operation error, if any, automatically freed if passed it.
* @users: List of users. * @users: (element-type utf8): List of users.
* @calobj: An iCalendar string representing the object sent. * @calobj: An iCalendar string representing the object sent.
* *
* Notifies listeners of the completion of the send_objects method call. * Notifies listeners of the completion of the send_objects method call.
* *
* Since: 3.2 * Since: 3.2
*/ */
void void
e_data_cal_respond_send_objects (EDataCal *cal, e_data_cal_respond_send_objects (EDataCal *cal,
guint32 opid, guint32 opid,
GError *error, GError *error,
skipping to change at line 2203 skipping to change at line 1913
g_object_unref (simple); g_object_unref (simple);
g_object_unref (backend); g_object_unref (backend);
} }
/** /**
* e_data_cal_respond_get_attachment_uris: * e_data_cal_respond_get_attachment_uris:
* @cal: A calendar client interface. * @cal: A calendar client interface.
* @opid: associated operation id * @opid: associated operation id
* @error: Operation error, if any, automatically freed if passed it. * @error: Operation error, if any, automatically freed if passed it.
* @attachment_uris: List of retrieved attachment uri's. * @attachment_uris: (element-type utf8): List of retrieved attachment uri's.
* *
* Notifies listeners of the completion of the get_attachment_uris method call. * Notifies listeners of the completion of the get_attachment_uris method call.
* *
* Since: 3.2 * Since: 3.2
**/ **/
void void
e_data_cal_respond_get_attachment_uris (EDataCal *cal, e_data_cal_respond_get_attachment_uris (EDataCal *cal,
guint32 opid, guint32 opid,
GError *error, GError *error,
const GSList *attachment_uris) const GSList *attachment_uris)
skipping to change at line 2464 skipping to change at line 2174
if (g_str_equal (prop_name, CLIENT_BACKEND_PROPERTY_CAPABILITIES)) { if (g_str_equal (prop_name, CLIENT_BACKEND_PROPERTY_CAPABILITIES)) {
strv = g_strsplit (prop_value, ",", -1); strv = g_strsplit (prop_value, ",", -1);
e_dbus_calendar_set_capabilities ( e_dbus_calendar_set_capabilities (
dbus_interface, (const gchar * const *) strv); dbus_interface, (const gchar * const *) strv);
g_strfreev (strv); g_strfreev (strv);
} }
if (g_str_equal (prop_name, CLIENT_BACKEND_PROPERTY_REVISION)) if (g_str_equal (prop_name, CLIENT_BACKEND_PROPERTY_REVISION))
e_dbus_calendar_set_revision (dbus_interface, prop_value); e_dbus_calendar_set_revision (dbus_interface, prop_value);
if (g_str_equal (prop_name, CAL_BACKEND_PROPERTY_CAL_EMAIL_ADDRESS)) if (g_str_equal (prop_name, E_CAL_BACKEND_PROPERTY_CAL_EMAIL_ADDRESS))
e_dbus_calendar_set_cal_email_address (dbus_interface, prop_value ); e_dbus_calendar_set_cal_email_address (dbus_interface, prop_value );
if (g_str_equal (prop_name, CAL_BACKEND_PROPERTY_ALARM_EMAIL_ADDRESS)) if (g_str_equal (prop_name, E_CAL_BACKEND_PROPERTY_ALARM_EMAIL_ADDRESS))
e_dbus_calendar_set_alarm_email_address (dbus_interface, prop_val ue); e_dbus_calendar_set_alarm_email_address (dbus_interface, prop_val ue);
if (g_str_equal (prop_name, CAL_BACKEND_PROPERTY_DEFAULT_OBJECT)) if (g_str_equal (prop_name, E_CAL_BACKEND_PROPERTY_DEFAULT_OBJECT))
e_dbus_calendar_set_default_object (dbus_interface, prop_value); e_dbus_calendar_set_default_object (dbus_interface, prop_value);
/* Ensure the property change signal on the D-Bus is invoked immediately, not on idle */ /* Ensure the property change signal on the D-Bus is invoked immediately, not on idle */
g_dbus_interface_skeleton_flush (G_DBUS_INTERFACE_SKELETON (dbus_interfac e)); g_dbus_interface_skeleton_flush (G_DBUS_INTERFACE_SKELETON (dbus_interfac e));
if (cal->priv->connection && !g_dbus_connection_is_closed (cal->priv->con nection)) if (cal->priv->connection && !g_dbus_connection_is_closed (cal->priv->con nection))
g_dbus_connection_flush_sync (cal->priv->connection, NULL, NULL); g_dbus_connection_flush_sync (cal->priv->connection, NULL, NULL);
/* Disregard anything else. */ /* Disregard anything else. */
} }
skipping to change at line 2660 skipping to change at line 2370
e_data_cal_report_backend_property_changed ( e_data_cal_report_backend_property_changed (
cal, prop_name, prop_value); cal, prop_name, prop_value);
g_free (prop_value); g_free (prop_value);
prop_name = CLIENT_BACKEND_PROPERTY_REVISION; prop_name = CLIENT_BACKEND_PROPERTY_REVISION;
prop_value = e_cal_backend_get_backend_property (backend, prop_name); prop_value = e_cal_backend_get_backend_property (backend, prop_name);
e_data_cal_report_backend_property_changed ( e_data_cal_report_backend_property_changed (
cal, prop_name, prop_value); cal, prop_name, prop_value);
g_free (prop_value); g_free (prop_value);
prop_name = CAL_BACKEND_PROPERTY_CAL_EMAIL_ADDRESS; prop_name = E_CAL_BACKEND_PROPERTY_CAL_EMAIL_ADDRESS;
prop_value = e_cal_backend_get_backend_property (backend, prop_name); prop_value = e_cal_backend_get_backend_property (backend, prop_name);
e_data_cal_report_backend_property_changed ( e_data_cal_report_backend_property_changed (
cal, prop_name, prop_value); cal, prop_name, prop_value);
g_free (prop_value); g_free (prop_value);
prop_name = CAL_BACKEND_PROPERTY_ALARM_EMAIL_ADDRESS; prop_name = E_CAL_BACKEND_PROPERTY_ALARM_EMAIL_ADDRESS;
prop_value = e_cal_backend_get_backend_property (backend, prop_name); prop_value = e_cal_backend_get_backend_property (backend, prop_name);
e_data_cal_report_backend_property_changed ( e_data_cal_report_backend_property_changed (
cal, prop_name, prop_value); cal, prop_name, prop_value);
g_free (prop_value); g_free (prop_value);
prop_name = CAL_BACKEND_PROPERTY_DEFAULT_OBJECT; prop_name = E_CAL_BACKEND_PROPERTY_DEFAULT_OBJECT;
prop_value = e_cal_backend_get_backend_property (backend, prop_name); prop_value = e_cal_backend_get_backend_property (backend, prop_name);
e_data_cal_report_backend_property_changed ( e_data_cal_report_backend_property_changed (
cal, prop_name, prop_value); cal, prop_name, prop_value);
g_free (prop_value); g_free (prop_value);
g_object_unref (backend); g_object_unref (backend);
} }
static gboolean static gboolean
data_cal_initable_init (GInitable *initable, data_cal_initable_init (GInitable *initable,
skipping to change at line 2830 skipping to change at line 2540
g_signal_connect ( g_signal_connect (
dbus_interface, "handle-add-timezone", dbus_interface, "handle-add-timezone",
G_CALLBACK (data_cal_handle_add_timezone_cb), data_cal); G_CALLBACK (data_cal_handle_add_timezone_cb), data_cal);
g_signal_connect ( g_signal_connect (
dbus_interface, "handle-close", dbus_interface, "handle-close",
G_CALLBACK (data_cal_handle_close_cb), data_cal); G_CALLBACK (data_cal_handle_close_cb), data_cal);
} }
/** /**
* e_data_cal_new: * e_data_cal_new:
* @backend: an #ECalBackend * @backend: (type ECalBackend): an #ECalBackend
* @connection: a #GDBusConnection * @connection: a #GDBusConnection
* @object_path: object path for the D-Bus interface * @object_path: object path for the D-Bus interface
* @error: return location for a #GError, or %NULL * @error: return location for a #GError, or %NULL
* *
* Creates a new #EDataCal and exports the Calendar D-Bus interface * Creates a new #EDataCal and exports the Calendar D-Bus interface
* on @connection at @object_path. The #EDataCal handles incoming remote * on @connection at @object_path. The #EDataCal handles incoming remote
* method invocations and forwards them to the @backend. If the Calendar * method invocations and forwards them to the @backend. If the Calendar
* interface fails to export, the function sets @error and returns %NULL. * interface fails to export, the function sets @error and returns %NULL.
* *
* Returns: an #EDataCal, or %NULL on error * Returns: (transfer full) (nullable): an #EDataCal, or %NULL on error
**/ **/
EDataCal * EDataCal *
e_data_cal_new (ECalBackend *backend, e_data_cal_new (ECalBackend *backend,
GDBusConnection *connection, GDBusConnection *connection,
const gchar *object_path, const gchar *object_path,
GError **error) GError **error)
{ {
g_return_val_if_fail (E_IS_CAL_BACKEND (backend), NULL); g_return_val_if_fail (E_IS_CAL_BACKEND (backend), NULL);
g_return_val_if_fail (G_IS_DBUS_CONNECTION (connection), NULL); g_return_val_if_fail (G_IS_DBUS_CONNECTION (connection), NULL);
g_return_val_if_fail (object_path != NULL, NULL); g_return_val_if_fail (object_path != NULL, NULL);
skipping to change at line 2870 skipping to change at line 2580
/** /**
* e_data_cal_ref_backend: * e_data_cal_ref_backend:
* @cal: an #EDataCal * @cal: an #EDataCal
* *
* Returns the #ECalBackend to which incoming remote method invocations * Returns the #ECalBackend to which incoming remote method invocations
* are being forwarded. * are being forwarded.
* *
* The returned #ECalBackend is referenced for thread-safety and should * The returned #ECalBackend is referenced for thread-safety and should
* be unreferenced with g_object_unref() when finished with it. * be unreferenced with g_object_unref() when finished with it.
* *
* Returns: an #ECalBackend * Returns: (type ECalBackend) (transfer full) (nullable): an #ECalBackend
* *
* Since: 3.10 * Since: 3.10
**/ **/
ECalBackend * ECalBackend *
e_data_cal_ref_backend (EDataCal *cal) e_data_cal_ref_backend (EDataCal *cal)
{ {
g_return_val_if_fail (E_IS_DATA_CAL (cal), NULL); g_return_val_if_fail (E_IS_DATA_CAL (cal), NULL);
return g_weak_ref_get (&cal->priv->backend); return g_weak_ref_get (&cal->priv->backend);
} }
/** /**
* e_data_cal_get_connection: * e_data_cal_get_connection:
* @cal: an #EDataCal * @cal: an #EDataCal
* *
* Returns the #GDBusConnection on which the Calendar D-Bus interface * Returns the #GDBusConnection on which the Calendar D-Bus interface
* is exported. * is exported.
* *
* Returns: the #GDBusConnection * Returns: (transfer none): the #GDBusConnection
* *
* Since: 3.8 * Since: 3.8
**/ **/
GDBusConnection * GDBusConnection *
e_data_cal_get_connection (EDataCal *cal) e_data_cal_get_connection (EDataCal *cal)
{ {
g_return_val_if_fail (E_IS_DATA_CAL (cal), NULL); g_return_val_if_fail (E_IS_DATA_CAL (cal), NULL);
return cal->priv->connection; return cal->priv->connection;
} }
 End of changes. 38 change blocks. 
372 lines changed or deleted 40 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)