diff --git a/gramps/gui/filters/_searchbar.py b/gramps/gui/filters/_searchbar.py index ccd1363c9..d420ea56a 100644 --- a/gramps/gui/filters/_searchbar.py +++ b/gramps/gui/filters/_searchbar.py @@ -42,9 +42,10 @@ _KP_ENTER = Gdk.keyval_from_name("KP_Enter") # #------------------------------------------------------------------------- class SearchBar(object): - def __init__( self, dbstate, uistate, on_apply, apply_done = None): + def __init__( self, dbstate, uistate, on_apply, apply_done = None, apply_clear = None): self.on_apply_callback = on_apply self.apply_done_callback = apply_done + self.apply_clear_callback = apply_clear self.dbstate = dbstate self.uistate = uistate self.apply_text = '' @@ -151,6 +152,8 @@ class SearchBar(object): def apply_clear(self, obj): self.filter_text.set_text('') self.apply_filter() + if self.apply_clear_callback is not None: + self.apply_clear_callback() def get_value(self): text = str(self.filter_text.get_text()).strip() diff --git a/gramps/gui/selectors/baseselector.py b/gramps/gui/selectors/baseselector.py index 1153c4fba..11c0ace65 100644 --- a/gramps/gui/selectors/baseselector.py +++ b/gramps/gui/selectors/baseselector.py @@ -92,7 +92,7 @@ class BaseSelector(ManagedWindow): self.tree.connect('key-press-event', self.searchbox.treeview_keypress) #add the search bar - self.search_bar = SearchBar(dbstate, uistate, self.build_tree) + self.search_bar = SearchBar(dbstate, uistate, self.build_tree, apply_clear=self.apply_clear) filter_box = self.search_bar.build() self.setup_filter() vbox.pack_start(filter_box, False, False, 0) @@ -348,6 +348,9 @@ class BaseSelector(ManagedWindow): self.model.destroy() self.model = None + def apply_clear(self): + self.showall.set_active(False) + def _cleanup_on_exit(self): """Unset all things that can block garbage collection. Finalize rest