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
use crate::Buildable;
use glib::translate::*;
use std::fmt;
glib::wrapper! {
#[doc(alias = "GtkStringList")]
pub struct StringList(Object<ffi::GtkStringList, ffi::GtkStringListClass>) @implements gio::ListModel, Buildable;
match fn {
type_ => || ffi::gtk_string_list_get_type(),
}
}
impl StringList {
#[doc(alias = "gtk_string_list_new")]
pub fn new(strings: &[&str]) -> StringList {
assert_initialized_main_thread!();
unsafe { from_glib_full(ffi::gtk_string_list_new(strings.to_glib_none().0)) }
}
#[doc(alias = "gtk_string_list_append")]
pub fn append(&self, string: &str) {
unsafe {
ffi::gtk_string_list_append(self.to_glib_none().0, string.to_glib_none().0);
}
}
#[doc(alias = "gtk_string_list_get_string")]
#[doc(alias = "get_string")]
pub fn string(&self, position: u32) -> Option<glib::GString> {
unsafe {
from_glib_none(ffi::gtk_string_list_get_string(
self.to_glib_none().0,
position,
))
}
}
#[doc(alias = "gtk_string_list_remove")]
pub fn remove(&self, position: u32) {
unsafe {
ffi::gtk_string_list_remove(self.to_glib_none().0, position);
}
}
#[doc(alias = "gtk_string_list_splice")]
pub fn splice(&self, position: u32, n_removals: u32, additions: &[&str]) {
unsafe {
ffi::gtk_string_list_splice(
self.to_glib_none().0,
position,
n_removals,
additions.to_glib_none().0,
);
}
}
}
impl fmt::Display for StringList {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.write_str("StringList")
}
}