@@ -4,18 +4,22 @@ use std::path::PathBuf;
4
4
5
5
use crate :: { translate:: * , GString , StrV } ;
6
6
7
- #[ derive( Clone , Copy , Debug , Eq , PartialEq , Hash ) ]
8
- pub enum OSType {
7
+ #[ doc( alias = "GWin32OSType" ) ]
8
+ #[ derive( Debug , Eq , PartialEq , Ord , PartialOrd , Hash , Clone , Copy ) ]
9
+ #[ non_exhaustive]
10
+ pub enum Win32OSType {
9
11
#[ doc( alias = "G_WIN32_OS_ANY" ) ]
10
12
Any ,
11
13
#[ doc( alias = "G_WIN32_OS_WORKSTATION" ) ]
12
14
Workstation ,
13
15
#[ doc( alias = "G_WIN32_OS_SERVER" ) ]
14
16
Server ,
17
+ #[ doc( hidden) ]
18
+ __Unknown( i32 ) ,
15
19
}
16
20
17
21
#[ doc( hidden) ]
18
- impl IntoGlib for OSType {
22
+ impl IntoGlib for Win32OSType {
19
23
type GlibType = ffi:: GWin32OSType ;
20
24
21
25
#[ inline]
@@ -24,12 +28,31 @@ impl IntoGlib for OSType {
24
28
Self :: Any => ffi:: G_WIN32_OS_ANY ,
25
29
Self :: Workstation => ffi:: G_WIN32_OS_WORKSTATION ,
26
30
Self :: Server => ffi:: G_WIN32_OS_SERVER ,
31
+ Self :: __Unknown( value) => value,
32
+ }
33
+ }
34
+ }
35
+
36
+ #[ doc( hidden) ]
37
+ impl FromGlib < ffi:: GWin32OSType > for Win32OSType {
38
+ #[ inline]
39
+ unsafe fn from_glib ( value : ffi:: GWin32OSType ) -> Self {
40
+ match value {
41
+ ffi:: G_WIN32_OS_ANY => Self :: Any ,
42
+ ffi:: G_WIN32_OS_WORKSTATION => Self :: Workstation ,
43
+ ffi:: G_WIN32_OS_SERVER => Self :: Server ,
44
+ value => Self :: __Unknown ( value) ,
27
45
}
28
46
}
29
47
}
30
48
31
49
#[ doc( alias = "g_win32_check_windows_version" ) ]
32
- pub fn check_windows_version ( major : i32 , minor : i32 , spver : i32 , os_type : OSType ) -> bool {
50
+ pub fn win32_check_windows_version (
51
+ major : i32 ,
52
+ minor : i32 ,
53
+ spver : i32 ,
54
+ os_type : Win32OSType ,
55
+ ) -> bool {
33
56
unsafe {
34
57
from_glib ( ffi:: g_win32_check_windows_version (
35
58
major,
@@ -42,23 +65,23 @@ pub fn check_windows_version(major: i32, minor: i32, spver: i32, os_type: OSType
42
65
43
66
#[ doc( alias = "g_win32_get_command_line" ) ]
44
67
#[ doc( alias = "get_command_line" ) ]
45
- pub fn command_line ( ) -> StrV {
68
+ pub fn win32_command_line ( ) -> StrV {
46
69
unsafe { FromGlibPtrContainer :: from_glib_full ( ffi:: g_win32_get_command_line ( ) ) }
47
70
}
48
71
49
72
#[ doc( alias = "g_win32_error_message" ) ]
50
- pub fn error_message ( error : i32 ) -> GString {
73
+ pub fn win32_error_message ( error : i32 ) -> GString {
51
74
unsafe { from_glib_full ( ffi:: g_win32_error_message ( error) ) }
52
75
}
53
76
54
77
#[ doc( alias = "g_win32_getlocale" ) ]
55
- pub fn getlocale ( ) -> GString {
78
+ pub fn win32_getlocale ( ) -> GString {
56
79
unsafe { from_glib_full ( ffi:: g_win32_getlocale ( ) ) }
57
80
}
58
81
59
82
#[ doc( alias = "g_win32_get_package_installation_directory_of_module" ) ]
60
83
#[ doc( alias = "get_package_installation_directory_of_module" ) ]
61
- pub fn package_installation_directory_of_module (
84
+ pub fn win32_package_installation_directory_of_module (
62
85
hmodule : std:: os:: windows:: raw:: HANDLE ,
63
86
) -> Result < PathBuf , std:: io:: Error > {
64
87
// # Safety
0 commit comments