Commit 1e89f981 authored by Milan Crha's avatar Milan Crha

[evolution-dbus-session] Handle method calls with GUnixFDList

This is required to have properly propagated calls like OpenFile,
which use it.

Related to GNOME/evolution#169
parent 14ed8b11
......@@ -164,25 +164,57 @@ handle_method_call_cb (GDBusConnection *connection,
GDBusMethodInvocation *invocation,
gpointer user_data)
{
#ifdef G_OS_UNIX
GDBusMessage *message;
GUnixFDList *in_fd_list, *out_fd_list = NULL;
#endif
ProxyData *pd = user_data;
GVariant *result;
GError *error = NULL;
g_return_if_fail (pd != NULL);
result = g_dbus_connection_call_sync (g_dbus_proxy_get_connection (pd->proxy),
g_dbus_proxy_get_name (pd->proxy),
object_path,
interface_name,
method_name,
parameters,
NULL,
G_DBUS_CALL_FLAGS_NONE,
DBUS_CALL_TIMEOUT,
NULL, &error);
#ifdef G_OS_UNIX
message = g_dbus_method_invocation_get_message (invocation);
in_fd_list = g_dbus_message_get_unix_fd_list (message);
if (in_fd_list) {
result = g_dbus_connection_call_with_unix_fd_list_sync (g_dbus_proxy_get_connection (pd->proxy),
g_dbus_proxy_get_name (pd->proxy),
object_path,
interface_name,
method_name,
parameters,
NULL,
G_DBUS_CALL_FLAGS_NONE,
DBUS_CALL_TIMEOUT,
in_fd_list,
&out_fd_list,
NULL, &error);
} else {
#endif
result = g_dbus_connection_call_sync (g_dbus_proxy_get_connection (pd->proxy),
g_dbus_proxy_get_name (pd->proxy),
object_path,
interface_name,
method_name,
parameters,
NULL,
G_DBUS_CALL_FLAGS_NONE,
DBUS_CALL_TIMEOUT,
NULL, &error);
#ifdef G_OS_UNIX
}
#endif
if (result) {
g_dbus_method_invocation_return_value (invocation, result);
#ifdef G_OS_UNIX
if (out_fd_list) {
g_dbus_method_invocation_return_value_with_unix_fd_list (invocation, result, out_fd_list);
g_object_unref (out_fd_list);
} else
#endif
g_dbus_method_invocation_return_value (invocation, result);
g_variant_unref (result);
} else {
g_dbus_method_invocation_return_gerror (invocation, error);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment