From 71a5521b66d6ecf37a238389d34726ed53161601 Mon Sep 17 00:00:00 2001 From: Hombre Date: Thu, 13 Dec 2018 01:56:36 +0100 Subject: [PATCH] The (custom) entry was added to the combobox at each profile loading See issue #5092 --- rtgui/profilepanel.cc | 2 ++ rtgui/profilestorecombobox.cc | 8 ++++++++ rtgui/profilestorecombobox.h | 1 + 3 files changed, 11 insertions(+) diff --git a/rtgui/profilepanel.cc b/rtgui/profilepanel.cc index eb835c648..a3a0f72b7 100644 --- a/rtgui/profilepanel.cc +++ b/rtgui/profilepanel.cc @@ -167,6 +167,7 @@ Gtk::TreeIter ProfilePanel::getLastSavedRow() Gtk::TreeIter ProfilePanel::addCustomRow() { if(customPSE) { + profiles->deleteRow(customPSE); delete customPSE; customPSE = nullptr; } @@ -179,6 +180,7 @@ Gtk::TreeIter ProfilePanel::addCustomRow() Gtk::TreeIter ProfilePanel::addLastSavedRow() { if(lastSavedPSE) { + profiles->deleteRow(lastSavedPSE); delete lastSavedPSE; lastSavedPSE = nullptr; } diff --git a/rtgui/profilestorecombobox.cc b/rtgui/profilestorecombobox.cc index b4e893c1d..e7d64f28b 100644 --- a/rtgui/profilestorecombobox.cc +++ b/rtgui/profilestorecombobox.cc @@ -356,3 +356,11 @@ Gtk::TreeIter ProfileStoreComboBox::addRow (const ProfileStoreEntry *profileStor return newEntry; } +/** @brief Delete a row from the first level of the tree */ +void ProfileStoreComboBox::deleteRow (const ProfileStoreEntry *profileStoreEntry) +{ + Gtk::TreeIter entry = findRowFromEntry(profileStoreEntry); + if (entry) { + refTreeModel->erase(entry); + } +} diff --git a/rtgui/profilestorecombobox.h b/rtgui/profilestorecombobox.h index 111e767c2..9c31ad60a 100644 --- a/rtgui/profilestorecombobox.h +++ b/rtgui/profilestorecombobox.h @@ -90,6 +90,7 @@ public: bool setInternalEntry (); Gtk::TreeIter getRowFromLabel (Glib::ustring name); Gtk::TreeIter addRow (const ProfileStoreEntry *profileStoreEntry); + void deleteRow (const ProfileStoreEntry *profileStoreEntry); }; #endif