[evince] [ev-daemon] Add FindDocument method to the daemon DBus interface



commit 7d1fe337277503928b4862f78342b72a123a630c
Author: Jose Aliste <jose aliste gmail com>
Date:   Fri Jul 9 09:17:00 2010 +0200

    [ev-daemon] Add FindDocument method to the daemon DBus interface
    
    It returns the name owner of the evince process for the given document
    URI.

 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>";
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]