[gnome-photos/gnome-3-20] view-container: Consolidate searchbar and	mouse activation
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc: 
- Subject: [gnome-photos/gnome-3-20] view-container: Consolidate searchbar and	mouse activation
- Date: Wed, 20 Jul 2016 13:20:56 +0000 (UTC)
commit 806aa36ff93851e5932e293eae8013b6e5004873
Author: Debarshi Ray <debarshir gnome org>
Date:   Tue Jun 28 19:31:26 2016 +0200
    view-container: Consolidate searchbar and mouse activation
    
    ViewContainer->current_path is only set in response to
    GdMainView::item-activated, which is emitted due to a mouse click.
    When we activate by hitting ENTER in the searchbar, current_path might
    not have been set (or set to something that is not the first item).
    Therefore, when we try to use it to set the model for PreviewView, it
    leads to:
      CRITICAL **: photos_preview_view_set_model: assertion
        'current_path != NULL' failed
    
    Let's handle searchbar activation by triggering the same code path
    that is used for mouse activation.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=768130
 src/photos-view-container.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/src/photos-view-container.c b/src/photos-view-container.c
index 866f482..d9d8133 100644
--- a/src/photos-view-container.c
+++ b/src/photos-view-container.c
@@ -486,13 +486,13 @@ photos_view_container_activate_result (PhotosViewContainer *self)
 
   if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (self->model), &iter))
     {
-      GObject *item;
-      gchar *id;
+      GtkTreePath *path;
+      GtkWidget *generic_view;
 
-      gtk_tree_model_get (GTK_TREE_MODEL (self->model), &iter, PHOTOS_VIEW_MODEL_URN, &id, -1);
-      item = photos_base_manager_get_object_by_id (self->item_mngr, id);
-      photos_base_manager_set_active_object (self->item_mngr, item);
-      g_free (id);
+      path = gtk_tree_model_get_path (GTK_TREE_MODEL (self->model), &iter);
+      generic_view = gd_main_view_get_generic_view (self->view);
+      gtk_icon_view_item_activated (GTK_ICON_VIEW (generic_view), path);
+      gtk_tree_path_free (path);
     }
 }
 
[
Date Prev][
Date Next]   [
Thread Prev][
Thread Next]   
[
Thread Index]
[
Date Index]
[
Author Index]