+static gboolean
+load_files_remote (const char **files,
+ GHashTable *args)
+{
+ int i;
+ GError *error = NULL;
+ DBusGConnection *connection;
+ gboolean result = FALSE;
+#if DBUS_VERSION < 35
+ DBusGPendingCall *call;
+#endif
+ DBusGProxy *remote_object;
+ GdkDisplay *display;
+ guint32 timestamp;
+
+ display = gdk_display_get_default();
+ timestamp = gdk_x11_display_get_user_time (display);
+ connection = dbus_g_bus_get (DBUS_BUS_STARTER, &error);
+
+ if (connection == NULL) {
+ g_warning (error->message);
+ g_error_free (error);
+
+ return FALSE;
+ }
+
+ remote_object = dbus_g_proxy_new_for_name (connection,
+ "org.gnome.evince.ApplicationService",
+ "/org/gnome/evince/Evince",
+ "org.gnome.evince.Application");
+ if (!files) {
+#if DBUS_VERSION <= 33
+ call = dbus_g_proxy_begin_call (remote_object, "OpenWindow",
+ DBUS_TYPE_UINT32, ×tamp,
+ DBUS_TYPE_INVALID);
+
+ if (!dbus_g_proxy_end_call (remote_object, call, &error, DBUS_TYPE_INVALID)) {
+ g_warning (error->message);
+ g_clear_error (&error);
+ g_object_unref (remote_object);
+ dbus_g_connection_unref (connection);
+ return FALSE;
+ }
+#elif DBUS_VERSION == 34
+ call = dbus_g_proxy_begin_call (remote_object, "OpenWindow",
+ G_TYPE_UINT, timestamp,
+ G_TYPE_INVALID);
+
+ if (!dbus_g_proxy_end_call (remote_object, call, &error, G_TYPE_INVALID)) {
+ g_warning (error->message);
+ g_clear_error (&error);
+ g_object_unref (remote_object);
+ dbus_g_connection_unref (connection);
+ return FALSE;
+ }
+#else
+ if (!dbus_g_proxy_call (remote_object, "OpenWindow", &error,
+ G_TYPE_UINT, timestamp,
+ G_TYPE_INVALID,
+ G_TYPE_INVALID)) {
+ g_warning (error->message);
+ g_clear_error (&error);
+ g_object_unref (remote_object);
+ dbus_g_connection_unref (connection);
+ return FALSE;
+ }
+#endif
+ g_object_unref (remote_object);
+ dbus_g_connection_unref (connection);
+
+ return TRUE;
+ }
+
+ for (i = 0; files[i]; i++) {
+ const char *page_label;
+ char *uri;
+
+ uri = gnome_vfs_make_uri_from_shell_arg (files[i]);
+ page_label = ev_page_label ? ev_page_label : "";
+#if DBUS_VERSION <= 33
+ call = dbus_g_proxy_begin_call (remote_object, "OpenURI",
+ DBUS_TYPE_STRING, &uri,
+ DBUS_TYPE_STRING, &page_label,
+ DBUS_TYPE_UINT32, ×tamp,
+ DBUS_TYPE_INVALID);
+
+ if (!dbus_g_proxy_end_call (remote_object, call, &error, DBUS_TYPE_INVALID)) {
+ g_warning (error->message);
+ g_clear_error (&error);
+ g_free (uri);
+ continue;
+ }
+#elif DBUS_VERSION == 34
+ call = dbus_g_proxy_begin_call (remote_object, "OpenURI",
+ G_TYPE_STRING, uri,
+ G_TYPE_STRING, page_label,
+ G_TYPE_UINT, timestamp,
+ G_TYPE_INVALID);
+
+ if (!dbus_g_proxy_end_call (remote_object, call, &error, G_TYPE_INVALID)) {
+ g_warning (error->message);
+ g_clear_error (&error);
+ g_free (uri);
+ continue;
+ }
+#else
+ if (!dbus_g_proxy_call (remote_object, "OpenURI", &error,
+ G_TYPE_STRING, uri,
+ dbus_g_type_get_map ("GHashTable", G_TYPE_STRING, G_TYPE_VALUE), args,
+ G_TYPE_UINT, timestamp,
+ G_TYPE_INVALID,
+ G_TYPE_INVALID)) {
+ g_warning (error->message);
+ g_clear_error (&error);
+ g_free (uri);
+ continue;
+ }
+#endif