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 725328 - Unbreak activating a search provider result
Unbreak activating a search provider result
Status: RESOLVED FIXED
Product: gnome-photos
Classification: Applications
Component: general
3.11.x
Other All
: Normal normal
: ---
Assigned To: GNOME photos maintainer(s)
GNOME photos maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2014-02-27 15:20 UTC by Debarshi Ray
Modified: 2014-02-28 07:35 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Unbreak activating a search provider result (2.75 KB, patch)
2014-02-27 15:22 UTC, Debarshi Ray
none Details | Review
Unbreak activating a search provider result (3.30 KB, patch)
2014-02-27 17:15 UTC, Debarshi Ray
committed Details | Review

Description Debarshi Ray 2014-02-27 15:20:46 UTC
Nothing happens if a search result is activated in gnome-shell.
Comment 1 Debarshi Ray 2014-02-27 15:22:14 UTC
Created attachment 270483 [details] [review]
Unbreak activating a search provider result
Comment 2 Pranav Kant 2014-02-27 16:43:49 UTC
Review of attachment 270483 [details] [review]:

::: src/photos-application.c
@@ +187,2 @@
   photos_application_create_window (self);
+  photos_base_manager_set_active_object (priv->item_mngr, item);

I think window mode should explicitly be set to PHOTOS_WINDOW_MODE_NONE.

::: src/photos-embed.c
@@ +159,3 @@
+      view_container = NULL;
+      break;
+

Since now there are two cases that has view_container = NULL, we can move the case "PHOTOS_WINDOW_MODE_PREVIEW" up to this case (PHOTOS_WINDOW_MODE_NONE) and use switch's fall-through construct. This will make the code more elegant + easy to understand.
Comment 3 Pranav Kant 2014-02-27 16:43:50 UTC
Review of attachment 270483 [details] [review]:

::: src/photos-application.c
@@ +187,2 @@
   photos_application_create_window (self);
+  photos_base_manager_set_active_object (priv->item_mngr, item);

I think window mode should explicitly be set to PHOTOS_WINDOW_MODE_NONE.

::: src/photos-embed.c
@@ +159,3 @@
+      view_container = NULL;
+      break;
+

Since now there are two cases that has view_container = NULL, we can move the case "PHOTOS_WINDOW_MODE_PREVIEW" up to this case (PHOTOS_WINDOW_MODE_NONE) and use switch's fall-through construct. This will make the code more elegant + easy to understand.
Comment 4 Debarshi Ray 2014-02-27 17:11:35 UTC
(In reply to comment #3)
> Review of attachment 270483 [details] [review]:

Thanks for the review, Pranav!

> ::: src/photos-application.c
> @@ +187,2 @@
>    photos_application_create_window (self);
> +  photos_base_manager_set_active_object (priv->item_mngr, item);
> 
> I think window mode should explicitly be set to PHOTOS_WINDOW_MODE_NONE.

I guess you are suggesting so to stress the point that we are in NONE before moving to the PREVIEW. Thing is that NONE is our "NULL mode" -- we start from NONE and then move between the valid modes. Hence I don't want to explicitly set a NONE mode after the application has started.

However, you are right. We can do better. We can rework the patch to avoid talking about NONE at all, which matches with our above rule.

> ::: src/photos-embed.c
> @@ +159,3 @@
> +      view_container = NULL;
> +      break;
> +
> 
> Since now there are two cases that has view_container = NULL, we can move the
> case "PHOTOS_WINDOW_MODE_PREVIEW" up to this case (PHOTOS_WINDOW_MODE_NONE) and
> use switch's fall-through construct.

Good point.

Thinking about it a bit more, I decided to remove the cases for NONE and PREVIEW altogether, because we should never call get_view_container_from_mode in those cases. If we do it would be a coding mistake. I moved the call in item_load inside the if branch.
Comment 5 Debarshi Ray 2014-02-27 17:15:06 UTC
Created attachment 270495 [details] [review]
Unbreak activating a search provider result
Comment 6 Pranav Kant 2014-02-28 06:29:52 UTC
Looks great now !
Comment 7 Debarshi Ray 2014-02-28 07:34:53 UTC
Comment on attachment 270495 [details] [review]
Unbreak activating a search provider result

Thanks for the review.