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 734175 - Can't open a text file from Nautilus
Can't open a text file from Nautilus
Status: RESOLVED FIXED
Product: gedit
Classification: Applications
Component: general
3.13.x
Other Linux
: Normal normal
: ---
Assigned To: Gedit maintainers
Gedit maintainers
3.14
Depends on:
Blocks:
 
 
Reported: 2014-08-02 12:07 UTC by Elad Alfassa
Modified: 2014-08-12 09:12 UTC
See Also:
GNOME target: 3.14
GNOME version: ---


Attachments
patch (2.22 KB, patch)
2014-08-11 19:12 UTC, Paolo Borelli
none Details | Review
patch (8.61 KB, patch)
2014-08-11 20:02 UTC, Paolo Borelli
committed Details | Review

Description Elad Alfassa 2014-08-02 12:07:08 UTC
If I try to open a text file with gedit from nautilus (either by double click or rightclick->Open With gedit), the file is not opened.

I get the spinner mouse cursor for few seconds, and then nothing.

When I do this, the process "/usr/bin/gedit --gapplication-service" starts, but then disappears after few seconds.
Comment 1 Paolo Borelli 2014-08-02 12:18:49 UTC
I guess this is a fallout of moving to dbus service stuff.

Could you check if reverting https://git.gnome.org/browse/gedit/commit/?id=0dd265a74d91d804b0a54fa9d30ad75922e79015 fixes the problem?
Comment 2 Elad Alfassa 2014-08-02 12:25:44 UTC
Changing DBusActivatable to false in the desktop file does fix the problem.
Comment 3 Allison Karlitskaya (desrt) 2014-08-04 14:12:43 UTC
What is your system setup?  Are you using jhbuild, for example?
Comment 4 Elad Alfassa 2014-08-04 14:14:58 UTC
Normal Fedora 21 install.
Comment 5 Paolo Borelli 2014-08-11 15:47:29 UTC
I am guessing that nautilus uses dbus activation and so it starts gedit with "--gapplication-service" which in turn ignores any other argument.


I have no idea how to solve this :)
Comment 6 jessevdk@gmail.com 2014-08-11 16:07:46 UTC
The relevant call is here (I think): https://git.gnome.org/browse/glib/tree/gio/gdesktopappinfo.c#n2802

This should normally work fine. As far as I understood, when services are launched with -gapplication-service, there is a timeout where the app waits for either Open or Activate to be received. If it doesn't receive it, the app is closed (which is the behavior seen here).

Would be useful to check with dbus-monitor what happens.
Comment 7 Paolo Borelli 2014-08-11 16:46:18 UTC
But we do not do "Open" because we manually handle the command line (needed to manage things like reading from stdin, --wait, etc)
Comment 8 jessevdk@gmail.com 2014-08-11 17:30:13 UTC
As far as I can see, there is no problem supporting both. We handle command line args ourselves, so the default app implementation will not try to run Open for us when launching from the commandline. It should only do so when called over dbus (https://developer.gnome.org/gio/stable/GApplication.html#G-APPLICATION-HANDLES-OPEN:CAPS).
Comment 9 Paolo Borelli 2014-08-11 17:57:23 UTC
I guess it is true that we can *also* handle open.

Ryan: is this how things should work?
Comment 10 Paolo Borelli 2014-08-11 18:57:55 UTC
<pbor> desrt: hi, so discussing https://bugzilla.gnome.org/show_bug.cgi?id=734175 in #gedit and looking at the code we have the impression that we need to implement *both* handle_command_line and open
<pbor> desrt: so that when launched from command line, the first method is used and open is not called
<pbor> desrt: while nautilus etc will use open directly
<pbor> is that correct?
<desrt> yes
<pbor> cool
<pbor> thanks, so we'll implement open
<desrt> but only because you have this weird +nnn syntax
<pbor> yeah, and stdin
<desrt> otherwise you could strip out only the commandline args in handle_command_line and leave the rest to open/activated via the automatic handling
<desrt> right.



So yes, we need to add open()
Comment 11 Paolo Borelli 2014-08-11 19:12:07 UTC
Created attachment 283131 [details] [review]
patch
Comment 12 Paolo Borelli 2014-08-11 20:02:09 UTC
Created attachment 283135 [details] [review]
patch

actually I do not think we can rely on activate to follow open, so instead lets' factor out a open_files helper and call it in both cases
Comment 13 Kalev Lember 2014-08-12 08:17:54 UTC
Thanks, I can confirm this patch fixes the issue.
Comment 14 Ignacio Casal Quinteiro (nacho) 2014-08-12 08:24:44 UTC
Review of attachment 283135 [details] [review]:

I'd rather have this commit split into 2 patches. For one side the refactoring and from the other the handling of the open method

::: gedit/gedit-app.c
@@ +87,1 @@
+	/* command line parsing */

I guess this could go in a different commit first

@@ +1004,3 @@
+                GFile        **files,
+                gint           n_files,
+               const gchar   *hint)

wrong indentation?
Comment 15 Paolo Borelli 2014-08-12 09:12:03 UTC
amemnded as suggested and pushed