[gnome-photos] Unbreak activating a search provider result



commit 8f5109445fcd35b0d05f1015b022f0ea5990b41e
Author: Debarshi Ray <debarshir gnome org>
Date:   Thu Feb 27 10:55:54 2014 +0100

    Unbreak activating a search provider result
    
    I swear I had tested it before pushing, but looks I made a mistake.
    
    We have to create the main window before setting the active item.
    Otherwise the emission of PhotosItemManager::active-changed will be
    missed. Secondly, since we are not moving from a view with an
    associated model we should skip setting it.
    
    Fallout from 5e6a86718aabf7731f885adcaf5b7ef4da905d3b
    
    Fixes: https://bugzilla.gnome.org/725328

 src/photos-application.c |    4 +---
 src/photos-embed.c       |   18 ++++++++++--------
 2 files changed, 11 insertions(+), 11 deletions(-)
---
diff --git a/src/photos-application.c b/src/photos-application.c
index 527b84d..4a05a49 100644
--- a/src/photos-application.c
+++ b/src/photos-application.c
@@ -184,10 +184,8 @@ photos_application_activate_item (PhotosApplication *self, GObject *item)
 {
   PhotosApplicationPrivate *priv = self->priv;
 
-  photos_base_manager_set_active_object (priv->item_mngr, item);
-
   photos_application_create_window (self);
-  photos_mode_controller_set_window_mode (priv->mode_cntrlr, PHOTOS_WINDOW_MODE_PREVIEW);
+  photos_base_manager_set_active_object (priv->item_mngr, item);
   g_application_activate (G_APPLICATION (self));
 
   /* TODO: Forward the search terms when we exit the preview */
diff --git a/src/photos-embed.c b/src/photos-embed.c
index 991893c..c2c4a9d 100644
--- a/src/photos-embed.c
+++ b/src/photos-embed.c
@@ -164,9 +164,6 @@ photos_embed_get_view_container_from_mode (PhotosEmbed *self, PhotosWindowMode m
       view_container = priv->overview;
       break;
 
-    case PHOTOS_WINDOW_MODE_PREVIEW:
-      view_container = NULL;
-      break;
 
     case PHOTOS_WINDOW_MODE_SEARCH:
       view_container = priv->search;
@@ -228,7 +225,6 @@ photos_embed_item_load (GObject *source_object, GAsyncResult *res, gpointer user
   GeglNode *node;
   GtkListStore *model;
   GtkTreePath *current_path;
-  GtkWidget *view_container;
   PhotosBaseItem *item = PHOTOS_BASE_ITEM (source_object);
   PhotosWindowMode mode;
 
@@ -240,13 +236,19 @@ photos_embed_item_load (GObject *source_object, GAsyncResult *res, gpointer user
     goto out;
 
   mode = photos_mode_controller_get_window_mode (priv->mode_cntrlr);
-  view_container = photos_embed_get_view_container_from_mode (self, mode);
 
-  /* If we are already in the preview and navigating using the
-   * buttons, then we don't need this.
+  /* This is not needed when:
+   *  - activated from the search provider
+   *  - already in the preview and navigating using the buttons
    */
-  if (mode != PHOTOS_WINDOW_MODE_PREVIEW)
+  if (mode == PHOTOS_WINDOW_MODE_COLLECTIONS
+      || mode == PHOTOS_WINDOW_MODE_FAVORITES
+      || mode == PHOTOS_WINDOW_MODE_OVERVIEW
+      || mode == PHOTOS_WINDOW_MODE_SEARCH)
     {
+      GtkWidget *view_container;
+
+      view_container = photos_embed_get_view_container_from_mode (self, mode);
       current_path = photos_view_container_get_current_path (PHOTOS_VIEW_CONTAINER (view_container));
       model = photos_view_container_get_model (PHOTOS_VIEW_CONTAINER (view_container));
       photos_preview_view_set_model (PHOTOS_PREVIEW_VIEW (priv->preview), GTK_TREE_MODEL (model), 
current_path);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]