Skip to content

Commit ea55f08

Browse files
A6GibKmbilelmoussaoui
authored andcommitted
image: Rename set_from_paintable et. al.
We lost set_paintable and others in the last commit and all these _from_ are rarely used nor idiomatic.
1 parent ca6c3ca commit ea55f08

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

gtk4/Gir.toml

+12
Original file line numberDiff line numberDiff line change
@@ -1426,6 +1426,18 @@ status = "generate"
14261426
[[object.function.parameter]]
14271427
name = "pixbuf"
14281428
nullable = false
1429+
# The following are more idiomatic, set_from_x are the actual setters and
1430+
# gir no longer generates Object::set_property("prop-name", _) setters when
1431+
# there is a setter in the gir annotation.
1432+
[[object.function]]
1433+
name = "set_from_paintable"
1434+
rename = "set_paintable"
1435+
[[object.function]]
1436+
name = "set_from_icon_name"
1437+
rename = "set_icon_name"
1438+
[[object.function]]
1439+
name = "set_from_resource"
1440+
rename = "set_resource"
14291441

14301442

14311443
[[object]]

gtk4/src/auto/image.rs

+6-3
Original file line numberDiff line numberDiff line change
@@ -177,16 +177,18 @@ impl Image {
177177
}
178178

179179
#[doc(alias = "gtk_image_set_from_icon_name")]
180+
#[doc(alias = "set_from_icon_name")]
180181
#[doc(alias = "icon-name")]
181-
pub fn set_from_icon_name(&self, icon_name: Option<&str>) {
182+
pub fn set_icon_name(&self, icon_name: Option<&str>) {
182183
unsafe {
183184
ffi::gtk_image_set_from_icon_name(self.to_glib_none().0, icon_name.to_glib_none().0);
184185
}
185186
}
186187

187188
#[doc(alias = "gtk_image_set_from_paintable")]
189+
#[doc(alias = "set_from_paintable")]
188190
#[doc(alias = "paintable")]
189-
pub fn set_from_paintable(&self, paintable: Option<&impl IsA<gdk::Paintable>>) {
191+
pub fn set_paintable(&self, paintable: Option<&impl IsA<gdk::Paintable>>) {
190192
unsafe {
191193
ffi::gtk_image_set_from_paintable(
192194
self.to_glib_none().0,
@@ -206,8 +208,9 @@ impl Image {
206208
}
207209

208210
#[doc(alias = "gtk_image_set_from_resource")]
211+
#[doc(alias = "set_from_resource")]
209212
#[doc(alias = "resource")]
210-
pub fn set_from_resource(&self, resource_path: Option<&str>) {
213+
pub fn set_resource(&self, resource_path: Option<&str>) {
211214
unsafe {
212215
ffi::gtk_image_set_from_resource(self.to_glib_none().0, resource_path.to_glib_none().0);
213216
}

0 commit comments

Comments
 (0)