[gnome-photos] embed, overview-searchbar: Simplify code



commit 5defdad1e9203241520f9e9c35b33d51466bb4a2
Author: Debarshi Ray <debarshir gnome org>
Date:   Fri Aug 18 14:53:32 2017 +0200

    embed, overview-searchbar: Simplify code
    
    OverviewSearchbar unsets all the search criteria, except the search
    string, when it gets hidden. There is no reason for it not to.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=786936

 src/photos-embed.c              |   14 ++------------
 src/photos-overview-searchbar.c |    2 ++
 2 files changed, 4 insertions(+), 12 deletions(-)
---
diff --git a/src/photos-embed.c b/src/photos-embed.c
index 1bff91c..30edeff 100644
--- a/src/photos-embed.c
+++ b/src/photos-embed.c
@@ -345,19 +345,9 @@ photos_embed_active_collection_changed (PhotosBaseManager *manager, PhotosBaseIt
     return;
 
   if (collection == NULL)
-    {
-      photos_embed_restore_search (self);
-    }
+    photos_embed_restore_search (self);
   else
-    {
-      const gchar *str;
-
-      photos_embed_save_search (self);
-
-      str = photos_search_controller_get_string (self->srch_cntrlr);
-      if (g_strcmp0 (str, "") != 0)
-        photos_search_controller_set_string (self->srch_cntrlr, "");
-    }
+    photos_embed_save_search (self);
 }
 
 
diff --git a/src/photos-overview-searchbar.c b/src/photos-overview-searchbar.c
index ad2815a..6480d56 100644
--- a/src/photos-overview-searchbar.c
+++ b/src/photos-overview-searchbar.c
@@ -102,6 +102,8 @@ photos_overview_searchbar_hide (PhotosSearchbar *searchbar)
   photos_base_manager_set_active_object_by_id (self->srch_mtch_mngr, "all");
   photos_base_manager_set_active_object_by_id (self->src_mngr, "all");
 
+  photos_search_controller_set_string (self->srch_cntrlr, "");
+
   PHOTOS_SEARCHBAR_CLASS (photos_overview_searchbar_parent_class)->hide (searchbar);
 }
 


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