From 29f8b97127107ce5939cca47696dd1a502a9f61a Mon Sep 17 00:00:00 2001 From: eidheim Date: Wed, 23 Dec 2015 17:51:05 +0100 Subject: [PATCH] Minor improvement: rows in selection dialogs now gets cleared when the dialog is hidden, instead of when destroyed --- src/selectiondialog.cc | 9 +++++---- src/selectiondialog.h | 1 + 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/selectiondialog.cc b/src/selectiondialog.cc index 12cf580..187a304 100644 --- a/src/selectiondialog.cc +++ b/src/selectiondialog.cc @@ -31,10 +31,6 @@ ListViewText::ListViewText(bool use_markup) : Gtk::TreeView(), use_markup(use_ma set_activate_on_single_click(true); set_hover_selection(false); set_rules_hint(true); - - signal_hide().connect([this]() { - list_store->clear(); - }); } void ListViewText::append(const std::string& value) { @@ -42,6 +38,10 @@ void ListViewText::append(const std::string& value) { new_row->set_value(column_record.text, value); } +void ListViewText::clear() { + list_store->clear(); +} + SelectionDialogBase::SelectionDialogBase(Gtk::TextView& text_view, Glib::RefPtr start_mark, bool show_search_entry, bool use_markup): text_view(text_view), list_view_text(use_markup), start_mark(start_mark), show_search_entry(show_search_entry) { if(!show_search_entry) @@ -107,6 +107,7 @@ void SelectionDialogBase::hide() { tooltips->hide(); if(on_hide) on_hide(); + list_view_text.clear(); shown=false; } diff --git a/src/selectiondialog.h b/src/selectiondialog.h index 474e799..7c6d901 100644 --- a/src/selectiondialog.h +++ b/src/selectiondialog.h @@ -18,6 +18,7 @@ public: bool use_markup; ListViewText(bool use_markup); void append(const std::string& value); + void clear(); private: Glib::RefPtr list_store; ColumnRecord column_record;