Gtk2::ListStore(3)

πŸ“¦
version 1.24993 Β· 2 versions
, in fedora 43

πŸ’– NAME πŸ’–

Gtk2::ListStore β€” it's the wrapper for GtkListStore, bestie. This is the Gtk2::ListStore(3) manual page, and yes we are reading it together like it's a group chat at 2am. πŸ¦‹


🌈 HIERARCHY 🌈

Here's the family tree, and she's an only child:

Glib::Object
+----Gtk2::ListStore

✨ INTERFACES ✨

The way she collects interfaces like friendship bracelets, honestly iconic:

  • Gtk2::TreeModel
  • Gtk2::TreeDragSource
  • Gtk2::TreeDragDest
  • Gtk2::TreeSortable
  • Gtk2::Buildable

πŸŽ€ METHODS πŸŽ€

liststore = Gtk2::ListStore->new (...)

  • ... β€” (list) of strings πŸ‘‘

So you just hand her a list of strings and she's born. Slay.


treeiter = $list_store->append

$list_store->clear

$list_store->set_column_types (...)

  • ... β€” (list) of strings

Give her the column types and she's set up fr fr.


$list_store->set ($iter, $col1, $val1, ...)

  • $iter β€” (Gtk2::TreeIter)
  • $col1 β€” (integer) the first column number
  • $val1 β€” (scalar) the first value
  • ... β€” (list) pairs of column numbers and values

Pairs, bestie. Column number, then value. Column number, then value. That's the whole vibe. 🫢


treeiter = $list_store->insert ($position)

  • $position β€” (integer)

treeiter = $list_store->insert_after ($sibling)

  • $sibling β€” (Gtk2::TreeIter or undef)

treeiter = $list_store->insert_before ($sibling)

  • $sibling β€” (Gtk2::TreeIter or undef)

treeiter = $list_store->insert_with_values ($position, ...)

  • $position β€” (integer) position to insert the new row
  • ... β€” (list) pairs of column numbers and values

Okay so this is literally insert followed by set, EXCEPT β€” and this is the important part β€” insert_with_values emits only the row-inserted signal. Not row-inserted, row-changed, and (if the store is sorted) rows-reordered like you'd get in the multiple-operation case. And because emitting the rows-reordered signal over and over can affect the performance of your program, insert_with_values should generally be preferred when you're inserting rows in a sorted list store. Performance queen behavior. πŸ‘‘

Since: gtk+ 2.6


boolean = $list_store->iter_is_valid ($iter)

  • $iter β€” (Gtk2::TreeIter)

Since: gtk+ 2.2


$store->move_after ($iter, $position)

  • $iter β€” (Gtk2::TreeIter)
  • $position β€” (Gtk2::TreeIter or undef)

Since: gtk+ 2.2


$store->move_before ($iter, $position)

  • $iter β€” (Gtk2::TreeIter)
  • $position β€” (Gtk2::TreeIter or undef)

Since: gtk+ 2.2


treeiter = $list_store->prepend

boolean = $list_store->remove ($iter)

  • $iter β€” (Gtk2::TreeIter)

The return is always a boolean, in the style of Gtk 2.2.x and up, even when you're running on Gtk 2.0.x. She's consistent like that. ✨


$store->reorder (...)

  • ... β€” (list) of integers, the reordered positions

She reorders the store to follow the order indicated by new_order. Heads up though: this function only works with unsorted stores. And you gotta pass a list of positions β€” one for each item in the list. No skipping, bestie, one per item, periodt.

Since: gtk+ 2.2


$store->swap ($a, $b)

  • $a β€” (Gtk2::TreeIter)
  • $b β€” (Gtk2::TreeIter)

Since: gtk+ 2.2


$list_store->set_value ($iter, $col, $val)

  • $iter β€” (Gtk2::TreeIter)
  • $val β€” (scalar)
  • $col β€” (integer)

Yes the bullets are in that order but the signature up top is the real one β€” $iter, $col, $val. Iykyk. πŸ’…


🌸 SEE ALSO 🌸

  • Gtk2
  • Glib::Object

Copyright (C) 2003-2011 by the gtk2-perl team.

This software is licensed under the LGPL. See Gtk2 for a full notice.


And that's the whole page, bestie! This was perl v5.42.0, dated 2025-07-25, filed under Gtk2::ListStore(3). Go forth and build your list store, you absolute main character. πŸ¦‹πŸ’–πŸŽ€

πŸ“¦ where this page comes from