Skip to main content

gtk4/auto/
tree_model.rs

1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir-files (https://github.com/gtk-rs/gir-files)
3// DO NOT EDIT
4#![allow(deprecated)]
5
6use crate::{TreeIter, TreeModelFlags, TreePath, ffi};
7use glib::{
8    object::ObjectType as _,
9    prelude::*,
10    signal::{SignalHandlerId, connect_raw},
11    translate::*,
12};
13use std::boxed::Box as Box_;
14
15glib::wrapper! {
16    /// Use [`gio::ListModel`][crate::gio::ListModel] instead
17    /// iter);
18    ///    row_count++;
19    ///  }
20    /// ```text
21    ///
22    /// The [`TreeModel`][crate::TreeModel] interface contains two methods for reference
23    /// counting: gtk_tree_model_ref_node() and gtk_tree_model_unref_node().
24    /// These two methods are optional to implement. The reference counting
25    /// is meant as a way for views to let models know when nodes are being
26    /// displayed. [`TreeView`][crate::TreeView] will take a reference on a node when it is
27    /// visible, which means the node is either in the toplevel or expanded.
28    /// Being displayed does not mean that the node is currently directly
29    /// visible to the user in the viewport. Based on this reference counting
30    /// scheme a caching model, for example, can decide whether or not to cache
31    /// a node based on the reference count. A file-system based model would
32    /// not want to keep the entire file hierarchy in memory, but just the
33    /// folders that are currently expanded in every current view.
34    ///
35    /// When working with reference counting, the following rules must be taken
36    /// into account:
37    ///
38    /// - Never take a reference on a node without owning a reference on its parent.
39    ///   This means that all parent nodes of a referenced node must be referenced
40    ///   as well.
41    ///
42    /// - Outstanding references on a deleted node are not released. This is not
43    ///   possible because the node has already been deleted by the time the
44    ///   row-deleted signal is received.
45    ///
46    /// - Models are not obligated to emit a signal on rows of which none of its
47    ///   siblings are referenced. To phrase this differently, signals are only
48    ///   required for levels in which nodes are referenced. For the root level
49    ///   however, signals must be emitted at all times (however the root level
50    ///   is always referenced when any view is attached).
51    ///
52    /// ## Signals
53    ///
54    ///
55    /// #### `row-changed`
56    ///  This signal is emitted when a row in the model has changed.
57    ///
58    ///
59    ///
60    ///
61    /// #### `row-deleted`
62    ///  This signal is emitted when a row has been deleted.
63    ///
64    /// Note that no iterator is passed to the signal handler,
65    /// since the row is already deleted.
66    ///
67    /// This should be called by models after a row has been removed.
68    /// The location pointed to by @path should be the location that
69    /// the row previously was at. It may not be a valid location anymore.
70    ///
71    ///
72    ///
73    ///
74    /// #### `row-has-child-toggled`
75    ///  This signal is emitted when a row has gotten the first child
76    /// row or lost its last child row.
77    ///
78    ///
79    ///
80    ///
81    /// #### `row-inserted`
82    ///  This signal is emitted when a new row has been inserted in
83    /// the model.
84    ///
85    /// Note that the row may still be empty at this point, since
86    /// it is a common pattern to first insert an empty row, and
87    /// then fill it with the desired values.
88    ///
89    ///
90    ///
91    ///
92    /// #### `rows-reordered`
93    ///  This signal is emitted when the children of a node in the
94    /// [`TreeModel`][crate::TreeModel] have been reordered.
95    ///
96    /// Note that this signal is not emitted
97    /// when rows are reordered by DND, since this is implemented
98    /// by removing and then reinserting the row.
99    ///
100    ///
101    ///
102    /// # Implements
103    ///
104    /// [`TreeModelExt`][trait@crate::prelude::TreeModelExt], [`TreeModelExtManual`][trait@crate::prelude::TreeModelExtManual]
105    #[doc(alias = "GtkTreeModel")]
106    pub struct TreeModel(Interface<ffi::GtkTreeModel, ffi::GtkTreeModelIface>);
107
108    match fn {
109        type_ => || ffi::gtk_tree_model_get_type(),
110    }
111}
112
113impl TreeModel {
114    pub const NONE: Option<&'static TreeModel> = None;
115}
116
117/// Trait containing all [`struct@TreeModel`] methods.
118///
119/// # Implementors
120///
121/// [`ListStore`][struct@crate::ListStore], [`TreeModelFilter`][struct@crate::TreeModelFilter], [`TreeModelSort`][struct@crate::TreeModelSort], [`TreeModel`][struct@crate::TreeModel], [`TreeSortable`][struct@crate::TreeSortable], [`TreeStore`][struct@crate::TreeStore]
122pub trait TreeModelExt: IsA<TreeModel> + 'static {
123    /// Calls @func on each node in model in a depth-first fashion.
124    ///
125    /// If @func returns [`true`], then the tree ceases to be walked,
126    /// and gtk_tree_model_foreach() returns.
127    ///
128    /// # Deprecated since 4.10
129    ///
130    /// ## `func`
131    /// a function to be called on each row
132    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
133    #[allow(deprecated)]
134    #[doc(alias = "gtk_tree_model_foreach")]
135    fn foreach<P: FnMut(&TreeModel, &TreePath, &TreeIter) -> bool>(&self, func: P) {
136        let mut func_data: P = func;
137        unsafe extern "C" fn func_func<P: FnMut(&TreeModel, &TreePath, &TreeIter) -> bool>(
138            model: *mut ffi::GtkTreeModel,
139            path: *mut ffi::GtkTreePath,
140            iter: *mut ffi::GtkTreeIter,
141            data: glib::ffi::gpointer,
142        ) -> glib::ffi::gboolean {
143            unsafe {
144                let model = from_glib_borrow(model);
145                let path = from_glib_borrow(path);
146                let iter = from_glib_borrow(iter);
147                let callback = data as *mut P;
148                (*callback)(&model, &path, &iter).into_glib()
149            }
150        }
151        let func = Some(func_func::<P> as _);
152        let super_callback0: &mut P = &mut func_data;
153        unsafe {
154            ffi::gtk_tree_model_foreach(
155                self.as_ref().to_glib_none().0,
156                func,
157                super_callback0 as *mut _ as *mut _,
158            );
159        }
160    }
161
162    /// Returns the type of the column.
163    ///
164    /// # Deprecated since 4.10
165    ///
166    /// ## `index_`
167    /// the column index
168    ///
169    /// # Returns
170    ///
171    /// the type of the column
172    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
173    #[allow(deprecated)]
174    #[doc(alias = "gtk_tree_model_get_column_type")]
175    #[doc(alias = "get_column_type")]
176    fn column_type(&self, index_: i32) -> glib::types::Type {
177        unsafe {
178            from_glib(ffi::gtk_tree_model_get_column_type(
179                self.as_ref().to_glib_none().0,
180                index_,
181            ))
182        }
183    }
184
185    /// Returns a set of flags supported by this interface.
186    ///
187    /// The flags are a bitwise combination of [`TreeModel`][crate::TreeModel]Flags.
188    /// The flags supported should not change during the lifetime
189    /// of the @self.
190    ///
191    /// # Deprecated since 4.10
192    ///
193    ///
194    /// # Returns
195    ///
196    /// the flags supported by this interface
197    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
198    #[allow(deprecated)]
199    #[doc(alias = "gtk_tree_model_get_flags")]
200    #[doc(alias = "get_flags")]
201    fn flags(&self) -> TreeModelFlags {
202        unsafe {
203            from_glib(ffi::gtk_tree_model_get_flags(
204                self.as_ref().to_glib_none().0,
205            ))
206        }
207    }
208
209    /// Sets @iter to a valid iterator pointing to @path.
210    ///
211    /// If @path does not exist, @iter is set to an invalid
212    /// iterator and [`false`] is returned.
213    ///
214    /// # Deprecated since 4.10
215    ///
216    /// ## `path`
217    /// the [`TreePath`][crate::TreePath]
218    ///
219    /// # Returns
220    ///
221    /// [`true`], if @iter was set
222    ///
223    /// ## `iter`
224    /// the uninitialized [`TreeIter`][crate::TreeIter]
225    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
226    #[allow(deprecated)]
227    #[doc(alias = "gtk_tree_model_get_iter")]
228    #[doc(alias = "get_iter")]
229    fn iter(&self, path: &TreePath) -> Option<TreeIter> {
230        unsafe {
231            let mut iter = TreeIter::uninitialized();
232            let ret = from_glib(ffi::gtk_tree_model_get_iter(
233                self.as_ref().to_glib_none().0,
234                iter.to_glib_none_mut().0,
235                mut_override(path.to_glib_none().0),
236            ));
237            if ret { Some(iter) } else { None }
238        }
239    }
240
241    /// Initializes @iter with the first iterator in the tree
242    /// (the one at the path "0").
243    ///
244    /// Returns [`false`] if the tree is empty, [`true`] otherwise.
245    ///
246    /// # Deprecated since 4.10
247    ///
248    ///
249    /// # Returns
250    ///
251    /// [`true`], if @iter was set
252    ///
253    /// ## `iter`
254    /// the uninitialized [`TreeIter`][crate::TreeIter]
255    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
256    #[allow(deprecated)]
257    #[doc(alias = "gtk_tree_model_get_iter_first")]
258    #[doc(alias = "get_iter_first")]
259    fn iter_first(&self) -> Option<TreeIter> {
260        unsafe {
261            let mut iter = TreeIter::uninitialized();
262            let ret = from_glib(ffi::gtk_tree_model_get_iter_first(
263                self.as_ref().to_glib_none().0,
264                iter.to_glib_none_mut().0,
265            ));
266            if ret { Some(iter) } else { None }
267        }
268    }
269
270    /// Sets @iter to a valid iterator pointing to @path_string, if it
271    /// exists.
272    ///
273    /// Otherwise, @iter is left invalid and [`false`] is returned.
274    ///
275    /// # Deprecated since 4.10
276    ///
277    /// ## `path_string`
278    /// a string representation of a [`TreePath`][crate::TreePath]
279    ///
280    /// # Returns
281    ///
282    /// [`true`], if @iter was set
283    ///
284    /// ## `iter`
285    /// an uninitialized [`TreeIter`][crate::TreeIter]
286    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
287    #[allow(deprecated)]
288    #[doc(alias = "gtk_tree_model_get_iter_from_string")]
289    #[doc(alias = "get_iter_from_string")]
290    fn iter_from_string(&self, path_string: &str) -> Option<TreeIter> {
291        unsafe {
292            let mut iter = TreeIter::uninitialized();
293            let ret = from_glib(ffi::gtk_tree_model_get_iter_from_string(
294                self.as_ref().to_glib_none().0,
295                iter.to_glib_none_mut().0,
296                path_string.to_glib_none().0,
297            ));
298            if ret { Some(iter) } else { None }
299        }
300    }
301
302    /// Returns the number of columns supported by @self.
303    ///
304    /// # Deprecated since 4.10
305    ///
306    ///
307    /// # Returns
308    ///
309    /// the number of columns
310    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
311    #[allow(deprecated)]
312    #[doc(alias = "gtk_tree_model_get_n_columns")]
313    #[doc(alias = "get_n_columns")]
314    fn n_columns(&self) -> i32 {
315        unsafe { ffi::gtk_tree_model_get_n_columns(self.as_ref().to_glib_none().0) }
316    }
317
318    /// Returns a newly-created [`TreePath`][crate::TreePath] referenced by @iter.
319    ///
320    /// This path should be freed with gtk_tree_path_free().
321    ///
322    /// # Deprecated since 4.10
323    ///
324    /// ## `iter`
325    /// the [`TreeIter`][crate::TreeIter]
326    ///
327    /// # Returns
328    ///
329    /// a newly-created [`TreePath`][crate::TreePath]
330    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
331    #[allow(deprecated)]
332    #[doc(alias = "gtk_tree_model_get_path")]
333    #[doc(alias = "get_path")]
334    fn path(&self, iter: &TreeIter) -> TreePath {
335        unsafe {
336            from_glib_full(ffi::gtk_tree_model_get_path(
337                self.as_ref().to_glib_none().0,
338                mut_override(iter.to_glib_none().0),
339            ))
340        }
341    }
342
343    /// Generates a string representation of the iter.
344    ///
345    /// This string is a “:” separated list of numbers.
346    /// For example, “4:10:0:3” would be an acceptable
347    /// return value for this string.
348    ///
349    /// # Deprecated since 4.10
350    ///
351    /// ## `iter`
352    /// a [`TreeIter`][crate::TreeIter]
353    ///
354    /// # Returns
355    ///
356    /// a newly-allocated string
357    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
358    #[allow(deprecated)]
359    #[doc(alias = "gtk_tree_model_get_string_from_iter")]
360    #[doc(alias = "get_string_from_iter")]
361    fn string_from_iter(&self, iter: &TreeIter) -> Option<glib::GString> {
362        unsafe {
363            from_glib_full(ffi::gtk_tree_model_get_string_from_iter(
364                self.as_ref().to_glib_none().0,
365                mut_override(iter.to_glib_none().0),
366            ))
367        }
368    }
369
370    /// Sets @iter to point to the first child of @parent.
371    ///
372    /// If @parent has no children, [`false`] is returned and @iter is
373    /// set to be invalid. @parent will remain a valid node after this
374    /// function has been called.
375    ///
376    /// If @parent is [`None`] returns the first node, equivalent to
377    /// `gtk_tree_model_get_iter_first (tree_model, iter);`
378    ///
379    /// # Deprecated since 4.10
380    ///
381    /// ## `parent`
382    /// the [`TreeIter`][crate::TreeIter]
383    ///
384    /// # Returns
385    ///
386    /// [`true`], if @iter has been set to the first child
387    ///
388    /// ## `iter`
389    /// the new [`TreeIter`][crate::TreeIter] to be set to the child
390    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
391    #[allow(deprecated)]
392    #[doc(alias = "gtk_tree_model_iter_children")]
393    fn iter_children(&self, parent: Option<&TreeIter>) -> Option<TreeIter> {
394        unsafe {
395            let mut iter = TreeIter::uninitialized();
396            let ret = from_glib(ffi::gtk_tree_model_iter_children(
397                self.as_ref().to_glib_none().0,
398                iter.to_glib_none_mut().0,
399                mut_override(parent.to_glib_none().0),
400            ));
401            if ret { Some(iter) } else { None }
402        }
403    }
404
405    /// Returns [`true`] if @iter has children, [`false`] otherwise.
406    ///
407    /// # Deprecated since 4.10
408    ///
409    /// ## `iter`
410    /// the [`TreeIter`][crate::TreeIter] to test for children
411    ///
412    /// # Returns
413    ///
414    /// [`true`] if @iter has children
415    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
416    #[allow(deprecated)]
417    #[doc(alias = "gtk_tree_model_iter_has_child")]
418    fn iter_has_child(&self, iter: &TreeIter) -> bool {
419        unsafe {
420            from_glib(ffi::gtk_tree_model_iter_has_child(
421                self.as_ref().to_glib_none().0,
422                mut_override(iter.to_glib_none().0),
423            ))
424        }
425    }
426
427    /// Returns the number of children that @iter has.
428    ///
429    /// As a special case, if @iter is [`None`], then the number
430    /// of toplevel nodes is returned.
431    ///
432    /// # Deprecated since 4.10
433    ///
434    /// ## `iter`
435    /// the [`TreeIter`][crate::TreeIter]
436    ///
437    /// # Returns
438    ///
439    /// the number of children of @iter
440    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
441    #[allow(deprecated)]
442    #[doc(alias = "gtk_tree_model_iter_n_children")]
443    fn iter_n_children(&self, iter: Option<&TreeIter>) -> i32 {
444        unsafe {
445            ffi::gtk_tree_model_iter_n_children(
446                self.as_ref().to_glib_none().0,
447                mut_override(iter.to_glib_none().0),
448            )
449        }
450    }
451
452    /// Sets @iter to be the child of @parent, using the given index.
453    ///
454    /// The first index is 0. If @n is too big, or @parent has no children,
455    /// @iter is set to an invalid iterator and [`false`] is returned. @parent
456    /// will remain a valid node after this function has been called. As a
457    /// special case, if @parent is [`None`], then the @n-th root node
458    /// is set.
459    ///
460    /// # Deprecated since 4.10
461    ///
462    /// ## `parent`
463    /// the [`TreeIter`][crate::TreeIter] to get the child from
464    /// ## `n`
465    /// the index of the desired child
466    ///
467    /// # Returns
468    ///
469    /// [`true`], if @parent has an @n-th child
470    ///
471    /// ## `iter`
472    /// the [`TreeIter`][crate::TreeIter] to set to the nth child
473    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
474    #[allow(deprecated)]
475    #[doc(alias = "gtk_tree_model_iter_nth_child")]
476    fn iter_nth_child(&self, parent: Option<&TreeIter>, n: i32) -> Option<TreeIter> {
477        unsafe {
478            let mut iter = TreeIter::uninitialized();
479            let ret = from_glib(ffi::gtk_tree_model_iter_nth_child(
480                self.as_ref().to_glib_none().0,
481                iter.to_glib_none_mut().0,
482                mut_override(parent.to_glib_none().0),
483                n,
484            ));
485            if ret { Some(iter) } else { None }
486        }
487    }
488
489    /// Sets @iter to be the parent of @child.
490    ///
491    /// If @child is at the toplevel, and doesn’t have a parent, then
492    /// @iter is set to an invalid iterator and [`false`] is returned.
493    /// @child will remain a valid node after this function has been
494    /// called.
495    ///
496    /// @iter will be initialized before the lookup is performed, so @child
497    /// and @iter cannot point to the same memory location.
498    ///
499    /// # Deprecated since 4.10
500    ///
501    /// ## `child`
502    /// the [`TreeIter`][crate::TreeIter]
503    ///
504    /// # Returns
505    ///
506    /// [`true`], if @iter is set to the parent of @child
507    ///
508    /// ## `iter`
509    /// the new [`TreeIter`][crate::TreeIter] to set to the parent
510    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
511    #[allow(deprecated)]
512    #[doc(alias = "gtk_tree_model_iter_parent")]
513    fn iter_parent(&self, child: &TreeIter) -> Option<TreeIter> {
514        unsafe {
515            let mut iter = TreeIter::uninitialized();
516            let ret = from_glib(ffi::gtk_tree_model_iter_parent(
517                self.as_ref().to_glib_none().0,
518                iter.to_glib_none_mut().0,
519                mut_override(child.to_glib_none().0),
520            ));
521            if ret { Some(iter) } else { None }
522        }
523    }
524
525    /// Emits the ::row-changed signal on @self.
526    ///
527    /// See [`row-changed`][struct@crate::TreeModel#row-changed].
528    ///
529    /// # Deprecated since 4.10
530    ///
531    /// ## `path`
532    /// a [`TreePath`][crate::TreePath] pointing to the changed row
533    /// ## `iter`
534    /// a valid [`TreeIter`][crate::TreeIter] pointing to the changed row
535    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
536    #[allow(deprecated)]
537    #[doc(alias = "gtk_tree_model_row_changed")]
538    fn row_changed(&self, path: &TreePath, iter: &TreeIter) {
539        unsafe {
540            ffi::gtk_tree_model_row_changed(
541                self.as_ref().to_glib_none().0,
542                mut_override(path.to_glib_none().0),
543                mut_override(iter.to_glib_none().0),
544            );
545        }
546    }
547
548    /// Emits the ::row-deleted signal on @self.
549    ///
550    /// See [`row-deleted`][struct@crate::TreeModel#row-deleted].
551    ///
552    /// This should be called by models after a row has been removed.
553    /// The location pointed to by @path should be the location that
554    /// the row previously was at. It may not be a valid location anymore.
555    ///
556    /// Nodes that are deleted are not unreffed, this means that any
557    /// outstanding references on the deleted node should not be released.
558    ///
559    /// # Deprecated since 4.10
560    ///
561    /// ## `path`
562    /// a [`TreePath`][crate::TreePath] pointing to the previous location of
563    ///   the deleted row
564    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
565    #[allow(deprecated)]
566    #[doc(alias = "gtk_tree_model_row_deleted")]
567    fn row_deleted(&self, path: &TreePath) {
568        unsafe {
569            ffi::gtk_tree_model_row_deleted(
570                self.as_ref().to_glib_none().0,
571                mut_override(path.to_glib_none().0),
572            );
573        }
574    }
575
576    /// Emits the ::row-has-child-toggled signal on @self.
577    ///
578    /// See [`row-has-child-toggled`][struct@crate::TreeModel#row-has-child-toggled].
579    ///
580    /// This should be called by models after the child
581    /// state of a node changes.
582    ///
583    /// # Deprecated since 4.10
584    ///
585    /// ## `path`
586    /// a [`TreePath`][crate::TreePath] pointing to the changed row
587    /// ## `iter`
588    /// a valid [`TreeIter`][crate::TreeIter] pointing to the changed row
589    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
590    #[allow(deprecated)]
591    #[doc(alias = "gtk_tree_model_row_has_child_toggled")]
592    fn row_has_child_toggled(&self, path: &TreePath, iter: &TreeIter) {
593        unsafe {
594            ffi::gtk_tree_model_row_has_child_toggled(
595                self.as_ref().to_glib_none().0,
596                mut_override(path.to_glib_none().0),
597                mut_override(iter.to_glib_none().0),
598            );
599        }
600    }
601
602    /// Emits the ::row-inserted signal on @self.
603    ///
604    /// See [`row-inserted`][struct@crate::TreeModel#row-inserted].
605    ///
606    /// # Deprecated since 4.10
607    ///
608    /// ## `path`
609    /// a [`TreePath`][crate::TreePath] pointing to the inserted row
610    /// ## `iter`
611    /// a valid [`TreeIter`][crate::TreeIter] pointing to the inserted row
612    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
613    #[allow(deprecated)]
614    #[doc(alias = "gtk_tree_model_row_inserted")]
615    fn row_inserted(&self, path: &TreePath, iter: &TreeIter) {
616        unsafe {
617            ffi::gtk_tree_model_row_inserted(
618                self.as_ref().to_glib_none().0,
619                mut_override(path.to_glib_none().0),
620                mut_override(iter.to_glib_none().0),
621            );
622        }
623    }
624
625    /// This signal is emitted when a row in the model has changed.
626    /// ## `path`
627    /// a [`TreePath`][crate::TreePath] identifying the changed row
628    /// ## `iter`
629    /// a valid [`TreeIter`][crate::TreeIter] pointing to the changed row
630    #[doc(alias = "row-changed")]
631    fn connect_row_changed<F: Fn(&Self, &TreePath, &TreeIter) + 'static>(
632        &self,
633        f: F,
634    ) -> SignalHandlerId {
635        unsafe extern "C" fn row_changed_trampoline<
636            P: IsA<TreeModel>,
637            F: Fn(&P, &TreePath, &TreeIter) + 'static,
638        >(
639            this: *mut ffi::GtkTreeModel,
640            path: *mut ffi::GtkTreePath,
641            iter: *mut ffi::GtkTreeIter,
642            f: glib::ffi::gpointer,
643        ) {
644            unsafe {
645                let f: &F = &*(f as *const F);
646                f(
647                    TreeModel::from_glib_borrow(this).unsafe_cast_ref(),
648                    &from_glib_borrow(path),
649                    &from_glib_borrow(iter),
650                )
651            }
652        }
653        unsafe {
654            let f: Box_<F> = Box_::new(f);
655            connect_raw(
656                self.as_ptr() as *mut _,
657                c"row-changed".as_ptr(),
658                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
659                    row_changed_trampoline::<Self, F> as *const (),
660                )),
661                Box_::into_raw(f),
662            )
663        }
664    }
665
666    /// This signal is emitted when a row has been deleted.
667    ///
668    /// Note that no iterator is passed to the signal handler,
669    /// since the row is already deleted.
670    ///
671    /// This should be called by models after a row has been removed.
672    /// The location pointed to by @path should be the location that
673    /// the row previously was at. It may not be a valid location anymore.
674    /// ## `path`
675    /// a [`TreePath`][crate::TreePath] identifying the row
676    #[doc(alias = "row-deleted")]
677    fn connect_row_deleted<F: Fn(&Self, &TreePath) + 'static>(&self, f: F) -> SignalHandlerId {
678        unsafe extern "C" fn row_deleted_trampoline<
679            P: IsA<TreeModel>,
680            F: Fn(&P, &TreePath) + 'static,
681        >(
682            this: *mut ffi::GtkTreeModel,
683            path: *mut ffi::GtkTreePath,
684            f: glib::ffi::gpointer,
685        ) {
686            unsafe {
687                let f: &F = &*(f as *const F);
688                f(
689                    TreeModel::from_glib_borrow(this).unsafe_cast_ref(),
690                    &from_glib_borrow(path),
691                )
692            }
693        }
694        unsafe {
695            let f: Box_<F> = Box_::new(f);
696            connect_raw(
697                self.as_ptr() as *mut _,
698                c"row-deleted".as_ptr(),
699                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
700                    row_deleted_trampoline::<Self, F> as *const (),
701                )),
702                Box_::into_raw(f),
703            )
704        }
705    }
706
707    /// This signal is emitted when a row has gotten the first child
708    /// row or lost its last child row.
709    /// ## `path`
710    /// a [`TreePath`][crate::TreePath] identifying the row
711    /// ## `iter`
712    /// a valid [`TreeIter`][crate::TreeIter] pointing to the row
713    #[doc(alias = "row-has-child-toggled")]
714    fn connect_row_has_child_toggled<F: Fn(&Self, &TreePath, &TreeIter) + 'static>(
715        &self,
716        f: F,
717    ) -> SignalHandlerId {
718        unsafe extern "C" fn row_has_child_toggled_trampoline<
719            P: IsA<TreeModel>,
720            F: Fn(&P, &TreePath, &TreeIter) + 'static,
721        >(
722            this: *mut ffi::GtkTreeModel,
723            path: *mut ffi::GtkTreePath,
724            iter: *mut ffi::GtkTreeIter,
725            f: glib::ffi::gpointer,
726        ) {
727            unsafe {
728                let f: &F = &*(f as *const F);
729                f(
730                    TreeModel::from_glib_borrow(this).unsafe_cast_ref(),
731                    &from_glib_borrow(path),
732                    &from_glib_borrow(iter),
733                )
734            }
735        }
736        unsafe {
737            let f: Box_<F> = Box_::new(f);
738            connect_raw(
739                self.as_ptr() as *mut _,
740                c"row-has-child-toggled".as_ptr(),
741                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
742                    row_has_child_toggled_trampoline::<Self, F> as *const (),
743                )),
744                Box_::into_raw(f),
745            )
746        }
747    }
748
749    /// This signal is emitted when a new row has been inserted in
750    /// the model.
751    ///
752    /// Note that the row may still be empty at this point, since
753    /// it is a common pattern to first insert an empty row, and
754    /// then fill it with the desired values.
755    /// ## `path`
756    /// a [`TreePath`][crate::TreePath] identifying the new row
757    /// ## `iter`
758    /// a valid [`TreeIter`][crate::TreeIter] pointing to the new row
759    #[doc(alias = "row-inserted")]
760    fn connect_row_inserted<F: Fn(&Self, &TreePath, &TreeIter) + 'static>(
761        &self,
762        f: F,
763    ) -> SignalHandlerId {
764        unsafe extern "C" fn row_inserted_trampoline<
765            P: IsA<TreeModel>,
766            F: Fn(&P, &TreePath, &TreeIter) + 'static,
767        >(
768            this: *mut ffi::GtkTreeModel,
769            path: *mut ffi::GtkTreePath,
770            iter: *mut ffi::GtkTreeIter,
771            f: glib::ffi::gpointer,
772        ) {
773            unsafe {
774                let f: &F = &*(f as *const F);
775                f(
776                    TreeModel::from_glib_borrow(this).unsafe_cast_ref(),
777                    &from_glib_borrow(path),
778                    &from_glib_borrow(iter),
779                )
780            }
781        }
782        unsafe {
783            let f: Box_<F> = Box_::new(f);
784            connect_raw(
785                self.as_ptr() as *mut _,
786                c"row-inserted".as_ptr(),
787                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
788                    row_inserted_trampoline::<Self, F> as *const (),
789                )),
790                Box_::into_raw(f),
791            )
792        }
793    }
794
795    //#[doc(alias = "rows-reordered")]
796    //fn connect_rows_reordered<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId {
797    //    Unimplemented new_order: *.Pointer
798    //}
799}
800
801impl<O: IsA<TreeModel>> TreeModelExt for O {}