| 1 |
// Copyright 2023 The Servo Project Developers. See the COPYRIGHT |
| 2 |
// file at the top-level directory of this distribution. |
| 3 |
// |
| 4 |
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or |
| 5 |
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license |
| 6 |
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your |
| 7 |
// option. This file may not be copied, modified, or distributed |
| 8 |
// except according to those terms. |
| 9 |
|
| 10 |
use crate::array::CFArrayRef; |
| 11 |
use crate::base::{Boolean, CFIndex}; |
| 12 |
use crate::dictionary::CFDictionaryRef; |
| 13 |
use crate::propertylist::CFPropertyListRef; |
| 14 |
use crate::string::CFStringRef; |
| 15 |
|
| 16 |
extern "C" { |
| 17 |
/* |
| 18 |
* CFPreferences.h |
| 19 |
*/ |
| 20 |
/* Application, Host, and User Keys */ |
| 21 |
pub static kCFPreferencesAnyApplication: CFStringRef; |
| 22 |
pub static kCFPreferencesCurrentApplication: CFStringRef; |
| 23 |
pub static kCFPreferencesAnyHost: CFStringRef; |
| 24 |
pub static kCFPreferencesCurrentHost: CFStringRef; |
| 25 |
pub static kCFPreferencesAnyUser: CFStringRef; |
| 26 |
pub static kCFPreferencesCurrentUser: CFStringRef; |
| 27 |
|
| 28 |
/* Getting Preference Values */ |
| 29 |
pub fn CFPreferencesCopyAppValue( |
| 30 |
key: CFStringRef, |
| 31 |
applicationID: CFStringRef, |
| 32 |
) -> CFPropertyListRef; |
| 33 |
pub fn CFPreferencesCopyKeyList( |
| 34 |
applicationID: CFStringRef, |
| 35 |
userName: CFStringRef, |
| 36 |
hostName: CFStringRef, |
| 37 |
) -> CFArrayRef; |
| 38 |
pub fn CFPreferencesCopyMultiple( |
| 39 |
keysToFetch: CFArrayRef, |
| 40 |
applicationID: CFStringRef, |
| 41 |
userName: CFStringRef, |
| 42 |
hostName: CFStringRef, |
| 43 |
) -> CFDictionaryRef; |
| 44 |
pub fn CFPreferencesCopyValue( |
| 45 |
key: CFStringRef, |
| 46 |
applicationID: CFStringRef, |
| 47 |
userName: CFStringRef, |
| 48 |
hostName: CFStringRef, |
| 49 |
) -> CFPropertyListRef; |
| 50 |
pub fn CFPreferencesGetAppBooleanValue( |
| 51 |
key: CFStringRef, |
| 52 |
applicationID: CFStringRef, |
| 53 |
keyExistsAndHasValidFormat: *mut Boolean, |
| 54 |
) -> Boolean; |
| 55 |
pub fn CFPreferencesGetAppIntegerValue( |
| 56 |
key: CFStringRef, |
| 57 |
applicationID: CFStringRef, |
| 58 |
keyExistsAndHasValidFormat: *mut Boolean, |
| 59 |
) -> CFIndex; |
| 60 |
|
| 61 |
/* Setting Preference Values */ |
| 62 |
pub fn CFPreferencesSetAppValue( |
| 63 |
key: CFStringRef, |
| 64 |
value: CFPropertyListRef, |
| 65 |
applicationID: CFStringRef, |
| 66 |
); |
| 67 |
pub fn CFPreferencesSetMultiple( |
| 68 |
keysToSet: CFDictionaryRef, |
| 69 |
keysToRemove: CFArrayRef, |
| 70 |
applicationID: CFStringRef, |
| 71 |
userName: CFStringRef, |
| 72 |
hostName: CFStringRef, |
| 73 |
); |
| 74 |
pub fn CFPreferencesSetValue( |
| 75 |
key: CFStringRef, |
| 76 |
value: CFPropertyListRef, |
| 77 |
applicationID: CFStringRef, |
| 78 |
userName: CFStringRef, |
| 79 |
hostName: CFStringRef, |
| 80 |
); |
| 81 |
|
| 82 |
/* Synchronizing Preferences */ |
| 83 |
pub fn CFPreferencesAppSynchronize(applicationID: CFStringRef) -> Boolean; |
| 84 |
pub fn CFPreferencesSynchronize( |
| 85 |
applicationID: CFStringRef, |
| 86 |
userName: CFStringRef, |
| 87 |
hostName: CFStringRef, |
| 88 |
) -> Boolean; |
| 89 |
|
| 90 |
/* Adding and Removing Suite Preferences */ |
| 91 |
pub fn CFPreferencesAddSuitePreferencesToApp(applicationID: CFStringRef, suiteID: CFStringRef); |
| 92 |
pub fn CFPreferencesRemoveSuitePreferencesFromApp( |
| 93 |
applicationID: CFStringRef, |
| 94 |
suiteID: CFStringRef, |
| 95 |
); |
| 96 |
|
| 97 |
/* Miscellaneous Functions */ |
| 98 |
pub fn CFPreferencesAppValueIsForced(key: CFStringRef, applicationID: CFStringRef) -> Boolean; |
| 99 |
pub fn CFPreferencesCopyApplicationList( |
| 100 |
userName: CFStringRef, |
| 101 |
hostName: CFStringRef, |
| 102 |
) -> CFArrayRef; // deprecated since macos 10.9 |
| 103 |
} |