[gtkmm-documentation] Clarify: ColumnRecords can be static *singletons*
- From: Daniel Boles <dboles src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtkmm-documentation] Clarify: ColumnRecords can be static *singletons*
- Date: Sun, 14 Jan 2018 20:50:47 +0000 (UTC)
commit baeb2620c1369d1add73aca61a786fd722dc6560
Author: Daniel Boles <dboles src gmail com>
Date: Wed Nov 22 21:56:38 2017 +0000
Clarify: ColumnRecords can be static *singletons*
Sharing these between models is highly desirable as it can avoid a lot
of work and waste. So, take the para warning about not making static
ColumnRecords, and reword it to explain why you probably wanted a static
one and what the real solution is.
https://bugzilla.gnome.org/show_bug.cgi?id=792482
docs/tutorial/C/index-in.docbook | 11 +++++++++--
1 files changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/docs/tutorial/C/index-in.docbook b/docs/tutorial/C/index-in.docbook
index 3c8e303..9dd8812 100644
--- a/docs/tutorial/C/index-in.docbook
+++ b/docs/tutorial/C/index-in.docbook
@@ -2381,8 +2381,15 @@ like so:
</para>
<programlisting>Glib::RefPtr<Gtk::ListStore> refListStore =
Gtk::ListStore::create(m_Columns);</programlisting>
-<para>Note that the instance (such as m_Columns here) should usually not be static, because it often needs
to be instantiated after
-glibmm has been instantiated.</para>
+<para>
+As a <classname>TreeModelColumnRecord</classname> describes structure, not data,
+it can be shared among multiple models, and this is preferable for efficiency.
+However, the instance (such as <varname>m_Columns</varname> here) should usually
+not be static, because it often needs to be instantiated after
+<application>glibmm</application> has been ininitialized. The best solution is
+to make it a lazily instantiated singleton, so that it will be constructed
+on-demand, whenever the first model accesses it.
+</para>
</sect2>
<sect2 id="treeview-adding-rows">
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]