Skip to content

Commit 077dfb1

Browse files
tautropflisdroege
authored andcommitted
Overloads for new_for_bus
1 parent 3b2dc89 commit 077dfb1

File tree

1 file changed

+51
-1
lines changed

1 file changed

+51
-1
lines changed

gio/src/dbus_object_manager_client.rs

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,56 @@ impl DBusObjectManagerClient {
298298
#[allow(clippy::new_ret_no_self)]
299299
pub fn new_for_bus<
300300
P: FnOnce(Result<DBusObjectManagerClient, glib::Error>) + Send + Sync + 'static,
301+
>(
302+
bus_type: BusType,
303+
flags: DBusObjectManagerClientFlags,
304+
name: &str,
305+
object_path: &str,
306+
cancellable: Option<&impl IsA<Cancellable>>,
307+
callback: P,
308+
) {
309+
Self::new_for_bus_impl(
310+
bus_type,
311+
flags,
312+
name,
313+
object_path,
314+
None,
315+
cancellable,
316+
callback,
317+
);
318+
}
319+
320+
#[doc(alias = "g_dbus_object_manager_client_new_for_bus")]
321+
#[allow(clippy::new_ret_no_self)]
322+
pub fn new_for_bus_with_fn<
323+
P: FnOnce(Result<DBusObjectManagerClient, glib::Error>) + Send + Sync + 'static,
324+
F: Fn(&DBusObjectManagerClient, &str, Option<&str>) -> glib::types::Type
325+
+ Send
326+
+ Sync
327+
+ 'static,
328+
>(
329+
bus_type: BusType,
330+
flags: DBusObjectManagerClientFlags,
331+
name: &str,
332+
object_path: &str,
333+
get_proxy_type_func: F,
334+
cancellable: Option<&impl IsA<Cancellable>>,
335+
callback: P,
336+
) {
337+
Self::new_for_bus_impl(
338+
bus_type,
339+
flags,
340+
name,
341+
object_path,
342+
Some(Box::new(get_proxy_type_func)),
343+
cancellable,
344+
callback,
345+
);
346+
}
347+
348+
#[allow(clippy::new_ret_no_self)]
349+
fn new_for_bus_impl<
350+
P: FnOnce(Result<DBusObjectManagerClient, glib::Error>) + Send + Sync + 'static,
301351
>(
302352
bus_type: BusType,
303353
flags: DBusObjectManagerClientFlags,
@@ -435,7 +485,7 @@ impl DBusObjectManagerClient {
435485
let name = String::from(name);
436486
let object_path = String::from(object_path);
437487
Box::pin(GioFuture::new(&(), move |_obj, cancellable, send| {
438-
Self::new_for_bus(
488+
Self::new_for_bus_impl(
439489
bus_type,
440490
flags,
441491
&name,

0 commit comments

Comments
 (0)