Merge lp:~jmiguelbenitez/pantheon-photos/fix-1368626 into lp:~pantheon-photos/pantheon-photos/trunk

Proposed by José M. Benítez
Status: Merged
Approved by: Corentin Noël
Approved revision: 2870
Merged at revision: 2872
Proposed branch: lp:~jmiguelbenitez/pantheon-photos/fix-1368626
Merge into: lp:~pantheon-photos/pantheon-photos/trunk
Diff against target: 50 lines (+5/-20)
2 files modified
src/AppWindow.vala (+4/-11)
src/util/system.vala (+1/-9)
To merge this branch: bzr merge lp:~jmiguelbenitez/pantheon-photos/fix-1368626
Reviewer Review Type Date Requested Status
Corentin Noël Approve
Review via email: mp+281376@code.launchpad.net

Commit message

Added launch context when launching file manager to highlight the selected file

Description of the change

Item is highlighted in file manager when "Show in File Manager" option is used from the context menu.

Also, Nautilus was explicitly looked up. That has been removed to use the default file manager instead.

Please note that the fix does not work when an item is shown in the same directory than a previously open file manager instance is currently displaying. But this seems to be a Files thing (this behavior can be easily reproduced launching instances from the command line).

I guess I should file a bug against Files to see what people there say about it, but, as long as Photos is concerned, this fix should be as good as it gets ;)

To post a comment you must log in.
Revision history for this message
Corentin Noël (tintou) wrote :

Really nice fix.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/AppWindow.vala'
--- src/AppWindow.vala 2015-09-05 18:50:53 +0000
+++ src/AppWindow.vala 2015-12-27 12:20:41 +0000
@@ -754,17 +754,10 @@
754 }754 }
755755
756 public void show_file_uri (File file) throws Error {756 public void show_file_uri (File file) throws Error {
757 string tmp;757 AppInfo app_info = AppInfo.get_default_for_type ("inode/directory", true);
758758 var file_list = new List<File> ();
759 // if file manager is nautilus then pass the full path to file; otherwise pass759 file_list.append (file);
760 // the enclosing directory760 app_info.launch (file_list, get_window ().get_screen ().get_display ().get_app_launch_context ());
761 if (get_nautilus_install_location () != null) {
762 tmp = file.get_uri ().replace ("'", "\\\'");
763 show_file_in_nautilus (tmp);
764 } else {
765 tmp = file.get_parent ().get_uri ().replace ("'", "\\\'");
766 show_uri (tmp);
767 }
768 }761 }
769762
770 public void show_uri (string url) throws Error {763 public void show_uri (string url) throws Error {
771764
=== modified file 'src/util/system.vala'
--- src/util/system.vala 2014-08-24 00:41:11 +0000
+++ src/util/system.vala 2015-12-27 12:20:41 +0000
@@ -23,18 +23,10 @@
23 return exec_dir1.has_prefix (prefix_dir) ? prefix_dir : null;23 return exec_dir1.has_prefix (prefix_dir) ? prefix_dir : null;
24}24}
2525
26string get_nautilus_install_location () {
27 return Environment.find_program_in_path ("nautilus");
28}
29
30void sys_show_uri (Gdk.Screen screen, string uri) throws Error {26void sys_show_uri (Gdk.Screen screen, string uri) throws Error {
31 Gtk.show_uri (screen, uri, Gdk.CURRENT_TIME);27 Gtk.show_uri (screen, uri, Gdk.CURRENT_TIME);
32}28}
3329
34void show_file_in_nautilus (string filename) throws Error {
35 GLib.Process.spawn_command_line_async (get_nautilus_install_location () + " " + filename);
36}
37
38int posix_wexitstatus (int status) {30int posix_wexitstatus (int status) {
39 return (((status) & 0xff00) >> 8);31 return (((status) & 0xff00) >> 8);
40}
41\ No newline at end of file32\ No newline at end of file
33}

Subscribers

People subscribed via source and target branches