:right-sidebar: True TreeRowReference =================================================================== .. currentmodule:: gi.repository.Gtk .. deprecated:: 4.10 Use :obj:`~gi.repository.Gio.ListModel` instead .. class:: TreeRowReference(**kwargs) :no-contents-entry: A GtkTreeRowReference tracks model changes so that it always refers to the same row (a ``GtkTreePath`` refers to a position, not a fixed row). Create a new GtkTreeRowReference with :func:`~gi.repository.Gtk.TreeRowReference.new`. Constructors ------------ .. rst-class:: interim-class .. class:: TreeRowReference :no-index: .. classmethod:: new(model: ~gi.repository.Gtk.TreeModel, path: ~gi.repository.Gtk.TreePath) -> ~gi.repository.Gtk.TreeRowReference | None Creates a row reference based on ``path``\. This reference will keep pointing to the node pointed to by ``path``\, so long as it exists. Any changes that occur on ``model`` are propagated, and the path is updated appropriately. If ``path`` isn’t a valid path in ``model``\, then :const:`None` is returned. .. deprecated:: 4.10 Please do not use it in newly written code :param model: a ``GtkTreeModel`` :param path: a valid ``GtkTreePath`` to monitor .. classmethod:: new_proxy(proxy: ~gi.repository.GObject.Object, model: ~gi.repository.Gtk.TreeModel, path: ~gi.repository.Gtk.TreePath) -> ~gi.repository.Gtk.TreeRowReference | None You do not need to use this function. Creates a row reference based on ``path``\. This reference will keep pointing to the node pointed to by ``path``\, so long as it exists. If ``path`` isn’t a valid path in ``model``\, then :const:`None` is returned. However, unlike references created with :func:`~gi.repository.Gtk.TreeRowReference.new`, it does not listen to the model for changes. The creator of the row reference must do this explicitly using :func:`~gi.repository.Gtk.TreeRowReference.inserted`, :func:`~gi.repository.Gtk.TreeRowReference.deleted`, :func:`~gi.repository.Gtk.TreeRowReference.reordered`. These functions must be called exactly once per proxy when the corresponding signal on the model is emitted. This single call updates all row references for that proxy. Since built-in GTK objects like ``GtkTreeView`` already use this mechanism internally, using them as the proxy object will produce unpredictable results. Further more, passing the same object as ``model`` and ``proxy`` doesn’t work for reasons of internal implementation. This type of row reference is primarily meant by structures that need to carefully monitor exactly when a row reference updates itself, and is not generally needed by most applications. .. deprecated:: 4.10 Please do not use it in newly written code :param proxy: a proxy ``GObject`` :param model: a ``GtkTreeModel`` :param path: a valid ``GtkTreePath`` to monitor Methods ------- .. rst-class:: interim-class .. class:: TreeRowReference :no-index: .. classmethod:: deleted(path: ~gi.repository.Gtk.TreePath) -> None Lets a set of row reference created by :func:`~gi.repository.Gtk.TreeRowReference.new_proxy` know that the model emitted the ::row-deleted signal. .. deprecated:: 4.10 Please do not use it in newly written code :param path: the path position that was deleted .. method:: free() -> None Free’s ``reference``\. ``reference`` may be :const:`None` .. deprecated:: 4.10 Please do not use it in newly written code .. method:: get_model() -> ~gi.repository.Gtk.TreeModel Returns the model that the row reference is monitoring. .. deprecated:: 4.10 Please do not use it in newly written code .. method:: get_path() -> ~gi.repository.Gtk.TreePath | None Returns a path that the row reference currently points to, or :const:`None` if the path pointed to is no longer valid. .. deprecated:: 4.10 Please do not use it in newly written code .. classmethod:: inserted(path: ~gi.repository.Gtk.TreePath) -> None Lets a set of row reference created by :func:`~gi.repository.Gtk.TreeRowReference.new_proxy` know that the model emitted the ::row-inserted signal. .. deprecated:: 4.10 Please do not use it in newly written code :param path: the row position that was inserted .. method:: valid() -> bool Returns :const:`True` if the ``reference`` is non-:const:`None` and refers to a current valid path. .. deprecated:: 4.10 Please do not use it in newly written code