Skip to content

Commit d453eba

Browse files
elmarcosdroege
authored andcommitted
Update to current git
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
1 parent 688aa0e commit d453eba

File tree

12 files changed

+79
-79
lines changed

12 files changed

+79
-79
lines changed

src/bar/imp.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ impl ObjectImpl for Bar {
2727
fn properties() -> &'static [glib::ParamSpec] {
2828
use once_cell::sync::Lazy;
2929
static PROPERTIES: Lazy<Vec<glib::ParamSpec>> = Lazy::new(|| {
30-
vec![glib::ParamSpec::double(
30+
vec![glib::ParamSpec::new_double(
3131
"number",
3232
"Number",
3333
"Some number",
@@ -48,7 +48,7 @@ impl ObjectImpl for Bar {
4848
value: &glib::Value,
4949
pspec: &glib::ParamSpec,
5050
) {
51-
match pspec.get_name() {
51+
match pspec.name() {
5252
"number" => {
5353
let number = value.get().unwrap().unwrap();
5454
self.set_number(obj, number);
@@ -57,9 +57,9 @@ impl ObjectImpl for Bar {
5757
}
5858
}
5959

60-
fn get_property(&self, obj: &Self::Type, _id: usize, pspec: &glib::ParamSpec) -> glib::Value {
61-
match pspec.get_name() {
62-
"number" => self.get_number(obj).to_value(),
60+
fn property(&self, obj: &Self::Type, _id: usize, pspec: &glib::ParamSpec) -> glib::Value {
61+
match pspec.name() {
62+
"number" => self.number(obj).to_value(),
6363
_ => unimplemented!(),
6464
}
6565
}
@@ -77,7 +77,7 @@ impl Bar {
7777
this.notify("number");
7878
}
7979

80-
fn get_number(&self, _this: &super::Bar) -> f64 {
80+
fn number(&self, _this: &super::Bar) -> f64 {
8181
*self.number.borrow_mut()
8282
}
8383
}
@@ -93,16 +93,16 @@ pub(crate) mod ffi {
9393
/// Must be a BarInstance object.
9494
#[no_mangle]
9595
pub unsafe extern "C" fn ex_bar_get_number(this: *mut ExBar) -> f64 {
96-
let imp = glib::subclass::types::InstanceStruct::get_impl(&*this);
97-
imp.get_number(&from_glib_borrow(this))
96+
let imp = glib::subclass::types::InstanceStruct::impl_(&*this);
97+
imp.number(&from_glib_borrow(this))
9898
}
9999

100100
/// # Safety
101101
///
102102
/// Must be a BarInstance object.
103103
#[no_mangle]
104104
pub unsafe extern "C" fn ex_bar_set_number(this: *mut ExBar, num: f64) {
105-
let imp = glib::subclass::types::InstanceStruct::get_impl(&*this);
105+
let imp = glib::subclass::types::InstanceStruct::impl_(&*this);
106106
imp.set_number(&from_glib_borrow(this), num);
107107
}
108108

@@ -122,6 +122,6 @@ pub(crate) mod ffi {
122122

123123
#[no_mangle]
124124
pub extern "C" fn ex_bar_get_type() -> glib::ffi::GType {
125-
<super::Bar as glib::subclass::types::ObjectSubclassType>::get_type().to_glib()
125+
<super::Bar as glib::subclass::types::ObjectSubclassType>::type_().to_glib()
126126
}
127127
}

src/bar/mod.rs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ glib::wrapper! {
2121
pub struct Bar(Object<ffi::ExBar, ffi::ExBarClass>) @extends Foo, @implements Nameable;
2222

2323
match fn {
24-
get_type => || ffi::ex_bar_get_type(),
24+
type_ => || ffi::ex_bar_get_type(),
2525
}
2626
}
2727

@@ -39,11 +39,11 @@ impl Bar {
3939
unsafe { ffi::ex_bar_set_number(self.to_glib_none().0, num) }
4040
}
4141

42-
pub fn get_number(&self) -> f64 {
42+
pub fn number(&self) -> f64 {
4343
unsafe { ffi::ex_bar_get_number(self.to_glib_none().0) }
4444
}
4545

46-
pub fn get_property_number(&self) -> f64 {
46+
pub fn property_number(&self) -> f64 {
4747
let mut value = glib::Value::from(&0.0f64);
4848
unsafe {
4949
glib::gobject_ffi::g_object_get_property(
@@ -106,19 +106,19 @@ mod tests {
106106
fn test_counter() {
107107
let bar = Bar::new(Some("bar's name"));
108108

109-
assert_eq!(bar.get_counter(), 0);
109+
assert_eq!(bar.counter(), 0);
110110
assert_eq!(bar.increment(1), 2);
111-
assert_eq!(bar.get_counter(), 2);
111+
assert_eq!(bar.counter(), 2);
112112
assert_eq!(bar.increment(10), 22);
113-
assert_eq!(bar.get_counter(), 22);
113+
assert_eq!(bar.counter(), 22);
114114
}
115115

116116
#[test]
117117
fn test_name() {
118118
let bar = Bar::new(Some("bar's name"));
119119

120-
assert_eq!(bar.get_name(), Some("bar's name".into()));
121-
assert_eq!(bar.get_property_name(), Some("bar's name".into()));
120+
assert_eq!(bar.name(), Some("bar's name".into()));
121+
assert_eq!(bar.property_name(), Some("bar's name".into()));
122122
}
123123

124124
#[test]
@@ -132,15 +132,15 @@ mod tests {
132132
});
133133

134134
assert_eq!(*counter.borrow(), 0);
135-
assert_eq!(bar.get_number(), 0.0);
136-
assert_eq!(bar.get_property_number(), 0.0);
135+
assert_eq!(bar.number(), 0.0);
136+
assert_eq!(bar.property_number(), 0.0);
137137
bar.set_number(10.0);
138138
assert_eq!(*counter.borrow(), 1);
139-
assert_eq!(bar.get_number(), 10.0);
140-
assert_eq!(bar.get_property_number(), 10.0);
139+
assert_eq!(bar.number(), 10.0);
140+
assert_eq!(bar.property_number(), 10.0);
141141
bar.set_property_number(20.0);
142142
assert_eq!(*counter.borrow(), 2);
143-
assert_eq!(bar.get_number(), 20.0);
144-
assert_eq!(bar.get_property_number(), 20.0);
143+
assert_eq!(bar.number(), 20.0);
144+
assert_eq!(bar.property_number(), 20.0);
145145
}
146146
}

src/color/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,10 @@ mod tests {
6161
assert_eq!(t.name(), "ExColor");
6262

6363
let e = glib::EnumClass::new(t).unwrap();
64-
let v = e.get_value(1).unwrap();
65-
assert_eq!(v.get_name(), "Green");
66-
assert_eq!(v.get_nick(), "green");
64+
let v = e.value(1).unwrap();
65+
assert_eq!(v.name(), "Green");
66+
assert_eq!(v.nick(), "green");
6767

68-
assert_eq!(e.get_value(42), None);
68+
assert_eq!(e.value(42), None);
6969
}
7070
}

src/flags/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@ mod tests {
4949
assert!(t.is_a(glib::Type::FLAGS));
5050
assert_eq!(t.name(), "ExFlags");
5151
let e = glib::FlagsClass::new(t).unwrap();
52-
let v = e.get_value(1).unwrap();
53-
assert_eq!(v.get_name(), "Some");
54-
assert_eq!(v.get_nick(), "some");
52+
let v = e.value(1).unwrap();
53+
assert_eq!(v.name(), "Some");
54+
assert_eq!(v.nick(), "some");
5555

5656
}
5757
}

src/foo/imp.rs

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ impl ObjectImpl for Foo {
7676
let inc = args[2].get::<i32>().unwrap().unwrap();
7777

7878
unsafe {
79-
let klass = &*(obj.get_object_class() as *const _ as *const FooClass);
79+
let klass = &*(obj.object_class() as *const _ as *const FooClass);
8080
if let Some(ref func) = klass.incremented {
8181
func(obj.as_ptr() as *mut ffi::ExFoo, val, inc);
8282
}
@@ -93,7 +93,7 @@ impl ObjectImpl for Foo {
9393
fn properties() -> &'static [glib::ParamSpec] {
9494
use once_cell::sync::Lazy;
9595
static PROPERTIES: Lazy<Vec<glib::ParamSpec>> = Lazy::new(|| {
96-
vec![glib::ParamSpec::string(
96+
vec![glib::ParamSpec::new_string(
9797
"name",
9898
"Name",
9999
"Name of this object",
@@ -112,7 +112,7 @@ impl ObjectImpl for Foo {
112112
value: &glib::Value,
113113
pspec: &glib::ParamSpec,
114114
) {
115-
match pspec.get_name() {
115+
match pspec.name() {
116116
"name" => {
117117
let name = value.get().unwrap();
118118
self.set_name(obj, name);
@@ -121,17 +121,17 @@ impl ObjectImpl for Foo {
121121
}
122122
}
123123

124-
fn get_property(&self, obj: &Self::Type, _id: usize, pspec: &glib::ParamSpec) -> glib::Value {
125-
match pspec.get_name() {
126-
"name" => self.get_name(obj).to_value(),
124+
fn property(&self, obj: &Self::Type, _id: usize, pspec: &glib::ParamSpec) -> glib::Value {
125+
match pspec.name() {
126+
"name" => self.name(obj).to_value(),
127127
_ => unimplemented!(),
128128
}
129129
}
130130
}
131131

132132
impl NameableImpl for Foo {
133-
fn get_name(&self, nameable: &Self::Type) -> Option<String> {
134-
self.get_name(nameable.dynamic_cast_ref().unwrap())
133+
fn name(&self, nameable: &Self::Type) -> Option<String> {
134+
self.name(nameable.dynamic_cast_ref().unwrap())
135135
}
136136
}
137137

@@ -154,11 +154,11 @@ impl Foo {
154154
// signal that could be overriden by subclasses
155155
}
156156

157-
fn get_counter(&self, _this: &super::Foo) -> i32 {
157+
fn counter(&self, _this: &super::Foo) -> i32 {
158158
*self.counter.borrow()
159159
}
160160

161-
fn get_name(&self, _this: &super::Foo) -> Option<String> {
161+
fn name(&self, _this: &super::Foo) -> Option<String> {
162162
self.name.borrow().clone()
163163
}
164164

@@ -179,7 +179,7 @@ pub(crate) mod ffi {
179179
/// Must be a ExFoo object.
180180
#[no_mangle]
181181
pub unsafe extern "C" fn ex_foo_increment(this: *mut ExFoo, inc: i32) -> i32 {
182-
let klass = glib::subclass::types::InstanceStruct::get_class(&*this);
182+
let klass = glib::subclass::types::InstanceStruct::class(&*this);
183183

184184
(klass.increment.unwrap())(this, inc)
185185
}
@@ -190,17 +190,17 @@ pub(crate) mod ffi {
190190
/// Must be a FooInstance object.
191191
#[no_mangle]
192192
pub unsafe extern "C" fn ex_foo_get_counter(this: *mut ExFoo) -> i32 {
193-
let imp = glib::subclass::types::InstanceStruct::get_impl(&*this);
194-
imp.get_counter(&from_glib_borrow(this))
193+
let imp = glib::subclass::types::InstanceStruct::impl_(&*this);
194+
imp.counter(&from_glib_borrow(this))
195195
}
196196

197197
/// # Safety
198198
///
199199
/// Must be a FooInstance object.
200200
#[no_mangle]
201201
pub unsafe extern "C" fn ex_foo_get_name(this: *mut ExFoo) -> *mut c_char {
202-
let imp = glib::subclass::types::InstanceStruct::get_impl(&*this);
203-
imp.get_name(&from_glib_borrow(this)).to_glib_full()
202+
let imp = glib::subclass::types::InstanceStruct::impl_(&*this);
203+
imp.name(&from_glib_borrow(this)).to_glib_full()
204204
}
205205

206206
// GObject glue
@@ -219,17 +219,17 @@ pub(crate) mod ffi {
219219

220220
#[no_mangle]
221221
pub extern "C" fn ex_foo_get_type() -> glib::ffi::GType {
222-
<super::Foo as glib::subclass::types::ObjectSubclassType>::get_type().to_glib()
222+
<super::Foo as glib::subclass::types::ObjectSubclassType>::type_().to_glib()
223223
}
224224
}
225225

226226
// Virtual method default implementation trampolines
227227
unsafe extern "C" fn increment_default_trampoline(this: *mut ffi::ExFoo, inc: i32) -> i32 {
228-
let imp = (*this).get_impl();
228+
let imp = (*this).impl_();
229229
imp.increment(&from_glib_borrow(this), inc)
230230
}
231231

232232
unsafe extern "C" fn incremented_default_trampoline(this: *mut ffi::ExFoo, val: i32, inc: i32) {
233-
let imp = (*this).get_impl();
233+
let imp = (*this).impl_();
234234
imp.incremented(&from_glib_borrow(this), val, inc);
235235
}

src/foo/mod.rs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ glib::wrapper! {
2020
pub struct Foo(Object<ffi::ExFoo, ffi::ExFooClass>) @implements Nameable;
2121

2222
match fn {
23-
get_type => || ffi::ex_foo_get_type(),
23+
type_ => || ffi::ex_foo_get_type(),
2424
}
2525
}
2626

@@ -37,10 +37,10 @@ impl Foo {
3737

3838
pub trait FooExt {
3939
fn increment(&self, inc: i32) -> i32;
40-
fn get_counter(&self) -> i32;
41-
fn get_name(&self) -> Option<String>;
40+
fn counter(&self) -> i32;
41+
fn name(&self) -> Option<String>;
4242

43-
fn get_property_name(&self) -> Option<String>;
43+
fn property_name(&self) -> Option<String>;
4444

4545
fn connect_incremented<F: Fn(&Self, i32, i32) + 'static>(&self, f: F) -> SignalHandlerId;
4646
}
@@ -50,15 +50,15 @@ impl<O: IsA<Foo>> FooExt for O {
5050
unsafe { ffi::ex_foo_increment(self.as_ref().to_glib_none().0, inc) }
5151
}
5252

53-
fn get_counter(&self) -> i32 {
53+
fn counter(&self) -> i32 {
5454
unsafe { ffi::ex_foo_get_counter(self.as_ref().to_glib_none().0) }
5555
}
5656

57-
fn get_name(&self) -> Option<String> {
57+
fn name(&self) -> Option<String> {
5858
unsafe { from_glib_full(ffi::ex_foo_get_name(self.as_ref().to_glib_none().0)) }
5959
}
6060

61-
fn get_property_name(&self) -> Option<String> {
61+
fn property_name(&self) -> Option<String> {
6262
let mut value = glib::Value::from(None::<&str>);
6363
unsafe {
6464
glib::gobject_ffi::g_object_get_property(
@@ -112,7 +112,7 @@ pub trait FooImpl: ObjectImpl + 'static {
112112
fn parent_increment(&self, obj: &Foo, inc: i32) -> i32 {
113113
unsafe {
114114
let data = Self::type_data();
115-
let parent_class = data.as_ref().get_parent_class() as *mut ffi::ExFooClass;
115+
let parent_class = data.as_ref().parent_class() as *mut ffi::ExFooClass;
116116
if let Some(ref f) = (*parent_class).increment {
117117
f(obj.to_glib_none().0, inc)
118118
} else {
@@ -124,7 +124,7 @@ pub trait FooImpl: ObjectImpl + 'static {
124124
fn parent_incremented(&self, obj: &Foo, val: i32, inc: i32) {
125125
unsafe {
126126
let data = Self::type_data();
127-
let parent_class = data.as_ref().get_parent_class() as *mut ffi::ExFooClass;
127+
let parent_class = data.as_ref().parent_class() as *mut ffi::ExFooClass;
128128
if let Some(ref f) = (*parent_class).incremented {
129129
f(obj.to_glib_none().0, val, inc)
130130
}
@@ -151,7 +151,7 @@ where
151151
T: FooImpl,
152152
{
153153
let instance = &*(this as *const T::Instance);
154-
let imp = instance.get_impl();
154+
let imp = instance.impl_();
155155
imp.increment(&from_glib_borrow(this), inc)
156156
}
157157

@@ -163,7 +163,7 @@ unsafe extern "C" fn incremented_trampoline<T: ObjectSubclass>(
163163
T: FooImpl,
164164
{
165165
let instance = &*(this as *const T::Instance);
166-
let imp = instance.get_impl();
166+
let imp = instance.impl_();
167167
imp.incremented(&from_glib_borrow(this), val, inc);
168168
}
169169

@@ -190,20 +190,20 @@ mod tests {
190190
*incremented_clone.borrow_mut() = (val, inc);
191191
});
192192

193-
assert_eq!(foo.get_counter(), 0);
193+
assert_eq!(foo.counter(), 0);
194194
assert_eq!(foo.increment(1), 1);
195195
assert_eq!(*incremented.borrow(), (1, 1));
196-
assert_eq!(foo.get_counter(), 1);
196+
assert_eq!(foo.counter(), 1);
197197
assert_eq!(foo.increment(10), 11);
198198
assert_eq!(*incremented.borrow(), (11, 10));
199-
assert_eq!(foo.get_counter(), 11);
199+
assert_eq!(foo.counter(), 11);
200200
}
201201

202202
#[test]
203203
fn test_name() {
204204
let foo = Foo::new(Some("foo's name"));
205205

206-
assert_eq!(foo.get_name(), Some("foo's name".into()));
207-
assert_eq!(foo.get_property_name(), Some("foo's name".into()));
206+
assert_eq!(foo.name(), Some("foo's name".into()));
207+
assert_eq!(foo.property_name(), Some("foo's name".into()));
208208
}
209209
}

0 commit comments

Comments
 (0)