Skip to content

Commit c85cd50

Browse files
authored
Merge pull request #1091 from gtk-rs/bilelmoussaoui/traits
Regenerate with latest gir
2 parents e7ac3be + 35261c4 commit c85cd50

File tree

220 files changed

+2905
-7515
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

220 files changed

+2905
-7515
lines changed

gdk-pixbuf/src/auto/pixbuf.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -660,7 +660,7 @@ impl Pixbuf {
660660
unsafe { FromGlibPtrContainer::from_glib_container(ffi::gdk_pixbuf_get_formats()) }
661661
}
662662

663-
#[cfg(any(feature = "v2_40"))]
663+
#[cfg(feature = "v2_40")]
664664
#[cfg_attr(docsrs, doc(cfg(feature = "v2_40")))]
665665
#[doc(alias = "gdk_pixbuf_init_modules")]
666666
pub fn init_modules(path: &str) -> Result<(), glib::Error> {

gdk-pixbuf/src/auto/pixbuf_animation.rs

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -137,28 +137,15 @@ impl PixbufAnimation {
137137
}
138138
}
139139

140-
pub trait PixbufAnimationExt: 'static {
140+
pub trait PixbufAnimationExt: IsA<PixbufAnimation> + 'static {
141141
#[doc(alias = "gdk_pixbuf_animation_get_height")]
142142
#[doc(alias = "get_height")]
143-
fn height(&self) -> i32;
144-
145-
#[doc(alias = "gdk_pixbuf_animation_get_static_image")]
146-
#[doc(alias = "get_static_image")]
147-
fn static_image(&self) -> Option<Pixbuf>;
148-
149-
#[doc(alias = "gdk_pixbuf_animation_get_width")]
150-
#[doc(alias = "get_width")]
151-
fn width(&self) -> i32;
152-
153-
#[doc(alias = "gdk_pixbuf_animation_is_static_image")]
154-
fn is_static_image(&self) -> bool;
155-
}
156-
157-
impl<O: IsA<PixbufAnimation>> PixbufAnimationExt for O {
158143
fn height(&self) -> i32 {
159144
unsafe { ffi::gdk_pixbuf_animation_get_height(self.as_ref().to_glib_none().0) }
160145
}
161146

147+
#[doc(alias = "gdk_pixbuf_animation_get_static_image")]
148+
#[doc(alias = "get_static_image")]
162149
fn static_image(&self) -> Option<Pixbuf> {
163150
unsafe {
164151
from_glib_none(ffi::gdk_pixbuf_animation_get_static_image(
@@ -167,10 +154,13 @@ impl<O: IsA<PixbufAnimation>> PixbufAnimationExt for O {
167154
}
168155
}
169156

157+
#[doc(alias = "gdk_pixbuf_animation_get_width")]
158+
#[doc(alias = "get_width")]
170159
fn width(&self) -> i32 {
171160
unsafe { ffi::gdk_pixbuf_animation_get_width(self.as_ref().to_glib_none().0) }
172161
}
173162

163+
#[doc(alias = "gdk_pixbuf_animation_is_static_image")]
174164
fn is_static_image(&self) -> bool {
175165
unsafe {
176166
from_glib(ffi::gdk_pixbuf_animation_is_static_image(
@@ -180,6 +170,8 @@ impl<O: IsA<PixbufAnimation>> PixbufAnimationExt for O {
180170
}
181171
}
182172

173+
impl<O: IsA<PixbufAnimation>> PixbufAnimationExt for O {}
174+
183175
impl fmt::Display for PixbufAnimation {
184176
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
185177
f.write_str("PixbufAnimation")

gdk-pixbuf/src/auto/pixbuf_loader.rs

Lines changed: 16 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -63,48 +63,8 @@ impl Default for PixbufLoader {
6363
}
6464
}
6565

66-
pub trait PixbufLoaderExt: 'static {
66+
pub trait PixbufLoaderExt: IsA<PixbufLoader> + 'static {
6767
#[doc(alias = "gdk_pixbuf_loader_close")]
68-
fn close(&self) -> Result<(), glib::Error>;
69-
70-
#[doc(alias = "gdk_pixbuf_loader_get_animation")]
71-
#[doc(alias = "get_animation")]
72-
fn animation(&self) -> Option<PixbufAnimation>;
73-
74-
#[doc(alias = "gdk_pixbuf_loader_get_format")]
75-
#[doc(alias = "get_format")]
76-
fn format(&self) -> Option<PixbufFormat>;
77-
78-
#[doc(alias = "gdk_pixbuf_loader_get_pixbuf")]
79-
#[doc(alias = "get_pixbuf")]
80-
fn pixbuf(&self) -> Option<Pixbuf>;
81-
82-
#[doc(alias = "gdk_pixbuf_loader_set_size")]
83-
fn set_size(&self, width: i32, height: i32);
84-
85-
#[doc(alias = "gdk_pixbuf_loader_write")]
86-
fn write(&self, buf: &[u8]) -> Result<(), glib::Error>;
87-
88-
#[doc(alias = "gdk_pixbuf_loader_write_bytes")]
89-
fn write_bytes(&self, buffer: &glib::Bytes) -> Result<(), glib::Error>;
90-
91-
#[doc(alias = "area-prepared")]
92-
fn connect_area_prepared<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
93-
94-
#[doc(alias = "area-updated")]
95-
fn connect_area_updated<F: Fn(&Self, i32, i32, i32, i32) + 'static>(
96-
&self,
97-
f: F,
98-
) -> SignalHandlerId;
99-
100-
#[doc(alias = "closed")]
101-
fn connect_closed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
102-
103-
#[doc(alias = "size-prepared")]
104-
fn connect_size_prepared<F: Fn(&Self, i32, i32) + 'static>(&self, f: F) -> SignalHandlerId;
105-
}
106-
107-
impl<O: IsA<PixbufLoader>> PixbufLoaderExt for O {
10868
fn close(&self) -> Result<(), glib::Error> {
10969
unsafe {
11070
let mut error = ptr::null_mut();
@@ -118,6 +78,8 @@ impl<O: IsA<PixbufLoader>> PixbufLoaderExt for O {
11878
}
11979
}
12080

81+
#[doc(alias = "gdk_pixbuf_loader_get_animation")]
82+
#[doc(alias = "get_animation")]
12183
fn animation(&self) -> Option<PixbufAnimation> {
12284
unsafe {
12385
from_glib_none(ffi::gdk_pixbuf_loader_get_animation(
@@ -126,6 +88,8 @@ impl<O: IsA<PixbufLoader>> PixbufLoaderExt for O {
12688
}
12789
}
12890

91+
#[doc(alias = "gdk_pixbuf_loader_get_format")]
92+
#[doc(alias = "get_format")]
12993
fn format(&self) -> Option<PixbufFormat> {
13094
unsafe {
13195
from_glib_none(ffi::gdk_pixbuf_loader_get_format(
@@ -134,6 +98,8 @@ impl<O: IsA<PixbufLoader>> PixbufLoaderExt for O {
13498
}
13599
}
136100

101+
#[doc(alias = "gdk_pixbuf_loader_get_pixbuf")]
102+
#[doc(alias = "get_pixbuf")]
137103
fn pixbuf(&self) -> Option<Pixbuf> {
138104
unsafe {
139105
from_glib_none(ffi::gdk_pixbuf_loader_get_pixbuf(
@@ -142,12 +108,14 @@ impl<O: IsA<PixbufLoader>> PixbufLoaderExt for O {
142108
}
143109
}
144110

111+
#[doc(alias = "gdk_pixbuf_loader_set_size")]
145112
fn set_size(&self, width: i32, height: i32) {
146113
unsafe {
147114
ffi::gdk_pixbuf_loader_set_size(self.as_ref().to_glib_none().0, width, height);
148115
}
149116
}
150117

118+
#[doc(alias = "gdk_pixbuf_loader_write")]
151119
fn write(&self, buf: &[u8]) -> Result<(), glib::Error> {
152120
let count = buf.len() as _;
153121
unsafe {
@@ -167,6 +135,7 @@ impl<O: IsA<PixbufLoader>> PixbufLoaderExt for O {
167135
}
168136
}
169137

138+
#[doc(alias = "gdk_pixbuf_loader_write_bytes")]
170139
fn write_bytes(&self, buffer: &glib::Bytes) -> Result<(), glib::Error> {
171140
unsafe {
172141
let mut error = ptr::null_mut();
@@ -184,6 +153,7 @@ impl<O: IsA<PixbufLoader>> PixbufLoaderExt for O {
184153
}
185154
}
186155

156+
#[doc(alias = "area-prepared")]
187157
fn connect_area_prepared<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
188158
unsafe extern "C" fn area_prepared_trampoline<P: IsA<PixbufLoader>, F: Fn(&P) + 'static>(
189159
this: *mut ffi::GdkPixbufLoader,
@@ -205,6 +175,7 @@ impl<O: IsA<PixbufLoader>> PixbufLoaderExt for O {
205175
}
206176
}
207177

178+
#[doc(alias = "area-updated")]
208179
fn connect_area_updated<F: Fn(&Self, i32, i32, i32, i32) + 'static>(
209180
&self,
210181
f: F,
@@ -242,6 +213,7 @@ impl<O: IsA<PixbufLoader>> PixbufLoaderExt for O {
242213
}
243214
}
244215

216+
#[doc(alias = "closed")]
245217
fn connect_closed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
246218
unsafe extern "C" fn closed_trampoline<P: IsA<PixbufLoader>, F: Fn(&P) + 'static>(
247219
this: *mut ffi::GdkPixbufLoader,
@@ -263,6 +235,7 @@ impl<O: IsA<PixbufLoader>> PixbufLoaderExt for O {
263235
}
264236
}
265237

238+
#[doc(alias = "size-prepared")]
266239
fn connect_size_prepared<F: Fn(&Self, i32, i32) + 'static>(&self, f: F) -> SignalHandlerId {
267240
unsafe extern "C" fn size_prepared_trampoline<
268241
P: IsA<PixbufLoader>,
@@ -294,6 +267,8 @@ impl<O: IsA<PixbufLoader>> PixbufLoaderExt for O {
294267
}
295268
}
296269

270+
impl<O: IsA<PixbufLoader>> PixbufLoaderExt for O {}
271+
297272
impl fmt::Display for PixbufLoader {
298273
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
299274
f.write_str("PixbufLoader")

gdk-pixbuf/src/auto/versions.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
Generated by gir (https://github.com/gtk-rs/gir @ 6a0603f52c3c)
2-
from gir-files (https://github.com/gtk-rs/gir-files @ b42700b30bb2)
1+
Generated by gir (https://github.com/gtk-rs/gir @ bf8c5e344a73)
2+
from gir-files (https://github.com/gtk-rs/gir-files @ 43cac7495ff5)

gdk-pixbuf/sys/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,7 @@ extern "C" {
541541
error: *mut *mut glib::GError,
542542
) -> *mut GdkPixbufFormat;
543543
pub fn gdk_pixbuf_get_formats() -> *mut glib::GSList;
544-
#[cfg(any(feature = "v2_40"))]
544+
#[cfg(feature = "v2_40")]
545545
#[cfg_attr(docsrs, doc(cfg(feature = "v2_40")))]
546546
pub fn gdk_pixbuf_init_modules(path: *const c_char, error: *mut *mut glib::GError) -> gboolean;
547547
pub fn gdk_pixbuf_new_from_stream_async(

gdk-pixbuf/sys/versions.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
Generated by gir (https://github.com/gtk-rs/gir @ 6a0603f52c3c)
2-
from gir-files (https://github.com/gtk-rs/gir-files @ b42700b30bb2)
1+
Generated by gir (https://github.com/gtk-rs/gir @ bf8c5e344a73)
2+
from gir-files (https://github.com/gtk-rs/gir-files @ 43cac7495ff5)

gio/Gir.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -665,6 +665,7 @@ manual_traits = ["DebugControllerDBusExtManual"]
665665
[[object]]
666666
name = "Gio.DesktopAppInfo"
667667
status = "generate"
668+
manual_traits = ["DesktopAppInfoExtManual"]
668669
cfg_condition = "all(not(windows),not(target_os = \"macos\"))"
669670
[[object.function]]
670671
name = "get_boolean"
@@ -845,6 +846,7 @@ concurrency = "send+sync"
845846
[[object]]
846847
name = "Gio.InetAddress"
847848
status = "generate"
849+
manual_traits = ["InetAddressExtManual"]
848850
concurrency = "send+sync"
849851
[[object.function]]
850852
name = "new_from_bytes"
@@ -1124,6 +1126,7 @@ status = "generate"
11241126
[[object]]
11251127
name = "Gio.Settings"
11261128
status = "generate"
1129+
manual_traits = ["SettingsExtManual"]
11271130
[[object.signal]]
11281131
name = "writable-change-event"
11291132
inhibit = true

gio/src/action_map.rs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,8 @@ use glib::{clone, prelude::*};
44

55
use crate::{prelude::*, ActionEntry, ActionMap, SimpleAction};
66

7-
pub trait ActionMapExtManual {
7+
pub trait ActionMapExtManual: IsA<ActionMap> {
88
#[doc(alias = "g_action_map_add_action_entries")]
9-
fn add_action_entries(&self, entries: impl IntoIterator<Item = ActionEntry<Self>>)
10-
where
11-
Self: IsA<ActionMap>;
12-
}
13-
14-
impl<O: IsA<ActionMap>> ActionMapExtManual for O {
159
fn add_action_entries(&self, entries: impl IntoIterator<Item = ActionEntry<Self>>) {
1610
for entry in entries.into_iter() {
1711
let action = if let Some(state) = entry.state() {
@@ -23,16 +17,18 @@ impl<O: IsA<ActionMap>> ActionMapExtManual for O {
2317
if let Some(callback) = entry.activate {
2418
action.connect_activate(clone!(@strong action_map => move |action, state| {
2519
// safe to unwrap as O: IsA<ActionMap>
26-
callback(action_map.downcast_ref::<O>().unwrap(), action, state);
20+
callback(action_map.downcast_ref::<Self>().unwrap(), action, state);
2721
}));
2822
}
2923
if let Some(callback) = entry.change_state {
3024
action.connect_change_state(clone!(@strong action_map => move |action, state| {
3125
// safe to unwrap as O: IsA<ActionMap>
32-
callback(action_map.downcast_ref::<O>().unwrap(), action, state);
26+
callback(action_map.downcast_ref::<Self>().unwrap(), action, state);
3327
}));
3428
}
3529
self.as_ref().add_action(&action);
3630
}
3731
}
3832
}
33+
34+
impl<O: IsA<ActionMap>> ActionMapExtManual for O {}

gio/src/app_info.rs

Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -17,34 +17,10 @@ use crate::AppLaunchContext;
1717
#[cfg(feature = "v2_60")]
1818
use crate::Cancellable;
1919

20-
pub trait AppInfoExtManual: 'static {
20+
pub trait AppInfoExtManual: IsA<AppInfo> + 'static {
2121
#[cfg(feature = "v2_60")]
2222
#[cfg_attr(docsrs, doc(cfg(feature = "v2_60")))]
2323
#[doc(alias = "g_app_info_launch_uris_async")]
24-
fn launch_uris_async<
25-
P: IsA<AppLaunchContext>,
26-
Q: IsA<Cancellable>,
27-
R: FnOnce(Result<(), glib::Error>) + 'static,
28-
>(
29-
&self,
30-
uris: &[&str],
31-
context: Option<&P>,
32-
cancellable: Option<&Q>,
33-
callback: R,
34-
);
35-
36-
#[cfg(feature = "v2_60")]
37-
#[cfg_attr(docsrs, doc(cfg(feature = "v2_60")))]
38-
fn launch_uris_future<P: IsA<AppLaunchContext> + Clone + 'static>(
39-
&self,
40-
uris: &[&str],
41-
context: Option<&P>,
42-
) -> Pin<Box_<dyn std::future::Future<Output = Result<(), glib::Error>> + 'static>>;
43-
}
44-
45-
impl<O: IsA<AppInfo>> AppInfoExtManual for O {
46-
#[cfg(feature = "v2_60")]
47-
#[cfg_attr(docsrs, doc(cfg(feature = "v2_60")))]
4824
fn launch_uris_async<
4925
P: IsA<AppLaunchContext>,
5026
Q: IsA<Cancellable>,
@@ -133,3 +109,5 @@ impl<O: IsA<AppInfo>> AppInfoExtManual for O {
133109
))
134110
}
135111
}
112+
113+
impl<O: IsA<AppInfo>> AppInfoExtManual for O {}

gio/src/application.rs

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,25 +11,12 @@ use glib::{
1111

1212
use crate::{Application, File};
1313

14-
pub trait ApplicationExtManual {
14+
pub trait ApplicationExtManual: IsA<Application> {
1515
#[doc(alias = "g_application_run")]
16-
fn run(&self) -> ExitCode;
17-
#[doc(alias = "g_application_run")]
18-
fn run_with_args<S: AsRef<str>>(&self, args: &[S]) -> ExitCode;
19-
fn connect_open<F: Fn(&Self, &[File], &str) + 'static>(&self, f: F) -> SignalHandlerId;
20-
21-
#[doc(alias = "g_application_hold")]
22-
fn hold(&self) -> ApplicationHoldGuard;
23-
24-
#[doc(alias = "g_application_mark_busy")]
25-
fn mark_busy(&self) -> ApplicationBusyGuard;
26-
}
27-
28-
impl<O: IsA<Application>> ApplicationExtManual for O {
2916
fn run(&self) -> ExitCode {
3017
self.run_with_args(&std::env::args().collect::<Vec<_>>())
3118
}
32-
19+
#[doc(alias = "g_application_run")]
3320
fn run_with_args<S: AsRef<str>>(&self, args: &[S]) -> ExitCode {
3421
let argv: Vec<&str> = args.iter().map(|a| a.as_ref()).collect();
3522
let argc = argv.len() as i32;
@@ -38,7 +25,6 @@ impl<O: IsA<Application>> ApplicationExtManual for O {
3825
};
3926
ExitCode::from(exit_code)
4027
}
41-
4228
fn connect_open<F: Fn(&Self, &[File], &str) + 'static>(&self, f: F) -> SignalHandlerId {
4329
unsafe extern "C" fn open_trampoline<P, F: Fn(&P, &[File], &str) + 'static>(
4430
this: *mut ffi::GApplication,
@@ -70,13 +56,15 @@ impl<O: IsA<Application>> ApplicationExtManual for O {
7056
}
7157
}
7258

59+
#[doc(alias = "g_application_hold")]
7360
fn hold(&self) -> ApplicationHoldGuard {
7461
unsafe {
7562
ffi::g_application_hold(self.as_ref().to_glib_none().0);
7663
}
7764
ApplicationHoldGuard(self.as_ref().downgrade())
7865
}
7966

67+
#[doc(alias = "g_application_mark_busy")]
8068
fn mark_busy(&self) -> ApplicationBusyGuard {
8169
unsafe {
8270
ffi::g_application_mark_busy(self.as_ref().to_glib_none().0);
@@ -85,6 +73,8 @@ impl<O: IsA<Application>> ApplicationExtManual for O {
8573
}
8674
}
8775

76+
impl<O: IsA<Application>> ApplicationExtManual for O {}
77+
8878
#[derive(Debug)]
8979
#[must_use = "if unused the Application will immediately be released"]
9080
pub struct ApplicationHoldGuard(glib::WeakRef<Application>);

0 commit comments

Comments
 (0)