diff options
author | Jose Aliste <jose.aliste@gmail.com> | 2010-07-09 07:17:00 (GMT) |
---|---|---|
committer | Carlos Garcia Campos <carlosgc@gnome.org> | 2010-07-09 07:17:00 (GMT) |
commit | 7d1fe337277503928b4862f78342b72a123a630c (patch) | |
tree | ffc2f26d3f91688df87697e761c54344160812d0 /shell/ev-daemon.c | |
parent | cc65d4bdd4dce52591e871f0632e40aeaa5f08df (diff) |
[ev-daemon] Add FindDocument method to the daemon DBus interface
It returns the name owner of the evince process for the given document
URI.
Diffstat (limited to 'shell/ev-daemon.c')
-rw-r--r-- | shell/ev-daemon.c | 25 |
1 files changed, 24 insertions, 1 deletions
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[] = "<method name='UnregisterDocument'>" "<arg type='s' name='uri' direction='in'/>" "</method>" + "<method name='FindDocument'>" + "<arg type='s' name='uri' direction='in'/>" + "<arg type='s' name='owner' direction='out'/>" + "</method>" "</interface>" "</node>"; |