From 7d1fe337277503928b4862f78342b72a123a630c Mon Sep 17 00:00:00 2001 From: Jose Aliste Date: Fri, 09 Jul 2010 07:17:00 +0000 Subject: [ev-daemon] Add FindDocument method to the daemon DBus interface It returns the name owner of the evince process for the given document URI. --- (limited to 'shell') diff --git a/shell/ev-daemon.c b/shell/ev-daemon.c index b136369..99b2924 100644 --- a/shell/ev-daemon.c +++ b/shell/ev-daemon.c @@ -317,7 +317,26 @@ method_call_cb (GDBusConnection *connection, ev_daemon_maybe_start_killtimer (user_data); g_dbus_method_invocation_return_value (invocation, g_variant_new ("()")); - } + } else if (g_strcmp0 (method_name, "FindDocument") == 0) { + EvDoc *doc; + const gchar *uri; + + g_variant_get (parameters, "(&s)", &uri); + + LOG ("FindDocument '%s' \n", uri); + + doc = ev_daemon_find_doc (uri); + if (doc == NULL) { + LOG ("GetViewerForUri URI was not registered!\n"); + g_dbus_method_invocation_return_error_literal (invocation, + G_DBUS_ERROR, + G_DBUS_ERROR_INVALID_ARGS, + "URI not registered"); + return; + } + + g_dbus_method_invocation_return_value (invocation, g_variant_new ("(s)", doc->dbus_name)); + } } static const char introspection_xml[] = @@ -330,6 +349,10 @@ static const char introspection_xml[] = "" "" "" + "" + "" + "" + "" "" ""; -- cgit v0.9.1