title: How to assign “hidden data” to Gtk.TreeView row in order to catch them with Gtk.TreeView.connect("row-activated")?
body: <p>In Python, I have a class <code>person</code> witch contain <code>firstName</code> and <code>lastName</code> and also <code>country</code> attributes (actually their is much more other data, but I simplify it for the example).</p>
  
  <p>So, I generate a table witch should only show <code>firstName</code> and <code>lastName</code> (the user shouldn’t see the country). But when the user click on a specific row, I want to get the  the full <code>person</code> object.</p>
  
  <p>This is my code:</p>
  
  <pre class="lang-py prettyprint-override"><code>#!/usr/bin/env python3
  # -*- coding: utf-8 -*-
  # MWE for hidden data in Gtk.TreeView
  
  import sys
  import os
  import gi
  
  gi.require_version('Gtk', '3.0')
  
  from gi.repository import Gtk
  from gi.repository import Gdk
  from gi.repository import Gio
  from gi.repository import Pango
  
  
  class person():
      def __init__(self, firstName, lastName, country):
          self.firstName=firstName
          self.lastName=lastName
          self.country=country
  
  personsList=[
      person("Ada",   "Lovelace", "UK"),
      person("Alan",  "Turing",   "UK"),
      person("Denis", "Richie",   "USA")
  ]
  
  def onRowChange(widget, row, col):
      # This function is executed when a user click on a row
      print(widget)
      print(row)
      print(col)
      pass
  
  
  class GridWindow(Gtk.Window):
  
      def __init__(self):
          Gtk.Window.__init__(self, title="TreeView MWE")
          self.connect("destroy", Gtk.main_quit)
  
          # Setting up the self.grid in which the elements are to be positionned
          self.grid = Gtk.Grid()
          self.grid.set_column_homogeneous(True)
          self.grid.set_row_homogeneous(True)
          self.add(self.grid)
  
          # Preparing the list store
          listStore=Gtk.ListStore(str, str)
          for aPerson in personsList:
              listStore.append([aPerson.firstName, aPerson.lastName])
  
          # Seting up the TreeView and given the ListStore to the Treeview
          treeView=Gtk.TreeView(model=listStore)
          renderer_text = Gtk.CellRendererText()
  
          # Preparing the headers
          column_text = Gtk.TreeViewColumn("First Name", renderer_text, text=0)
          treeView.append_column(column_text)
          column_text = Gtk.TreeViewColumn("Last Name", renderer_text, text=1)
          treeView.append_column(column_text)
  
          # Setting the event connection
          treeView.connect("row-activated", onRowChange)
  
  
          # Attaching the treeView to the Gride
          self.grid.add(treeView)
  
  
  
  
  screen = Gdk.Screen.get_default()
  styleContext = Gtk.StyleContext()
  
  
  win = GridWindow()
  win.connect("destroy", Gtk.main_quit)
  win.show_all()
  Gtk.main()
  
  </code></pre>
  
  <p>And here is the rendering:</p>
  
  <p><a href="https://i.stack.imgur.com/u1N2b.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/u1N2b.png" alt="enter image description here"></a></p>
  
  <p>As you can see, the <code>onRowChange()</code> function can only get the <code>TreeView</code> and the <code>TreeViewColumn</code> objects when the user click on it, according to the <a href="https://lazka.github.io/pgi-docs/Gtk-3.0/classes/TreeView.html#Gtk.TreeView.signals.row_activated" rel="nofollow noreferrer"><code>row_activated</code></a> signal’s documentation.</p>
  
  <p>I know I can get the row number and search in the list witch object has this row number but it’s too much hazardous and a little bit <em>hacky</em>.</p>
  
  <p>So, is their a way to include in the <code>Gtk.ListStore</code> a user’s hidden data and catch back this data with <code>row-activated</code> signal?</p>