1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
// This file was generated by gir (32b0f11) from gir-files (71d73f0)
// DO NOT EDIT

use CellRenderer;
use Container;
use Entry;
use MovementStep;
use Scrollable;
use Tooltip;
use TreeIter;
use TreeModel;
use TreePath;
use TreeSelection;
use TreeViewColumn;
use TreeViewDropPosition;
use TreeViewGridLines;
use Widget;
use cairo;
use ffi;
use gdk;
use glib::Value;
use glib::object::Downcast;
use glib::object::IsA;
use glib::signal::connect;
use glib::translate::*;
use glib_ffi;
use gobject_ffi;
use libc;
use signal::Inhibit;
use std::boxed::Box as Box_;
use std::mem;
use std::mem::transmute;
use std::ptr;

glib_wrapper! {
    pub struct TreeView(Object<ffi::GtkTreeView>): Container, Widget, Scrollable;

    match fn {
        get_type => || ffi::gtk_tree_view_get_type(),
    }
}

impl TreeView {
    pub fn new() -> TreeView {
        assert_initialized_main_thread!();
        unsafe {
            Widget::from_glib_none(ffi::gtk_tree_view_new()).downcast_unchecked()
        }
    }

    pub fn new_with_model<P: IsA<TreeModel>>(model: &P) -> TreeView {
        skip_assert_initialized!();
        unsafe {
            Widget::from_glib_none(ffi::gtk_tree_view_new_with_model(model.to_glib_none().0)).downcast_unchecked()
        }
    }

    pub fn append_column(&self, column: &TreeViewColumn) -> i32 {
        unsafe {
            ffi::gtk_tree_view_append_column(self.to_glib_none().0, column.to_glib_none().0)
        }
    }

    pub fn collapse_all(&self) {
        unsafe {
            ffi::gtk_tree_view_collapse_all(self.to_glib_none().0);
        }
    }

    pub fn collapse_row(&self, path: &TreePath) -> bool {
        unsafe {
            from_glib(ffi::gtk_tree_view_collapse_row(self.to_glib_none().0, mut_override(path.to_glib_none().0)))
        }
    }

    pub fn columns_autosize(&self) {
        unsafe {
            ffi::gtk_tree_view_columns_autosize(self.to_glib_none().0);
        }
    }

    pub fn convert_bin_window_to_tree_coords(&self, bx: i32, by: i32) -> (i32, i32) {
        unsafe {
            let mut tx = mem::uninitialized();
            let mut ty = mem::uninitialized();
            ffi::gtk_tree_view_convert_bin_window_to_tree_coords(self.to_glib_none().0, bx, by, &mut tx, &mut ty);
            (tx, ty)
        }
    }

    pub fn convert_bin_window_to_widget_coords(&self, bx: i32, by: i32) -> (i32, i32) {
        unsafe {
            let mut wx = mem::uninitialized();
            let mut wy = mem::uninitialized();
            ffi::gtk_tree_view_convert_bin_window_to_widget_coords(self.to_glib_none().0, bx, by, &mut wx, &mut wy);
            (wx, wy)
        }
    }

    pub fn convert_tree_to_bin_window_coords(&self, tx: i32, ty: i32) -> (i32, i32) {
        unsafe {
            let mut bx = mem::uninitialized();
            let mut by = mem::uninitialized();
            ffi::gtk_tree_view_convert_tree_to_bin_window_coords(self.to_glib_none().0, tx, ty, &mut bx, &mut by);
            (bx, by)
        }
    }

    pub fn convert_tree_to_widget_coords(&self, tx: i32, ty: i32) -> (i32, i32) {
        unsafe {
            let mut wx = mem::uninitialized();
            let mut wy = mem::uninitialized();
            ffi::gtk_tree_view_convert_tree_to_widget_coords(self.to_glib_none().0, tx, ty, &mut wx, &mut wy);
            (wx, wy)
        }
    }

    pub fn convert_widget_to_bin_window_coords(&self, wx: i32, wy: i32) -> (i32, i32) {
        unsafe {
            let mut bx = mem::uninitialized();
            let mut by = mem::uninitialized();
            ffi::gtk_tree_view_convert_widget_to_bin_window_coords(self.to_glib_none().0, wx, wy, &mut bx, &mut by);
            (bx, by)
        }
    }

    pub fn convert_widget_to_tree_coords(&self, wx: i32, wy: i32) -> (i32, i32) {
        unsafe {
            let mut tx = mem::uninitialized();
            let mut ty = mem::uninitialized();
            ffi::gtk_tree_view_convert_widget_to_tree_coords(self.to_glib_none().0, wx, wy, &mut tx, &mut ty);
            (tx, ty)
        }
    }

    pub fn create_row_drag_icon(&self, path: &TreePath) -> Option<cairo::Surface> {
        unsafe {
            from_glib_full(ffi::gtk_tree_view_create_row_drag_icon(self.to_glib_none().0, mut_override(path.to_glib_none().0)))
        }
    }

    pub fn expand_all(&self) {
        unsafe {
            ffi::gtk_tree_view_expand_all(self.to_glib_none().0);
        }
    }

    pub fn expand_row(&self, path: &TreePath, open_all: bool) -> bool {
        unsafe {
            from_glib(ffi::gtk_tree_view_expand_row(self.to_glib_none().0, mut_override(path.to_glib_none().0), open_all.to_glib()))
        }
    }

    pub fn expand_to_path(&self, path: &TreePath) {
        unsafe {
            ffi::gtk_tree_view_expand_to_path(self.to_glib_none().0, mut_override(path.to_glib_none().0));
        }
    }

    #[cfg(feature = "v3_8")]
    pub fn get_activate_on_single_click(&self) -> bool {
        unsafe {
            from_glib(ffi::gtk_tree_view_get_activate_on_single_click(self.to_glib_none().0))
        }
    }

    pub fn get_background_area<'a, 'b, P: Into<Option<&'a TreePath>>, Q: Into<Option<&'b TreeViewColumn>>>(&self, path: P, column: Q) -> gdk::Rectangle {
        let path = path.into();
        let column = column.into();
        let column = column.to_glib_none();
        unsafe {
            let mut rect = gdk::Rectangle::uninitialized();
            ffi::gtk_tree_view_get_background_area(self.to_glib_none().0, mut_override(path.to_glib_none().0), column.0, rect.to_glib_none_mut().0);
            rect
        }
    }

    pub fn get_bin_window(&self) -> Option<gdk::Window> {
        unsafe {
            from_glib_none(ffi::gtk_tree_view_get_bin_window(self.to_glib_none().0))
        }
    }

    pub fn get_cell_area<'a, 'b, P: Into<Option<&'a TreePath>>, Q: Into<Option<&'b TreeViewColumn>>>(&self, path: P, column: Q) -> gdk::Rectangle {
        let path = path.into();
        let column = column.into();
        let column = column.to_glib_none();
        unsafe {
            let mut rect = gdk::Rectangle::uninitialized();
            ffi::gtk_tree_view_get_cell_area(self.to_glib_none().0, mut_override(path.to_glib_none().0), column.0, rect.to_glib_none_mut().0);
            rect
        }
    }

    pub fn get_column(&self, n: i32) -> Option<TreeViewColumn> {
        unsafe {
            from_glib_none(ffi::gtk_tree_view_get_column(self.to_glib_none().0, n))
        }
    }

    pub fn get_columns(&self) -> Vec<TreeViewColumn> {
        unsafe {
            FromGlibPtrContainer::from_glib_container(ffi::gtk_tree_view_get_columns(self.to_glib_none().0))
        }
    }

    pub fn get_cursor(&self) -> (Option<TreePath>, Option<TreeViewColumn>) {
        unsafe {
            let mut path = ptr::null_mut();
            let mut focus_column = ptr::null_mut();
            ffi::gtk_tree_view_get_cursor(self.to_glib_none().0, &mut path, &mut focus_column);
            (from_glib_full(path), from_glib_none(focus_column))
        }
    }

    pub fn get_dest_row_at_pos(&self, drag_x: i32, drag_y: i32) -> Option<(Option<TreePath>, TreeViewDropPosition)> {
        unsafe {
            let mut path = ptr::null_mut();
            let mut pos = mem::uninitialized();
            let ret = from_glib(ffi::gtk_tree_view_get_dest_row_at_pos(self.to_glib_none().0, drag_x, drag_y, &mut path, &mut pos));
            if ret { Some((from_glib_full(path), from_glib(pos))) } else { None }
        }
    }

    pub fn get_drag_dest_row(&self) -> (Option<TreePath>, TreeViewDropPosition) {
        unsafe {
            let mut path = ptr::null_mut();
            let mut pos = mem::uninitialized();
            ffi::gtk_tree_view_get_drag_dest_row(self.to_glib_none().0, &mut path, &mut pos);
            (from_glib_full(path), from_glib(pos))
        }
    }

    pub fn get_enable_search(&self) -> bool {
        unsafe {
            from_glib(ffi::gtk_tree_view_get_enable_search(self.to_glib_none().0))
        }
    }

    pub fn get_enable_tree_lines(&self) -> bool {
        unsafe {
            from_glib(ffi::gtk_tree_view_get_enable_tree_lines(self.to_glib_none().0))
        }
    }

    pub fn get_expander_column(&self) -> Option<TreeViewColumn> {
        unsafe {
            from_glib_none(ffi::gtk_tree_view_get_expander_column(self.to_glib_none().0))
        }
    }

    pub fn get_fixed_height_mode(&self) -> bool {
        unsafe {
            from_glib(ffi::gtk_tree_view_get_fixed_height_mode(self.to_glib_none().0))
        }
    }

    pub fn get_grid_lines(&self) -> TreeViewGridLines {
        unsafe {
            from_glib(ffi::gtk_tree_view_get_grid_lines(self.to_glib_none().0))
        }
    }

    pub fn get_headers_clickable(&self) -> bool {
        unsafe {
            from_glib(ffi::gtk_tree_view_get_headers_clickable(self.to_glib_none().0))
        }
    }

    pub fn get_headers_visible(&self) -> bool {
        unsafe {
            from_glib(ffi::gtk_tree_view_get_headers_visible(self.to_glib_none().0))
        }
    }

    pub fn get_hover_expand(&self) -> bool {
        unsafe {
            from_glib(ffi::gtk_tree_view_get_hover_expand(self.to_glib_none().0))
        }
    }

    pub fn get_hover_selection(&self) -> bool {
        unsafe {
            from_glib(ffi::gtk_tree_view_get_hover_selection(self.to_glib_none().0))
        }
    }

    pub fn get_level_indentation(&self) -> i32 {
        unsafe {
            ffi::gtk_tree_view_get_level_indentation(self.to_glib_none().0)
        }
    }

    pub fn get_model(&self) -> Option<TreeModel> {
        unsafe {
            from_glib_none(ffi::gtk_tree_view_get_model(self.to_glib_none().0))
        }
    }

    pub fn get_n_columns(&self) -> u32 {
        unsafe {
            ffi::gtk_tree_view_get_n_columns(self.to_glib_none().0)
        }
    }

    pub fn get_path_at_pos(&self, x: i32, y: i32) -> Option<(Option<TreePath>, Option<TreeViewColumn>, i32, i32)> {
        unsafe {
            let mut path = ptr::null_mut();
            let mut column = ptr::null_mut();
            let mut cell_x = mem::uninitialized();
            let mut cell_y = mem::uninitialized();
            let ret = from_glib(ffi::gtk_tree_view_get_path_at_pos(self.to_glib_none().0, x, y, &mut path, &mut column, &mut cell_x, &mut cell_y));
            if ret { Some((from_glib_full(path), from_glib_none(column), cell_x, cell_y)) } else { None }
        }
    }

    pub fn get_reorderable(&self) -> bool {
        unsafe {
            from_glib(ffi::gtk_tree_view_get_reorderable(self.to_glib_none().0))
        }
    }

    //pub fn get_row_separator_func(&self) -> /*Unknown conversion*//*Unimplemented*/TreeViewRowSeparatorFunc {
    //    unsafe { TODO: call ffi::gtk_tree_view_get_row_separator_func() }
    //}

    pub fn get_rubber_banding(&self) -> bool {
        unsafe {
            from_glib(ffi::gtk_tree_view_get_rubber_banding(self.to_glib_none().0))
        }
    }

    pub fn get_rules_hint(&self) -> bool {
        unsafe {
            from_glib(ffi::gtk_tree_view_get_rules_hint(self.to_glib_none().0))
        }
    }

    pub fn get_search_column(&self) -> i32 {
        unsafe {
            ffi::gtk_tree_view_get_search_column(self.to_glib_none().0)
        }
    }

    pub fn get_search_entry(&self) -> Option<Entry> {
        unsafe {
            from_glib_none(ffi::gtk_tree_view_get_search_entry(self.to_glib_none().0))
        }
    }

    //pub fn get_search_equal_func(&self) -> /*Unknown conversion*//*Unimplemented*/TreeViewSearchEqualFunc {
    //    unsafe { TODO: call ffi::gtk_tree_view_get_search_equal_func() }
    //}

    //pub fn get_search_position_func(&self) -> /*Unknown conversion*//*Unimplemented*/TreeViewSearchPositionFunc {
    //    unsafe { TODO: call ffi::gtk_tree_view_get_search_position_func() }
    //}

    pub fn get_selection(&self) -> TreeSelection {
        unsafe {
            from_glib_none(ffi::gtk_tree_view_get_selection(self.to_glib_none().0))
        }
    }

    pub fn get_show_expanders(&self) -> bool {
        unsafe {
            from_glib(ffi::gtk_tree_view_get_show_expanders(self.to_glib_none().0))
        }
    }

    pub fn get_tooltip_column(&self) -> i32 {
        unsafe {
            ffi::gtk_tree_view_get_tooltip_column(self.to_glib_none().0)
        }
    }

    pub fn get_tooltip_context(&self, x: &mut i32, y: &mut i32, keyboard_tip: bool) -> Option<(Option<TreeModel>, TreePath, TreeIter)> {
        unsafe {
            let mut model = ptr::null_mut();
            let mut path = ptr::null_mut();
            let mut iter = TreeIter::uninitialized();
            let ret = from_glib(ffi::gtk_tree_view_get_tooltip_context(self.to_glib_none().0, x, y, keyboard_tip.to_glib(), &mut model, &mut path, iter.to_glib_none_mut().0));
            if ret { Some((from_glib_none(model), from_glib_full(path), iter)) } else { None }
        }
    }

    pub fn get_visible_range(&self) -> Option<(TreePath, TreePath)> {
        unsafe {
            let mut start_path = ptr::null_mut();
            let mut end_path = ptr::null_mut();
            let ret = from_glib(ffi::gtk_tree_view_get_visible_range(self.to_glib_none().0, &mut start_path, &mut end_path));
            if ret { Some((from_glib_full(start_path), from_glib_full(end_path))) } else { None }
        }
    }

    pub fn get_visible_rect(&self) -> gdk::Rectangle {
        unsafe {
            let mut visible_rect = gdk::Rectangle::uninitialized();
            ffi::gtk_tree_view_get_visible_rect(self.to_glib_none().0, visible_rect.to_glib_none_mut().0);
            visible_rect
        }
    }

    pub fn insert_column(&self, column: &TreeViewColumn, position: i32) -> i32 {
        unsafe {
            ffi::gtk_tree_view_insert_column(self.to_glib_none().0, column.to_glib_none().0, position)
        }
    }

    //pub fn insert_column_with_attributes<P: IsA<CellRenderer>>(&self, position: i32, title: &str, cell: &P, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs) -> i32 {
    //    unsafe { TODO: call ffi::gtk_tree_view_insert_column_with_attributes() }
    //}

    //pub fn insert_column_with_data_func<P: IsA<CellRenderer>, Q: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&self, position: i32, title: &str, cell: &P, func: /*Unknown conversion*//*Unimplemented*/TreeCellDataFunc, data: Q, dnotify: /*Unknown conversion*//*Unimplemented*/DestroyNotify) -> i32 {
    //    unsafe { TODO: call ffi::gtk_tree_view_insert_column_with_data_func() }
    //}

    pub fn is_blank_at_pos(&self, x: i32, y: i32) -> Option<(TreePath, TreeViewColumn, i32, i32)> {
        unsafe {
            let mut path = ptr::null_mut();
            let mut column = ptr::null_mut();
            let mut cell_x = mem::uninitialized();
            let mut cell_y = mem::uninitialized();
            let ret = from_glib(ffi::gtk_tree_view_is_blank_at_pos(self.to_glib_none().0, x, y, &mut path, &mut column, &mut cell_x, &mut cell_y));
            if ret { Some((from_glib_full(path), from_glib_full(column), cell_x, cell_y)) } else { None }
        }
    }

    pub fn is_rubber_banding_active(&self) -> bool {
        unsafe {
            from_glib(ffi::gtk_tree_view_is_rubber_banding_active(self.to_glib_none().0))
        }
    }

    //pub fn map_expanded_rows<P: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&self, func: /*Unknown conversion*//*Unimplemented*/TreeViewMappingFunc, data: P) {
    //    unsafe { TODO: call ffi::gtk_tree_view_map_expanded_rows() }
    //}

    pub fn move_column_after<'a, P: Into<Option<&'a TreeViewColumn>>>(&self, column: &TreeViewColumn, base_column: P) {
        let base_column = base_column.into();
        let base_column = base_column.to_glib_none();
        unsafe {
            ffi::gtk_tree_view_move_column_after(self.to_glib_none().0, column.to_glib_none().0, base_column.0);
        }
    }

    pub fn remove_column(&self, column: &TreeViewColumn) -> i32 {
        unsafe {
            ffi::gtk_tree_view_remove_column(self.to_glib_none().0, column.to_glib_none().0)
        }
    }

    pub fn row_activated(&self, path: &TreePath, column: &TreeViewColumn) {
        unsafe {
            ffi::gtk_tree_view_row_activated(self.to_glib_none().0, mut_override(path.to_glib_none().0), column.to_glib_none().0);
        }
    }

    pub fn row_expanded(&self, path: &TreePath) -> bool {
        unsafe {
            from_glib(ffi::gtk_tree_view_row_expanded(self.to_glib_none().0, mut_override(path.to_glib_none().0)))
        }
    }

    pub fn scroll_to_cell<'a, 'b, P: Into<Option<&'a TreePath>>, Q: Into<Option<&'b TreeViewColumn>>>(&self, path: P, column: Q, use_align: bool, row_align: f32, col_align: f32) {
        let path = path.into();
        let column = column.into();
        let column = column.to_glib_none();
        unsafe {
            ffi::gtk_tree_view_scroll_to_cell(self.to_glib_none().0, mut_override(path.to_glib_none().0), column.0, use_align.to_glib(), row_align, col_align);
        }
    }

    pub fn scroll_to_point(&self, tree_x: i32, tree_y: i32) {
        unsafe {
            ffi::gtk_tree_view_scroll_to_point(self.to_glib_none().0, tree_x, tree_y);
        }
    }

    #[cfg(feature = "v3_8")]
    pub fn set_activate_on_single_click(&self, single: bool) {
        unsafe {
            ffi::gtk_tree_view_set_activate_on_single_click(self.to_glib_none().0, single.to_glib());
        }
    }

    //pub fn set_column_drag_function<'a, 'b, P: Into<Option<&'a /*Unimplemented*/TreeViewColumnDropFunc>>, Q: Into<Option</*Unimplemented*/Fundamental: Pointer>>, R: Into<Option<&'b /*Ignored*/glib::DestroyNotify>>>(&self, func: P, user_data: Q, destroy: R) {
    //    unsafe { TODO: call ffi::gtk_tree_view_set_column_drag_function() }
    //}

    pub fn set_cursor<'a, P: Into<Option<&'a TreeViewColumn>>>(&self, path: &TreePath, focus_column: P, start_editing: bool) {
        let focus_column = focus_column.into();
        let focus_column = focus_column.to_glib_none();
        unsafe {
            ffi::gtk_tree_view_set_cursor(self.to_glib_none().0, mut_override(path.to_glib_none().0), focus_column.0, start_editing.to_glib());
        }
    }

    pub fn set_cursor_on_cell<'a, 'b, P: Into<Option<&'a TreeViewColumn>>, Q: IsA<CellRenderer> + 'b, R: Into<Option<&'b Q>>>(&self, path: &TreePath, focus_column: P, focus_cell: R, start_editing: bool) {
        let focus_column = focus_column.into();
        let focus_column = focus_column.to_glib_none();
        let focus_cell = focus_cell.into();
        let focus_cell = focus_cell.to_glib_none();
        unsafe {
            ffi::gtk_tree_view_set_cursor_on_cell(self.to_glib_none().0, mut_override(path.to_glib_none().0), focus_column.0, focus_cell.0, start_editing.to_glib());
        }
    }

    pub fn set_drag_dest_row<'a, P: Into<Option<&'a TreePath>>>(&self, path: P, pos: TreeViewDropPosition) {
        let path = path.into();
        unsafe {
            ffi::gtk_tree_view_set_drag_dest_row(self.to_glib_none().0, mut_override(path.to_glib_none().0), pos.to_glib());
        }
    }

    pub fn set_enable_search(&self, enable_search: bool) {
        unsafe {
            ffi::gtk_tree_view_set_enable_search(self.to_glib_none().0, enable_search.to_glib());
        }
    }

    pub fn set_enable_tree_lines(&self, enabled: bool) {
        unsafe {
            ffi::gtk_tree_view_set_enable_tree_lines(self.to_glib_none().0, enabled.to_glib());
        }
    }

    pub fn set_expander_column(&self, column: &TreeViewColumn) {
        unsafe {
            ffi::gtk_tree_view_set_expander_column(self.to_glib_none().0, column.to_glib_none().0);
        }
    }

    pub fn set_fixed_height_mode(&self, enable: bool) {
        unsafe {
            ffi::gtk_tree_view_set_fixed_height_mode(self.to_glib_none().0, enable.to_glib());
        }
    }

    pub fn set_grid_lines(&self, grid_lines: TreeViewGridLines) {
        unsafe {
            ffi::gtk_tree_view_set_grid_lines(self.to_glib_none().0, grid_lines.to_glib());
        }
    }

    pub fn set_headers_clickable(&self, setting: bool) {
        unsafe {
            ffi::gtk_tree_view_set_headers_clickable(self.to_glib_none().0, setting.to_glib());
        }
    }

    pub fn set_headers_visible(&self, headers_visible: bool) {
        unsafe {
            ffi::gtk_tree_view_set_headers_visible(self.to_glib_none().0, headers_visible.to_glib());
        }
    }

    pub fn set_hover_expand(&self, expand: bool) {
        unsafe {
            ffi::gtk_tree_view_set_hover_expand(self.to_glib_none().0, expand.to_glib());
        }
    }

    pub fn set_hover_selection(&self, hover: bool) {
        unsafe {
            ffi::gtk_tree_view_set_hover_selection(self.to_glib_none().0, hover.to_glib());
        }
    }

    pub fn set_level_indentation(&self, indentation: i32) {
        unsafe {
            ffi::gtk_tree_view_set_level_indentation(self.to_glib_none().0, indentation);
        }
    }

    pub fn set_model<'a, P: IsA<TreeModel> + 'a, Q: Into<Option<&'a P>>>(&self, model: Q) {
        let model = model.into();
        let model = model.to_glib_none();
        unsafe {
            ffi::gtk_tree_view_set_model(self.to_glib_none().0, model.0);
        }
    }

    pub fn set_reorderable(&self, reorderable: bool) {
        unsafe {
            ffi::gtk_tree_view_set_reorderable(self.to_glib_none().0, reorderable.to_glib());
        }
    }

    //pub fn set_row_separator_func<'a, 'b, P: Into<Option<&'a /*Unimplemented*/TreeViewRowSeparatorFunc>>, Q: Into<Option</*Unimplemented*/Fundamental: Pointer>>, R: Into<Option<&'b /*Ignored*/glib::DestroyNotify>>>(&self, func: P, data: Q, destroy: R) {
    //    unsafe { TODO: call ffi::gtk_tree_view_set_row_separator_func() }
    //}

    pub fn set_rubber_banding(&self, enable: bool) {
        unsafe {
            ffi::gtk_tree_view_set_rubber_banding(self.to_glib_none().0, enable.to_glib());
        }
    }

    pub fn set_rules_hint(&self, setting: bool) {
        unsafe {
            ffi::gtk_tree_view_set_rules_hint(self.to_glib_none().0, setting.to_glib());
        }
    }

    pub fn set_search_column(&self, column: i32) {
        unsafe {
            ffi::gtk_tree_view_set_search_column(self.to_glib_none().0, column);
        }
    }

    pub fn set_search_entry<'a, P: IsA<Entry> + 'a, Q: Into<Option<&'a P>>>(&self, entry: Q) {
        let entry = entry.into();
        let entry = entry.to_glib_none();
        unsafe {
            ffi::gtk_tree_view_set_search_entry(self.to_glib_none().0, entry.0);
        }
    }

    //pub fn set_search_equal_func<'a, P: Into<Option</*Unimplemented*/Fundamental: Pointer>>, Q: Into<Option<&'a /*Ignored*/glib::DestroyNotify>>>(&self, search_equal_func: /*Unknown conversion*//*Unimplemented*/TreeViewSearchEqualFunc, search_user_data: P, search_destroy: Q) {
    //    unsafe { TODO: call ffi::gtk_tree_view_set_search_equal_func() }
    //}

    //pub fn set_search_position_func<'a, 'b, P: Into<Option<&'a /*Unimplemented*/TreeViewSearchPositionFunc>>, Q: Into<Option</*Unimplemented*/Fundamental: Pointer>>, R: Into<Option<&'b /*Ignored*/glib::DestroyNotify>>>(&self, func: P, data: Q, destroy: R) {
    //    unsafe { TODO: call ffi::gtk_tree_view_set_search_position_func() }
    //}

    pub fn set_show_expanders(&self, enabled: bool) {
        unsafe {
            ffi::gtk_tree_view_set_show_expanders(self.to_glib_none().0, enabled.to_glib());
        }
    }

    pub fn set_tooltip_cell<'a, 'b, 'c, P: Into<Option<&'a TreePath>>, Q: Into<Option<&'b TreeViewColumn>>, R: IsA<CellRenderer> + 'c, S: Into<Option<&'c R>>>(&self, tooltip: &Tooltip, path: P, column: Q, cell: S) {
        let path = path.into();
        let column = column.into();
        let column = column.to_glib_none();
        let cell = cell.into();
        let cell = cell.to_glib_none();
        unsafe {
            ffi::gtk_tree_view_set_tooltip_cell(self.to_glib_none().0, tooltip.to_glib_none().0, mut_override(path.to_glib_none().0), column.0, cell.0);
        }
    }

    pub fn set_tooltip_column(&self, column: i32) {
        unsafe {
            ffi::gtk_tree_view_set_tooltip_column(self.to_glib_none().0, column);
        }
    }

    pub fn set_tooltip_row(&self, tooltip: &Tooltip, path: &TreePath) {
        unsafe {
            ffi::gtk_tree_view_set_tooltip_row(self.to_glib_none().0, tooltip.to_glib_none().0, mut_override(path.to_glib_none().0));
        }
    }

    pub fn unset_rows_drag_dest(&self) {
        unsafe {
            ffi::gtk_tree_view_unset_rows_drag_dest(self.to_glib_none().0);
        }
    }

    pub fn unset_rows_drag_source(&self) {
        unsafe {
            ffi::gtk_tree_view_unset_rows_drag_source(self.to_glib_none().0);
        }
    }

    pub fn get_property_enable_grid_lines(&self) -> TreeViewGridLines {
        let mut value = Value::from(&0);
        unsafe {
            gobject_ffi::g_object_get_property(self.to_glib_none().0, "enable-grid-lines".to_glib_none().0, value.to_glib_none_mut().0);
            from_glib(transmute(value.get::<i32>().unwrap()))
        }
    }

    pub fn set_property_enable_grid_lines(&self, enable_grid_lines: TreeViewGridLines) {
        let enable_grid_lines = enable_grid_lines.to_glib() as i32;
        unsafe {
            gobject_ffi::g_object_set_property(self.to_glib_none().0, "enable-grid-lines".to_glib_none().0, Value::from(&enable_grid_lines).to_glib_none().0);
        }
    }

    pub fn set_property_ubuntu_almost_fixed_height_mode(&self, ubuntu_almost_fixed_height_mode: bool) {
        unsafe {
            gobject_ffi::g_object_set_property(self.to_glib_none().0, "ubuntu-almost-fixed-height-mode".to_glib_none().0, Value::from(&ubuntu_almost_fixed_height_mode).to_glib_none().0);
        }
    }

    pub fn connect_columns_changed<F: Fn(&TreeView) + 'static>(&self, f: F) -> u64 {
        unsafe {
            let f: Box_<Box_<Fn(&TreeView) + 'static>> = Box_::new(Box_::new(f));
            connect(self.to_glib_none().0, "columns-changed",
                transmute(columns_changed_trampoline as usize), Box_::into_raw(f) as *mut _)
        }
    }

    pub fn connect_cursor_changed<F: Fn(&TreeView) + 'static>(&self, f: F) -> u64 {
        unsafe {
            let f: Box_<Box_<Fn(&TreeView) + 'static>> = Box_::new(Box_::new(f));
            connect(self.to_glib_none().0, "cursor-changed",
                transmute(cursor_changed_trampoline as usize), Box_::into_raw(f) as *mut _)
        }
    }

    pub fn connect_expand_collapse_cursor_row<F: Fn(&TreeView, bool, bool, bool) -> bool + 'static>(&self, f: F) -> u64 {
        unsafe {
            let f: Box_<Box_<Fn(&TreeView, bool, bool, bool) -> bool + 'static>> = Box_::new(Box_::new(f));
            connect(self.to_glib_none().0, "expand-collapse-cursor-row",
                transmute(expand_collapse_cursor_row_trampoline as usize), Box_::into_raw(f) as *mut _)
        }
    }

    pub fn connect_move_cursor<F: Fn(&TreeView, MovementStep, i32) -> bool + 'static>(&self, f: F) -> u64 {
        unsafe {
            let f: Box_<Box_<Fn(&TreeView, MovementStep, i32) -> bool + 'static>> = Box_::new(Box_::new(f));
            connect(self.to_glib_none().0, "move-cursor",
                transmute(move_cursor_trampoline as usize), Box_::into_raw(f) as *mut _)
        }
    }

    pub fn connect_row_activated<F: Fn(&TreeView, &TreePath, &TreeViewColumn) + 'static>(&self, f: F) -> u64 {
        unsafe {
            let f: Box_<Box_<Fn(&TreeView, &TreePath, &TreeViewColumn) + 'static>> = Box_::new(Box_::new(f));
            connect(self.to_glib_none().0, "row-activated",
                transmute(row_activated_trampoline as usize), Box_::into_raw(f) as *mut _)
        }
    }

    pub fn connect_row_collapsed<F: Fn(&TreeView, &TreeIter, &TreePath) + 'static>(&self, f: F) -> u64 {
        unsafe {
            let f: Box_<Box_<Fn(&TreeView, &TreeIter, &TreePath) + 'static>> = Box_::new(Box_::new(f));
            connect(self.to_glib_none().0, "row-collapsed",
                transmute(row_collapsed_trampoline as usize), Box_::into_raw(f) as *mut _)
        }
    }

    pub fn connect_row_expanded<F: Fn(&TreeView, &TreeIter, &TreePath) + 'static>(&self, f: F) -> u64 {
        unsafe {
            let f: Box_<Box_<Fn(&TreeView, &TreeIter, &TreePath) + 'static>> = Box_::new(Box_::new(f));
            connect(self.to_glib_none().0, "row-expanded",
                transmute(row_expanded_trampoline as usize), Box_::into_raw(f) as *mut _)
        }
    }

    pub fn connect_select_all<F: Fn(&TreeView) -> bool + 'static>(&self, f: F) -> u64 {
        unsafe {
            let f: Box_<Box_<Fn(&TreeView) -> bool + 'static>> = Box_::new(Box_::new(f));
            connect(self.to_glib_none().0, "select-all",
                transmute(select_all_trampoline as usize), Box_::into_raw(f) as *mut _)
        }
    }

    pub fn connect_select_cursor_parent<F: Fn(&TreeView) -> bool + 'static>(&self, f: F) -> u64 {
        unsafe {
            let f: Box_<Box_<Fn(&TreeView) -> bool + 'static>> = Box_::new(Box_::new(f));
            connect(self.to_glib_none().0, "select-cursor-parent",
                transmute(select_cursor_parent_trampoline as usize), Box_::into_raw(f) as *mut _)
        }
    }

    pub fn connect_select_cursor_row<F: Fn(&TreeView, bool) -> bool + 'static>(&self, f: F) -> u64 {
        unsafe {
            let f: Box_<Box_<Fn(&TreeView, bool) -> bool + 'static>> = Box_::new(Box_::new(f));
            connect(self.to_glib_none().0, "select-cursor-row",
                transmute(select_cursor_row_trampoline as usize), Box_::into_raw(f) as *mut _)
        }
    }

    pub fn connect_start_interactive_search<F: Fn(&TreeView) -> bool + 'static>(&self, f: F) -> u64 {
        unsafe {
            let f: Box_<Box_<Fn(&TreeView) -> bool + 'static>> = Box_::new(Box_::new(f));
            connect(self.to_glib_none().0, "start-interactive-search",
                transmute(start_interactive_search_trampoline as usize), Box_::into_raw(f) as *mut _)
        }
    }

    pub fn connect_test_collapse_row<F: Fn(&TreeView, &TreeIter, &TreePath) -> Inhibit + 'static>(&self, f: F) -> u64 {
        unsafe {
            let f: Box_<Box_<Fn(&TreeView, &TreeIter, &TreePath) -> Inhibit + 'static>> = Box_::new(Box_::new(f));
            connect(self.to_glib_none().0, "test-collapse-row",
                transmute(test_collapse_row_trampoline as usize), Box_::into_raw(f) as *mut _)
        }
    }

    pub fn connect_test_expand_row<F: Fn(&TreeView, &TreeIter, &TreePath) -> Inhibit + 'static>(&self, f: F) -> u64 {
        unsafe {
            let f: Box_<Box_<Fn(&TreeView, &TreeIter, &TreePath) -> Inhibit + 'static>> = Box_::new(Box_::new(f));
            connect(self.to_glib_none().0, "test-expand-row",
                transmute(test_expand_row_trampoline as usize), Box_::into_raw(f) as *mut _)
        }
    }

    pub fn connect_toggle_cursor_row<F: Fn(&TreeView) -> bool + 'static>(&self, f: F) -> u64 {
        unsafe {
            let f: Box_<Box_<Fn(&TreeView) -> bool + 'static>> = Box_::new(Box_::new(f));
            connect(self.to_glib_none().0, "toggle-cursor-row",
                transmute(toggle_cursor_row_trampoline as usize), Box_::into_raw(f) as *mut _)
        }
    }

    pub fn connect_unselect_all<F: Fn(&TreeView) -> bool + 'static>(&self, f: F) -> u64 {
        unsafe {
            let f: Box_<Box_<Fn(&TreeView) -> bool + 'static>> = Box_::new(Box_::new(f));
            connect(self.to_glib_none().0, "unselect-all",
                transmute(unselect_all_trampoline as usize), Box_::into_raw(f) as *mut _)
        }
    }
}

unsafe extern "C" fn columns_changed_trampoline(this: *mut ffi::GtkTreeView, f: glib_ffi::gpointer) {
    callback_guard!();
    let f: &Box_<Fn(&TreeView) + 'static> = transmute(f);
    f(&from_glib_none(this))
}

unsafe extern "C" fn cursor_changed_trampoline(this: *mut ffi::GtkTreeView, f: glib_ffi::gpointer) {
    callback_guard!();
    let f: &Box_<Fn(&TreeView) + 'static> = transmute(f);
    f(&from_glib_none(this))
}

unsafe extern "C" fn expand_collapse_cursor_row_trampoline(this: *mut ffi::GtkTreeView, object: glib_ffi::gboolean, p0: glib_ffi::gboolean, p1: glib_ffi::gboolean, f: glib_ffi::gpointer) -> glib_ffi::gboolean {
    callback_guard!();
    let f: &Box_<Fn(&TreeView, bool, bool, bool) -> bool + 'static> = transmute(f);
    f(&from_glib_none(this), from_glib(object), from_glib(p0), from_glib(p1)).to_glib()
}

unsafe extern "C" fn move_cursor_trampoline(this: *mut ffi::GtkTreeView, step: ffi::GtkMovementStep, direction: libc::c_int, f: glib_ffi::gpointer) -> glib_ffi::gboolean {
    callback_guard!();
    let f: &Box_<Fn(&TreeView, MovementStep, i32) -> bool + 'static> = transmute(f);
    f(&from_glib_none(this), from_glib(step), direction).to_glib()
}

unsafe extern "C" fn row_activated_trampoline(this: *mut ffi::GtkTreeView, path: *mut ffi::GtkTreePath, column: *mut ffi::GtkTreeViewColumn, f: glib_ffi::gpointer) {
    callback_guard!();
    let f: &Box_<Fn(&TreeView, &TreePath, &TreeViewColumn) + 'static> = transmute(f);
    f(&from_glib_none(this), &from_glib_borrow(path), &from_glib_none(column))
}

unsafe extern "C" fn row_collapsed_trampoline(this: *mut ffi::GtkTreeView, iter: *mut ffi::GtkTreeIter, path: *mut ffi::GtkTreePath, f: glib_ffi::gpointer) {
    callback_guard!();
    let f: &Box_<Fn(&TreeView, &TreeIter, &TreePath) + 'static> = transmute(f);
    f(&from_glib_none(this), &from_glib_borrow(iter), &from_glib_borrow(path))
}

unsafe extern "C" fn row_expanded_trampoline(this: *mut ffi::GtkTreeView, iter: *mut ffi::GtkTreeIter, path: *mut ffi::GtkTreePath, f: glib_ffi::gpointer) {
    callback_guard!();
    let f: &Box_<Fn(&TreeView, &TreeIter, &TreePath) + 'static> = transmute(f);
    f(&from_glib_none(this), &from_glib_borrow(iter), &from_glib_borrow(path))
}

unsafe extern "C" fn select_all_trampoline(this: *mut ffi::GtkTreeView, f: glib_ffi::gpointer) -> glib_ffi::gboolean {
    callback_guard!();
    let f: &Box_<Fn(&TreeView) -> bool + 'static> = transmute(f);
    f(&from_glib_none(this)).to_glib()
}

unsafe extern "C" fn select_cursor_parent_trampoline(this: *mut ffi::GtkTreeView, f: glib_ffi::gpointer) -> glib_ffi::gboolean {
    callback_guard!();
    let f: &Box_<Fn(&TreeView) -> bool + 'static> = transmute(f);
    f(&from_glib_none(this)).to_glib()
}

unsafe extern "C" fn select_cursor_row_trampoline(this: *mut ffi::GtkTreeView, object: glib_ffi::gboolean, f: glib_ffi::gpointer) -> glib_ffi::gboolean {
    callback_guard!();
    let f: &Box_<Fn(&TreeView, bool) -> bool + 'static> = transmute(f);
    f(&from_glib_none(this), from_glib(object)).to_glib()
}

unsafe extern "C" fn start_interactive_search_trampoline(this: *mut ffi::GtkTreeView, f: glib_ffi::gpointer) -> glib_ffi::gboolean {
    callback_guard!();
    let f: &Box_<Fn(&TreeView) -> bool + 'static> = transmute(f);
    f(&from_glib_none(this)).to_glib()
}

unsafe extern "C" fn test_collapse_row_trampoline(this: *mut ffi::GtkTreeView, iter: *mut ffi::GtkTreeIter, path: *mut ffi::GtkTreePath, f: glib_ffi::gpointer) -> glib_ffi::gboolean {
    callback_guard!();
    let f: &Box_<Fn(&TreeView, &TreeIter, &TreePath) -> Inhibit + 'static> = transmute(f);
    f(&from_glib_none(this), &from_glib_borrow(iter), &from_glib_borrow(path)).to_glib()
}

unsafe extern "C" fn test_expand_row_trampoline(this: *mut ffi::GtkTreeView, iter: *mut ffi::GtkTreeIter, path: *mut ffi::GtkTreePath, f: glib_ffi::gpointer) -> glib_ffi::gboolean {
    callback_guard!();
    let f: &Box_<Fn(&TreeView, &TreeIter, &TreePath) -> Inhibit + 'static> = transmute(f);
    f(&from_glib_none(this), &from_glib_borrow(iter), &from_glib_borrow(path)).to_glib()
}

unsafe extern "C" fn toggle_cursor_row_trampoline(this: *mut ffi::GtkTreeView, f: glib_ffi::gpointer) -> glib_ffi::gboolean {
    callback_guard!();
    let f: &Box_<Fn(&TreeView) -> bool + 'static> = transmute(f);
    f(&from_glib_none(this)).to_glib()
}

unsafe extern "C" fn unselect_all_trampoline(this: *mut ffi::GtkTreeView, f: glib_ffi::gpointer) -> glib_ffi::gboolean {
    callback_guard!();
    let f: &Box_<Fn(&TreeView) -> bool + 'static> = transmute(f);
    f(&from_glib_none(this)).to_glib()
}