#ifdef ENABLE_DBUS
+/*
+ * ev_application_register_uri:
+ * @application:
+ * @uri:
+ * @screen:
+ * @dest:
+ * @mode:
+ * @search_string:
+ * @timestamp:
+ *
+ * Registers @uri with evince-daemon.
+ *
+ * Returns: %TRUE to continue by opening @uri in this instance,
+ * or %FALSE if the request was forwarded to an existing evince
+ * instance for @uri
+ */
static gboolean
ev_application_register_uri (EvApplication *application,
const gchar *uri,
return TRUE;
/* FIXME: Don't make sync dbus calls, they block the UI! */
- value = g_dbus_connection_invoke_method_sync
+ value = g_dbus_connection_call_sync
(application->connection,
"org.gnome.evince.Daemon",
"/org/gnome/evince/Daemon",
"org.gnome.evince.Daemon",
"RegisterDocument",
g_variant_new ("(s)", uri),
- G_DBUS_INVOKE_METHOD_FLAGS_NONE,
+ G_DBUS_CALL_FLAGS_NONE,
-1,
NULL,
&error);
g_variant_get (value, "(&s)", &owner);
- if (owner[0] != ':') {
+ /* This means that the document wasn't already registered; go
+ * ahead with opening it.
+ */
+ if (owner[0] == '\0') {
g_variant_unref (value);
return TRUE;
}
g_variant_builder_add (&builder, "u", timestamp);
- value2 = g_dbus_connection_invoke_method_sync
+ value2 = g_dbus_connection_call_sync
(application->connection,
owner,
APPLICATION_DBUS_OBJECT_PATH,
APPLICATION_DBUS_INTERFACE,
"OpenURI",
g_variant_builder_end (&builder),
- G_DBUS_INVOKE_METHOD_FLAGS_NONE,
+ G_DBUS_CALL_FLAGS_NONE,
-1,
NULL,
&error);
if (value2 == NULL) {
- g_warning ("%s", error->message);
+ g_warning ("Failed to OpenURI: %s", error->message);
g_error_free (error);
+ return FALSE;
}
g_variant_unref (value);
return;
/* FIXME: Don't make sync dbus calls, they block the UI! */
- value = g_dbus_connection_invoke_method_sync
+ value = g_dbus_connection_call_sync
(application->connection,
"org.gnome.evince.Daemon",
"/org/gnome/evince/Daemon",
"org.gnome.evince.Daemon",
"UnregisterDocument",
g_variant_new ("(s)", uri),
- G_DBUS_INVOKE_METHOD_FLAGS_NONE,
+ G_DBUS_CALL_FLAGS_NO_AUTO_START,
-1,
NULL,
&error);
ev_application_accel_map_load (ev_application);
- ev_application->scr_saver = totem_scrsaver_new ();
-
#ifdef ENABLE_DBUS
{
static const char introspection_xml[] =
g_error_free (error);
}
- ev_application->keys = ev_media_player_keys_new ();
+ ev_application->keys = ev_media_player_keys_new (ev_application->connection);
+
+ ev_application->scr_saver = totem_scrsaver_new (ev_application->connection);
}
+#else
+ ev_application->scr_saver = totem_scrsaver_new ();
#endif /* ENABLE_DBUS */
}