summaryrefslogtreecommitdiff
path: root/libs/gtkmm2ext/utils.cc
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2015-08-11 14:04:58 +0200
committerRobin Gareus <robin@gareus.org>2015-08-11 15:38:26 +0200
commit9bc85a553c542bc3bff108a066a1da9493078491 (patch)
tree89759df5fc3b68ce3d94ac6c98061cf5e641c1d2 /libs/gtkmm2ext/utils.cc
parenta3b2b1bcfae110c01d47b256e5a4e973a86d2f71 (diff)
add API to get combobox option count.
The data model needs to be checked to count available options. Directly using ComboBoxText::children()::size() counts widgets.
Diffstat (limited to 'libs/gtkmm2ext/utils.cc')
-rw-r--r--libs/gtkmm2ext/utils.cc10
1 files changed, 10 insertions, 0 deletions
diff --git a/libs/gtkmm2ext/utils.cc b/libs/gtkmm2ext/utils.cc
index 6efa95ac1a..f1616f16a1 100644
--- a/libs/gtkmm2ext/utils.cc
+++ b/libs/gtkmm2ext/utils.cc
@@ -322,6 +322,16 @@ Gtkmm2ext::get_popdown_strings (Gtk::ComboBoxText& cr, std::vector<std::string>&
}
}
+size_t
+Gtkmm2ext::get_popdown_string_count (Gtk::ComboBoxText& cr)
+{
+ Glib::RefPtr<const Gtk::TreeModel> m = cr.get_model();
+ if (!m) {
+ return 0;
+ }
+ return m->children().size();
+}
+
bool
Gtkmm2ext::contains_value (Gtk::ComboBoxText& cr, const std::string text)
{