@@ -88,25 +88,21 @@ public class Views.AllTasks : Gtk.EventBox {
8888 labels_popover = new Widgets .Popovers .LabelsPopover (labels_button, true );
8989 labels_popover. position = Gtk . PositionType . BOTTOM ;
9090
91- var share_button = new Gtk .Button .from_icon_name (" planner-share-symbolic" , Gtk . IconSize . MENU );
92- share_button. get_style_context (). add_class (" planner-share-menu" );
93- share_button. tooltip_text = _(" Share" );
94- share_button. valign = Gtk . Align . CENTER ;
95- share_button. halign = Gtk . Align . CENTER ;
96-
97- share_button. clicked. connect (() = > {
98- var share_dialog = new Dialogs .ShareDialog (Application . instance. main_window);
99- share_dialog. inbox = true ;
100- share_dialog. destroy. connect (Gtk . main_quit);
101- share_dialog. show_all ();
102- });
91+ var search_button = new Gtk .ToggleButton ();
92+ search_button. get_style_context (). add_class (" planner-search-menu" );
93+ search_button. tooltip_text = _(" Search" );
94+ search_button. valign = Gtk . Align . CENTER ;
95+ search_button. halign = Gtk . Align . CENTER ;
96+ search_button. add (new Gtk .Image .from_icon_name (" edit-find-symbolic" , Gtk . IconSize . MENU ));
97+
98+ var search_popover = new Widgets .Popovers .SearchPopover (search_button);
10399
104100 var action_grid = new Gtk .Grid ();
105101 action_grid. valign = Gtk . Align . CENTER ;
106102 action_grid. column_spacing = 12 ;
107103
108104 action_grid. add (labels_button);
109- action_grid. add (share_button );
105+ action_grid. add (search_button );
110106 action_grid. add (show_hide_all_button);
111107
112108 var top_box = new Gtk .Box (Gtk . Orientation . HORIZONTAL , 0 );
@@ -172,7 +168,6 @@ public class Views.AllTasks : Gtk.EventBox {
172168 main_overlay. add (main_box);
173169
174170 add (main_overlay);
175-
176171 // Events
177172
178173 Gdk . Display display = Gdk . Display . get_default ();
@@ -283,6 +278,23 @@ public class Views.AllTasks : Gtk.EventBox {
283278 }
284279 });
285280
281+ search_button. toggled. connect (() = > {
282+ if (search_button. active) {
283+ search_popover. show_all ();
284+ }
285+ });
286+
287+ search_popover. closed. connect (() = > {
288+ search_button. active = false ;
289+ });
290+
291+ search_popover. search_changed. connect ((text) = > {
292+ tasks_list. set_filter_func ((row) = > {
293+ var item = row as Widgets . TaskRow ;
294+ return text. down () in item. task. content. down ();
295+ });
296+ });
297+
286298 tasks_list. remove. connect ((widget) = > {
287299 check_visible_alertview ();
288300 });
0 commit comments