[evince/gnome-2-32] [daemon] Process pending requests when document has been loaded
- From: Carlos Garcia Campos <carlosgc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evince/gnome-2-32] [daemon] Process pending requests when document has been loaded
- Date: Wed, 8 Sep 2010 12:21:12 +0000 (UTC)
commit 6462029b0703431d872baa6863e2d5c99c86a733
Author: Carlos Garcia Campos <carlosgc gnome org>
Date: Wed Sep 8 14:17:37 2010 +0200
[daemon] Process pending requests when document has been loaded
rather than when the uri is registered. Based on patch by José Aliste.
See bug #626561.
shell/ev-daemon.c | 31 ++++++++++++++++++++++++++++++-
1 files changed, 30 insertions(+), 1 deletions(-)
---
diff --git a/shell/ev-daemon.c b/shell/ev-daemon.c
index 6ecd48c..cc60ab1 100644
--- a/shell/ev-daemon.c
+++ b/shell/ev-daemon.c
@@ -35,6 +35,8 @@
#define EV_DBUS_DAEMON_INTERFACE_NAME "org.gnome.evince.Daemon"
#define EV_DBUS_DAEMON_OBJECT_PATH "/org/gnome/evince/Daemon"
+#define EV_DBUS_WINDOW_INTERFACE_NAME "org.gnome.evince.Window"
+
#define DAEMON_TIMEOUT (30) /* seconds */
#define LOG g_printerr
@@ -47,6 +49,7 @@ typedef struct {
gchar *dbus_name;
gchar *uri;
guint watch_id;
+ guint loaded_id;
} EvDoc;
static void
@@ -286,6 +289,23 @@ process_pending_invocations (const gchar *uri,
}
static void
+document_loaded_cb (GDBusConnection *connection,
+ const gchar *sender_name,
+ const gchar *object_path,
+ const gchar *interface_name,
+ const gchar *signal_name,
+ GVariant *parameters,
+ EvDoc *doc)
+{
+ const gchar *uri;
+
+ g_variant_get (parameters, "(&s)", &uri);
+ if (strcmp (uri, doc->uri) == 0)
+ process_pending_invocations (uri, sender_name);
+ g_dbus_connection_signal_unsubscribe (connection, doc->loaded_id);
+}
+
+static void
method_call_cb (GDBusConnection *connection,
const gchar *sender,
const gchar *object_path,
@@ -317,8 +337,17 @@ method_call_cb (GDBusConnection *connection,
doc = g_new (EvDoc, 1);
doc->dbus_name = g_strdup (sender);
doc->uri = g_strdup (uri);
- process_pending_invocations (doc->uri, doc->dbus_name);
+ doc->loaded_id = g_dbus_connection_signal_subscribe (connection,
+ doc->dbus_name,
+ EV_DBUS_WINDOW_INTERFACE_NAME,
+ "DocumentLoaded",
+ NULL,
+ NULL,
+ 0,
+ (GDBusSignalCallback) document_loaded_cb,
+ doc,
+ NULL);
doc->watch_id = g_bus_watch_name_on_connection (connection,
sender,
G_BUS_NAME_WATCHER_FLAGS_NONE,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]