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 131259 - Allow nautilus callers to specify a file to focus on
Allow nautilus callers to specify a file to focus on
Status: RESOLVED DUPLICATE of bug 632427
Product: nautilus
Classification: Core
Component: general
unspecified
Other Linux
: Normal enhancement
: ---
Assigned To: Nautilus Maintainers
Nautilus Maintainers
: 328124 339332 339565 600211 609413 612795 619624 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2004-01-12 18:23 UTC by Seth Nickell
Modified: 2011-06-27 23:48 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch to fix bug (2.51 KB, patch)
2008-09-10 11:55 UTC, Nelson Benitez
needs-work Details | Review
Patch using g_file_query_info_async (5.33 KB, patch)
2008-09-12 07:19 UTC, Nelson Benitez
none Details | Review
Updated patch (16.33 KB, patch)
2008-09-18 12:17 UTC, Nelson Benitez
needs-work Details | Review
Patch that hooks up with the window_go_to infrastructure (1.23 KB, patch)
2009-09-18 23:18 UTC, Marcus Carlson
rejected Details | Review

Description Seth Nickell 2004-01-12 18:23:22 UTC
Currently you can call nautilus with a URI and it will open a window
showing that folder. It would be good to go a step further and allow
specification of a file within that folder to scroll to and select by
default. This could be used, e.g., by File Roller to bring up a newly
unzipped file / set of files selected in Nautilus. Its also useful for
Epiphany to be able to focus Nautilus on a just downloaded file.
Comment 1 Nelson Benitez 2006-08-23 21:52:15 UTC
Bug 328124 is a duplicate of this bug, and now nautilus shows an error dialog while before it just opened the folder without selecting the file, which was better behaviour.
Comment 2 Josh Lee 2006-08-24 01:01:20 UTC
*** Bug 328124 has been marked as a duplicate of this bug. ***
Comment 3 Nelson Benitez 2008-09-10 11:55:08 UTC
Created attachment 118418 [details] [review]
Patch to fix bug

Hi, the patch is working well in my tests, both in spatial and browser window.
Comment 4 Cosimo Cecchi 2008-09-10 12:16:58 UTC
Hi Nelson, thanks for the patch!
I'm afraid that the use of g_file_query_file_type is not right there, as that function does blocking I/O, and could lock the whole Nautilus for quite some time if you try to open e.g. a remote URI. You should use g_file_query_info_async instead, and query for G_FILE_ATTRIBUTE_STANDARD_TYPE. Another solution, but the code can become more convoluted, can be wrapping the call to g_file_query_file_type in a I/O thread with the machinery that GIO offers (see documentation for g_io_scheduler_push_job).
Comment 5 Christian Neumair 2008-09-10 16:08:21 UTC
Cosimo is right. I also think that we should have distinct binary calling syntaxes for
* show a folder
* reveal a file

Maybe we should have a “--show-as-selection” parameter, which groups the incoming URIs by parent folders, and shows each of them with the specified appropriate selections.

That way, an application or script that acted on multiple files could call
nautilus --show-as-selection file:///home/foo/bar.zip file:///home/foo/foobar.rar
Comment 6 Nelson Benitez 2008-09-11 12:46:02 UTC
(In reply to comment #5)
> Cosimo is right. I also think that we should have distinct binary calling
> syntaxes for
> * show a folder
> * reveal a file
> Maybe we should have a “--show-as-selection” parameter, which groups the
> incoming URIs by parent folders, and shows each of them with the specified
> appropriate selections.
> 
> That way, an application or script that acted on multiple files could call
> nautilus --show-as-selection file:///home/foo/bar.zip
> file:///home/foo/foobar.rar
> 

I have re-made my patch using g_file_query_info_async().., but you're asking here for more features, what about doing them without new commandline switches like..

nautilus \
file:///home/foo/file.doc
file:///home/foo/my pics/
file:///home/foo/docs/1.doc
file:///home/foo/docs/2.doc
file:///home/foo/docs/3.doc

would open 3 windows, first showing "file.doc" highlighted, second showing folder "my pics", and third showing "1.doc","2.doc","3.doc" highlighted.. 
Comment 7 Nelson Benitez 2008-09-12 07:19:25 UTC
Created attachment 118562 [details] [review]
Patch using g_file_query_info_async

As said, this is my patch using g_file_query_info_async. Will try to look at adding the other switches..
Comment 8 Christian Neumair 2008-09-12 09:29:10 UTC
> I have re-made my patch using g_file_query_info_async()

Thanks.

> you're asking here for more features, what about doing them without new commandline switches

Without any command line switch, how would you reveal a folder as selection?
Comment 9 Nelson Benitez 2008-09-12 11:45:14 UTC
(In reply to comment #8)
> > I have re-made my patch using g_file_query_info_async()
> 
> Thanks.
> 
> > you're asking here for more features, what about doing them without new commandline switches
> 
> Without any command line switch, how would you reveal a folder as selection?
>

 I personally don't see how an external program would need a "reveal folder" option, moreover I see the whole "reveal" option like the weak brother of a "select" option, I mean, 90% of callers would choose "select" over "reveal" because their purpose is that the user can notice some file/folder over the other ones. That's right what "select" does.

 I haven't seen enhacement requests in bugzilla for "reveal" commandline option but for "selected" (this bug). Although bugzilla is not complete reflect of user's need it's some guidance.

 I'm adding to my patch the --show-as-selected option you mentioned, because current approach can't select a folder (it's opened instead) and can't select more than one file in the same folder..

 I can also add later the "reveal" option if you think it's needed.
Comment 10 Christian Neumair 2008-09-12 12:15:02 UTC
>  90% of callers would choose "select" over "reveal"

Actually, by “reveal” I meant “select”, i.e. what you are proposing and what you implemented, just with a command-line switch, and for multiple files at once. I agree that scrolling to a file without highlighting it doesn't make sense.

Looks like we had a misunderstanding here.
Comment 11 Nelson Benitez 2008-09-12 12:44:38 UTC
(In reply to comment #10)
> >  90% of callers would choose "select" over "reveal"
> 
> Actually, by “reveal” I meant “select”, i.e. what you are proposing and
> what you implemented, just with a command-line switch, and for multiple files
> at once. I agree that scrolling to a file without highlighting it doesn't make
> sense.
> 
> Looks like we had a misunderstanding here.
> 

Ok, sorry, my misunderstanding comes from the fact that nautilus has functions to reveal and functions to select files in icon view, so I thought you were talking about that revealing.. anyway I will post an updated patch by monday, have a good weekend!
Comment 12 Nelson Benitez 2008-09-18 12:17:28 UTC
Created attachment 118941 [details] [review]
Updated patch

This new patch adds the --show-as-selection option, you can use it in conjunction with existing uri option, so for example:
nautilus \
-s /home/nelson/dir1/file1.c \
-s /home/nelson/dir1 \
-s /home/nelson/dir1/file2.c \
/home/nelson/other_dir

will open 4 windows:
"/home/nelson/dir1" with fil1.c and file2.c selected
"/home/nelson" with dir1 selected
"/home/nelson/other_dir" showing the contents of other_dir

Also if you just want to select one file, you can use default nautilus uri as well:
nautilus /home/nelson/dir1/file1.c /home/nelson/dir2/file2.c

will open two windows with file1.c and file2.c selected in each one.
Comment 13 Nelson Benitez 2008-09-18 12:26:16 UTC
(In reply to comment #12)
> Created an attachment (id=118941) [edit]
> Updated patch
> 
> This new patch adds the --show-as-selection option, you can use it in
> conjunction with existing uri option, so for example:
> nautilus \
> -s /home/nelson/dir1/file1.c \
> -s /home/nelson/dir1 \
> -s /home/nelson/dir1/file2.c \
> /home/nelson/other_dir
> 
> will open 4 windows:

 I meant 3 windows not 4..


 Also, all window opening is done with g_file_query_info_async ()..
Comment 14 Nelson Benitez 2008-10-13 11:58:19 UTC
*** Bug 339332 has been marked as a duplicate of this bug. ***
Comment 15 A. Walton 2009-01-07 16:40:03 UTC
Patch needs to be updated to support libunique as we dropped the CORBA usage in NautilusApplication.
Comment 16 Marcus Carlson 2009-09-18 23:18:35 UTC
Created attachment 143473 [details] [review]
Patch that hooks up with the window_go_to infrastructure

Here's another approach that uses the current infrastructure to open a location. This changes the behavior both from command line without switches and the Open Location dialog and checks if the path entered isn't a directory and if so, opens the parent of the file and selects the file inside.

Comments?
Comment 17 Alexander Larsson 2009-10-06 14:42:52 UTC
Marcus: I agree with others in this bug that having such magical behaviour isn't right. The semantics of it is such that you can't express the "select a folder icon in the parent folder". 

What we need to do is finish the dbus API for nautilus scripting, and then use this API instead of the libunique stuff for the more complex commandline switches (in fact, maybe replace libunique totally?).

Christian Neumair is working on such a dbus API atm.
Comment 18 Cosimo Cecchi 2009-11-02 18:02:44 UTC
*** Bug 600211 has been marked as a duplicate of this bug. ***
Comment 19 Nelson Benitez 2010-02-11 09:28:38 UTC
*** Bug 609413 has been marked as a duplicate of this bug. ***
Comment 20 Cosimo Cecchi 2010-05-27 23:41:33 UTC
*** Bug 619624 has been marked as a duplicate of this bug. ***
Comment 21 Cosimo Cecchi 2010-05-27 23:42:04 UTC
*** Bug 339565 has been marked as a duplicate of this bug. ***
Comment 22 Cosimo Cecchi 2010-05-27 23:44:44 UTC
*** Bug 612795 has been marked as a duplicate of this bug. ***
Comment 23 Cosimo Cecchi 2010-05-27 23:45:15 UTC
*** Bug 610408 has been marked as a duplicate of this bug. ***
Comment 24 Marcus Carlson 2010-06-30 20:05:35 UTC
Review of attachment 143473 [details] [review]:

Marking as rejected because of Alex comment.
Comment 25 deters 2011-04-14 03:29:19 UTC
This bug was fixed here: https://bugzilla.gnome.org/show_bug.cgi?id=632427
Comment 26 Cosimo Cecchi 2011-06-27 20:13:33 UTC

*** This bug has been marked as a duplicate of bug 632427 ***