libxfce4util-sys 0.1.0

FFI bindings to libxfce4util
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files.gtk (https://github.com/gtk-rs/gir-files)
// from gir-files.xfce
// DO NOT EDIT

#![allow(non_camel_case_types, non_upper_case_globals, non_snake_case)]
#![allow(
    clippy::approx_constant,
    clippy::type_complexity,
    clippy::unreadable_literal,
    clippy::upper_case_acronyms
)]
#![cfg_attr(docsrs, feature(doc_cfg))]

use gio_sys as gio;
use glib_sys as glib;
use gobject_sys as gobject;

#[allow(unused_imports)]
use libc::{FILE, intptr_t, off_t, size_t, ssize_t, time_t, uintptr_t};
#[cfg(unix)]
#[allow(unused_imports)]
use libc::{dev_t, gid_t, pid_t, socklen_t, uid_t};
#[allow(unused_imports)]
use std::ffi::{
    c_char, c_double, c_float, c_int, c_long, c_short, c_uchar, c_uint, c_ulong, c_ushort, c_void,
};

#[allow(unused_imports)]
use glib::{GType, gboolean, gconstpointer, gpointer};

// Enums
pub type XfceLicenseTextType = c_int;
pub const XFCE_LICENSE_TEXT_BSD: XfceLicenseTextType = 0;
pub const XFCE_LICENSE_TEXT_GPL: XfceLicenseTextType = 1;
pub const XFCE_LICENSE_TEXT_LGPL: XfceLicenseTextType = 2;

pub type XfceResourceType = c_int;
pub const XFCE_RESOURCE_DATA: XfceResourceType = 0;
pub const XFCE_RESOURCE_CONFIG: XfceResourceType = 1;
pub const XFCE_RESOURCE_CACHE: XfceResourceType = 2;
pub const XFCE_RESOURCE_ICONS: XfceResourceType = 3;
pub const XFCE_RESOURCE_THEMES: XfceResourceType = 4;

// Constants
pub const XFCE_LOCALE_FULL_MATCH: c_int = 50;
pub const XFCE_LOCALE_NO_MATCH: c_int = 0;

// Callbacks
pub type XfceMatchFunc =
    Option<unsafe extern "C" fn(*const c_char, *const c_char, gpointer) -> gboolean>;
pub type XfcePosixSignalHandler = Option<unsafe extern "C" fn(c_int, gpointer)>;

// Records
#[derive(Copy, Clone)]
#[repr(C)]
pub struct XfceConsolekitClass {
    pub parent_class: gobject::GObjectClass,
}

impl ::std::fmt::Debug for XfceConsolekitClass {
    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
        f.debug_struct(&format!("XfceConsolekitClass @ {self:p}"))
            .field("parent_class", &self.parent_class)
            .finish()
    }
}

#[derive(Copy, Clone)]
#[repr(C)]
pub struct XfceKioskClass {
    pub parent_class: gobject::GObjectClass,
}

impl ::std::fmt::Debug for XfceKioskClass {
    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
        f.debug_struct(&format!("XfceKioskClass @ {self:p}"))
            .field("parent_class", &self.parent_class)
            .finish()
    }
}

#[repr(C)]
#[allow(dead_code)]
pub struct XfceRc {
    _data: [u8; 0],
    _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>,
}

impl ::std::fmt::Debug for XfceRc {
    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
        f.debug_struct(&format!("XfceRc @ {self:p}")).finish()
    }
}

#[derive(Copy, Clone)]
#[repr(C)]
pub struct XfceSystemdClass {
    pub parent_class: gobject::GObjectClass,
}

impl ::std::fmt::Debug for XfceSystemdClass {
    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
        f.debug_struct(&format!("XfceSystemdClass @ {self:p}"))
            .field("parent_class", &self.parent_class)
            .finish()
    }
}

// Classes
#[repr(C)]
#[allow(dead_code)]
pub struct XfceConsolekit {
    _data: [u8; 0],
    _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>,
}

impl ::std::fmt::Debug for XfceConsolekit {
    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
        f.debug_struct(&format!("XfceConsolekit @ {self:p}"))
            .finish()
    }
}

#[repr(C)]
#[allow(dead_code)]
pub struct XfceKiosk {
    _data: [u8; 0],
    _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>,
}

impl ::std::fmt::Debug for XfceKiosk {
    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
        f.debug_struct(&format!("XfceKiosk @ {self:p}")).finish()
    }
}

#[repr(C)]
#[allow(dead_code)]
pub struct XfceSystemd {
    _data: [u8; 0],
    _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>,
}

impl ::std::fmt::Debug for XfceSystemd {
    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
        f.debug_struct(&format!("XfceSystemd @ {self:p}")).finish()
    }
}

unsafe extern "C" {

    //=========================================================================
    // XfceRc
    //=========================================================================
    pub fn xfce_rc_get_type() -> GType;
    pub fn xfce_rc_close(rc: *mut XfceRc);
    pub fn xfce_rc_delete_entry(rc: *mut XfceRc, key: *const c_char, global: gboolean);
    pub fn xfce_rc_delete_group(rc: *mut XfceRc, group: *const c_char, global: gboolean);
    pub fn xfce_rc_flush(rc: *mut XfceRc);
    pub fn xfce_rc_get_entries(rc: *const XfceRc, group: *const c_char) -> *mut *mut c_char;
    pub fn xfce_rc_get_group(rc: *const XfceRc) -> *const c_char;
    pub fn xfce_rc_get_groups(rc: *const XfceRc) -> *mut *mut c_char;
    pub fn xfce_rc_get_locale(rc: *const XfceRc) -> *const c_char;
    pub fn xfce_rc_has_entry(rc: *const XfceRc, key: *const c_char) -> gboolean;
    pub fn xfce_rc_has_group(rc: *const XfceRc, group: *const c_char) -> gboolean;
    pub fn xfce_rc_is_dirty(rc: *const XfceRc) -> gboolean;
    pub fn xfce_rc_is_readonly(rc: *const XfceRc) -> gboolean;
    pub fn xfce_rc_read_bool_entry(
        rc: *const XfceRc,
        key: *const c_char,
        fallback: gboolean,
    ) -> gboolean;
    pub fn xfce_rc_read_entry(
        rc: *const XfceRc,
        key: *const c_char,
        fallback: *const c_char,
    ) -> *const c_char;
    pub fn xfce_rc_read_entry_untranslated(
        rc: *const XfceRc,
        key: *const c_char,
        fallback: *const c_char,
    ) -> *const c_char;
    pub fn xfce_rc_read_int_entry(rc: *const XfceRc, key: *const c_char, fallback: c_int) -> c_int;
    pub fn xfce_rc_read_list_entry(
        rc: *const XfceRc,
        key: *const c_char,
        delimiter: *const c_char,
    ) -> *mut *mut c_char;
    pub fn xfce_rc_rollback(rc: *mut XfceRc);
    pub fn xfce_rc_set_group(rc: *mut XfceRc, group: *const c_char);
    pub fn xfce_rc_write_bool_entry(rc: *mut XfceRc, key: *const c_char, value: gboolean);
    pub fn xfce_rc_write_entry(rc: *mut XfceRc, key: *const c_char, value: *const c_char);
    pub fn xfce_rc_write_int_entry(rc: *mut XfceRc, key: *const c_char, value: c_int);
    pub fn xfce_rc_write_list_entry(
        rc: *mut XfceRc,
        key: *const c_char,
        value: *mut *mut c_char,
        separator: *const c_char,
    );
    pub fn xfce_rc_config_open(
        type_: XfceResourceType,
        resource: *const c_char,
        readonly: gboolean,
    ) -> *mut XfceRc;
    pub fn xfce_rc_simple_open(filename: *const c_char, readonly: gboolean) -> *mut XfceRc;

    //=========================================================================
    // XfceConsolekit
    //=========================================================================
    pub fn xfce_consolekit_get_type() -> GType;
    pub fn xfce_consolekit_get() -> *mut XfceConsolekit;
    pub fn xfce_consolekit_can_hibernate(
        consolekit: *mut XfceConsolekit,
        can_hibernate: *mut gboolean,
        auth_hibernate: *mut gboolean,
        error: *mut *mut glib::GError,
    ) -> gboolean;
    pub fn xfce_consolekit_can_hybrid_sleep(
        consolekit: *mut XfceConsolekit,
        can_hybrid_sleep: *mut gboolean,
        auth_hybrid_sleep: *mut gboolean,
        error: *mut *mut glib::GError,
    ) -> gboolean;
    pub fn xfce_consolekit_can_power_off(
        consolekit: *mut XfceConsolekit,
        can_power_off: *mut gboolean,
        auth_power_off: *mut gboolean,
        error: *mut *mut glib::GError,
    ) -> gboolean;
    pub fn xfce_consolekit_can_reboot(
        consolekit: *mut XfceConsolekit,
        can_reboot: *mut gboolean,
        auth_reboot: *mut gboolean,
        error: *mut *mut glib::GError,
    ) -> gboolean;
    pub fn xfce_consolekit_can_suspend(
        consolekit: *mut XfceConsolekit,
        can_suspend: *mut gboolean,
        auth_suspend: *mut gboolean,
        error: *mut *mut glib::GError,
    ) -> gboolean;
    pub fn xfce_consolekit_hibernate(
        consolekit: *mut XfceConsolekit,
        polkit_interactive: gboolean,
        error: *mut *mut glib::GError,
    ) -> gboolean;
    pub fn xfce_consolekit_hybrid_sleep(
        consolekit: *mut XfceConsolekit,
        polkit_interactive: gboolean,
        error: *mut *mut glib::GError,
    ) -> gboolean;
    pub fn xfce_consolekit_power_off(
        consolekit: *mut XfceConsolekit,
        polkit_interactive: gboolean,
        error: *mut *mut glib::GError,
    ) -> gboolean;
    pub fn xfce_consolekit_reboot(
        consolekit: *mut XfceConsolekit,
        polkit_interactive: gboolean,
        error: *mut *mut glib::GError,
    ) -> gboolean;
    pub fn xfce_consolekit_suspend(
        consolekit: *mut XfceConsolekit,
        polkit_interactive: gboolean,
        error: *mut *mut glib::GError,
    ) -> gboolean;

    //=========================================================================
    // XfceKiosk
    //=========================================================================
    pub fn xfce_kiosk_get_type() -> GType;
    pub fn xfce_kiosk_new(module: *const c_char) -> *mut XfceKiosk;
    pub fn xfce_kiosk_free(kiosk: *mut XfceKiosk);
    pub fn xfce_kiosk_query(kiosk: *const XfceKiosk, capability: *const c_char) -> gboolean;

    //=========================================================================
    // XfceSystemd
    //=========================================================================
    pub fn xfce_systemd_get_type() -> GType;
    pub fn xfce_systemd_get() -> *mut XfceSystemd;
    pub fn xfce_systemd_can_hibernate(
        systemd: *mut XfceSystemd,
        can_hibernate: *mut gboolean,
        auth_hibernate: *mut gboolean,
        error: *mut *mut glib::GError,
    ) -> gboolean;
    pub fn xfce_systemd_can_hybrid_sleep(
        systemd: *mut XfceSystemd,
        can_hybrid_sleep: *mut gboolean,
        auth_hybrid_sleep: *mut gboolean,
        error: *mut *mut glib::GError,
    ) -> gboolean;
    pub fn xfce_systemd_can_power_off(
        systemd: *mut XfceSystemd,
        can_power_off: *mut gboolean,
        auth_power_off: *mut gboolean,
        error: *mut *mut glib::GError,
    ) -> gboolean;
    pub fn xfce_systemd_can_reboot(
        systemd: *mut XfceSystemd,
        can_reboot: *mut gboolean,
        auth_reboot: *mut gboolean,
        error: *mut *mut glib::GError,
    ) -> gboolean;
    pub fn xfce_systemd_can_suspend(
        systemd: *mut XfceSystemd,
        can_suspend: *mut gboolean,
        auth_suspend: *mut gboolean,
        error: *mut *mut glib::GError,
    ) -> gboolean;
    pub fn xfce_systemd_hibernate(
        systemd: *mut XfceSystemd,
        polkit_interactive: gboolean,
        error: *mut *mut glib::GError,
    ) -> gboolean;
    pub fn xfce_systemd_hybrid_sleep(
        systemd: *mut XfceSystemd,
        polkit_interactive: gboolean,
        error: *mut *mut glib::GError,
    ) -> gboolean;
    pub fn xfce_systemd_power_off(
        systemd: *mut XfceSystemd,
        polkit_interactive: gboolean,
        error: *mut *mut glib::GError,
    ) -> gboolean;
    pub fn xfce_systemd_reboot(
        systemd: *mut XfceSystemd,
        polkit_interactive: gboolean,
        error: *mut *mut glib::GError,
    ) -> gboolean;
    pub fn xfce_systemd_suspend(
        systemd: *mut XfceSystemd,
        polkit_interactive: gboolean,
        error: *mut *mut glib::GError,
    ) -> gboolean;

    //=========================================================================
    // Other functions
    //=========================================================================
    pub fn xfce_append_quoted(string: *mut glib::GString, unquoted: *const c_char);
    pub fn xfce_create_shared_thumbnail_path(
        uri: *const c_char,
        size: *const c_char,
    ) -> *mut c_char;
    pub fn xfce_expand_desktop_entry_field_codes(
        command: *const c_char,
        uri_list: *mut glib::GSList,
        icon: *const c_char,
        name: *const c_char,
        uri: *const c_char,
        requires_terminal: gboolean,
    ) -> *mut c_char;
    pub fn xfce_expand_variables(command: *const c_char, envp: *mut *mut c_char) -> *mut c_char;
    pub fn xfce_g_file_create_checksum(
        file: *mut gio::GFile,
        cancellable: *mut gio::GCancellable,
        error: *mut *mut glib::GError,
    ) -> *mut c_char;
    pub fn xfce_g_file_is_trusted(
        file: *mut gio::GFile,
        cancellable: *mut gio::GCancellable,
        error: *mut *mut glib::GError,
    ) -> gboolean;
    pub fn xfce_g_file_metadata_is_supported(file: *mut gio::GFile) -> gboolean;
    pub fn xfce_g_file_set_trusted(
        file: *mut gio::GFile,
        is_trusted: gboolean,
        cancellable: *mut gio::GCancellable,
        error: *mut *mut glib::GError,
    ) -> gboolean;
    pub fn xfce_g_string_append_quoted(string: *mut glib::GString, unquoted: *const c_char);
    pub fn xfce_get_dir_localized(directory: *const c_char) -> *mut c_char;
    pub fn xfce_get_dir_localized_r(
        buffer: *mut c_char,
        length: size_t,
        directory: *const c_char,
    ) -> *mut c_char;
    pub fn xfce_get_file_localized(filename: *const c_char) -> *mut c_char;
    pub fn xfce_get_file_localized_r(
        buffer: *mut c_char,
        length: size_t,
        filename: *const c_char,
    ) -> *mut c_char;
    pub fn xfce_get_homedir() -> *const c_char;
    pub fn xfce_get_homefile_r(
        buffer: *mut c_char,
        length: size_t,
        format: *const c_char,
        ...
    ) -> *mut c_char;
    pub fn xfce_get_license_text(license_type: XfceLicenseTextType) -> *const c_char;
    pub fn xfce_get_path_localized(
        dst: *mut c_char,
        size: size_t,
        paths: *const c_char,
        filename: *const c_char,
        test: glib::GFileTest,
    ) -> *mut c_char;
    pub fn xfce_get_userdir() -> *const c_char;
    pub fn xfce_get_userfile_r(
        buffer: *mut c_char,
        length: size_t,
        format: *const c_char,
        ...
    ) -> *mut c_char;
    pub fn xfce_gethostname() -> *mut c_char;
    pub fn xfce_locale_match(locale1: *const c_char, locale2: *const c_char) -> c_uint;
    pub fn xfce_mkdirhier(
        whole_path: *const c_char,
        mode: c_ulong,
        error: *mut *mut glib::GError,
    ) -> gboolean;
    pub fn xfce_posix_signal_handler_init(error: *mut *mut glib::GError) -> gboolean;
    pub fn xfce_posix_signal_handler_restore_handler(signal: c_int);
    pub fn xfce_posix_signal_handler_set_handler(
        signal: c_int,
        handler: XfcePosixSignalHandler,
        user_data: gpointer,
        error: *mut *mut glib::GError,
    ) -> gboolean;
    pub fn xfce_posix_signal_handler_shutdown();
    pub fn xfce_resource_dirs(type_: XfceResourceType) -> *mut *mut c_char;
    pub fn xfce_resource_lookup(type_: XfceResourceType, filename: *const c_char) -> *mut c_char;
    pub fn xfce_resource_lookup_all(
        type_: XfceResourceType,
        filename: *const c_char,
    ) -> *mut *mut c_char;
    pub fn xfce_resource_match(
        type_: XfceResourceType,
        pattern: *const c_char,
        unique: gboolean,
    ) -> *mut *mut c_char;
    pub fn xfce_resource_match_custom(
        type_: XfceResourceType,
        unique: gboolean,
        func: XfceMatchFunc,
        user_data: gpointer,
    ) -> *mut *mut c_char;
    pub fn xfce_resource_pop_path(type_: XfceResourceType);
    pub fn xfce_resource_push_path(type_: XfceResourceType, path: *const c_char);
    pub fn xfce_resource_save_location(
        type_: XfceResourceType,
        relpath: *const c_char,
        create: gboolean,
    ) -> *mut c_char;
    pub fn xfce_str_replace(
        str: *const c_char,
        pattern: *const c_char,
        replacement: *const c_char,
    ) -> *mut c_char;
    pub fn xfce_textdomain(
        package: *const c_char,
        localedir: *const c_char,
        encoding: *const c_char,
    );
    pub fn xfce_unescape_desktop_entry_value(value: *const c_char) -> *mut c_char;
    pub fn xfce_utf8_remove_controls(
        str: *mut c_char,
        max_len: ssize_t,
        end: *const c_char,
    ) -> *mut c_char;
    pub fn xfce_utf8_strndup(src: *const c_char, max_len: ssize_t) -> *mut c_char;
    pub fn xfce_version_string() -> *const c_char;

}