Merged revisions 6293,6296-6306,6308 via svnmerge from
[ardour.git] / libs / gtkmm2 / gtk / gtkmm / comboboxtext.cc
index a9c8d20d5f39527aead9732b744250738f36a59e..b5f1f73f7ea6ff28193d7f50fa61eb2a90601f11 100644 (file)
@@ -99,7 +99,13 @@ Glib::ustring ComboBoxText::get_active_text() const
   return result;
 }
 
+//deprecated.
 void ComboBoxText::clear()
+{
+  clear_items();
+}
+
+void ComboBoxText::clear_items()
 {
   //Ideally, we would just store the ListStore as a member variable, but we forgot to do that and not it would break the ABI.
   Glib::RefPtr<Gtk::TreeModel> model = get_model();
@@ -109,6 +115,28 @@ void ComboBoxText::clear()
     list_model->clear();
 }
 
+void ComboBoxText::remove_text(const Glib::ustring& text)
+{
+  //Ideally, we would just store the ListStore as a member variable, but we forgot to do that and not it would break the ABI.
+  Glib::RefPtr<Gtk::TreeModel> model = get_model();
+  Glib::RefPtr<Gtk::ListStore> list_model = Glib::RefPtr<ListStore>::cast_dynamic(model);
+
+  //Look for the row with this text, and remove it:
+  if(list_model)
+  {
+    for(Gtk::TreeModel::iterator iter = list_model->children().begin(); iter != list_model->children().end(); ++iter)
+    {
+      const Glib::ustring& this_text = (*iter)[m_text_columns.m_column];
+
+      if(this_text == text)
+      {
+        list_model->erase(iter);
+        return; //success
+      }
+    }
+  }
+}
+
 void ComboBoxText::set_active_text(const Glib::ustring& text)
 {
   //Look for the row with this text, and activate it: