After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 625971 - Add option so FindDocument method in Evince Daemon can spawn an evince process.
Add option so FindDocument method in Evince Daemon can spawn an evince process.
Status: RESOLVED FIXED
Product: evince
Classification: Core
Component: general
git master
Other Linux
: Normal normal
: ---
Assigned To: Evince Maintainers
Evince Maintainers
Depends on:
Blocks:
 
 
Reported: 2010-08-03 19:10 UTC by José Aliste
Modified: 2010-08-29 17:22 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Proposed patch. (4.69 KB, patch)
2010-08-03 19:13 UTC, José Aliste
needs-work Details | Review
Updated patch. (5.27 KB, patch)
2010-08-04 18:16 UTC, José Aliste
none Details | Review

Description José Aliste 2010-08-03 19:10:35 UTC
When Calling "FindDocument" DBUS method on the Evince Daemon, it would be nice to pass a new option "spawn" that instructs the daemon to spawn a new instance of evince for the given URI if no current instance can be found. 

A mainly working patch comes in second comment. the only thing not working is that when I close the evince instance (that was spawn by the ev-daemon with g_spawn_async) the Evince window is not destroyed. Should I use gdk_spawn_on_screen instead? or am I missing some options to g_spawn_async?
Comment 1 José Aliste 2010-08-03 19:13:00 UTC
Created attachment 167066 [details] [review]
Proposed patch.
Comment 2 Carlos Garcia Campos 2010-08-04 07:11:44 UTC
Review of attachment 167066 [details] [review]:

You are creating the document and adding it to ev_daemon_docs before they are registered. ev_daemon_docs is the list of registered documents. I think documents should only be created in RegisterDocument. We might use a global hash_table to store the list of pending incovations for every uri

::: shell/ev-daemon.c
@@ +349,3 @@
+				char *argv[3];
+
+				argv[0] = g_build_filename (BINDIR, "evince", NULL);

You are leaking this

@@ +360,3 @@
+
+				g_spawn_async (NULL, argv, NULL, 
+					       0, NULL, NULL, NULL, NULL);

Please, check exit status and handle possible errors here.
Comment 3 José Aliste 2010-08-04 18:16:00 UTC
Created attachment 167133 [details] [review]
Updated patch.

Patch reworked to use a global hash_table.
Comment 4 Carlos Garcia Campos 2010-08-29 17:22:24 UTC
Pushed with some minor changes to master and gnome-2-32. Thanks!