From: Jose Aliste Date: Fri, 9 Jul 2010 07:17:00 +0000 (+0200) Subject: [ev-daemon] Add FindDocument method to the daemon DBus interface X-Git-Tag: EVINCE_2_31_5~24 X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=commitdiff_plain;h=7d1fe337277503928b4862f78342b72a123a630c;p=evince.git [ev-daemon] Add FindDocument method to the daemon DBus interface It returns the name owner of the evince process for the given document URI. --- diff --git a/shell/ev-daemon.c b/shell/ev-daemon.c index b136369d..99b29242 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[] = "" "" "" + "" + "" + "" + "" "" "";