Skip to content
This repository has been archived by the owner on Mar 4, 2024. It is now read-only.

Commit

Permalink
gio: Mark the source_object argument to the ThreadedSocketService::ru…
Browse files Browse the repository at this point in the history
…n as nullable

Just like everywhere else.

Fixes gtk-rs/gio#300
  • Loading branch information
sdroege committed Jun 2, 2020
1 parent d9717d8 commit ea9066e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
10 changes: 9 additions & 1 deletion Gir.toml
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ generate = [
"Gio.SrvTarget",
"Gio.SubprocessFlags",
"Gio.TcpConnection",
"Gio.ThreadedSocketService",
"Gio.TlsAuthenticationMode",
"Gio.TlsCertificate",
"Gio.TlsCertificateFlags",
Expand Down Expand Up @@ -805,6 +804,15 @@ status = "generate"
# ConstructOnly
generate = ["notify"]

[[object]]
name = "Gio.ThreadedSocketService"
status = "generate"
[[object.signal]]
name = "run"
[[object.signal.parameter]]
name = "source_object"
nullable = true

[[object]]
name = "Gio.TlsPassword"
status = "generate"
Expand Down
10 changes: 6 additions & 4 deletions src/auto/threaded_socket_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ pub const NONE_THREADED_SOCKET_SERVICE: Option<&ThreadedSocketService> = None;
pub trait ThreadedSocketServiceExt: 'static {
fn get_property_max_threads(&self) -> i32;

fn connect_run<F: Fn(&Self, &SocketConnection, &glib::Object) -> bool + 'static>(
fn connect_run<F: Fn(&Self, &SocketConnection, Option<&glib::Object>) -> bool + 'static>(
&self,
f: F,
) -> SignalHandlerId;
Expand All @@ -64,13 +64,13 @@ impl<O: IsA<ThreadedSocketService>> ThreadedSocketServiceExt for O {
}
}

fn connect_run<F: Fn(&Self, &SocketConnection, &glib::Object) -> bool + 'static>(
fn connect_run<F: Fn(&Self, &SocketConnection, Option<&glib::Object>) -> bool + 'static>(
&self,
f: F,
) -> SignalHandlerId {
unsafe extern "C" fn run_trampoline<
P,
F: Fn(&P, &SocketConnection, &glib::Object) -> bool + 'static,
F: Fn(&P, &SocketConnection, Option<&glib::Object>) -> bool + 'static,
>(
this: *mut gio_sys::GThreadedSocketService,
connection: *mut gio_sys::GSocketConnection,
Expand All @@ -84,7 +84,9 @@ impl<O: IsA<ThreadedSocketService>> ThreadedSocketServiceExt for O {
f(
&ThreadedSocketService::from_glib_borrow(this).unsafe_cast_ref(),
&from_glib_borrow(connection),
&from_glib_borrow(source_object),
Option::<glib::Object>::from_glib_borrow(source_object)
.as_ref()
.as_ref(),
)
.to_glib()
}
Expand Down

0 comments on commit ea9066e

Please sign in to comment.