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 759413 - Pre-select the file when opening a local source with Nautilus from Properties
Pre-select the file when opening a local source with Nautilus from Properties
Status: RESOLVED FIXED
Product: gnome-photos
Classification: Applications
Component: general
3.18.x
Other All
: Normal enhancement
: ---
Assigned To: GNOME photos maintainer(s)
GNOME photos maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2015-12-13 19:55 UTC by medeoTL
Modified: 2018-01-18 15:25 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
local-item: Pre-select the file when opening with Nautilus (2.45 KB, patch)
2018-01-16 17:33 UTC, Umang Jain
none Details | Review
Split out the code to create a GAppLaunchContext from a GtkWidget (5.26 KB, patch)
2018-01-18 13:29 UTC, Debarshi Ray
committed Details | Review
base-item, export-notification: Use GAppLaunchContexts to launch apps (2.52 KB, patch)
2018-01-18 13:30 UTC, Debarshi Ray
committed Details | Review
local-item: Pre-select the file when opening with Nautilus (4.31 KB, patch)
2018-01-18 13:31 UTC, Debarshi Ray
committed Details | Review

Description medeoTL 2015-12-13 19:55:27 UTC
Use case: I browse in gnome-photos and I find an image that I want to move/save/send to other people, using Nautilus. In my case, I want to send it via Whatsapp web client.

Current behaviuor: Go in property dialog and click the link/path of source (fonte in my italian installation)

Expected behaviour: a Nautilus window arise with the right image file selected

Current behaviour: a Nautilus window arise but no file is selected

If I have many images in one folder (and I have, my phones backup for example) is really hard to find the right image.
Comment 1 Debarshi Ray 2016-09-09 13:30:01 UTC
Thanks for getting in touch!

Being able to share an image in various ways is definitely a valid use-case that we want to cover. In GNOME 3.22, we are going to have support for sharing. We started out small - at the moment it offers you only e-mail and Google Photos. Bluetooth, Facebook, removable storage devices are going to appear in future versions.

Having said that, I realize that we will never natively cover all the different ways in which an user might want to share content. For that we have 'export'.

Since GNOME 3.20, we have some simple non-destructive editing features. ie.  we never touch the original pixel data. So, if you directly use the original file, you  won't have any edits that you might have done. Exporting solves that by rendering to a separate file, which you can delete whenever you want. It will also let you downscale the image to preserve bandwidth, etc..

Generally speaking, I don't want to lead users too much towards the traditional files and directories model. One of the overarching goals of the new GNOME content applications is to provide an alternative to Files (ie. nautilus). It means that those who meticulously organize their content across directories can still continue to do so (that's why we are trying to make Files even better), but others who don't care much about the underlying storage will now have an alternative and there certainly is a good number of such users these days.

Once again, thank you.
Comment 2 Debarshi Ray 2018-01-15 16:12:38 UTC
On second thoughts, it seems like a nice touch to pre-select the file in the file manager.

(Note that directly manipulating the file might not work for edited items as mentioned in comment 1.)

Here's how to do it:
* connect to GtkLinkButton::activate-link
* use g_app_info_get_default_for_uri_scheme with uri_scheme="file"
* check if the GAppInfo is nautilus, if not return FALSE
* if it's nautilus then spawn it as "nautilus -s file:///uri/of/the/actual/item"
Comment 3 Umang Jain 2018-01-16 17:33:00 UTC
Created attachment 366895 [details] [review]
local-item: Pre-select the file when opening with Nautilus

g_app_info_get_default_for_uri_scheme ("file")

returns NULL for some reason. I don't know why, so this is what I have till now.
Comment 4 Debarshi Ray 2018-01-16 19:32:57 UTC
Given that gtk_show_uri ("file:///path/to/directory") opens nautilus, we might need to exploit the fact that nautilus (or any file manager) is registered as a handler for the inode/directory MIME type.

In that case, you will need two URIs. One for the parent directory to get the default inode/directory handler, and if that's nautilus you want to pass it the URI of the actual item behind the -s option.
Comment 5 Debarshi Ray 2018-01-18 11:19:03 UTC
Review of attachment 366895 [details] [review]:

::: src/photos-local-item.c
@@ +165,1 @@
+static void

A GtkLinkButton::activate-link needs to return a gboolean.
Comment 6 Debarshi Ray 2018-01-18 11:27:10 UTC
Review of attachment 366895 [details] [review]:

::: src/photos-local-item.c
@@ +234,3 @@
       source_widget = gtk_link_button_new_with_label (source_uri, source_path);
+      g_signal_connect_swapped (source_widget,
+                                "activate-link",

Since the source_widget's lifetime isn't controlled by LocalItem, we need to ensure that the signal handler isn't invoked after the LocalItem has been destroyed. The best way to do that is to use g_signal_connect_object. It will disconnect the handler when the LocalItem is destroyed.

@@ +236,3 @@
+                                "activate-link",
+                                G_CALLBACK (photos_local_item_source_link_activated),
+                                g_object_ref (item));

Simply adding a reference will also solve the above issue, but it will also end up leaking the LocalItem.
Comment 7 Debarshi Ray 2018-01-18 13:29:51 UTC
Created attachment 367013 [details] [review]
Split out the code to create a GAppLaunchContext from a GtkWidget
Comment 8 Debarshi Ray 2018-01-18 13:30:05 UTC
Created attachment 367014 [details] [review]
base-item, export-notification: Use GAppLaunchContexts to launch apps
Comment 9 Debarshi Ray 2018-01-18 13:31:17 UTC
Created attachment 367015 [details] [review]
local-item: Pre-select the file when opening with Nautilus
Comment 10 Debarshi Ray 2018-01-18 13:32:48 UTC
Thanks for all the work!
Comment 11 Debarshi Ray 2018-01-18 13:33:18 UTC
Please file a GitLab issue if things don't work with Flatpak.