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
// This file was generated by gir (4b09025) from gir-files (71d73f0)
// DO NOT EDIT

use TreeIter;
use TreeModel;
use TreeSortable;
use ffi;
use glib::object::IsA;
use glib::translate::*;
use gobject_ffi;

glib_wrapper! {
    pub struct ListStore(Object<ffi::GtkListStore>): TreeModel, TreeSortable;

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

impl ListStore {
    //pub fn new(n_columns: i32, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs) -> ListStore {
    //    unsafe { TODO: call ffi::gtk_list_store_new() }
    //}

    //pub fn newv(types: /*Unimplemented*/&CArray TypeId { ns_id: 0, id: 30 }) -> ListStore {
    //    unsafe { TODO: call ffi::gtk_list_store_newv() }
    //}
}

pub trait ListStoreExt {
    fn append(&self) -> TreeIter;

    fn clear(&self);

    fn insert(&self, position: i32) -> TreeIter;

    fn insert_after<'a, P: Into<Option<&'a TreeIter>>>(&self, sibling: P) -> TreeIter;

    fn insert_before<'a, P: Into<Option<&'a TreeIter>>>(&self, sibling: P) -> TreeIter;

    //fn insert_with_values(&self, position: i32, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs) -> TreeIter;

    //fn insert_with_valuesv(&self, position: i32, columns: /*Unimplemented*/&CArray TypeId { ns_id: 0, id: 14 }, values: &[&glib::Value]) -> TreeIter;

    fn iter_is_valid(&self, iter: &TreeIter) -> bool;

    fn move_after<'a, P: Into<Option<&'a TreeIter>>>(&self, iter: &TreeIter, position: P);

    fn move_before<'a, P: Into<Option<&'a TreeIter>>>(&self, iter: &TreeIter, position: P);

    fn prepend(&self) -> TreeIter;

    fn remove(&self, iter: &TreeIter) -> bool;

    //fn reorder(&self, new_order: /*Unimplemented*/&CArray TypeId { ns_id: 0, id: 14 });

    //fn set(&self, iter: &TreeIter, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs);

    //fn set_column_types(&self, types: /*Unimplemented*/&CArray TypeId { ns_id: 0, id: 30 });

    //fn set_valist(&self, iter: &TreeIter, var_args: /*Unknown conversion*//*Unimplemented*/Unsupported);

    //fn set_valuesv(&self, iter: &TreeIter, columns: /*Unimplemented*/&CArray TypeId { ns_id: 0, id: 14 }, values: &[&glib::Value]);

    fn swap(&self, a: &TreeIter, b: &TreeIter);
}

impl<O: IsA<ListStore>> ListStoreExt for O {
    fn append(&self) -> TreeIter {
        unsafe {
            let mut iter = TreeIter::uninitialized();
            ffi::gtk_list_store_append(self.to_glib_none().0, iter.to_glib_none_mut().0);
            iter
        }
    }

    fn clear(&self) {
        unsafe {
            ffi::gtk_list_store_clear(self.to_glib_none().0);
        }
    }

    fn insert(&self, position: i32) -> TreeIter {
        unsafe {
            let mut iter = TreeIter::uninitialized();
            ffi::gtk_list_store_insert(self.to_glib_none().0, iter.to_glib_none_mut().0, position);
            iter
        }
    }

    fn insert_after<'a, P: Into<Option<&'a TreeIter>>>(&self, sibling: P) -> TreeIter {
        let sibling = sibling.into();
        unsafe {
            let mut iter = TreeIter::uninitialized();
            ffi::gtk_list_store_insert_after(self.to_glib_none().0, iter.to_glib_none_mut().0, mut_override(sibling.to_glib_none().0));
            iter
        }
    }

    fn insert_before<'a, P: Into<Option<&'a TreeIter>>>(&self, sibling: P) -> TreeIter {
        let sibling = sibling.into();
        unsafe {
            let mut iter = TreeIter::uninitialized();
            ffi::gtk_list_store_insert_before(self.to_glib_none().0, iter.to_glib_none_mut().0, mut_override(sibling.to_glib_none().0));
            iter
        }
    }

    //fn insert_with_values(&self, position: i32, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs) -> TreeIter {
    //    unsafe { TODO: call ffi::gtk_list_store_insert_with_values() }
    //}

    //fn insert_with_valuesv(&self, position: i32, columns: /*Unimplemented*/&CArray TypeId { ns_id: 0, id: 14 }, values: &[&glib::Value]) -> TreeIter {
    //    unsafe { TODO: call ffi::gtk_list_store_insert_with_valuesv() }
    //}

    fn iter_is_valid(&self, iter: &TreeIter) -> bool {
        unsafe {
            from_glib(ffi::gtk_list_store_iter_is_valid(self.to_glib_none().0, mut_override(iter.to_glib_none().0)))
        }
    }

    fn move_after<'a, P: Into<Option<&'a TreeIter>>>(&self, iter: &TreeIter, position: P) {
        let position = position.into();
        unsafe {
            ffi::gtk_list_store_move_after(self.to_glib_none().0, mut_override(iter.to_glib_none().0), mut_override(position.to_glib_none().0));
        }
    }

    fn move_before<'a, P: Into<Option<&'a TreeIter>>>(&self, iter: &TreeIter, position: P) {
        let position = position.into();
        unsafe {
            ffi::gtk_list_store_move_before(self.to_glib_none().0, mut_override(iter.to_glib_none().0), mut_override(position.to_glib_none().0));
        }
    }

    fn prepend(&self) -> TreeIter {
        unsafe {
            let mut iter = TreeIter::uninitialized();
            ffi::gtk_list_store_prepend(self.to_glib_none().0, iter.to_glib_none_mut().0);
            iter
        }
    }

    fn remove(&self, iter: &TreeIter) -> bool {
        unsafe {
            from_glib(ffi::gtk_list_store_remove(self.to_glib_none().0, mut_override(iter.to_glib_none().0)))
        }
    }

    //fn reorder(&self, new_order: /*Unimplemented*/&CArray TypeId { ns_id: 0, id: 14 }) {
    //    unsafe { TODO: call ffi::gtk_list_store_reorder() }
    //}

    //fn set(&self, iter: &TreeIter, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs) {
    //    unsafe { TODO: call ffi::gtk_list_store_set() }
    //}

    //fn set_column_types(&self, types: /*Unimplemented*/&CArray TypeId { ns_id: 0, id: 30 }) {
    //    unsafe { TODO: call ffi::gtk_list_store_set_column_types() }
    //}

    //fn set_valist(&self, iter: &TreeIter, var_args: /*Unknown conversion*//*Unimplemented*/Unsupported) {
    //    unsafe { TODO: call ffi::gtk_list_store_set_valist() }
    //}

    //fn set_valuesv(&self, iter: &TreeIter, columns: /*Unimplemented*/&CArray TypeId { ns_id: 0, id: 14 }, values: &[&glib::Value]) {
    //    unsafe { TODO: call ffi::gtk_list_store_set_valuesv() }
    //}

    fn swap(&self, a: &TreeIter, b: &TreeIter) {
        unsafe {
            ffi::gtk_list_store_swap(self.to_glib_none().0, mut_override(a.to_glib_none().0), mut_override(b.to_glib_none().0));
        }
    }
}