1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
// automatically generated by rust-bindgen

// Generated using:
// bindgen 0.54.0
// macOS SDK 10.15.4.

use core::ffi::c_void;
use core_foundation_sys::array::CFArrayRef;
use core_foundation_sys::base::{Boolean, CFAllocatorRef, CFIndex, CFTypeID};
use core_foundation_sys::data::CFDataRef;
use core_foundation_sys::propertylist::CFPropertyListRef;
use core_foundation_sys::runloop::CFRunLoopRef;
use core_foundation_sys::string::CFStringRef;

use crate::dispatch_queue_t;

pub type AuthorizationOpaqueRef = c_void;
pub type __SCPreferences = c_void;

pub type AuthorizationRef = *const AuthorizationOpaqueRef;
pub type SCPreferencesRef = *const __SCPreferences;
pub type SCPreferencesNotification = u32;
#[repr(C)]
pub struct SCPreferencesContext {
    pub version: CFIndex,
    pub info: *mut ::core::ffi::c_void,
    pub retain: Option<
        unsafe extern "C" fn(info: *const ::core::ffi::c_void) -> *const ::core::ffi::c_void,
    >,
    pub release: Option<unsafe extern "C" fn(info: *const ::core::ffi::c_void)>,
    pub copyDescription:
        Option<unsafe extern "C" fn(info: *const ::core::ffi::c_void) -> CFStringRef>,
}
pub type SCPreferencesCallBack = Option<
    unsafe extern "C" fn(
        prefs: SCPreferencesRef,
        notificationType: SCPreferencesNotification,
        info: *mut ::core::ffi::c_void,
    ),
>;
extern "C" {
    pub fn SCPreferencesGetTypeID() -> CFTypeID;

    pub fn SCPreferencesCreate(
        allocator: CFAllocatorRef,
        name: CFStringRef,
        prefsID: CFStringRef,
    ) -> SCPreferencesRef;

    pub fn SCPreferencesCreateWithAuthorization(
        allocator: CFAllocatorRef,
        name: CFStringRef,
        prefsID: CFStringRef,
        authorization: AuthorizationRef,
    ) -> SCPreferencesRef;

    pub fn SCPreferencesLock(prefs: SCPreferencesRef, wait: Boolean) -> Boolean;

    pub fn SCPreferencesCommitChanges(prefs: SCPreferencesRef) -> Boolean;

    pub fn SCPreferencesApplyChanges(prefs: SCPreferencesRef) -> Boolean;

    pub fn SCPreferencesUnlock(prefs: SCPreferencesRef) -> Boolean;

    pub fn SCPreferencesGetSignature(prefs: SCPreferencesRef) -> CFDataRef;

    pub fn SCPreferencesCopyKeyList(prefs: SCPreferencesRef) -> CFArrayRef;

    pub fn SCPreferencesGetValue(prefs: SCPreferencesRef, key: CFStringRef) -> CFPropertyListRef;

    pub fn SCPreferencesAddValue(
        prefs: SCPreferencesRef,
        key: CFStringRef,
        value: CFPropertyListRef,
    ) -> Boolean;

    pub fn SCPreferencesSetValue(
        prefs: SCPreferencesRef,
        key: CFStringRef,
        value: CFPropertyListRef,
    ) -> Boolean;

    pub fn SCPreferencesRemoveValue(prefs: SCPreferencesRef, key: CFStringRef) -> Boolean;

    pub fn SCPreferencesSetCallback(
        prefs: SCPreferencesRef,
        callout: SCPreferencesCallBack,
        context: *mut SCPreferencesContext,
    ) -> Boolean;

    pub fn SCPreferencesScheduleWithRunLoop(
        prefs: SCPreferencesRef,
        runLoop: CFRunLoopRef,
        runLoopMode: CFStringRef,
    ) -> Boolean;

    pub fn SCPreferencesUnscheduleFromRunLoop(
        prefs: SCPreferencesRef,
        runLoop: CFRunLoopRef,
        runLoopMode: CFStringRef,
    ) -> Boolean;

    pub fn SCPreferencesSetDispatchQueue(
        prefs: SCPreferencesRef,
        queue: dispatch_queue_t,
    ) -> Boolean;

    pub fn SCPreferencesSynchronize(prefs: SCPreferencesRef);
}