[evolution-data-server] EDataCal: Make GDBusMethodInvocation optional in operations.
- From: Matthew Barnes <mbarnes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server] EDataCal: Make GDBusMethodInvocation optional in operations.
- Date: Tue, 29 Jan 2013 14:37:35 +0000 (UTC)
commit 0ea428f31d0914d2222377a2eb8ed5bba3b4ff3a
Author: Matthew Barnes <mbarnes redhat com>
Date: Tue Jan 29 09:36:33 2013 -0500
EDataCal: Make GDBusMethodInvocation optional in operations.
Allows us to fake client requests, since ECalBackend's API is still too
intertwined with EDataCal to call directly.
calendar/libedata-cal/e-data-cal.c | 35 +++++++++++++++++++++--------------
1 files changed, 21 insertions(+), 14 deletions(-)
---
diff --git a/calendar/libedata-cal/e-data-cal.c b/calendar/libedata-cal/e-data-cal.c
index 06a2ad8..f1a8f41 100644
--- a/calendar/libedata-cal/e-data-cal.c
+++ b/calendar/libedata-cal/e-data-cal.c
@@ -195,8 +195,6 @@ op_new (OperationID op,
GDBusMethodInvocation *invocation)
{
OperationData *data;
- GDBusConnection *connection;
- const gchar *sender;
data = g_slice_new0 (OperationData);
data->ref_count = 1;
@@ -204,18 +202,24 @@ op_new (OperationID op,
data->id = e_operation_pool_reserve_opid (ops_pool);
data->cal = g_object_ref (cal);
data->cancellable = g_cancellable_new ();
- data->invocation = g_object_ref (invocation);
- connection = g_dbus_method_invocation_get_connection (invocation);
- sender = g_dbus_method_invocation_get_sender (invocation);
+ if (invocation != NULL) {
+ GDBusConnection *connection;
+ const gchar *sender;
+
+ data->invocation = g_object_ref (invocation);
- data->watcher_id = g_bus_watch_name_on_connection (
- connection, sender,
- G_BUS_NAME_WATCHER_FLAGS_NONE,
- (GBusNameAppearedCallback) NULL,
- (GBusNameVanishedCallback) op_sender_vanished_cb,
- g_object_ref (data->cancellable),
- (GDestroyNotify) g_object_unref);
+ connection = e_data_cal_get_connection (cal);
+ sender = g_dbus_method_invocation_get_sender (invocation);
+
+ data->watcher_id = g_bus_watch_name_on_connection (
+ connection, sender,
+ G_BUS_NAME_WATCHER_FLAGS_NONE,
+ (GBusNameAppearedCallback) NULL,
+ (GBusNameVanishedCallback) op_sender_vanished_cb,
+ g_object_ref (data->cancellable),
+ (GDestroyNotify) g_object_unref);
+ }
g_rec_mutex_lock (&cal->priv->pending_ops_lock);
g_hash_table_insert (
@@ -289,9 +293,12 @@ op_unref (OperationData *data)
g_object_unref (data->cal);
g_object_unref (data->cancellable);
- g_object_unref (data->invocation);
- g_bus_unwatch_name (data->watcher_id);
+ if (data->invocation != NULL)
+ g_object_unref (data->invocation);
+
+ if (data->watcher_id > 0)
+ g_bus_unwatch_name (data->watcher_id);
g_slice_free (OperationData, data);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]