Browse Source

Minor improvement: rows in selection dialogs now gets cleared when the dialog is hidden, instead of when destroyed

merge-requests/365/head
eidheim 10 years ago
parent
commit
29f8b97127
  1. 9
      src/selectiondialog.cc
  2. 1
      src/selectiondialog.h

9
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_activate_on_single_click(true);
set_hover_selection(false); set_hover_selection(false);
set_rules_hint(true); set_rules_hint(true);
signal_hide().connect([this]() {
list_store->clear();
});
} }
void ListViewText::append(const std::string& value) { 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); new_row->set_value(column_record.text, value);
} }
void ListViewText::clear() {
list_store->clear();
}
SelectionDialogBase::SelectionDialogBase(Gtk::TextView& text_view, Glib::RefPtr<Gtk::TextBuffer::Mark> start_mark, bool show_search_entry, bool use_markup): text_view(text_view), SelectionDialogBase::SelectionDialogBase(Gtk::TextView& text_view, Glib::RefPtr<Gtk::TextBuffer::Mark> 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) { list_view_text(use_markup), start_mark(start_mark), show_search_entry(show_search_entry) {
if(!show_search_entry) if(!show_search_entry)
@ -107,6 +107,7 @@ void SelectionDialogBase::hide() {
tooltips->hide(); tooltips->hide();
if(on_hide) if(on_hide)
on_hide(); on_hide();
list_view_text.clear();
shown=false; shown=false;
} }

1
src/selectiondialog.h

@ -18,6 +18,7 @@ public:
bool use_markup; bool use_markup;
ListViewText(bool use_markup); ListViewText(bool use_markup);
void append(const std::string& value); void append(const std::string& value);
void clear();
private: private:
Glib::RefPtr<Gtk::ListStore> list_store; Glib::RefPtr<Gtk::ListStore> list_store;
ColumnRecord column_record; ColumnRecord column_record;

Loading…
Cancel
Save