[gnome-photos/wip/rishi/collection: 33/33] overview-searchbar: ...



commit cf2cb73eacbbf90bfa785230ff7e7b8d21b50be9
Author: Debarshi Ray <debarshir gnome org>
Date:   Mon Jan 22 00:37:57 2018 +0100

    overview-searchbar: ...

 src/photos-overview-searchbar.c | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)
---
diff --git a/src/photos-overview-searchbar.c b/src/photos-overview-searchbar.c
index 51c1579a..4a3cd857 100644
--- a/src/photos-overview-searchbar.c
+++ b/src/photos-overview-searchbar.c
@@ -39,6 +39,9 @@
 struct _PhotosOverviewSearchbar
 {
   PhotosSearchbar parent_instance;
+  GAction *search_match_action;
+  GAction *search_source_action;
+  GAction *search_type_action;
   GAction *select_all_action;
   GdTaggedEntry *search_entry;
   GdTaggedEntryTag *src_tag;
@@ -85,13 +88,17 @@ static void
 photos_overview_searchbar_hide (PhotosSearchbar *searchbar)
 {
   PhotosOverviewSearchbar *self = PHOTOS_OVERVIEW_SEARCHBAR (searchbar);
+  g_autoptr (GVariant) parameter = NULL;
 
   gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self->dropdown_button), FALSE);
   g_simple_action_set_enabled (G_SIMPLE_ACTION (self->select_all_action), TRUE);
 
-  photos_base_manager_set_active_object_by_id (self->srch_typ_mngr, "all");
-  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");
+  parameter = g_variant_new_string ("all");
+  parameter = g_variant_ref_sink (parameter);
+
+  g_action_activate (self->search_match_action, parameter);
+  g_action_activate (self->search_source_action, parameter);
+  g_action_activate (self->search_type_action, parameter);
 
   photos_search_controller_set_string (self->srch_cntrlr, "");
 
@@ -259,6 +266,9 @@ photos_overview_searchbar_init (PhotosOverviewSearchbar *self)
   app = g_application_get_default ();
   state = photos_search_context_get_state (PHOTOS_SEARCH_CONTEXT (app));
 
+  self->search_match_action = g_action_map_lookup_action (G_ACTION_MAP (app), "search-match");
+  self->search_source_action = g_action_map_lookup_action (G_ACTION_MAP (app), "search-source");
+  self->search_type_action = g_action_map_lookup_action (G_ACTION_MAP (app), "search-type");
   self->select_all_action = g_action_map_lookup_action (G_ACTION_MAP (app), "select-all");
 
   self->src_mngr = g_object_ref (state->src_mngr);


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