Commit 45cbf30d 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 2178b205
...@@ -164,25 +164,57 @@ handle_method_call_cb (GDBusConnection *connection, ...@@ -164,25 +164,57 @@ handle_method_call_cb (GDBusConnection *connection,
GDBusMethodInvocation *invocation, GDBusMethodInvocation *invocation,
gpointer user_data) gpointer user_data)
{ {
#ifdef G_OS_UNIX
GDBusMessage *message;
GUnixFDList *in_fd_list, *out_fd_list = NULL;
#endif
ProxyData *pd = user_data; ProxyData *pd = user_data;
GVariant *result; GVariant *result;
GError *error = NULL; GError *error = NULL;
g_return_if_fail (pd != NULL); g_return_if_fail (pd != NULL);
result = g_dbus_connection_call_sync (g_dbus_proxy_get_connection (pd->proxy), #ifdef G_OS_UNIX
g_dbus_proxy_get_name (pd->proxy), message = g_dbus_method_invocation_get_message (invocation);
object_path, in_fd_list = g_dbus_message_get_unix_fd_list (message);
interface_name,
method_name, if (in_fd_list) {
parameters, result = g_dbus_connection_call_with_unix_fd_list_sync (g_dbus_proxy_get_connection (pd->proxy),
NULL, g_dbus_proxy_get_name (pd->proxy),
G_DBUS_CALL_FLAGS_NONE, object_path,
DBUS_CALL_TIMEOUT, interface_name,
NULL, &error); 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) { 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); g_variant_unref (result);
} else { } else {
g_dbus_method_invocation_return_gerror (invocation, error); 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