3
3
#[ cfg( all( unix, feature = "v2_58" ) ) ]
4
4
use std:: boxed:: Box as Box_ ;
5
5
#[ cfg( all( unix, feature = "v2_58" ) ) ]
6
- use std:: os:: unix:: io:: AsRawFd ;
6
+ use std:: os:: unix:: io:: { AsFd , AsRawFd } ;
7
7
#[ cfg( all( unix, feature = "v2_58" ) ) ]
8
8
use std:: ptr;
9
9
@@ -48,21 +48,16 @@ impl DesktopAppInfo {
48
48
pub trait DesktopAppInfoExtManual : IsA < DesktopAppInfo > {
49
49
#[ cfg_attr( docsrs, doc( cfg( all( feature = "v2_58" , unix) ) ) ) ]
50
50
#[ doc( alias = "g_desktop_app_info_launch_uris_as_manager_with_fds" ) ]
51
- fn launch_uris_as_manager_with_fds <
52
- P : IsA < AppLaunchContext > ,
53
- T : AsRawFd ,
54
- U : AsRawFd ,
55
- V : AsRawFd ,
56
- > (
51
+ fn launch_uris_as_manager_with_fds < P : IsA < AppLaunchContext > > (
57
52
& self ,
58
53
uris : & [ & str ] ,
59
54
launch_context : Option < & P > ,
60
55
spawn_flags : glib:: SpawnFlags ,
61
56
user_setup : Option < Box_ < dyn FnOnce ( ) + ' static > > ,
62
57
pid_callback : Option < & mut dyn ( FnMut ( & DesktopAppInfo , glib:: Pid ) ) > ,
63
- stdin_fd : & mut T ,
64
- stdout_fd : & mut U ,
65
- stderr_fd : & mut V ,
58
+ stdin_fd : Option < impl AsFd > ,
59
+ stdout_fd : Option < impl AsFd > ,
60
+ stderr_fd : Option < impl AsFd > ,
66
61
) -> Result < ( ) , Error > {
67
62
let user_setup_data: Box_ < Option < Box_ < dyn FnOnce ( ) + ' static > > > = Box_ :: new ( user_setup) ;
68
63
unsafe extern "C" fn user_setup_func ( user_data : glib:: ffi:: gpointer ) {
@@ -99,6 +94,10 @@ pub trait DesktopAppInfoExtManual: IsA<DesktopAppInfo> {
99
94
let super_callback0: Box_ < Option < Box_ < dyn FnOnce ( ) + ' static > > > = user_setup_data;
100
95
let super_callback1: & Option < & mut dyn ( FnMut ( & DesktopAppInfo , glib:: Pid ) ) > =
101
96
& pid_callback_data;
97
+
98
+ let stdin_raw_fd = stdin_fd. map_or ( -1 , |fd| fd. as_fd ( ) . as_raw_fd ( ) ) ;
99
+ let stdout_raw_fd = stdout_fd. map_or ( -1 , |fd| fd. as_fd ( ) . as_raw_fd ( ) ) ;
100
+ let stderr_raw_fd = stderr_fd. map_or ( -1 , |fd| fd. as_fd ( ) . as_raw_fd ( ) ) ;
102
101
unsafe {
103
102
let mut error = ptr:: null_mut ( ) ;
104
103
let _ = ffi:: g_desktop_app_info_launch_uris_as_manager_with_fds (
@@ -110,9 +109,9 @@ pub trait DesktopAppInfoExtManual: IsA<DesktopAppInfo> {
110
109
Box_ :: into_raw ( super_callback0) as * mut _ ,
111
110
pid_callback,
112
111
super_callback1 as * const _ as * mut _ ,
113
- stdin_fd . as_raw_fd ( ) ,
114
- stdout_fd . as_raw_fd ( ) ,
115
- stderr_fd . as_raw_fd ( ) ,
112
+ stdin_raw_fd ,
113
+ stdout_raw_fd ,
114
+ stderr_raw_fd ,
116
115
& mut error,
117
116
) ;
118
117
if error. is_null ( ) {
0 commit comments