Skip to content

Commit 22c2db4

Browse files
tautropflisdroege
authored andcommitted
Split sync methods into overloads with and without fn
1 parent da2ab92 commit 22c2db4

File tree

3 files changed

+83
-2
lines changed

3 files changed

+83
-2
lines changed

gio/Gir.toml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -704,6 +704,14 @@ name = "Gio.DBusObjectManagerClient"
704704
status = "generate"
705705
concurrency = "send+sync"
706706
manual_traits = ["DBusObjectManagerClientExtManual"]
707+
[[object.function]]
708+
name = "new_for_bus_sync"
709+
visibility = "crate"
710+
rename = "for_bus_sync_impl"
711+
[[object.function]]
712+
name = "new_sync"
713+
visibility = "crate"
714+
rename = "new_sync_impl"
707715
[[object.function]]
708716
name = "new"
709717
manual = true

gio/src/auto/dbus_object_manager_client.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ impl DBusObjectManagerClient {
2828

2929
#[doc(alias = "g_dbus_object_manager_client_new_for_bus_sync")]
3030
#[doc(alias = "new_for_bus_sync")]
31-
pub fn for_bus_sync(
31+
#[allow(dead_code)]
32+
pub(crate) fn for_bus_sync_impl(
3233
bus_type: BusType,
3334
flags: DBusObjectManagerClientFlags,
3435
name: &str,
@@ -120,7 +121,9 @@ impl DBusObjectManagerClient {
120121
}
121122

122123
#[doc(alias = "g_dbus_object_manager_client_new_sync")]
123-
pub fn new_sync(
124+
#[doc(alias = "new_sync")]
125+
#[allow(dead_code)]
126+
pub(crate) fn new_sync_impl(
124127
connection: &DBusConnection,
125128
flags: DBusObjectManagerClientFlags,
126129
name: Option<&str>,

gio/src/dbus_object_manager_client.rs

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,76 @@ type DBusProxyTypeFn = Box<
2222
>;
2323

2424
impl DBusObjectManagerClient {
25+
#[doc(alias = "g_dbus_object_manager_client_new_sync")]
26+
pub fn new_sync(
27+
connection: &DBusConnection,
28+
flags: DBusObjectManagerClientFlags,
29+
name: Option<&str>,
30+
object_path: &str,
31+
cancellable: Option<&impl IsA<Cancellable>>,
32+
) -> Result<DBusObjectManagerClient, glib::Error> {
33+
Self::new_sync_impl(connection, flags, name, object_path, None, cancellable)
34+
}
35+
36+
#[doc(alias = "g_dbus_object_manager_client_new_sync")]
37+
pub fn new_sync_with_fn<
38+
F: Fn(&DBusObjectManagerClient, &str, Option<&str>) -> glib::types::Type
39+
+ Send
40+
+ Sync
41+
+ 'static,
42+
>(
43+
connection: &DBusConnection,
44+
flags: DBusObjectManagerClientFlags,
45+
name: Option<&str>,
46+
object_path: &str,
47+
get_proxy_type_func: F,
48+
cancellable: Option<&impl IsA<Cancellable>>,
49+
) -> Result<DBusObjectManagerClient, glib::Error> {
50+
Self::new_sync_impl(
51+
connection,
52+
flags,
53+
name,
54+
object_path,
55+
Some(Box::new(get_proxy_type_func)),
56+
cancellable,
57+
)
58+
}
59+
60+
#[doc(alias = "g_dbus_object_manager_client_new_for_bus_sync")]
61+
pub fn for_bus_sync(
62+
bus_type: BusType,
63+
flags: DBusObjectManagerClientFlags,
64+
name: &str,
65+
object_path: &str,
66+
cancellable: Option<&impl IsA<Cancellable>>,
67+
) -> Result<DBusObjectManagerClient, glib::Error> {
68+
Self::for_bus_sync_impl(bus_type, flags, name, object_path, None, cancellable)
69+
}
70+
71+
#[doc(alias = "g_dbus_object_manager_client_new_for_bus_sync")]
72+
pub fn for_bus_sync_with_fn<
73+
F: Fn(&DBusObjectManagerClient, &str, Option<&str>) -> glib::types::Type
74+
+ Send
75+
+ Sync
76+
+ 'static,
77+
>(
78+
bus_type: BusType,
79+
flags: DBusObjectManagerClientFlags,
80+
name: &str,
81+
object_path: &str,
82+
get_proxy_type_func: F,
83+
cancellable: Option<&impl IsA<Cancellable>>,
84+
) -> Result<DBusObjectManagerClient, glib::Error> {
85+
Self::for_bus_sync_impl(
86+
bus_type,
87+
flags,
88+
name,
89+
object_path,
90+
Some(Box::new(get_proxy_type_func)),
91+
cancellable,
92+
)
93+
}
94+
2595
// The checker tries to add a doc alias for `g_dbus_object_manager_client_new_finish`.
2696
// checker-ignore-item
2797
#[doc(alias = "g_dbus_object_manager_client_new")]

0 commit comments

Comments
 (0)