[gtkmm] Gtk::ListView: Fix the class description
- From: Kjell Ahlstedt <kjellahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtkmm] Gtk::ListView: Fix the class description
- Date: Sat, 5 Sep 2020 08:00:10 +0000 (UTC)
commit 6b4e86148464fc244202ac965ce7034856ddd676
Author: Kjell Ahlstedt <kjellahlstedt gmail com>
Date: Sat Sep 5 09:57:59 2020 +0200
Gtk::ListView: Fix the class description
Fixes #75
gtk/src/listview.hg | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)
---
diff --git a/gtk/src/listview.hg b/gtk/src/listview.hg
index 6b4474c2..1ef73387 100644
--- a/gtk/src/listview.hg
+++ b/gtk/src/listview.hg
@@ -34,8 +34,7 @@ namespace Gtk
* between the rows.
*
* %Gtk::ListView allows the user to select items according to the selection
- * characteristics of the model. If the provided model is not a Gtk::SelectionModel,
- * %Gtk::ListView will wrap it in a Gtk::SingleSelection. For models that allow
+ * characteristics of the model. For models that allow
* multiple selected items, it is possible to turn on _rubberband selection_,
* using set_enable_rubberband().
*
@@ -60,9 +59,12 @@ namespace Gtk
*
* void activate_cb(Gtk::ListView* list, guint position)
* {
- * auto item = list->get_model()->get_object(position);
- * if (auto app_info = std::dynamic_pointer_cast<Gio::AppInfo>(item))
- * app_info->launch(std::vector<Glib::RefPtr<Gio::File>>());
+ * if (auto model = std::dynamic_pointer_cast<Gio::ListModel>(list->get_model()))
+ * {
+ * auto item = model->get_object(position);
+ * if (auto app_info = std::dynamic_pointer_cast<Gio::AppInfo>(item))
+ * app_info->launch(std::vector<Glib::RefPtr<Gio::File>>());
+ * }
* }
*
* ...
@@ -71,14 +73,14 @@ namespace Gtk
* factory->signal_setup().connect(sigc::ptr_fun(setup_listitem_cb));
* factory->signal_bind().connect(sigc::ptr_fun(bind_listitem_cb));
*
- * auto list = Gtk::make_managed<Gtk::ListView>(factory);
+ * Glib::RefPtr<Gio::ListModel> model = create_application_list();
+ *
+ * auto list = Gtk::make_managed<Gtk::ListView>(
+ * Gtk::SingleSelection::create(model), factory);
*
* list->signal_activate().connect(
* sigc::bind<0>(sigc::ptr_fun(activate_cb), list));
*
- * auto model = create_application_list();
- * list->set_model(model);
- *
* scrolled_window.set_child(*list);
* ~~~
* @see Gtk::SelectionModel, Gtk::ColumnView, Gtk::GridView
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]