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 785051 - Unedited photo are shown as edited
Unedited photo are shown as edited
Status: RESOLVED OBSOLETE
Product: gnome-photos
Classification: Applications
Component: general
3.24.x
Other All
: Normal normal
: ---
Assigned To: GNOME photos maintainer(s)
GNOME photos maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2017-07-18 09:12 UTC by medeoTL
Modified: 2018-01-23 10:13 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Disables "done" button when photo is unedited. (9.19 KB, patch)
2017-10-17 10:55 UTC, Nidhi Gupta
needs-work Details | Review

Description medeoTL 2017-07-18 09:12:30 UTC
How to reproduce:

- select a photo
- click the edit button
- click "done" button (without actually editing the photo in any way)

expected result: nothing happens and you get back to the original photo

current result: you return to the original photo but get a "name-of-the-photo edited [undo]" pop up
Comment 1 Debarshi Ray 2017-07-18 09:49:02 UTC
That's a good point!
Comment 2 Debarshi Ray 2017-08-02 09:23:04 UTC
My suggestion would be disable the "done" button unless the item was actually edited. This should also take into consideration cases where some tools were temporarily used to do some edits, but their effects were undone afterwards.
Comment 3 Debarshi Ray 2017-10-02 17:43:44 UTC
Summarising the discussion in #photos on GIMPNet:

I think the way forward is to add a "changed" signal to PhotosPipeline and enable/disable the GAction driving the "done" button depending on whether the pipeline is edited or not.
Comment 4 Nidhi Gupta 2017-10-17 10:55:38 UTC
Created attachment 361732 [details] [review]
Disables "done" button when photo is unedited.
Comment 5 Debarshi Ray 2017-10-24 18:56:34 UTC
Review of attachment 361732 [details] [review]:

Thanks for the patch, Nidhi. I haven't tested it thoroughly, but some quick comments below:

::: src/photos-pipeline.c
@@ +56,3 @@
+};
+
+static guint signals[LAST_SIGNAL] = { 0 };

Nitpick: there should be a newline after this.

@@ +222,3 @@
   output = gegl_node_get_output_proxy (self->graph, "output");
   gegl_node_link (input, output);
+  g_signal_emit (self, signals[PIPELINE_CHANGED], 0, FALSE);

We shouldn't emit a signal here. The object is still getting constructed. ie., we are still inside photos_pipeline_new_*. So it is too early for any users of the Pipeline instance to connect to the signal.

@@ +324,3 @@
+
+  signals[PIPELINE_CHANGED] = g_signal_new ("changed",
+                                        G_TYPE_FROM_CLASS (class),

Nitpick: the alignment is off.

@@ +688,3 @@
   g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
 
+  g_signal_emit (self, signals[PIPELINE_CHANGED], 0, FALSE);

We shouldn't emit a signal here. This merely saves the current state of the pipeline in a file by serializing it into XML. There is no change in its output.

However, we are missing a signal emission in photos_pipeline_remove.

@@ +739,3 @@
   xml = gegl_node_to_xml_full (self->graph, self->graph, "/");
   photos_debug (PHOTOS_DEBUG_GEGL, "Pipeline: %s", xml);
+  g_signal_emit (self, signals[PIPELINE_CHANGED], 0, FALSE);

There is no guarantee that reverting will restore the pipeline to its unedited state. This will revert to the previous snapshot. ie., the state of the pipeline before we entered the EDIT mode. So, this won't work if someone is editing the same BaseItem twice.

I think that we need to use photos_pipeline_is_edited to get the signal's parameter.

@@ +781,3 @@
   if (parent != NULL)
     gegl_node_add_child (parent, self->graph);
+  g_signal_emit (self, signals[PIPELINE_CHANGED], 0, TRUE);

We shouldn't emit a signal here. This merely changes the parent GeglNode of the pipeline's graph. It doesn't change the contents of the graph.
Comment 6 Nidhi Gupta 2017-10-25 13:42:28 UTC
(In reply to Debarshi Ray from comment #5)
> Review of attachment 361732 [details] [review] [review]:
> 
> Thanks for the patch, Nidhi. I haven't tested it thoroughly, but some quick
> comments below:
> 
> ::: src/photos-pipeline.c

> @@ +688,3 @@
>    g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
>  
> +  g_signal_emit (self, signals[PIPELINE_CHANGED], 0, FALSE);
> 
> We shouldn't emit a signal here. This merely saves the current state of the
> pipeline in a file by serializing it into XML. There is no change in its
> output.

Signal with false parameter is required here because when we save the edited photo, next time on opening edit panel done button should be disabled.
I tested this case.

> 
> However, we are missing a signal emission in photos_pipeline_remove.
> 

In photos_pipeline_remove, we are removing one operation at a time but that doesn't ensure that overall photo is unedited. I think this will come into the picture when we take care of cases where some tools were temporarily used to do some edits, but their effects were undone afterwards. Correct me if this is wrong.

> @@ +739,3 @@
>    xml = gegl_node_to_xml_full (self->graph, self->graph, "/");
>    photos_debug (PHOTOS_DEBUG_GEGL, "Pipeline: %s", xml);
> +  g_signal_emit (self, signals[PIPELINE_CHANGED], 0, FALSE);
> 
> There is no guarantee that reverting will restore the pipeline to its
> unedited state. This will revert to the previous snapshot. ie., the state of
> the pipeline before we entered the EDIT mode. So, this won't work if someone
> is editing the same BaseItem twice.

This is called when we click cancel button, done button should be disabled so that when we enter edit section again,we find it disabled. I tested this case.
Comment 7 Debarshi Ray 2017-10-25 14:22:15 UTC
(In reply to Nidhi Gupta from comment #6)
> (In reply to Debarshi Ray from comment #5)
> > ::: src/photos-pipeline.c
> 
> > @@ +688,3 @@
> >    g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
> >  
> > +  g_signal_emit (self, signals[PIPELINE_CHANGED], 0, FALSE);
> > 
> > We shouldn't emit a signal here. This merely saves the current state of the
> > pipeline in a file by serializing it into XML. There is no change in its
> > output.
> 
> Signal with false parameter is required here because when we save the edited
> photo, next time on opening edit panel done button should be disabled.
> I tested this case.

That needs to be handled somewhere else. Possibly something more higher-level that Pipeline.

The Pipeline::changed signal should have a clear meaning - it's emitted when the graph changes after the initial construction has happened, and the boolean parameter indicates whether there are any edits or not.

> > However, we are missing a signal emission in photos_pipeline_remove.
> > 
> 
> In photos_pipeline_remove, we are removing one operation at a time but that
> doesn't ensure that overall photo is unedited.

You can use photos_pipeline_is_edited to determine what value to pass with the signal.

> > @@ +739,3 @@
> >    xml = gegl_node_to_xml_full (self->graph, self->graph, "/");
> >    photos_debug (PHOTOS_DEBUG_GEGL, "Pipeline: %s", xml);
> > +  g_signal_emit (self, signals[PIPELINE_CHANGED], 0, FALSE);
> > 
> > There is no guarantee that reverting will restore the pipeline to its
> > unedited state. This will revert to the previous snapshot. ie., the state of
> > the pipeline before we entered the EDIT mode. So, this won't work if someone
> > is editing the same BaseItem twice.
> 
> This is called when we click cancel button, done button should be disabled
> so that when we enter edit section again,we find it disabled. I tested this
> case.

That should be handled somewhere else. The patch might be working (I haven't tried it) in its current form, but in future the code will become confusing and unmanageable if things (especially interfaces) don't have clear semantics. That's why Pipeline::changed needs to have a clear meaning. See above.
Comment 8 Umang Jain 2018-01-04 11:54:15 UTC
Hi Nidhi, Can you re-work the patch according to the review comments given and try to get this merged?

Thanks!
Comment 9 Nidhi Gupta 2018-01-04 13:39:09 UTC
Hi Umang,
I am stuck at the review comment "That needs to be handled somewhere else. Possibly something more higher-level that Pipeline.".
I am not clear how to approach this bug correctly.
Thanks for your time.
Comment 10 Umang Jain 2018-01-04 13:47:19 UTC
(In reply to Nidhi Gupta from comment #9)
> Hi Umang,
> I am stuck at the review comment "That needs to be handled somewhere else.
> Possibly something more higher-level that Pipeline.".
> I am not clear how to approach this bug correctly.
> Thanks for your time.

Hi Nidhi. Looks like that something can be discussed at IRC maybe? What do you think? :)
Comment 11 Debarshi Ray 2018-01-05 14:18:38 UTC
By "higher-level than Pipeline" I meant something that's conceptually more abstract than Pipeline in the application's architecture.

The most abstract entity that we have is Application. Instantiating it, and invoking its "run" method is all that you need to start the application. Inside Application there is MainWindow, the various singletons (like ItemManager, SourceManager, etc.), and so on. MainWindow contains a hierarchy of more specialized widgets; the ItemManager contains all the BaseItems, and each of those can have a Pipeline.

So, Pipeline is a few layers below the UI widgets, which is why things need to be wired through the different layers.
Comment 12 GNOME Infrastructure Team 2018-01-23 10:13:32 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/gnome-photos/issues/68.