diff options
Diffstat (limited to 'libsecret/src/auto')
-rw-r--r-- | libsecret/src/auto/backend.rs | 92 | ||||
-rw-r--r-- | libsecret/src/auto/collection.rs | 742 | ||||
-rw-r--r-- | libsecret/src/auto/constants.rs | 16 | ||||
-rw-r--r-- | libsecret/src/auto/enums.rs | 462 | ||||
-rw-r--r-- | libsecret/src/auto/flags.rs | 591 | ||||
-rw-r--r-- | libsecret/src/auto/functions.rs | 41 | ||||
-rw-r--r-- | libsecret/src/auto/item.rs | 556 | ||||
-rw-r--r-- | libsecret/src/auto/mod.rs | 75 | ||||
-rw-r--r-- | libsecret/src/auto/prompt.rs | 76 | ||||
-rw-r--r-- | libsecret/src/auto/retrievable.rs | 269 | ||||
-rw-r--r-- | libsecret/src/auto/schema.rs | 15 | ||||
-rw-r--r-- | libsecret/src/auto/schema_attribute.rs | 15 | ||||
-rw-r--r-- | libsecret/src/auto/service.rs | 1208 | ||||
-rw-r--r-- | libsecret/src/auto/versions.txt | 3 |
14 files changed, 0 insertions, 4161 deletions
diff --git a/libsecret/src/auto/backend.rs b/libsecret/src/auto/backend.rs deleted file mode 100644 index bba5bf0..0000000 --- a/libsecret/src/auto/backend.rs +++ /dev/null @@ -1,92 +0,0 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir) -// from -// from gir-files (https://github.com/gtk-rs/gir-files.git) -// DO NOT EDIT - -use crate::{BackendFlags, ServiceFlags}; -use glib::{prelude::*, translate::*}; -use std::{boxed::Box as Box_, pin::Pin}; - -glib::wrapper! { - #[doc(alias = "SecretBackend")] - pub struct Backend(Interface<ffi::SecretBackend, ffi::SecretBackendInterface>); - - match fn { - type_ => || ffi::secret_backend_get_type(), - } -} - -impl Backend { - pub const NONE: Option<&'static Backend> = None; - - #[doc(alias = "secret_backend_get")] - pub fn get<P: FnOnce(Result<Backend, glib::Error>) + 'static>( - flags: BackendFlags, - cancellable: Option<&impl IsA<gio::Cancellable>>, - callback: P, - ) { - let main_context = glib::MainContext::ref_thread_default(); - let is_main_context_owner = main_context.is_owner(); - let has_acquired_main_context = (!is_main_context_owner) - .then(|| main_context.acquire().ok()) - .flatten(); - assert!( - is_main_context_owner || has_acquired_main_context.is_some(), - "Async operations only allowed if the thread is owning the MainContext" - ); - - let user_data: Box_<glib::thread_guard::ThreadGuard<P>> = - Box_::new(glib::thread_guard::ThreadGuard::new(callback)); - unsafe extern "C" fn get_trampoline<P: FnOnce(Result<Backend, glib::Error>) + 'static>( - _source_object: *mut glib::gobject_ffi::GObject, - res: *mut gio::ffi::GAsyncResult, - user_data: glib::ffi::gpointer, - ) { - let mut error = std::ptr::null_mut(); - let ret = ffi::secret_backend_get_finish(res, &mut error); - let result = if error.is_null() { - Ok(from_glib_full(ret)) - } else { - Err(from_glib_full(error)) - }; - let callback: Box_<glib::thread_guard::ThreadGuard<P>> = - Box_::from_raw(user_data as *mut _); - let callback: P = callback.into_inner(); - callback(result); - } - let callback = get_trampoline::<P>; - unsafe { - ffi::secret_backend_get( - flags.into_glib(), - cancellable.map(|p| p.as_ref()).to_glib_none().0, - Some(callback), - Box_::into_raw(user_data) as *mut _, - ); - } - } - - pub fn get_future( - flags: BackendFlags, - ) -> Pin<Box_<dyn std::future::Future<Output = Result<Backend, glib::Error>> + 'static>> { - Box_::pin(gio::GioFuture::new(&(), move |_obj, cancellable, send| { - Self::get(flags, Some(cancellable), move |res| { - send.resolve(res); - }); - })) - } -} - -mod sealed { - pub trait Sealed {} - impl<T: super::IsA<super::Backend>> Sealed for T {} -} - -pub trait BackendExt: IsA<Backend> + sealed::Sealed + 'static { - #[cfg(feature = "v0_19")] - #[cfg_attr(docsrs, doc(cfg(feature = "v0_19")))] - fn flags(&self) -> ServiceFlags { - ObjectExt::property(self.as_ref(), "flags") - } -} - -impl<O: IsA<Backend>> BackendExt for O {} diff --git a/libsecret/src/auto/collection.rs b/libsecret/src/auto/collection.rs deleted file mode 100644 index 8c91b65..0000000 --- a/libsecret/src/auto/collection.rs +++ /dev/null @@ -1,742 +0,0 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir) -// from -// from gir-files (https://github.com/gtk-rs/gir-files.git) -// DO NOT EDIT - -use crate::{CollectionCreateFlags, CollectionFlags, Item, Service}; -use glib::{ - prelude::*, - signal::{connect_raw, SignalHandlerId}, - translate::*, -}; -use std::{boxed::Box as Box_, pin::Pin}; - -glib::wrapper! { - #[doc(alias = "SecretCollection")] - pub struct Collection(Object<ffi::SecretCollection, ffi::SecretCollectionClass>) @extends gio::DBusProxy, @implements gio::DBusInterface, gio::Initable; - - match fn { - type_ => || ffi::secret_collection_get_type(), - } -} - -impl Collection { - pub const NONE: Option<&'static Collection> = None; - - #[doc(alias = "secret_collection_new_for_dbus_path_sync")] - #[doc(alias = "new_for_dbus_path_sync")] - pub fn for_dbus_path_sync( - service: Option<&impl IsA<Service>>, - collection_path: &str, - flags: CollectionFlags, - cancellable: Option<&impl IsA<gio::Cancellable>>, - ) -> Result<Collection, glib::Error> { - unsafe { - let mut error = std::ptr::null_mut(); - let ret = ffi::secret_collection_new_for_dbus_path_sync( - service.map(|p| p.as_ref()).to_glib_none().0, - collection_path.to_glib_none().0, - flags.into_glib(), - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); - if error.is_null() { - Ok(from_glib_full(ret)) - } else { - Err(from_glib_full(error)) - } - } - } - - #[doc(alias = "secret_collection_create")] - pub fn create<P: FnOnce(Result<Collection, glib::Error>) + 'static>( - service: Option<&impl IsA<Service>>, - label: &str, - alias: Option<&str>, - flags: CollectionCreateFlags, - cancellable: Option<&impl IsA<gio::Cancellable>>, - callback: P, - ) { - let main_context = glib::MainContext::ref_thread_default(); - let is_main_context_owner = main_context.is_owner(); - let has_acquired_main_context = (!is_main_context_owner) - .then(|| main_context.acquire().ok()) - .flatten(); - assert!( - is_main_context_owner || has_acquired_main_context.is_some(), - "Async operations only allowed if the thread is owning the MainContext" - ); - - let user_data: Box_<glib::thread_guard::ThreadGuard<P>> = - Box_::new(glib::thread_guard::ThreadGuard::new(callback)); - unsafe extern "C" fn create_trampoline< - P: FnOnce(Result<Collection, glib::Error>) + 'static, - >( - _source_object: *mut glib::gobject_ffi::GObject, - res: *mut gio::ffi::GAsyncResult, - user_data: glib::ffi::gpointer, - ) { - let mut error = std::ptr::null_mut(); - let ret = ffi::secret_collection_create_finish(res, &mut error); - let result = if error.is_null() { - Ok(from_glib_full(ret)) - } else { - Err(from_glib_full(error)) - }; - let callback: Box_<glib::thread_guard::ThreadGuard<P>> = - Box_::from_raw(user_data as *mut _); - let callback: P = callback.into_inner(); - callback(result); - } - let callback = create_trampoline::<P>; - unsafe { - ffi::secret_collection_create( - service.map(|p| p.as_ref()).to_glib_none().0, - label.to_glib_none().0, - alias.to_glib_none().0, - flags.into_glib(), - cancellable.map(|p| p.as_ref()).to_glib_none().0, - Some(callback), - Box_::into_raw(user_data) as *mut _, - ); - } - } - - pub fn create_future( - service: Option<&(impl IsA<Service> + Clone + 'static)>, - label: &str, - alias: Option<&str>, - flags: CollectionCreateFlags, - ) -> Pin<Box_<dyn std::future::Future<Output = Result<Collection, glib::Error>> + 'static>> - { - let service = service.map(ToOwned::to_owned); - let label = String::from(label); - let alias = alias.map(ToOwned::to_owned); - Box_::pin(gio::GioFuture::new(&(), move |_obj, cancellable, send| { - Self::create( - service.as_ref().map(::std::borrow::Borrow::borrow), - &label, - alias.as_ref().map(::std::borrow::Borrow::borrow), - flags, - Some(cancellable), - move |res| { - send.resolve(res); - }, - ); - })) - } - - #[doc(alias = "secret_collection_create_sync")] - pub fn create_sync( - service: Option<&impl IsA<Service>>, - label: &str, - alias: Option<&str>, - flags: CollectionCreateFlags, - cancellable: Option<&impl IsA<gio::Cancellable>>, - ) -> Result<Collection, glib::Error> { - unsafe { - let mut error = std::ptr::null_mut(); - let ret = ffi::secret_collection_create_sync( - service.map(|p| p.as_ref()).to_glib_none().0, - label.to_glib_none().0, - alias.to_glib_none().0, - flags.into_glib(), - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); - if error.is_null() { - Ok(from_glib_full(ret)) - } else { - Err(from_glib_full(error)) - } - } - } - - #[doc(alias = "secret_collection_for_alias")] - pub fn for_alias<P: FnOnce(Result<Option<Collection>, glib::Error>) + 'static>( - service: Option<&impl IsA<Service>>, - alias: &str, - flags: CollectionFlags, - cancellable: Option<&impl IsA<gio::Cancellable>>, - callback: P, - ) { - let main_context = glib::MainContext::ref_thread_default(); - let is_main_context_owner = main_context.is_owner(); - let has_acquired_main_context = (!is_main_context_owner) - .then(|| main_context.acquire().ok()) - .flatten(); - assert!( - is_main_context_owner || has_acquired_main_context.is_some(), - "Async operations only allowed if the thread is owning the MainContext" - ); - - let user_data: Box_<glib::thread_guard::ThreadGuard<P>> = - Box_::new(glib::thread_guard::ThreadGuard::new(callback)); - unsafe extern "C" fn for_alias_trampoline< - P: FnOnce(Result<Option<Collection>, glib::Error>) + 'static, - >( - _source_object: *mut glib::gobject_ffi::GObject, - res: *mut gio::ffi::GAsyncResult, - user_data: glib::ffi::gpointer, - ) { - let mut error = std::ptr::null_mut(); - let ret = ffi::secret_collection_for_alias_finish(res, &mut error); - let result = if error.is_null() { - Ok(from_glib_full(ret)) - } else { - Err(from_glib_full(error)) - }; - let callback: Box_<glib::thread_guard::ThreadGuard<P>> = - Box_::from_raw(user_data as *mut _); - let callback: P = callback.into_inner(); - callback(result); - } - let callback = for_alias_trampoline::<P>; - unsafe { - ffi::secret_collection_for_alias( - service.map(|p| p.as_ref()).to_glib_none().0, - alias.to_glib_none().0, - flags.into_glib(), - cancellable.map(|p| p.as_ref()).to_glib_none().0, - Some(callback), - Box_::into_raw(user_data) as *mut _, - ); - } - } - - pub fn for_alias_future( - service: Option<&(impl IsA<Service> + Clone + 'static)>, - alias: &str, - flags: CollectionFlags, - ) -> Pin< - Box_<dyn std::future::Future<Output = Result<Option<Collection>, glib::Error>> + 'static>, - > { - let service = service.map(ToOwned::to_owned); - let alias = String::from(alias); - Box_::pin(gio::GioFuture::new(&(), move |_obj, cancellable, send| { - Self::for_alias( - service.as_ref().map(::std::borrow::Borrow::borrow), - &alias, - flags, - Some(cancellable), - move |res| { - send.resolve(res); - }, - ); - })) - } - - #[doc(alias = "secret_collection_for_alias_sync")] - pub fn for_alias_sync( - service: Option<&impl IsA<Service>>, - alias: &str, - flags: CollectionFlags, - cancellable: Option<&impl IsA<gio::Cancellable>>, - ) -> Result<Option<Collection>, glib::Error> { - unsafe { - let mut error = std::ptr::null_mut(); - let ret = ffi::secret_collection_for_alias_sync( - service.map(|p| p.as_ref()).to_glib_none().0, - alias.to_glib_none().0, - flags.into_glib(), - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); - if error.is_null() { - Ok(from_glib_full(ret)) - } else { - Err(from_glib_full(error)) - } - } - } - - #[doc(alias = "secret_collection_new_for_dbus_path")] - pub fn new_for_dbus_path<P: FnOnce(Result<Collection, glib::Error>) + 'static>( - service: Option<&impl IsA<Service>>, - collection_path: &str, - flags: CollectionFlags, - cancellable: Option<&impl IsA<gio::Cancellable>>, - callback: P, - ) { - let main_context = glib::MainContext::ref_thread_default(); - let is_main_context_owner = main_context.is_owner(); - let has_acquired_main_context = (!is_main_context_owner) - .then(|| main_context.acquire().ok()) - .flatten(); - assert!( - is_main_context_owner || has_acquired_main_context.is_some(), - "Async operations only allowed if the thread is owning the MainContext" - ); - - let user_data: Box_<glib::thread_guard::ThreadGuard<P>> = - Box_::new(glib::thread_guard::ThreadGuard::new(callback)); - unsafe extern "C" fn new_for_dbus_path_trampoline< - P: FnOnce(Result<Collection, glib::Error>) + 'static, - >( - _source_object: *mut glib::gobject_ffi::GObject, - res: *mut gio::ffi::GAsyncResult, - user_data: glib::ffi::gpointer, - ) { - let mut error = std::ptr::null_mut(); - let ret = ffi::secret_collection_new_for_dbus_path_finish(res, &mut error); - let result = if error.is_null() { - Ok(from_glib_full(ret)) - } else { - Err(from_glib_full(error)) - }; - let callback: Box_<glib::thread_guard::ThreadGuard<P>> = - Box_::from_raw(user_data as *mut _); - let callback: P = callback.into_inner(); - callback(result); - } - let callback = new_for_dbus_path_trampoline::<P>; - unsafe { - ffi::secret_collection_new_for_dbus_path( - service.map(|p| p.as_ref()).to_glib_none().0, - collection_path.to_glib_none().0, - flags.into_glib(), - cancellable.map(|p| p.as_ref()).to_glib_none().0, - Some(callback), - Box_::into_raw(user_data) as *mut _, - ); - } - } - - pub fn new_for_dbus_path_future( - service: Option<&(impl IsA<Service> + Clone + 'static)>, - collection_path: &str, - flags: CollectionFlags, - ) -> Pin<Box_<dyn std::future::Future<Output = Result<Collection, glib::Error>> + 'static>> - { - let service = service.map(ToOwned::to_owned); - let collection_path = String::from(collection_path); - Box_::pin(gio::GioFuture::new(&(), move |_obj, cancellable, send| { - Self::new_for_dbus_path( - service.as_ref().map(::std::borrow::Borrow::borrow), - &collection_path, - flags, - Some(cancellable), - move |res| { - send.resolve(res); - }, - ); - })) - } -} - -mod sealed { - pub trait Sealed {} - impl<T: super::IsA<super::Collection>> Sealed for T {} -} - -pub trait CollectionExt: IsA<Collection> + sealed::Sealed + 'static { - #[doc(alias = "secret_collection_delete")] - fn delete<P: FnOnce(Result<(), glib::Error>) + 'static>( - &self, - cancellable: Option<&impl IsA<gio::Cancellable>>, - callback: P, - ) { - let main_context = glib::MainContext::ref_thread_default(); - let is_main_context_owner = main_context.is_owner(); - let has_acquired_main_context = (!is_main_context_owner) - .then(|| main_context.acquire().ok()) - .flatten(); - assert!( - is_main_context_owner || has_acquired_main_context.is_some(), - "Async operations only allowed if the thread is owning the MainContext" - ); - - let user_data: Box_<glib::thread_guard::ThreadGuard<P>> = - Box_::new(glib::thread_guard::ThreadGuard::new(callback)); - unsafe extern "C" fn delete_trampoline<P: FnOnce(Result<(), glib::Error>) + 'static>( - _source_object: *mut glib::gobject_ffi::GObject, - res: *mut gio::ffi::GAsyncResult, - user_data: glib::ffi::gpointer, - ) { - let mut error = std::ptr::null_mut(); - let _ = ffi::secret_collection_delete_finish(_source_object as *mut _, res, &mut error); - let result = if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - }; - let callback: Box_<glib::thread_guard::ThreadGuard<P>> = - Box_::from_raw(user_data as *mut _); - let callback: P = callback.into_inner(); - callback(result); - } - let callback = delete_trampoline::<P>; - unsafe { - ffi::secret_collection_delete( - self.as_ref().to_glib_none().0, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - Some(callback), - Box_::into_raw(user_data) as *mut _, - ); - } - } - - fn delete_future( - &self, - ) -> Pin<Box_<dyn std::future::Future<Output = Result<(), glib::Error>> + 'static>> { - Box_::pin(gio::GioFuture::new(self, move |obj, cancellable, send| { - obj.delete(Some(cancellable), move |res| { - send.resolve(res); - }); - })) - } - - #[doc(alias = "secret_collection_delete_sync")] - fn delete_sync( - &self, - cancellable: Option<&impl IsA<gio::Cancellable>>, - ) -> Result<(), glib::Error> { - unsafe { - let mut error = std::ptr::null_mut(); - let is_ok = ffi::secret_collection_delete_sync( - self.as_ref().to_glib_none().0, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); - debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - } - } - } - - #[doc(alias = "secret_collection_get_created")] - #[doc(alias = "get_created")] - fn created(&self) -> u64 { - unsafe { ffi::secret_collection_get_created(self.as_ref().to_glib_none().0) } - } - - #[doc(alias = "secret_collection_get_flags")] - #[doc(alias = "get_flags")] - fn flags(&self) -> CollectionFlags { - unsafe { - from_glib(ffi::secret_collection_get_flags( - self.as_ref().to_glib_none().0, - )) - } - } - - #[doc(alias = "secret_collection_get_items")] - #[doc(alias = "get_items")] - fn items(&self) -> Vec<Item> { - unsafe { - FromGlibPtrContainer::from_glib_full(ffi::secret_collection_get_items( - self.as_ref().to_glib_none().0, - )) - } - } - - #[doc(alias = "secret_collection_get_label")] - #[doc(alias = "get_label")] - fn label(&self) -> glib::GString { - unsafe { - from_glib_full(ffi::secret_collection_get_label( - self.as_ref().to_glib_none().0, - )) - } - } - - #[doc(alias = "secret_collection_get_locked")] - #[doc(alias = "get_locked")] - fn is_locked(&self) -> bool { - unsafe { - from_glib(ffi::secret_collection_get_locked( - self.as_ref().to_glib_none().0, - )) - } - } - - #[doc(alias = "secret_collection_get_modified")] - #[doc(alias = "get_modified")] - fn modified(&self) -> u64 { - unsafe { ffi::secret_collection_get_modified(self.as_ref().to_glib_none().0) } - } - - #[doc(alias = "secret_collection_get_service")] - #[doc(alias = "get_service")] - fn service(&self) -> Service { - unsafe { - from_glib_none(ffi::secret_collection_get_service( - self.as_ref().to_glib_none().0, - )) - } - } - - #[doc(alias = "secret_collection_load_items")] - fn load_items<P: FnOnce(Result<(), glib::Error>) + 'static>( - &self, - cancellable: Option<&impl IsA<gio::Cancellable>>, - callback: P, - ) { - let main_context = glib::MainContext::ref_thread_default(); - let is_main_context_owner = main_context.is_owner(); - let has_acquired_main_context = (!is_main_context_owner) - .then(|| main_context.acquire().ok()) - .flatten(); - assert!( - is_main_context_owner || has_acquired_main_context.is_some(), - "Async operations only allowed if the thread is owning the MainContext" - ); - - let user_data: Box_<glib::thread_guard::ThreadGuard<P>> = - Box_::new(glib::thread_guard::ThreadGuard::new(callback)); - unsafe extern "C" fn load_items_trampoline<P: FnOnce(Result<(), glib::Error>) + 'static>( - _source_object: *mut glib::gobject_ffi::GObject, - res: *mut gio::ffi::GAsyncResult, - user_data: glib::ffi::gpointer, - ) { - let mut error = std::ptr::null_mut(); - let _ = - ffi::secret_collection_load_items_finish(_source_object as *mut _, res, &mut error); - let result = if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - }; - let callback: Box_<glib::thread_guard::ThreadGuard<P>> = - Box_::from_raw(user_data as *mut _); - let callback: P = callback.into_inner(); - callback(result); - } - let callback = load_items_trampoline::<P>; - unsafe { - ffi::secret_collection_load_items( - self.as_ref().to_glib_none().0, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - Some(callback), - Box_::into_raw(user_data) as *mut _, - ); - } - } - - fn load_items_future( - &self, - ) -> Pin<Box_<dyn std::future::Future<Output = Result<(), glib::Error>> + 'static>> { - Box_::pin(gio::GioFuture::new(self, move |obj, cancellable, send| { - obj.load_items(Some(cancellable), move |res| { - send.resolve(res); - }); - })) - } - - #[doc(alias = "secret_collection_load_items_sync")] - fn load_items_sync( - &self, - cancellable: Option<&impl IsA<gio::Cancellable>>, - ) -> Result<(), glib::Error> { - unsafe { - let mut error = std::ptr::null_mut(); - let is_ok = ffi::secret_collection_load_items_sync( - self.as_ref().to_glib_none().0, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); - debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - } - } - } - - #[doc(alias = "secret_collection_refresh")] - fn refresh(&self) { - unsafe { - ffi::secret_collection_refresh(self.as_ref().to_glib_none().0); - } - } - - #[doc(alias = "secret_collection_set_label")] - fn set_label<P: FnOnce(Result<(), glib::Error>) + 'static>( - &self, - label: &str, - cancellable: Option<&impl IsA<gio::Cancellable>>, - callback: P, - ) { - let main_context = glib::MainContext::ref_thread_default(); - let is_main_context_owner = main_context.is_owner(); - let has_acquired_main_context = (!is_main_context_owner) - .then(|| main_context.acquire().ok()) - .flatten(); - assert!( - is_main_context_owner || has_acquired_main_context.is_some(), - "Async operations only allowed if the thread is owning the MainContext" - ); - - let user_data: Box_<glib::thread_guard::ThreadGuard<P>> = - Box_::new(glib::thread_guard::ThreadGuard::new(callback)); - unsafe extern "C" fn set_label_trampoline<P: FnOnce(Result<(), glib::Error>) + 'static>( - _source_object: *mut glib::gobject_ffi::GObject, - res: *mut gio::ffi::GAsyncResult, - user_data: glib::ffi::gpointer, - ) { - let mut error = std::ptr::null_mut(); - let _ = - ffi::secret_collection_set_label_finish(_source_object as *mut _, res, &mut error); - let result = if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - }; - let callback: Box_<glib::thread_guard::ThreadGuard<P>> = - Box_::from_raw(user_data as *mut _); - let callback: P = callback.into_inner(); - callback(result); - } - let callback = set_label_trampoline::<P>; - unsafe { - ffi::secret_collection_set_label( - self.as_ref().to_glib_none().0, - label.to_glib_none().0, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - Some(callback), - Box_::into_raw(user_data) as *mut _, - ); - } - } - - fn set_label_future( - &self, - label: &str, - ) -> Pin<Box_<dyn std::future::Future<Output = Result<(), glib::Error>> + 'static>> { - let label = String::from(label); - Box_::pin(gio::GioFuture::new(self, move |obj, cancellable, send| { - obj.set_label(&label, Some(cancellable), move |res| { - send.resolve(res); - }); - })) - } - - #[doc(alias = "secret_collection_set_label_sync")] - fn set_label_sync( - &self, - label: &str, - cancellable: Option<&impl IsA<gio::Cancellable>>, - ) -> Result<(), glib::Error> { - unsafe { - let mut error = std::ptr::null_mut(); - let is_ok = ffi::secret_collection_set_label_sync( - self.as_ref().to_glib_none().0, - label.to_glib_none().0, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); - debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - } - } - } - - fn set_created(&self, created: u64) { - ObjectExt::set_property(self.as_ref(), "created", created) - } - - fn set_modified(&self, modified: u64) { - ObjectExt::set_property(self.as_ref(), "modified", modified) - } - - #[doc(alias = "created")] - fn connect_created_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_created_trampoline<P: IsA<Collection>, F: Fn(&P) + 'static>( - this: *mut ffi::SecretCollection, - _param_spec: glib::ffi::gpointer, - f: glib::ffi::gpointer, - ) { - let f: &F = &*(f as *const F); - f(Collection::from_glib_borrow(this).unsafe_cast_ref()) - } - unsafe { - let f: Box_<F> = Box_::new(f); - connect_raw( - self.as_ptr() as *mut _, - b"notify::created\0".as_ptr() as *const _, - Some(std::mem::transmute::<_, unsafe extern "C" fn()>( - notify_created_trampoline::<Self, F> as *const (), - )), - Box_::into_raw(f), - ) - } - } - - #[doc(alias = "label")] - fn connect_label_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_label_trampoline<P: IsA<Collection>, F: Fn(&P) + 'static>( - this: *mut ffi::SecretCollection, - _param_spec: glib::ffi::gpointer, - f: glib::ffi::gpointer, - ) { - let f: &F = &*(f as *const F); - f(Collection::from_glib_borrow(this).unsafe_cast_ref()) - } - unsafe { - let f: Box_<F> = Box_::new(f); - connect_raw( - self.as_ptr() as *mut _, - b"notify::label\0".as_ptr() as *const _, - Some(std::mem::transmute::<_, unsafe extern "C" fn()>( - notify_label_trampoline::<Self, F> as *const (), - )), - Box_::into_raw(f), - ) - } - } - - #[doc(alias = "locked")] - fn connect_locked_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_locked_trampoline<P: IsA<Collection>, F: Fn(&P) + 'static>( - this: *mut ffi::SecretCollection, - _param_spec: glib::ffi::gpointer, - f: glib::ffi::gpointer, - ) { - let f: &F = &*(f as *const F); - f(Collection::from_glib_borrow(this).unsafe_cast_ref()) - } - unsafe { - let f: Box_<F> = Box_::new(f); - connect_raw( - self.as_ptr() as *mut _, - b"notify::locked\0".as_ptr() as *const _, - Some(std::mem::transmute::<_, unsafe extern "C" fn()>( - notify_locked_trampoline::<Self, F> as *const (), - )), - Box_::into_raw(f), - ) - } - } - - #[doc(alias = "modified")] - fn connect_modified_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_modified_trampoline<P: IsA<Collection>, F: Fn(&P) + 'static>( - this: *mut ffi::SecretCollection, - _param_spec: glib::ffi::gpointer, - f: glib::ffi::gpointer, - ) { - let f: &F = &*(f as *const F); - f(Collection::from_glib_borrow(this).unsafe_cast_ref()) - } - unsafe { - let f: Box_<F> = Box_::new(f); - connect_raw( - self.as_ptr() as *mut _, - b"notify::modified\0".as_ptr() as *const _, - Some(std::mem::transmute::<_, unsafe extern "C" fn()>( - notify_modified_trampoline::<Self, F> as *const (), - )), - Box_::into_raw(f), - ) - } - } -} - -impl<O: IsA<Collection>> CollectionExt for O {} diff --git a/libsecret/src/auto/constants.rs b/libsecret/src/auto/constants.rs deleted file mode 100644 index 1086b79..0000000 --- a/libsecret/src/auto/constants.rs +++ /dev/null @@ -1,16 +0,0 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir) -// from -// from gir-files (https://github.com/gtk-rs/gir-files.git) -// DO NOT EDIT - -use glib::GStr; - -#[doc(alias = "SECRET_BACKEND_EXTENSION_POINT_NAME")] -pub static BACKEND_EXTENSION_POINT_NAME: &GStr = - unsafe { GStr::from_utf8_with_nul_unchecked(ffi::SECRET_BACKEND_EXTENSION_POINT_NAME) }; -#[doc(alias = "SECRET_COLLECTION_DEFAULT")] -pub static COLLECTION_DEFAULT: &GStr = - unsafe { GStr::from_utf8_with_nul_unchecked(ffi::SECRET_COLLECTION_DEFAULT) }; -#[doc(alias = "SECRET_COLLECTION_SESSION")] -pub static COLLECTION_SESSION: &GStr = - unsafe { GStr::from_utf8_with_nul_unchecked(ffi::SECRET_COLLECTION_SESSION) }; diff --git a/libsecret/src/auto/enums.rs b/libsecret/src/auto/enums.rs deleted file mode 100644 index d9cf2ff..0000000 --- a/libsecret/src/auto/enums.rs +++ /dev/null @@ -1,462 +0,0 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir) -// from -// from gir-files (https://github.com/gtk-rs/gir-files.git) -// DO NOT EDIT - -use glib::{prelude::*, translate::*}; - -#[cfg(feature = "v0_19")] -#[cfg_attr(docsrs, doc(cfg(feature = "v0_19")))] -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] -#[non_exhaustive] -#[doc(alias = "SecretBackendFlags")] -pub enum BackendFlags { - #[doc(alias = "SECRET_BACKEND_NONE")] - None, - #[doc(alias = "SECRET_BACKEND_OPEN_SESSION")] - OpenSession, - #[doc(alias = "SECRET_BACKEND_LOAD_COLLECTIONS")] - LoadCollections, - #[doc(hidden)] - __Unknown(i32), -} - -#[cfg(feature = "v0_19")] -#[cfg_attr(docsrs, doc(cfg(feature = "v0_19")))] -#[doc(hidden)] -impl IntoGlib for BackendFlags { - type GlibType = ffi::SecretBackendFlags; - - #[inline] - fn into_glib(self) -> ffi::SecretBackendFlags { - match self { - Self::None => ffi::SECRET_BACKEND_NONE, - Self::OpenSession => ffi::SECRET_BACKEND_OPEN_SESSION, - Self::LoadCollections => ffi::SECRET_BACKEND_LOAD_COLLECTIONS, - Self::__Unknown(value) => value, - } - } -} - -#[cfg(feature = "v0_19")] -#[cfg_attr(docsrs, doc(cfg(feature = "v0_19")))] -#[doc(hidden)] -impl FromGlib<ffi::SecretBackendFlags> for BackendFlags { - #[inline] - unsafe fn from_glib(value: ffi::SecretBackendFlags) -> Self { - match value { - ffi::SECRET_BACKEND_NONE => Self::None, - ffi::SECRET_BACKEND_OPEN_SESSION => Self::OpenSession, - ffi::SECRET_BACKEND_LOAD_COLLECTIONS => Self::LoadCollections, - value => Self::__Unknown(value), - } - } -} - -#[cfg(feature = "v0_19")] -#[cfg_attr(docsrs, doc(cfg(feature = "v0_19")))] -impl StaticType for BackendFlags { - #[inline] - #[doc(alias = "secret_backend_flags_get_type")] - fn static_type() -> glib::Type { - unsafe { from_glib(ffi::secret_backend_flags_get_type()) } - } -} - -#[cfg(feature = "v0_19")] -#[cfg_attr(docsrs, doc(cfg(feature = "v0_19")))] -impl glib::HasParamSpec for BackendFlags { - type ParamSpec = glib::ParamSpecEnum; - type SetValue = Self; - type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>; - - fn param_spec_builder() -> Self::BuilderFn { - Self::ParamSpec::builder_with_default - } -} - -#[cfg(feature = "v0_19")] -#[cfg_attr(docsrs, doc(cfg(feature = "v0_19")))] -impl glib::value::ValueType for BackendFlags { - type Type = Self; -} - -#[cfg(feature = "v0_19")] -#[cfg_attr(docsrs, doc(cfg(feature = "v0_19")))] -unsafe impl<'a> glib::value::FromValue<'a> for BackendFlags { - type Checker = glib::value::GenericValueTypeChecker<Self>; - - #[inline] - unsafe fn from_value(value: &'a glib::Value) -> Self { - from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) - } -} - -#[cfg(feature = "v0_19")] -#[cfg_attr(docsrs, doc(cfg(feature = "v0_19")))] -impl ToValue for BackendFlags { - #[inline] - fn to_value(&self) -> glib::Value { - let mut value = glib::Value::for_value_type::<Self>(); - unsafe { - glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib()); - } - value - } - - #[inline] - fn value_type(&self) -> glib::Type { - Self::static_type() - } -} - -#[cfg(feature = "v0_19")] -#[cfg_attr(docsrs, doc(cfg(feature = "v0_19")))] -impl From<BackendFlags> for glib::Value { - #[inline] - fn from(v: BackendFlags) -> Self { - ToValue::to_value(&v) - } -} - -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] -#[non_exhaustive] -#[doc(alias = "SecretError")] -pub enum Error { - #[doc(alias = "SECRET_ERROR_PROTOCOL")] - Protocol, - #[doc(alias = "SECRET_ERROR_IS_LOCKED")] - IsLocked, - #[doc(alias = "SECRET_ERROR_NO_SUCH_OBJECT")] - NoSuchObject, - #[doc(alias = "SECRET_ERROR_ALREADY_EXISTS")] - AlreadyExists, - #[doc(alias = "SECRET_ERROR_INVALID_FILE_FORMAT")] - InvalidFileFormat, - #[cfg(feature = "v0_21_2")] - #[cfg_attr(docsrs, doc(cfg(feature = "v0_21_2")))] - #[doc(alias = "SECRET_ERROR_MISMATCHED_SCHEMA")] - MismatchedSchema, - #[cfg(feature = "v0_21_2")] - #[cfg_attr(docsrs, doc(cfg(feature = "v0_21_2")))] - #[doc(alias = "SECRET_ERROR_NO_MATCHING_ATTRIBUTE")] - NoMatchingAttribute, - #[cfg(feature = "v0_21_2")] - #[cfg_attr(docsrs, doc(cfg(feature = "v0_21_2")))] - #[doc(alias = "SECRET_ERROR_WRONG_TYPE")] - WrongType, - #[cfg(feature = "v0_21_2")] - #[cfg_attr(docsrs, doc(cfg(feature = "v0_21_2")))] - #[doc(alias = "SECRET_ERROR_EMPTY_TABLE")] - EmptyTable, - #[doc(hidden)] - __Unknown(i32), -} - -#[doc(hidden)] -impl IntoGlib for Error { - type GlibType = ffi::SecretError; - - #[inline] - fn into_glib(self) -> ffi::SecretError { - match self { - Self::Protocol => ffi::SECRET_ERROR_PROTOCOL, - Self::IsLocked => ffi::SECRET_ERROR_IS_LOCKED, - Self::NoSuchObject => ffi::SECRET_ERROR_NO_SUCH_OBJECT, - Self::AlreadyExists => ffi::SECRET_ERROR_ALREADY_EXISTS, - Self::InvalidFileFormat => ffi::SECRET_ERROR_INVALID_FILE_FORMAT, - #[cfg(feature = "v0_21_2")] - Self::MismatchedSchema => ffi::SECRET_ERROR_MISMATCHED_SCHEMA, - #[cfg(feature = "v0_21_2")] - Self::NoMatchingAttribute => ffi::SECRET_ERROR_NO_MATCHING_ATTRIBUTE, - #[cfg(feature = "v0_21_2")] - Self::WrongType => ffi::SECRET_ERROR_WRONG_TYPE, - #[cfg(feature = "v0_21_2")] - Self::EmptyTable => ffi::SECRET_ERROR_EMPTY_TABLE, - Self::__Unknown(value) => value, - } - } -} - -#[doc(hidden)] -impl FromGlib<ffi::SecretError> for Error { - #[inline] - unsafe fn from_glib(value: ffi::SecretError) -> Self { - match value { - ffi::SECRET_ERROR_PROTOCOL => Self::Protocol, - ffi::SECRET_ERROR_IS_LOCKED => Self::IsLocked, - ffi::SECRET_ERROR_NO_SUCH_OBJECT => Self::NoSuchObject, - ffi::SECRET_ERROR_ALREADY_EXISTS => Self::AlreadyExists, - ffi::SECRET_ERROR_INVALID_FILE_FORMAT => Self::InvalidFileFormat, - #[cfg(feature = "v0_21_2")] - ffi::SECRET_ERROR_MISMATCHED_SCHEMA => Self::MismatchedSchema, - #[cfg(feature = "v0_21_2")] - ffi::SECRET_ERROR_NO_MATCHING_ATTRIBUTE => Self::NoMatchingAttribute, - #[cfg(feature = "v0_21_2")] - ffi::SECRET_ERROR_WRONG_TYPE => Self::WrongType, - #[cfg(feature = "v0_21_2")] - ffi::SECRET_ERROR_EMPTY_TABLE => Self::EmptyTable, - value => Self::__Unknown(value), - } - } -} - -impl StaticType for Error { - #[inline] - #[doc(alias = "secret_error_get_type")] - fn static_type() -> glib::Type { - unsafe { from_glib(ffi::secret_error_get_type()) } - } -} - -impl glib::HasParamSpec for Error { - type ParamSpec = glib::ParamSpecEnum; - type SetValue = Self; - type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>; - - fn param_spec_builder() -> Self::BuilderFn { - Self::ParamSpec::builder_with_default - } -} - -impl glib::value::ValueType for Error { - type Type = Self; -} - -unsafe impl<'a> glib::value::FromValue<'a> for Error { - type Checker = glib::value::GenericValueTypeChecker<Self>; - - #[inline] - unsafe fn from_value(value: &'a glib::Value) -> Self { - from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) - } -} - -impl ToValue for Error { - #[inline] - fn to_value(&self) -> glib::Value { - let mut value = glib::Value::for_value_type::<Self>(); - unsafe { - glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib()); - } - value - } - - #[inline] - fn value_type(&self) -> glib::Type { - Self::static_type() - } -} - -impl From<Error> for glib::Value { - #[inline] - fn from(v: Error) -> Self { - ToValue::to_value(&v) - } -} - -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] -#[non_exhaustive] -#[doc(alias = "SecretSchemaAttributeType")] -pub enum SchemaAttributeType { - #[doc(alias = "SECRET_SCHEMA_ATTRIBUTE_STRING")] - String, - #[doc(alias = "SECRET_SCHEMA_ATTRIBUTE_INTEGER")] - Integer, - #[doc(alias = "SECRET_SCHEMA_ATTRIBUTE_BOOLEAN")] - Boolean, - #[doc(hidden)] - __Unknown(i32), -} - -#[doc(hidden)] -impl IntoGlib for SchemaAttributeType { - type GlibType = ffi::SecretSchemaAttributeType; - - #[inline] - fn into_glib(self) -> ffi::SecretSchemaAttributeType { - match self { - Self::String => ffi::SECRET_SCHEMA_ATTRIBUTE_STRING, - Self::Integer => ffi::SECRET_SCHEMA_ATTRIBUTE_INTEGER, - Self::Boolean => ffi::SECRET_SCHEMA_ATTRIBUTE_BOOLEAN, - Self::__Unknown(value) => value, - } - } -} - -#[doc(hidden)] -impl FromGlib<ffi::SecretSchemaAttributeType> for SchemaAttributeType { - #[inline] - unsafe fn from_glib(value: ffi::SecretSchemaAttributeType) -> Self { - match value { - ffi::SECRET_SCHEMA_ATTRIBUTE_STRING => Self::String, - ffi::SECRET_SCHEMA_ATTRIBUTE_INTEGER => Self::Integer, - ffi::SECRET_SCHEMA_ATTRIBUTE_BOOLEAN => Self::Boolean, - value => Self::__Unknown(value), - } - } -} - -impl StaticType for SchemaAttributeType { - #[inline] - #[doc(alias = "secret_schema_attribute_type_get_type")] - fn static_type() -> glib::Type { - unsafe { from_glib(ffi::secret_schema_attribute_type_get_type()) } - } -} - -impl glib::HasParamSpec for SchemaAttributeType { - type ParamSpec = glib::ParamSpecEnum; - type SetValue = Self; - type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>; - - fn param_spec_builder() -> Self::BuilderFn { - Self::ParamSpec::builder_with_default - } -} - -impl glib::value::ValueType for SchemaAttributeType { - type Type = Self; -} - -unsafe impl<'a> glib::value::FromValue<'a> for SchemaAttributeType { - type Checker = glib::value::GenericValueTypeChecker<Self>; - - #[inline] - unsafe fn from_value(value: &'a glib::Value) -> Self { - from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) - } -} - -impl ToValue for SchemaAttributeType { - #[inline] - fn to_value(&self) -> glib::Value { - let mut value = glib::Value::for_value_type::<Self>(); - unsafe { - glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib()); - } - value - } - - #[inline] - fn value_type(&self) -> glib::Type { - Self::static_type() - } -} - -impl From<SchemaAttributeType> for glib::Value { - #[inline] - fn from(v: SchemaAttributeType) -> Self { - ToValue::to_value(&v) - } -} - -#[cfg(feature = "v0_18_6")] -#[cfg_attr(docsrs, doc(cfg(feature = "v0_18_6")))] -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] -#[non_exhaustive] -#[doc(alias = "SecretSchemaType")] -pub enum SchemaType { - #[doc(alias = "SECRET_SCHEMA_TYPE_NOTE")] - Note, - #[doc(alias = "SECRET_SCHEMA_TYPE_COMPAT_NETWORK")] - CompatNetwork, - #[doc(hidden)] - __Unknown(i32), -} - -#[cfg(feature = "v0_18_6")] -#[cfg_attr(docsrs, doc(cfg(feature = "v0_18_6")))] -#[doc(hidden)] -impl IntoGlib for SchemaType { - type GlibType = ffi::SecretSchemaType; - - #[inline] - fn into_glib(self) -> ffi::SecretSchemaType { - match self { - Self::Note => ffi::SECRET_SCHEMA_TYPE_NOTE, - Self::CompatNetwork => ffi::SECRET_SCHEMA_TYPE_COMPAT_NETWORK, - Self::__Unknown(value) => value, - } - } -} - -#[cfg(feature = "v0_18_6")] -#[cfg_attr(docsrs, doc(cfg(feature = "v0_18_6")))] -#[doc(hidden)] -impl FromGlib<ffi::SecretSchemaType> for SchemaType { - #[inline] - unsafe fn from_glib(value: ffi::SecretSchemaType) -> Self { - match value { - ffi::SECRET_SCHEMA_TYPE_NOTE => Self::Note, - ffi::SECRET_SCHEMA_TYPE_COMPAT_NETWORK => Self::CompatNetwork, - value => Self::__Unknown(value), - } - } -} - -#[cfg(feature = "v0_18_6")] -#[cfg_attr(docsrs, doc(cfg(feature = "v0_18_6")))] -impl StaticType for SchemaType { - #[inline] - #[doc(alias = "secret_schema_type_get_type")] - fn static_type() -> glib::Type { - unsafe { from_glib(ffi::secret_schema_type_get_type()) } - } -} - -#[cfg(feature = "v0_18_6")] -#[cfg_attr(docsrs, doc(cfg(feature = "v0_18_6")))] -impl glib::HasParamSpec for SchemaType { - type ParamSpec = glib::ParamSpecEnum; - type SetValue = Self; - type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>; - - fn param_spec_builder() -> Self::BuilderFn { - Self::ParamSpec::builder_with_default - } -} - -#[cfg(feature = "v0_18_6")] -#[cfg_attr(docsrs, doc(cfg(feature = "v0_18_6")))] -impl glib::value::ValueType for SchemaType { - type Type = Self; -} - -#[cfg(feature = "v0_18_6")] -#[cfg_attr(docsrs, doc(cfg(feature = "v0_18_6")))] -unsafe impl<'a> glib::value::FromValue<'a> for SchemaType { - type Checker = glib::value::GenericValueTypeChecker<Self>; - - #[inline] - unsafe fn from_value(value: &'a glib::Value) -> Self { - from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) - } -} - -#[cfg(feature = "v0_18_6")] -#[cfg_attr(docsrs, doc(cfg(feature = "v0_18_6")))] -impl ToValue for SchemaType { - #[inline] - fn to_value(&self) -> glib::Value { - let mut value = glib::Value::for_value_type::<Self>(); - unsafe { - glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib()); - } - value - } - - #[inline] - fn value_type(&self) -> glib::Type { - Self::static_type() - } -} - -#[cfg(feature = "v0_18_6")] -#[cfg_attr(docsrs, doc(cfg(feature = "v0_18_6")))] -impl From<SchemaType> for glib::Value { - #[inline] - fn from(v: SchemaType) -> Self { - ToValue::to_value(&v) - } -} diff --git a/libsecret/src/auto/flags.rs b/libsecret/src/auto/flags.rs deleted file mode 100644 index 81c0f71..0000000 --- a/libsecret/src/auto/flags.rs +++ /dev/null @@ -1,591 +0,0 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir) -// from -// from gir-files (https://github.com/gtk-rs/gir-files.git) -// DO NOT EDIT - -use glib::{bitflags::bitflags, prelude::*, translate::*}; - -bitflags! { - #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] - #[doc(alias = "SecretCollectionCreateFlags")] - pub struct CollectionCreateFlags: u32 { - #[doc(alias = "SECRET_COLLECTION_CREATE_NONE")] - const NONE = ffi::SECRET_COLLECTION_CREATE_NONE as _; - } -} - -#[doc(hidden)] -impl IntoGlib for CollectionCreateFlags { - type GlibType = ffi::SecretCollectionCreateFlags; - - #[inline] - fn into_glib(self) -> ffi::SecretCollectionCreateFlags { - self.bits() - } -} - -#[doc(hidden)] -impl FromGlib<ffi::SecretCollectionCreateFlags> for CollectionCreateFlags { - #[inline] - unsafe fn from_glib(value: ffi::SecretCollectionCreateFlags) -> Self { - Self::from_bits_truncate(value) - } -} - -impl StaticType for CollectionCreateFlags { - #[inline] - #[doc(alias = "secret_collection_create_flags_get_type")] - fn static_type() -> glib::Type { - unsafe { from_glib(ffi::secret_collection_create_flags_get_type()) } - } -} - -impl glib::HasParamSpec for CollectionCreateFlags { - type ParamSpec = glib::ParamSpecFlags; - type SetValue = Self; - type BuilderFn = fn(&str) -> glib::ParamSpecFlagsBuilder<Self>; - - fn param_spec_builder() -> Self::BuilderFn { - Self::ParamSpec::builder - } -} - -impl glib::value::ValueType for CollectionCreateFlags { - type Type = Self; -} - -unsafe impl<'a> glib::value::FromValue<'a> for CollectionCreateFlags { - type Checker = glib::value::GenericValueTypeChecker<Self>; - - #[inline] - unsafe fn from_value(value: &'a glib::Value) -> Self { - from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0)) - } -} - -impl ToValue for CollectionCreateFlags { - #[inline] - fn to_value(&self) -> glib::Value { - let mut value = glib::Value::for_value_type::<Self>(); - unsafe { - glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib()); - } - value - } - - #[inline] - fn value_type(&self) -> glib::Type { - Self::static_type() - } -} - -impl From<CollectionCreateFlags> for glib::Value { - #[inline] - fn from(v: CollectionCreateFlags) -> Self { - ToValue::to_value(&v) - } -} - -bitflags! { - #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] - #[doc(alias = "SecretCollectionFlags")] - pub struct CollectionFlags: u32 { - #[doc(alias = "SECRET_COLLECTION_NONE")] - const NONE = ffi::SECRET_COLLECTION_NONE as _; - #[doc(alias = "SECRET_COLLECTION_LOAD_ITEMS")] - const LOAD_ITEMS = ffi::SECRET_COLLECTION_LOAD_ITEMS as _; - } -} - -#[doc(hidden)] -impl IntoGlib for CollectionFlags { - type GlibType = ffi::SecretCollectionFlags; - - #[inline] - fn into_glib(self) -> ffi::SecretCollectionFlags { - self.bits() - } -} - -#[doc(hidden)] -impl FromGlib<ffi::SecretCollectionFlags> for CollectionFlags { - #[inline] - unsafe fn from_glib(value: ffi::SecretCollectionFlags) -> Self { - Self::from_bits_truncate(value) - } -} - -impl StaticType for CollectionFlags { - #[inline] - #[doc(alias = "secret_collection_flags_get_type")] - fn static_type() -> glib::Type { - unsafe { from_glib(ffi::secret_collection_flags_get_type()) } - } -} - -impl glib::HasParamSpec for CollectionFlags { - type ParamSpec = glib::ParamSpecFlags; - type SetValue = Self; - type BuilderFn = fn(&str) -> glib::ParamSpecFlagsBuilder<Self>; - - fn param_spec_builder() -> Self::BuilderFn { - Self::ParamSpec::builder - } -} - -impl glib::value::ValueType for CollectionFlags { - type Type = Self; -} - -unsafe impl<'a> glib::value::FromValue<'a> for CollectionFlags { - type Checker = glib::value::GenericValueTypeChecker<Self>; - - #[inline] - unsafe fn from_value(value: &'a glib::Value) -> Self { - from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0)) - } -} - -impl ToValue for CollectionFlags { - #[inline] - fn to_value(&self) -> glib::Value { - let mut value = glib::Value::for_value_type::<Self>(); - unsafe { - glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib()); - } - value - } - - #[inline] - fn value_type(&self) -> glib::Type { - Self::static_type() - } -} - -impl From<CollectionFlags> for glib::Value { - #[inline] - fn from(v: CollectionFlags) -> Self { - ToValue::to_value(&v) - } -} - -bitflags! { - #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] - #[doc(alias = "SecretItemCreateFlags")] - pub struct ItemCreateFlags: u32 { - #[doc(alias = "SECRET_ITEM_CREATE_NONE")] - const NONE = ffi::SECRET_ITEM_CREATE_NONE as _; - #[doc(alias = "SECRET_ITEM_CREATE_REPLACE")] - const REPLACE = ffi::SECRET_ITEM_CREATE_REPLACE as _; - } -} - -#[doc(hidden)] -impl IntoGlib for ItemCreateFlags { - type GlibType = ffi::SecretItemCreateFlags; - - #[inline] - fn into_glib(self) -> ffi::SecretItemCreateFlags { - self.bits() - } -} - -#[doc(hidden)] -impl FromGlib<ffi::SecretItemCreateFlags> for ItemCreateFlags { - #[inline] - unsafe fn from_glib(value: ffi::SecretItemCreateFlags) -> Self { - Self::from_bits_truncate(value) - } -} - -impl StaticType for ItemCreateFlags { - #[inline] - #[doc(alias = "secret_item_create_flags_get_type")] - fn static_type() -> glib::Type { - unsafe { from_glib(ffi::secret_item_create_flags_get_type()) } - } -} - -impl glib::HasParamSpec for ItemCreateFlags { - type ParamSpec = glib::ParamSpecFlags; - type SetValue = Self; - type BuilderFn = fn(&str) -> glib::ParamSpecFlagsBuilder<Self>; - - fn param_spec_builder() -> Self::BuilderFn { - Self::ParamSpec::builder - } -} - -impl glib::value::ValueType for ItemCreateFlags { - type Type = Self; -} - -unsafe impl<'a> glib::value::FromValue<'a> for ItemCreateFlags { - type Checker = glib::value::GenericValueTypeChecker<Self>; - - #[inline] - unsafe fn from_value(value: &'a glib::Value) -> Self { - from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0)) - } -} - -impl ToValue for ItemCreateFlags { - #[inline] - fn to_value(&self) -> glib::Value { - let mut value = glib::Value::for_value_type::<Self>(); - unsafe { - glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib()); - } - value - } - - #[inline] - fn value_type(&self) -> glib::Type { - Self::static_type() - } -} - -impl From<ItemCreateFlags> for glib::Value { - #[inline] - fn from(v: ItemCreateFlags) -> Self { - ToValue::to_value(&v) - } -} - -bitflags! { - #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] - #[doc(alias = "SecretItemFlags")] - pub struct ItemFlags: u32 { - #[doc(alias = "SECRET_ITEM_NONE")] - const NONE = ffi::SECRET_ITEM_NONE as _; - #[doc(alias = "SECRET_ITEM_LOAD_SECRET")] - const LOAD_SECRET = ffi::SECRET_ITEM_LOAD_SECRET as _; - } -} - -#[doc(hidden)] -impl IntoGlib for ItemFlags { - type GlibType = ffi::SecretItemFlags; - - #[inline] - fn into_glib(self) -> ffi::SecretItemFlags { - self.bits() - } -} - -#[doc(hidden)] -impl FromGlib<ffi::SecretItemFlags> for ItemFlags { - #[inline] - unsafe fn from_glib(value: ffi::SecretItemFlags) -> Self { - Self::from_bits_truncate(value) - } -} - -impl StaticType for ItemFlags { - #[inline] - #[doc(alias = "secret_item_flags_get_type")] - fn static_type() -> glib::Type { - unsafe { from_glib(ffi::secret_item_flags_get_type()) } - } -} - -impl glib::HasParamSpec for ItemFlags { - type ParamSpec = glib::ParamSpecFlags; - type SetValue = Self; - type BuilderFn = fn(&str) -> glib::ParamSpecFlagsBuilder<Self>; - - fn param_spec_builder() -> Self::BuilderFn { - Self::ParamSpec::builder - } -} - -impl glib::value::ValueType for ItemFlags { - type Type = Self; -} - -unsafe impl<'a> glib::value::FromValue<'a> for ItemFlags { - type Checker = glib::value::GenericValueTypeChecker<Self>; - - #[inline] - unsafe fn from_value(value: &'a glib::Value) -> Self { - from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0)) - } -} - -impl ToValue for ItemFlags { - #[inline] - fn to_value(&self) -> glib::Value { - let mut value = glib::Value::for_value_type::<Self>(); - unsafe { - glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib()); - } - value - } - - #[inline] - fn value_type(&self) -> glib::Type { - Self::static_type() - } -} - -impl From<ItemFlags> for glib::Value { - #[inline] - fn from(v: ItemFlags) -> Self { - ToValue::to_value(&v) - } -} - -bitflags! { - #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] - #[doc(alias = "SecretSchemaFlags")] - pub struct SchemaFlags: u32 { - #[doc(alias = "SECRET_SCHEMA_NONE")] - const NONE = ffi::SECRET_SCHEMA_NONE as _; - #[doc(alias = "SECRET_SCHEMA_DONT_MATCH_NAME")] - const DONT_MATCH_NAME = ffi::SECRET_SCHEMA_DONT_MATCH_NAME as _; - } -} - -#[doc(hidden)] -impl IntoGlib for SchemaFlags { - type GlibType = ffi::SecretSchemaFlags; - - #[inline] - fn into_glib(self) -> ffi::SecretSchemaFlags { - self.bits() - } -} - -#[doc(hidden)] -impl FromGlib<ffi::SecretSchemaFlags> for SchemaFlags { - #[inline] - unsafe fn from_glib(value: ffi::SecretSchemaFlags) -> Self { - Self::from_bits_truncate(value) - } -} - -impl StaticType for SchemaFlags { - #[inline] - #[doc(alias = "secret_schema_flags_get_type")] - fn static_type() -> glib::Type { - unsafe { from_glib(ffi::secret_schema_flags_get_type()) } - } -} - -impl glib::HasParamSpec for SchemaFlags { - type ParamSpec = glib::ParamSpecFlags; - type SetValue = Self; - type BuilderFn = fn(&str) -> glib::ParamSpecFlagsBuilder<Self>; - - fn param_spec_builder() -> Self::BuilderFn { - Self::ParamSpec::builder - } -} - -impl glib::value::ValueType for SchemaFlags { - type Type = Self; -} - -unsafe impl<'a> glib::value::FromValue<'a> for SchemaFlags { - type Checker = glib::value::GenericValueTypeChecker<Self>; - - #[inline] - unsafe fn from_value(value: &'a glib::Value) -> Self { - from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0)) - } -} - -impl ToValue for SchemaFlags { - #[inline] - fn to_value(&self) -> glib::Value { - let mut value = glib::Value::for_value_type::<Self>(); - unsafe { - glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib()); - } - value - } - - #[inline] - fn value_type(&self) -> glib::Type { - Self::static_type() - } -} - -impl From<SchemaFlags> for glib::Value { - #[inline] - fn from(v: SchemaFlags) -> Self { - ToValue::to_value(&v) - } -} - -bitflags! { - #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] - #[doc(alias = "SecretSearchFlags")] - pub struct SearchFlags: u32 { - #[doc(alias = "SECRET_SEARCH_NONE")] - const NONE = ffi::SECRET_SEARCH_NONE as _; - #[doc(alias = "SECRET_SEARCH_ALL")] - const ALL = ffi::SECRET_SEARCH_ALL as _; - #[doc(alias = "SECRET_SEARCH_UNLOCK")] - const UNLOCK = ffi::SECRET_SEARCH_UNLOCK as _; - #[doc(alias = "SECRET_SEARCH_LOAD_SECRETS")] - const LOAD_SECRETS = ffi::SECRET_SEARCH_LOAD_SECRETS as _; - } -} - -#[doc(hidden)] -impl IntoGlib for SearchFlags { - type GlibType = ffi::SecretSearchFlags; - - #[inline] - fn into_glib(self) -> ffi::SecretSearchFlags { - self.bits() - } -} - -#[doc(hidden)] -impl FromGlib<ffi::SecretSearchFlags> for SearchFlags { - #[inline] - unsafe fn from_glib(value: ffi::SecretSearchFlags) -> Self { - Self::from_bits_truncate(value) - } -} - -impl StaticType for SearchFlags { - #[inline] - #[doc(alias = "secret_search_flags_get_type")] - fn static_type() -> glib::Type { - unsafe { from_glib(ffi::secret_search_flags_get_type()) } - } -} - -impl glib::HasParamSpec for SearchFlags { - type ParamSpec = glib::ParamSpecFlags; - type SetValue = Self; - type BuilderFn = fn(&str) -> glib::ParamSpecFlagsBuilder<Self>; - - fn param_spec_builder() -> Self::BuilderFn { - Self::ParamSpec::builder - } -} - -impl glib::value::ValueType for SearchFlags { - type Type = Self; -} - -unsafe impl<'a> glib::value::FromValue<'a> for SearchFlags { - type Checker = glib::value::GenericValueTypeChecker<Self>; - - #[inline] - unsafe fn from_value(value: &'a glib::Value) -> Self { - from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0)) - } -} - -impl ToValue for SearchFlags { - #[inline] - fn to_value(&self) -> glib::Value { - let mut value = glib::Value::for_value_type::<Self>(); - unsafe { - glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib()); - } - value - } - - #[inline] - fn value_type(&self) -> glib::Type { - Self::static_type() - } -} - -impl From<SearchFlags> for glib::Value { - #[inline] - fn from(v: SearchFlags) -> Self { - ToValue::to_value(&v) - } -} - -bitflags! { - #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] - #[doc(alias = "SecretServiceFlags")] - pub struct ServiceFlags: u32 { - #[doc(alias = "SECRET_SERVICE_NONE")] - const NONE = ffi::SECRET_SERVICE_NONE as _; - #[doc(alias = "SECRET_SERVICE_OPEN_SESSION")] - const OPEN_SESSION = ffi::SECRET_SERVICE_OPEN_SESSION as _; - #[doc(alias = "SECRET_SERVICE_LOAD_COLLECTIONS")] - const LOAD_COLLECTIONS = ffi::SECRET_SERVICE_LOAD_COLLECTIONS as _; - } -} - -#[doc(hidden)] -impl IntoGlib for ServiceFlags { - type GlibType = ffi::SecretServiceFlags; - - #[inline] - fn into_glib(self) -> ffi::SecretServiceFlags { - self.bits() - } -} - -#[doc(hidden)] -impl FromGlib<ffi::SecretServiceFlags> for ServiceFlags { - #[inline] - unsafe fn from_glib(value: ffi::SecretServiceFlags) -> Self { - Self::from_bits_truncate(value) - } -} - -impl StaticType for ServiceFlags { - #[inline] - #[doc(alias = "secret_service_flags_get_type")] - fn static_type() -> glib::Type { - unsafe { from_glib(ffi::secret_service_flags_get_type()) } - } -} - -impl glib::HasParamSpec for ServiceFlags { - type ParamSpec = glib::ParamSpecFlags; - type SetValue = Self; - type BuilderFn = fn(&str) -> glib::ParamSpecFlagsBuilder<Self>; - - fn param_spec_builder() -> Self::BuilderFn { - Self::ParamSpec::builder - } -} - -impl glib::value::ValueType for ServiceFlags { - type Type = Self; -} - -unsafe impl<'a> glib::value::FromValue<'a> for ServiceFlags { - type Checker = glib::value::GenericValueTypeChecker<Self>; - - #[inline] - unsafe fn from_value(value: &'a glib::Value) -> Self { - from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0)) - } -} - -impl ToValue for ServiceFlags { - #[inline] - fn to_value(&self) -> glib::Value { - let mut value = glib::Value::for_value_type::<Self>(); - unsafe { - glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib()); - } - value - } - - #[inline] - fn value_type(&self) -> glib::Type { - Self::static_type() - } -} - -impl From<ServiceFlags> for glib::Value { - #[inline] - fn from(v: ServiceFlags) -> Self { - ToValue::to_value(&v) - } -} diff --git a/libsecret/src/auto/functions.rs b/libsecret/src/auto/functions.rs deleted file mode 100644 index 173139f..0000000 --- a/libsecret/src/auto/functions.rs +++ /dev/null @@ -1,41 +0,0 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir) -// from -// from gir-files (https://github.com/gtk-rs/gir-files.git) -// DO NOT EDIT - -#[cfg(feature = "v0_19")] -#[cfg_attr(docsrs, doc(cfg(feature = "v0_19")))] -use crate::{Retrievable, Value}; -#[cfg(feature = "v0_18_6")] -#[cfg_attr(docsrs, doc(cfg(feature = "v0_18_6")))] -use crate::{Schema, SchemaType}; -use glib::{prelude::*, translate::*}; - -//#[cfg(feature = "v0_21_2")] -//#[cfg_attr(docsrs, doc(cfg(feature = "v0_21_2")))] -//#[doc(alias = "secret_attributes_validate")] -//pub fn attributes_validate(schema: &Schema, attributes: /*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 0, id: 25 }/TypeId { ns_id: 0, id: 25 }) -> Result<(), glib::Error> { -// unsafe { TODO: call ffi:secret_attributes_validate() } -//} - -#[cfg(feature = "v0_18_6")] -#[cfg_attr(docsrs, doc(cfg(feature = "v0_18_6")))] -#[doc(alias = "secret_get_schema")] -#[doc(alias = "get_schema")] -pub fn schema(type_: SchemaType) -> Schema { - unsafe { from_glib_none(ffi::secret_get_schema(type_.into_glib())) } -} - -#[doc(alias = "secret_password_free")] -pub fn password_free(password: Option<&str>) { - unsafe { - ffi::secret_password_free(password.to_glib_none().0); - } -} - -#[doc(alias = "secret_password_wipe")] -pub fn password_wipe(password: Option<&str>) { - unsafe { - ffi::secret_password_wipe(password.to_glib_none().0); - } -} diff --git a/libsecret/src/auto/item.rs b/libsecret/src/auto/item.rs deleted file mode 100644 index 5fb03e6..0000000 --- a/libsecret/src/auto/item.rs +++ /dev/null @@ -1,556 +0,0 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir) -// from -// from gir-files (https://github.com/gtk-rs/gir-files.git) -// DO NOT EDIT - -#[cfg(feature = "v0_19")] -#[cfg_attr(docsrs, doc(cfg(feature = "v0_19")))] -use crate::Retrievable; -use crate::{ItemFlags, Service, Value}; -use glib::{ - prelude::*, - signal::{connect_raw, SignalHandlerId}, - translate::*, -}; -use std::{boxed::Box as Box_, pin::Pin}; - -#[cfg(feature = "v0_19")] -#[cfg_attr(docsrs, doc(cfg(feature = "v0_19")))] -glib::wrapper! { - #[doc(alias = "SecretItem")] - pub struct Item(Object<ffi::SecretItem, ffi::SecretItemClass>) @extends gio::DBusProxy, @implements gio::DBusInterface, gio::Initable, Retrievable; - - match fn { - type_ => || ffi::secret_item_get_type(), - } -} - -#[cfg(not(any(feature = "v0_19")))] -glib::wrapper! { - #[doc(alias = "SecretItem")] - pub struct Item(Object<ffi::SecretItem, ffi::SecretItemClass>) @extends gio::DBusProxy, @implements gio::DBusInterface, gio::Initable; - - match fn { - type_ => || ffi::secret_item_get_type(), - } -} - -impl Item { - pub const NONE: Option<&'static Item> = None; - - #[doc(alias = "secret_item_new_for_dbus_path_sync")] - #[doc(alias = "new_for_dbus_path_sync")] - pub fn for_dbus_path_sync( - service: Option<&impl IsA<Service>>, - item_path: &str, - flags: ItemFlags, - cancellable: Option<&impl IsA<gio::Cancellable>>, - ) -> Result<Item, glib::Error> { - unsafe { - let mut error = std::ptr::null_mut(); - let ret = ffi::secret_item_new_for_dbus_path_sync( - service.map(|p| p.as_ref()).to_glib_none().0, - item_path.to_glib_none().0, - flags.into_glib(), - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); - if error.is_null() { - Ok(from_glib_full(ret)) - } else { - Err(from_glib_full(error)) - } - } - } - - #[doc(alias = "secret_item_new_for_dbus_path")] - pub fn new_for_dbus_path<P: FnOnce(Result<Item, glib::Error>) + 'static>( - service: Option<&impl IsA<Service>>, - item_path: &str, - flags: ItemFlags, - cancellable: Option<&impl IsA<gio::Cancellable>>, - callback: P, - ) { - let main_context = glib::MainContext::ref_thread_default(); - let is_main_context_owner = main_context.is_owner(); - let has_acquired_main_context = (!is_main_context_owner) - .then(|| main_context.acquire().ok()) - .flatten(); - assert!( - is_main_context_owner || has_acquired_main_context.is_some(), - "Async operations only allowed if the thread is owning the MainContext" - ); - - let user_data: Box_<glib::thread_guard::ThreadGuard<P>> = - Box_::new(glib::thread_guard::ThreadGuard::new(callback)); - unsafe extern "C" fn new_for_dbus_path_trampoline< - P: FnOnce(Result<Item, glib::Error>) + 'static, - >( - _source_object: *mut glib::gobject_ffi::GObject, - res: *mut gio::ffi::GAsyncResult, - user_data: glib::ffi::gpointer, - ) { - let mut error = std::ptr::null_mut(); - let ret = ffi::secret_item_new_for_dbus_path_finish(res, &mut error); - let result = if error.is_null() { - Ok(from_glib_full(ret)) - } else { - Err(from_glib_full(error)) - }; - let callback: Box_<glib::thread_guard::ThreadGuard<P>> = - Box_::from_raw(user_data as *mut _); - let callback: P = callback.into_inner(); - callback(result); - } - let callback = new_for_dbus_path_trampoline::<P>; - unsafe { - ffi::secret_item_new_for_dbus_path( - service.map(|p| p.as_ref()).to_glib_none().0, - item_path.to_glib_none().0, - flags.into_glib(), - cancellable.map(|p| p.as_ref()).to_glib_none().0, - Some(callback), - Box_::into_raw(user_data) as *mut _, - ); - } - } - - pub fn new_for_dbus_path_future( - service: Option<&(impl IsA<Service> + Clone + 'static)>, - item_path: &str, - flags: ItemFlags, - ) -> Pin<Box_<dyn std::future::Future<Output = Result<Item, glib::Error>> + 'static>> { - let service = service.map(ToOwned::to_owned); - let item_path = String::from(item_path); - Box_::pin(gio::GioFuture::new(&(), move |_obj, cancellable, send| { - Self::new_for_dbus_path( - service.as_ref().map(::std::borrow::Borrow::borrow), - &item_path, - flags, - Some(cancellable), - move |res| { - send.resolve(res); - }, - ); - })) - } -} - -mod sealed { - pub trait Sealed {} - impl<T: super::IsA<super::Item>> Sealed for T {} -} - -pub trait ItemExt: IsA<Item> + sealed::Sealed + 'static { - #[doc(alias = "secret_item_delete")] - fn delete<P: FnOnce(Result<(), glib::Error>) + 'static>( - &self, - cancellable: Option<&impl IsA<gio::Cancellable>>, - callback: P, - ) { - let main_context = glib::MainContext::ref_thread_default(); - let is_main_context_owner = main_context.is_owner(); - let has_acquired_main_context = (!is_main_context_owner) - .then(|| main_context.acquire().ok()) - .flatten(); - assert!( - is_main_context_owner || has_acquired_main_context.is_some(), - "Async operations only allowed if the thread is owning the MainContext" - ); - - let user_data: Box_<glib::thread_guard::ThreadGuard<P>> = - Box_::new(glib::thread_guard::ThreadGuard::new(callback)); - unsafe extern "C" fn delete_trampoline<P: FnOnce(Result<(), glib::Error>) + 'static>( - _source_object: *mut glib::gobject_ffi::GObject, - res: *mut gio::ffi::GAsyncResult, - user_data: glib::ffi::gpointer, - ) { - let mut error = std::ptr::null_mut(); - let _ = ffi::secret_item_delete_finish(_source_object as *mut _, res, &mut error); - let result = if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - }; - let callback: Box_<glib::thread_guard::ThreadGuard<P>> = - Box_::from_raw(user_data as *mut _); - let callback: P = callback.into_inner(); - callback(result); - } - let callback = delete_trampoline::<P>; - unsafe { - ffi::secret_item_delete( - self.as_ref().to_glib_none().0, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - Some(callback), - Box_::into_raw(user_data) as *mut _, - ); - } - } - - fn delete_future( - &self, - ) -> Pin<Box_<dyn std::future::Future<Output = Result<(), glib::Error>> + 'static>> { - Box_::pin(gio::GioFuture::new(self, move |obj, cancellable, send| { - obj.delete(Some(cancellable), move |res| { - send.resolve(res); - }); - })) - } - - #[doc(alias = "secret_item_delete_sync")] - fn delete_sync( - &self, - cancellable: Option<&impl IsA<gio::Cancellable>>, - ) -> Result<(), glib::Error> { - unsafe { - let mut error = std::ptr::null_mut(); - let is_ok = ffi::secret_item_delete_sync( - self.as_ref().to_glib_none().0, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); - debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - } - } - } - - #[cfg(not(feature = "v0_19"))] - #[cfg_attr(docsrs, doc(cfg(not(feature = "v0_19"))))] - #[doc(alias = "secret_item_get_created")] - #[doc(alias = "get_created")] - fn created(&self) -> u64 { - unsafe { ffi::secret_item_get_created(self.as_ref().to_glib_none().0) } - } - - #[doc(alias = "secret_item_get_flags")] - #[doc(alias = "get_flags")] - fn flags(&self) -> ItemFlags { - unsafe { from_glib(ffi::secret_item_get_flags(self.as_ref().to_glib_none().0)) } - } - - #[cfg(not(feature = "v0_19"))] - #[cfg_attr(docsrs, doc(cfg(not(feature = "v0_19"))))] - #[doc(alias = "secret_item_get_label")] - #[doc(alias = "get_label")] - fn label(&self) -> glib::GString { - unsafe { from_glib_full(ffi::secret_item_get_label(self.as_ref().to_glib_none().0)) } - } - - #[doc(alias = "secret_item_get_locked")] - #[doc(alias = "get_locked")] - fn is_locked(&self) -> bool { - unsafe { from_glib(ffi::secret_item_get_locked(self.as_ref().to_glib_none().0)) } - } - - #[cfg(not(feature = "v0_19"))] - #[cfg_attr(docsrs, doc(cfg(not(feature = "v0_19"))))] - #[doc(alias = "secret_item_get_modified")] - #[doc(alias = "get_modified")] - fn modified(&self) -> u64 { - unsafe { ffi::secret_item_get_modified(self.as_ref().to_glib_none().0) } - } - - #[doc(alias = "secret_item_get_schema_name")] - #[doc(alias = "get_schema_name")] - fn schema_name(&self) -> Option<glib::GString> { - unsafe { - from_glib_full(ffi::secret_item_get_schema_name( - self.as_ref().to_glib_none().0, - )) - } - } - - #[doc(alias = "secret_item_get_secret")] - #[doc(alias = "get_secret")] - fn secret(&self) -> Option<Value> { - unsafe { from_glib_full(ffi::secret_item_get_secret(self.as_ref().to_glib_none().0)) } - } - - #[doc(alias = "secret_item_get_service")] - #[doc(alias = "get_service")] - fn service(&self) -> Service { - unsafe { from_glib_none(ffi::secret_item_get_service(self.as_ref().to_glib_none().0)) } - } - - #[doc(alias = "secret_item_load_secret")] - fn load_secret<P: FnOnce(Result<(), glib::Error>) + 'static>( - &self, - cancellable: Option<&impl IsA<gio::Cancellable>>, - callback: P, - ) { - let main_context = glib::MainContext::ref_thread_default(); - let is_main_context_owner = main_context.is_owner(); - let has_acquired_main_context = (!is_main_context_owner) - .then(|| main_context.acquire().ok()) - .flatten(); - assert!( - is_main_context_owner || has_acquired_main_context.is_some(), - "Async operations only allowed if the thread is owning the MainContext" - ); - - let user_data: Box_<glib::thread_guard::ThreadGuard<P>> = - Box_::new(glib::thread_guard::ThreadGuard::new(callback)); - unsafe extern "C" fn load_secret_trampoline< - P: FnOnce(Result<(), glib::Error>) + 'static, - >( - _source_object: *mut glib::gobject_ffi::GObject, - res: *mut gio::ffi::GAsyncResult, - user_data: glib::ffi::gpointer, - ) { - let mut error = std::ptr::null_mut(); - let _ = ffi::secret_item_load_secret_finish(_source_object as *mut _, res, &mut error); - let result = if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - }; - let callback: Box_<glib::thread_guard::ThreadGuard<P>> = - Box_::from_raw(user_data as *mut _); - let callback: P = callback.into_inner(); - callback(result); - } - let callback = load_secret_trampoline::<P>; - unsafe { - ffi::secret_item_load_secret( - self.as_ref().to_glib_none().0, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - Some(callback), - Box_::into_raw(user_data) as *mut _, - ); - } - } - - fn load_secret_future( - &self, - ) -> Pin<Box_<dyn std::future::Future<Output = Result<(), glib::Error>> + 'static>> { - Box_::pin(gio::GioFuture::new(self, move |obj, cancellable, send| { - obj.load_secret(Some(cancellable), move |res| { - send.resolve(res); - }); - })) - } - - #[doc(alias = "secret_item_load_secret_sync")] - fn load_secret_sync( - &self, - cancellable: Option<&impl IsA<gio::Cancellable>>, - ) -> Result<(), glib::Error> { - unsafe { - let mut error = std::ptr::null_mut(); - let is_ok = ffi::secret_item_load_secret_sync( - self.as_ref().to_glib_none().0, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); - debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - } - } - } - - #[doc(alias = "secret_item_refresh")] - fn refresh(&self) { - unsafe { - ffi::secret_item_refresh(self.as_ref().to_glib_none().0); - } - } - - #[doc(alias = "secret_item_set_label")] - fn set_label<P: FnOnce(Result<(), glib::Error>) + 'static>( - &self, - label: &str, - cancellable: Option<&impl IsA<gio::Cancellable>>, - callback: P, - ) { - let main_context = glib::MainContext::ref_thread_default(); - let is_main_context_owner = main_context.is_owner(); - let has_acquired_main_context = (!is_main_context_owner) - .then(|| main_context.acquire().ok()) - .flatten(); - assert!( - is_main_context_owner || has_acquired_main_context.is_some(), - "Async operations only allowed if the thread is owning the MainContext" - ); - - let user_data: Box_<glib::thread_guard::ThreadGuard<P>> = - Box_::new(glib::thread_guard::ThreadGuard::new(callback)); - unsafe extern "C" fn set_label_trampoline<P: FnOnce(Result<(), glib::Error>) + 'static>( - _source_object: *mut glib::gobject_ffi::GObject, - res: *mut gio::ffi::GAsyncResult, - user_data: glib::ffi::gpointer, - ) { - let mut error = std::ptr::null_mut(); - let _ = ffi::secret_item_set_label_finish(_source_object as *mut _, res, &mut error); - let result = if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - }; - let callback: Box_<glib::thread_guard::ThreadGuard<P>> = - Box_::from_raw(user_data as *mut _); - let callback: P = callback.into_inner(); - callback(result); - } - let callback = set_label_trampoline::<P>; - unsafe { - ffi::secret_item_set_label( - self.as_ref().to_glib_none().0, - label.to_glib_none().0, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - Some(callback), - Box_::into_raw(user_data) as *mut _, - ); - } - } - - fn set_label_future( - &self, - label: &str, - ) -> Pin<Box_<dyn std::future::Future<Output = Result<(), glib::Error>> + 'static>> { - let label = String::from(label); - Box_::pin(gio::GioFuture::new(self, move |obj, cancellable, send| { - obj.set_label(&label, Some(cancellable), move |res| { - send.resolve(res); - }); - })) - } - - #[doc(alias = "secret_item_set_label_sync")] - fn set_label_sync( - &self, - label: &str, - cancellable: Option<&impl IsA<gio::Cancellable>>, - ) -> Result<(), glib::Error> { - unsafe { - let mut error = std::ptr::null_mut(); - let is_ok = ffi::secret_item_set_label_sync( - self.as_ref().to_glib_none().0, - label.to_glib_none().0, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); - debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - } - } - } - - #[doc(alias = "secret_item_set_secret")] - fn set_secret<P: FnOnce(Result<(), glib::Error>) + 'static>( - &self, - value: &Value, - cancellable: Option<&impl IsA<gio::Cancellable>>, - callback: P, - ) { - let main_context = glib::MainContext::ref_thread_default(); - let is_main_context_owner = main_context.is_owner(); - let has_acquired_main_context = (!is_main_context_owner) - .then(|| main_context.acquire().ok()) - .flatten(); - assert!( - is_main_context_owner || has_acquired_main_context.is_some(), - "Async operations only allowed if the thread is owning the MainContext" - ); - - let user_data: Box_<glib::thread_guard::ThreadGuard<P>> = - Box_::new(glib::thread_guard::ThreadGuard::new(callback)); - unsafe extern "C" fn set_secret_trampoline<P: FnOnce(Result<(), glib::Error>) + 'static>( - _source_object: *mut glib::gobject_ffi::GObject, - res: *mut gio::ffi::GAsyncResult, - user_data: glib::ffi::gpointer, - ) { - let mut error = std::ptr::null_mut(); - let _ = ffi::secret_item_set_secret_finish(_source_object as *mut _, res, &mut error); - let result = if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - }; - let callback: Box_<glib::thread_guard::ThreadGuard<P>> = - Box_::from_raw(user_data as *mut _); - let callback: P = callback.into_inner(); - callback(result); - } - let callback = set_secret_trampoline::<P>; - unsafe { - ffi::secret_item_set_secret( - self.as_ref().to_glib_none().0, - value.to_glib_none().0, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - Some(callback), - Box_::into_raw(user_data) as *mut _, - ); - } - } - - fn set_secret_future( - &self, - value: &Value, - ) -> Pin<Box_<dyn std::future::Future<Output = Result<(), glib::Error>> + 'static>> { - let value = value.clone(); - Box_::pin(gio::GioFuture::new(self, move |obj, cancellable, send| { - obj.set_secret(&value, Some(cancellable), move |res| { - send.resolve(res); - }); - })) - } - - #[doc(alias = "secret_item_set_secret_sync")] - fn set_secret_sync( - &self, - value: &Value, - cancellable: Option<&impl IsA<gio::Cancellable>>, - ) -> Result<(), glib::Error> { - unsafe { - let mut error = std::ptr::null_mut(); - let is_ok = ffi::secret_item_set_secret_sync( - self.as_ref().to_glib_none().0, - value.to_glib_none().0, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); - debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - } - } - } - - #[doc(alias = "locked")] - fn connect_locked_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_locked_trampoline<P: IsA<Item>, F: Fn(&P) + 'static>( - this: *mut ffi::SecretItem, - _param_spec: glib::ffi::gpointer, - f: glib::ffi::gpointer, - ) { - let f: &F = &*(f as *const F); - f(Item::from_glib_borrow(this).unsafe_cast_ref()) - } - unsafe { - let f: Box_<F> = Box_::new(f); - connect_raw( - self.as_ptr() as *mut _, - b"notify::locked\0".as_ptr() as *const _, - Some(std::mem::transmute::<_, unsafe extern "C" fn()>( - notify_locked_trampoline::<Self, F> as *const (), - )), - Box_::into_raw(f), - ) - } - } -} - -impl<O: IsA<Item>> ItemExt for O {} diff --git a/libsecret/src/auto/mod.rs b/libsecret/src/auto/mod.rs deleted file mode 100644 index a8d7346..0000000 --- a/libsecret/src/auto/mod.rs +++ /dev/null @@ -1,75 +0,0 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir) -// from -// from gir-files (https://github.com/gtk-rs/gir-files.git) -// DO NOT EDIT - -#[cfg(feature = "v0_19")] -#[cfg_attr(docsrs, doc(cfg(feature = "v0_19")))] -mod backend; -#[cfg(feature = "v0_19")] -#[cfg_attr(docsrs, doc(cfg(feature = "v0_19")))] -pub use self::backend::Backend; - -mod collection; -pub use self::collection::Collection; - -mod item; -pub use self::item::Item; - -mod prompt; -pub use self::prompt::Prompt; - -#[cfg(feature = "v0_19")] -#[cfg_attr(docsrs, doc(cfg(feature = "v0_19")))] -mod retrievable; -#[cfg(feature = "v0_19")] -#[cfg_attr(docsrs, doc(cfg(feature = "v0_19")))] -pub use self::retrievable::Retrievable; - -mod service; -pub use self::service::Service; - -mod schema; -pub use self::schema::Schema; - -mod schema_attribute; -pub use self::schema_attribute::SchemaAttribute; - -mod enums; -#[cfg(feature = "v0_19")] -#[cfg_attr(docsrs, doc(cfg(feature = "v0_19")))] -pub use self::enums::BackendFlags; -pub use self::enums::Error; -pub use self::enums::SchemaAttributeType; -#[cfg(feature = "v0_18_6")] -#[cfg_attr(docsrs, doc(cfg(feature = "v0_18_6")))] -pub use self::enums::SchemaType; - -mod flags; -pub use self::flags::CollectionCreateFlags; -pub use self::flags::CollectionFlags; -pub use self::flags::ItemCreateFlags; -pub use self::flags::ItemFlags; -pub use self::flags::SchemaFlags; -pub use self::flags::SearchFlags; -pub use self::flags::ServiceFlags; - -pub(crate) mod functions; - -mod constants; -pub use self::constants::BACKEND_EXTENSION_POINT_NAME; -pub use self::constants::COLLECTION_DEFAULT; -pub use self::constants::COLLECTION_SESSION; - -pub(crate) mod traits { - #[cfg(feature = "v0_19")] - #[cfg_attr(docsrs, doc(cfg(feature = "v0_19")))] - pub use super::backend::BackendExt; - pub use super::collection::CollectionExt; - pub use super::item::ItemExt; - pub use super::prompt::PromptExt; - #[cfg(feature = "v0_19")] - #[cfg_attr(docsrs, doc(cfg(feature = "v0_19")))] - pub use super::retrievable::RetrievableExt; - pub use super::service::ServiceExt; -} diff --git a/libsecret/src/auto/prompt.rs b/libsecret/src/auto/prompt.rs deleted file mode 100644 index 245f68a..0000000 --- a/libsecret/src/auto/prompt.rs +++ /dev/null @@ -1,76 +0,0 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir) -// from -// from gir-files (https://github.com/gtk-rs/gir-files.git) -// DO NOT EDIT - -use glib::{prelude::*, translate::*}; - -glib::wrapper! { - #[doc(alias = "SecretPrompt")] - pub struct Prompt(Object<ffi::SecretPrompt, ffi::SecretPromptClass>) @extends gio::DBusProxy, @implements gio::DBusInterface, gio::Initable; - - match fn { - type_ => || ffi::secret_prompt_get_type(), - } -} - -impl Prompt { - pub const NONE: Option<&'static Prompt> = None; -} - -mod sealed { - pub trait Sealed {} - impl<T: super::IsA<super::Prompt>> Sealed for T {} -} - -pub trait PromptExt: IsA<Prompt> + sealed::Sealed + 'static { - #[doc(alias = "secret_prompt_perform_sync")] - fn perform_sync( - &self, - window_id: Option<&str>, - cancellable: Option<&impl IsA<gio::Cancellable>>, - return_type: &glib::VariantTy, - ) -> Result<glib::Variant, glib::Error> { - unsafe { - let mut error = std::ptr::null_mut(); - let ret = ffi::secret_prompt_perform_sync( - self.as_ref().to_glib_none().0, - window_id.to_glib_none().0, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - return_type.to_glib_none().0, - &mut error, - ); - if error.is_null() { - Ok(from_glib_full(ret)) - } else { - Err(from_glib_full(error)) - } - } - } - - #[doc(alias = "secret_prompt_run")] - fn run( - &self, - window_id: Option<&str>, - cancellable: Option<&impl IsA<gio::Cancellable>>, - return_type: &glib::VariantTy, - ) -> Result<glib::Variant, glib::Error> { - unsafe { - let mut error = std::ptr::null_mut(); - let ret = ffi::secret_prompt_run( - self.as_ref().to_glib_none().0, - window_id.to_glib_none().0, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - return_type.to_glib_none().0, - &mut error, - ); - if error.is_null() { - Ok(from_glib_full(ret)) - } else { - Err(from_glib_full(error)) - } - } - } -} - -impl<O: IsA<Prompt>> PromptExt for O {} diff --git a/libsecret/src/auto/retrievable.rs b/libsecret/src/auto/retrievable.rs deleted file mode 100644 index 14ab08f..0000000 --- a/libsecret/src/auto/retrievable.rs +++ /dev/null @@ -1,269 +0,0 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir) -// from -// from gir-files (https://github.com/gtk-rs/gir-files.git) -// DO NOT EDIT - -use crate::Value; -use glib::{ - prelude::*, - signal::{connect_raw, SignalHandlerId}, - translate::*, -}; -use std::{boxed::Box as Box_, pin::Pin}; - -glib::wrapper! { - #[doc(alias = "SecretRetrievable")] - pub struct Retrievable(Interface<ffi::SecretRetrievable, ffi::SecretRetrievableInterface>); - - match fn { - type_ => || ffi::secret_retrievable_get_type(), - } -} - -impl Retrievable { - pub const NONE: Option<&'static Retrievable> = None; -} - -mod sealed { - pub trait Sealed {} - impl<T: super::IsA<super::Retrievable>> Sealed for T {} -} - -pub trait RetrievableExt: IsA<Retrievable> + sealed::Sealed + 'static { - #[doc(alias = "secret_retrievable_get_created")] - #[doc(alias = "get_created")] - fn created(&self) -> u64 { - unsafe { ffi::secret_retrievable_get_created(self.as_ref().to_glib_none().0) } - } - - #[doc(alias = "secret_retrievable_get_label")] - #[doc(alias = "get_label")] - fn label(&self) -> glib::GString { - unsafe { - from_glib_full(ffi::secret_retrievable_get_label( - self.as_ref().to_glib_none().0, - )) - } - } - - #[doc(alias = "secret_retrievable_get_modified")] - #[doc(alias = "get_modified")] - fn modified(&self) -> u64 { - unsafe { ffi::secret_retrievable_get_modified(self.as_ref().to_glib_none().0) } - } - - #[doc(alias = "secret_retrievable_retrieve_secret")] - fn retrieve_secret<P: FnOnce(Result<Option<Value>, glib::Error>) + 'static>( - &self, - cancellable: Option<&impl IsA<gio::Cancellable>>, - callback: P, - ) { - let main_context = glib::MainContext::ref_thread_default(); - let is_main_context_owner = main_context.is_owner(); - let has_acquired_main_context = (!is_main_context_owner) - .then(|| main_context.acquire().ok()) - .flatten(); - assert!( - is_main_context_owner || has_acquired_main_context.is_some(), - "Async operations only allowed if the thread is owning the MainContext" - ); - - let user_data: Box_<glib::thread_guard::ThreadGuard<P>> = - Box_::new(glib::thread_guard::ThreadGuard::new(callback)); - unsafe extern "C" fn retrieve_secret_trampoline< - P: FnOnce(Result<Option<Value>, glib::Error>) + 'static, - >( - _source_object: *mut glib::gobject_ffi::GObject, - res: *mut gio::ffi::GAsyncResult, - user_data: glib::ffi::gpointer, - ) { - let mut error = std::ptr::null_mut(); - let ret = ffi::secret_retrievable_retrieve_secret_finish( - _source_object as *mut _, - res, - &mut error, - ); - let result = if error.is_null() { - Ok(from_glib_full(ret)) - } else { - Err(from_glib_full(error)) - }; - let callback: Box_<glib::thread_guard::ThreadGuard<P>> = - Box_::from_raw(user_data as *mut _); - let callback: P = callback.into_inner(); - callback(result); - } - let callback = retrieve_secret_trampoline::<P>; - unsafe { - ffi::secret_retrievable_retrieve_secret( - self.as_ref().to_glib_none().0, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - Some(callback), - Box_::into_raw(user_data) as *mut _, - ); - } - } - - fn retrieve_secret_future( - &self, - ) -> Pin<Box_<dyn std::future::Future<Output = Result<Option<Value>, glib::Error>> + 'static>> - { - Box_::pin(gio::GioFuture::new(self, move |obj, cancellable, send| { - obj.retrieve_secret(Some(cancellable), move |res| { - send.resolve(res); - }); - })) - } - - #[doc(alias = "secret_retrievable_retrieve_secret_sync")] - fn retrieve_secret_sync( - &self, - cancellable: Option<&impl IsA<gio::Cancellable>>, - ) -> Result<Option<Value>, glib::Error> { - unsafe { - let mut error = std::ptr::null_mut(); - let ret = ffi::secret_retrievable_retrieve_secret_sync( - self.as_ref().to_glib_none().0, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); - if error.is_null() { - Ok(from_glib_full(ret)) - } else { - Err(from_glib_full(error)) - } - } - } - - //#[cfg(feature = "v0_19")] - //#[cfg_attr(docsrs, doc(cfg(feature = "v0_19")))] - //fn set_attributes(&self, attributes: /*Unimplemented*/HashTable TypeId { ns_id: 0, id: 28 }/TypeId { ns_id: 0, id: 28 }) { - // ObjectExt::set_property(self.as_ref(),"attributes", attributes) - //} - - #[cfg(feature = "v0_19")] - #[cfg_attr(docsrs, doc(cfg(feature = "v0_19")))] - fn set_created(&self, created: u64) { - ObjectExt::set_property(self.as_ref(), "created", created) - } - - #[cfg(feature = "v0_19")] - #[cfg_attr(docsrs, doc(cfg(feature = "v0_19")))] - fn set_label(&self, label: Option<&str>) { - ObjectExt::set_property(self.as_ref(), "label", label) - } - - #[cfg(feature = "v0_19")] - #[cfg_attr(docsrs, doc(cfg(feature = "v0_19")))] - fn set_modified(&self, modified: u64) { - ObjectExt::set_property(self.as_ref(), "modified", modified) - } - - #[cfg(feature = "v0_19")] - #[cfg_attr(docsrs, doc(cfg(feature = "v0_19")))] - #[doc(alias = "attributes")] - fn connect_attributes_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_attributes_trampoline< - P: IsA<Retrievable>, - F: Fn(&P) + 'static, - >( - this: *mut ffi::SecretRetrievable, - _param_spec: glib::ffi::gpointer, - f: glib::ffi::gpointer, - ) { - let f: &F = &*(f as *const F); - f(Retrievable::from_glib_borrow(this).unsafe_cast_ref()) - } - unsafe { - let f: Box_<F> = Box_::new(f); - connect_raw( - self.as_ptr() as *mut _, - b"notify::attributes\0".as_ptr() as *const _, - Some(std::mem::transmute::<_, unsafe extern "C" fn()>( - notify_attributes_trampoline::<Self, F> as *const (), - )), - Box_::into_raw(f), - ) - } - } - - #[cfg(feature = "v0_19")] - #[cfg_attr(docsrs, doc(cfg(feature = "v0_19")))] - #[doc(alias = "created")] - fn connect_created_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_created_trampoline<P: IsA<Retrievable>, F: Fn(&P) + 'static>( - this: *mut ffi::SecretRetrievable, - _param_spec: glib::ffi::gpointer, - f: glib::ffi::gpointer, - ) { - let f: &F = &*(f as *const F); - f(Retrievable::from_glib_borrow(this).unsafe_cast_ref()) - } - unsafe { - let f: Box_<F> = Box_::new(f); - connect_raw( - self.as_ptr() as *mut _, - b"notify::created\0".as_ptr() as *const _, - Some(std::mem::transmute::<_, unsafe extern "C" fn()>( - notify_created_trampoline::<Self, F> as *const (), - )), - Box_::into_raw(f), - ) - } - } - - #[cfg(feature = "v0_19")] - #[cfg_attr(docsrs, doc(cfg(feature = "v0_19")))] - #[doc(alias = "label")] - fn connect_label_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_label_trampoline<P: IsA<Retrievable>, F: Fn(&P) + 'static>( - this: *mut ffi::SecretRetrievable, - _param_spec: glib::ffi::gpointer, - f: glib::ffi::gpointer, - ) { - let f: &F = &*(f as *const F); - f(Retrievable::from_glib_borrow(this).unsafe_cast_ref()) - } - unsafe { - let f: Box_<F> = Box_::new(f); - connect_raw( - self.as_ptr() as *mut _, - b"notify::label\0".as_ptr() as *const _, - Some(std::mem::transmute::<_, unsafe extern "C" fn()>( - notify_label_trampoline::<Self, F> as *const (), - )), - Box_::into_raw(f), - ) - } - } - - #[cfg(feature = "v0_19")] - #[cfg_attr(docsrs, doc(cfg(feature = "v0_19")))] - #[doc(alias = "modified")] - fn connect_modified_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_modified_trampoline< - P: IsA<Retrievable>, - F: Fn(&P) + 'static, - >( - this: *mut ffi::SecretRetrievable, - _param_spec: glib::ffi::gpointer, - f: glib::ffi::gpointer, - ) { - let f: &F = &*(f as *const F); - f(Retrievable::from_glib_borrow(this).unsafe_cast_ref()) - } - unsafe { - let f: Box_<F> = Box_::new(f); - connect_raw( - self.as_ptr() as *mut _, - b"notify::modified\0".as_ptr() as *const _, - Some(std::mem::transmute::<_, unsafe extern "C" fn()>( - notify_modified_trampoline::<Self, F> as *const (), - )), - Box_::into_raw(f), - ) - } - } -} - -impl<O: IsA<Retrievable>> RetrievableExt for O {} diff --git a/libsecret/src/auto/schema.rs b/libsecret/src/auto/schema.rs deleted file mode 100644 index 9889b31..0000000 --- a/libsecret/src/auto/schema.rs +++ /dev/null @@ -1,15 +0,0 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir) -// from -// from gir-files (https://github.com/gtk-rs/gir-files.git) -// DO NOT EDIT - -glib::wrapper! { - #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] - pub struct Schema(Shared<ffi::SecretSchema>); - - match fn { - ref => |ptr| ffi::secret_schema_ref(ptr), - unref => |ptr| ffi::secret_schema_unref(ptr), - type_ => || ffi::secret_schema_get_type(), - } -} diff --git a/libsecret/src/auto/schema_attribute.rs b/libsecret/src/auto/schema_attribute.rs deleted file mode 100644 index be20632..0000000 --- a/libsecret/src/auto/schema_attribute.rs +++ /dev/null @@ -1,15 +0,0 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir) -// from -// from gir-files (https://github.com/gtk-rs/gir-files.git) -// DO NOT EDIT - -glib::wrapper! { - #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] - pub struct SchemaAttribute(Boxed<ffi::SecretSchemaAttribute>); - - match fn { - copy => |ptr| glib::gobject_ffi::g_boxed_copy(ffi::secret_schema_attribute_get_type(), ptr as *mut _) as *mut ffi::SecretSchemaAttribute, - free => |ptr| glib::gobject_ffi::g_boxed_free(ffi::secret_schema_attribute_get_type(), ptr as *mut _), - type_ => || ffi::secret_schema_attribute_get_type(), - } -} diff --git a/libsecret/src/auto/service.rs b/libsecret/src/auto/service.rs deleted file mode 100644 index b4882b3..0000000 --- a/libsecret/src/auto/service.rs +++ /dev/null @@ -1,1208 +0,0 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir) -// from -// from gir-files (https://github.com/gtk-rs/gir-files.git) -// DO NOT EDIT - -#[cfg(feature = "v0_19")] -#[cfg_attr(docsrs, doc(cfg(feature = "v0_19")))] -use crate::Backend; -use crate::{Collection, Item, Prompt, ServiceFlags, Value}; -use glib::{prelude::*, translate::*}; -use std::{boxed::Box as Box_, pin::Pin}; - -#[cfg(feature = "v0_19")] -#[cfg_attr(docsrs, doc(cfg(feature = "v0_19")))] -glib::wrapper! { - #[doc(alias = "SecretService")] - pub struct Service(Object<ffi::SecretService, ffi::SecretServiceClass>) @extends gio::DBusProxy, @implements gio::DBusInterface, gio::Initable, Backend; - - match fn { - type_ => || ffi::secret_service_get_type(), - } -} - -#[cfg(not(any(feature = "v0_19")))] -glib::wrapper! { - #[doc(alias = "SecretService")] - pub struct Service(Object<ffi::SecretService, ffi::SecretServiceClass>) @extends gio::DBusProxy, @implements gio::DBusInterface, gio::Initable; - - match fn { - type_ => || ffi::secret_service_get_type(), - } -} - -impl Service { - pub const NONE: Option<&'static Service> = None; - - #[doc(alias = "secret_service_disconnect")] - pub fn disconnect() { - unsafe { - ffi::secret_service_disconnect(); - } - } - - #[doc(alias = "secret_service_get")] - pub fn get<P: FnOnce(Result<Service, glib::Error>) + 'static>( - flags: ServiceFlags, - cancellable: Option<&impl IsA<gio::Cancellable>>, - callback: P, - ) { - let main_context = glib::MainContext::ref_thread_default(); - let is_main_context_owner = main_context.is_owner(); - let has_acquired_main_context = (!is_main_context_owner) - .then(|| main_context.acquire().ok()) - .flatten(); - assert!( - is_main_context_owner || has_acquired_main_context.is_some(), - "Async operations only allowed if the thread is owning the MainContext" - ); - - let user_data: Box_<glib::thread_guard::ThreadGuard<P>> = - Box_::new(glib::thread_guard::ThreadGuard::new(callback)); - unsafe extern "C" fn get_trampoline<P: FnOnce(Result<Service, glib::Error>) + 'static>( - _source_object: *mut glib::gobject_ffi::GObject, - res: *mut gio::ffi::GAsyncResult, - user_data: glib::ffi::gpointer, - ) { - let mut error = std::ptr::null_mut(); - let ret = ffi::secret_service_get_finish(res, &mut error); - let result = if error.is_null() { - Ok(from_glib_full(ret)) - } else { - Err(from_glib_full(error)) - }; - let callback: Box_<glib::thread_guard::ThreadGuard<P>> = - Box_::from_raw(user_data as *mut _); - let callback: P = callback.into_inner(); - callback(result); - } - let callback = get_trampoline::<P>; - unsafe { - ffi::secret_service_get( - flags.into_glib(), - cancellable.map(|p| p.as_ref()).to_glib_none().0, - Some(callback), - Box_::into_raw(user_data) as *mut _, - ); - } - } - - pub fn get_future( - flags: ServiceFlags, - ) -> Pin<Box_<dyn std::future::Future<Output = Result<Service, glib::Error>> + 'static>> { - Box_::pin(gio::GioFuture::new(&(), move |_obj, cancellable, send| { - Self::get(flags, Some(cancellable), move |res| { - send.resolve(res); - }); - })) - } - - #[doc(alias = "secret_service_get_sync")] - #[doc(alias = "get_sync")] - pub fn sync( - flags: ServiceFlags, - cancellable: Option<&impl IsA<gio::Cancellable>>, - ) -> Result<Service, glib::Error> { - unsafe { - let mut error = std::ptr::null_mut(); - let ret = ffi::secret_service_get_sync( - flags.into_glib(), - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); - if error.is_null() { - Ok(from_glib_full(ret)) - } else { - Err(from_glib_full(error)) - } - } - } - - #[doc(alias = "secret_service_open")] - pub fn open<P: FnOnce(Result<Service, glib::Error>) + 'static>( - service_gtype: glib::types::Type, - service_bus_name: Option<&str>, - flags: ServiceFlags, - cancellable: Option<&impl IsA<gio::Cancellable>>, - callback: P, - ) { - let main_context = glib::MainContext::ref_thread_default(); - let is_main_context_owner = main_context.is_owner(); - let has_acquired_main_context = (!is_main_context_owner) - .then(|| main_context.acquire().ok()) - .flatten(); - assert!( - is_main_context_owner || has_acquired_main_context.is_some(), - "Async operations only allowed if the thread is owning the MainContext" - ); - - let user_data: Box_<glib::thread_guard::ThreadGuard<P>> = - Box_::new(glib::thread_guard::ThreadGuard::new(callback)); - unsafe extern "C" fn open_trampoline<P: FnOnce(Result<Service, glib::Error>) + 'static>( - _source_object: *mut glib::gobject_ffi::GObject, - res: *mut gio::ffi::GAsyncResult, - user_data: glib::ffi::gpointer, - ) { - let mut error = std::ptr::null_mut(); - let ret = ffi::secret_service_open_finish(res, &mut error); - let result = if error.is_null() { - Ok(from_glib_full(ret)) - } else { - Err(from_glib_full(error)) - }; - let callback: Box_<glib::thread_guard::ThreadGuard<P>> = - Box_::from_raw(user_data as *mut _); - let callback: P = callback.into_inner(); - callback(result); - } - let callback = open_trampoline::<P>; - unsafe { - ffi::secret_service_open( - service_gtype.into_glib(), - service_bus_name.to_glib_none().0, - flags.into_glib(), - cancellable.map(|p| p.as_ref()).to_glib_none().0, - Some(callback), - Box_::into_raw(user_data) as *mut _, - ); - } - } - - pub fn open_future( - service_gtype: glib::types::Type, - service_bus_name: Option<&str>, - flags: ServiceFlags, - ) -> Pin<Box_<dyn std::future::Future<Output = Result<Service, glib::Error>> + 'static>> { - let service_bus_name = service_bus_name.map(ToOwned::to_owned); - Box_::pin(gio::GioFuture::new(&(), move |_obj, cancellable, send| { - Self::open( - service_gtype, - service_bus_name.as_ref().map(::std::borrow::Borrow::borrow), - flags, - Some(cancellable), - move |res| { - send.resolve(res); - }, - ); - })) - } - - #[doc(alias = "secret_service_open_sync")] - pub fn open_sync( - service_gtype: glib::types::Type, - service_bus_name: Option<&str>, - flags: ServiceFlags, - cancellable: Option<&impl IsA<gio::Cancellable>>, - ) -> Result<Service, glib::Error> { - unsafe { - let mut error = std::ptr::null_mut(); - let ret = ffi::secret_service_open_sync( - service_gtype.into_glib(), - service_bus_name.to_glib_none().0, - flags.into_glib(), - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); - if error.is_null() { - Ok(from_glib_full(ret)) - } else { - Err(from_glib_full(error)) - } - } - } -} - -mod sealed { - pub trait Sealed {} - impl<T: super::IsA<super::Service>> Sealed for T {} -} - -pub trait ServiceExt: IsA<Service> + sealed::Sealed + 'static { - //#[doc(alias = "secret_service_clear_sync")] - //fn clear_sync(&self, schema: Option<&Schema>, attributes: /*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 0, id: 28 }/TypeId { ns_id: 0, id: 28 }, cancellable: Option<&impl IsA<gio::Cancellable>>) -> Result<(), glib::Error> { - // unsafe { TODO: call ffi:secret_service_clear_sync() } - //} - - //#[doc(alias = "secret_service_create_collection_dbus_path_sync")] - //fn create_collection_dbus_path_sync(&self, properties: /*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 0, id: 28 }/TypeId { ns_id: 2, id: 222 }, alias: Option<&str>, flags: CollectionCreateFlags, cancellable: Option<&impl IsA<gio::Cancellable>>) -> Result<glib::GString, glib::Error> { - // unsafe { TODO: call ffi:secret_service_create_collection_dbus_path_sync() } - //} - - //#[doc(alias = "secret_service_create_item_dbus_path_sync")] - //fn create_item_dbus_path_sync(&self, collection_path: &str, properties: /*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 0, id: 28 }/TypeId { ns_id: 2, id: 222 }, value: &Value, flags: ItemCreateFlags, cancellable: Option<&impl IsA<gio::Cancellable>>) -> Result<glib::GString, glib::Error> { - // unsafe { TODO: call ffi:secret_service_create_item_dbus_path_sync() } - //} - - #[doc(alias = "secret_service_decode_dbus_secret")] - fn decode_dbus_secret(&self, value: &glib::Variant) -> Value { - unsafe { - from_glib_full(ffi::secret_service_decode_dbus_secret( - self.as_ref().to_glib_none().0, - value.to_glib_none().0, - )) - } - } - - #[doc(alias = "secret_service_delete_item_dbus_path")] - fn delete_item_dbus_path<P: FnOnce(Result<(), glib::Error>) + 'static>( - &self, - item_path: &str, - cancellable: Option<&impl IsA<gio::Cancellable>>, - callback: P, - ) { - let main_context = glib::MainContext::ref_thread_default(); - let is_main_context_owner = main_context.is_owner(); - let has_acquired_main_context = (!is_main_context_owner) - .then(|| main_context.acquire().ok()) - .flatten(); - assert!( - is_main_context_owner || has_acquired_main_context.is_some(), - "Async operations only allowed if the thread is owning the MainContext" - ); - - let user_data: Box_<glib::thread_guard::ThreadGuard<P>> = - Box_::new(glib::thread_guard::ThreadGuard::new(callback)); - unsafe extern "C" fn delete_item_dbus_path_trampoline< - P: FnOnce(Result<(), glib::Error>) + 'static, - >( - _source_object: *mut glib::gobject_ffi::GObject, - res: *mut gio::ffi::GAsyncResult, - user_data: glib::ffi::gpointer, - ) { - let mut error = std::ptr::null_mut(); - let _ = ffi::secret_service_delete_item_dbus_path_finish( - _source_object as *mut _, - res, - &mut error, - ); - let result = if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - }; - let callback: Box_<glib::thread_guard::ThreadGuard<P>> = - Box_::from_raw(user_data as *mut _); - let callback: P = callback.into_inner(); - callback(result); - } - let callback = delete_item_dbus_path_trampoline::<P>; - unsafe { - ffi::secret_service_delete_item_dbus_path( - self.as_ref().to_glib_none().0, - item_path.to_glib_none().0, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - Some(callback), - Box_::into_raw(user_data) as *mut _, - ); - } - } - - fn delete_item_dbus_path_future( - &self, - item_path: &str, - ) -> Pin<Box_<dyn std::future::Future<Output = Result<(), glib::Error>> + 'static>> { - let item_path = String::from(item_path); - Box_::pin(gio::GioFuture::new(self, move |obj, cancellable, send| { - obj.delete_item_dbus_path(&item_path, Some(cancellable), move |res| { - send.resolve(res); - }); - })) - } - - #[doc(alias = "secret_service_delete_item_dbus_path_sync")] - fn delete_item_dbus_path_sync( - &self, - item_path: &str, - cancellable: Option<&impl IsA<gio::Cancellable>>, - ) -> Result<(), glib::Error> { - unsafe { - let mut error = std::ptr::null_mut(); - let is_ok = ffi::secret_service_delete_item_dbus_path_sync( - self.as_ref().to_glib_none().0, - item_path.to_glib_none().0, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); - debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - } - } - } - - #[doc(alias = "secret_service_encode_dbus_secret")] - fn encode_dbus_secret(&self, value: &Value) -> glib::Variant { - unsafe { - from_glib_none(ffi::secret_service_encode_dbus_secret( - self.as_ref().to_glib_none().0, - value.to_glib_none().0, - )) - } - } - - #[doc(alias = "secret_service_ensure_session")] - fn ensure_session<P: FnOnce(Result<(), glib::Error>) + 'static>( - &self, - cancellable: Option<&impl IsA<gio::Cancellable>>, - callback: P, - ) { - let main_context = glib::MainContext::ref_thread_default(); - let is_main_context_owner = main_context.is_owner(); - let has_acquired_main_context = (!is_main_context_owner) - .then(|| main_context.acquire().ok()) - .flatten(); - assert!( - is_main_context_owner || has_acquired_main_context.is_some(), - "Async operations only allowed if the thread is owning the MainContext" - ); - - let user_data: Box_<glib::thread_guard::ThreadGuard<P>> = - Box_::new(glib::thread_guard::ThreadGuard::new(callback)); - unsafe extern "C" fn ensure_session_trampoline< - P: FnOnce(Result<(), glib::Error>) + 'static, - >( - _source_object: *mut glib::gobject_ffi::GObject, - res: *mut gio::ffi::GAsyncResult, - user_data: glib::ffi::gpointer, - ) { - let mut error = std::ptr::null_mut(); - let _ = ffi::secret_service_ensure_session_finish( - _source_object as *mut _, - res, - &mut error, - ); - let result = if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - }; - let callback: Box_<glib::thread_guard::ThreadGuard<P>> = - Box_::from_raw(user_data as *mut _); - let callback: P = callback.into_inner(); - callback(result); - } - let callback = ensure_session_trampoline::<P>; - unsafe { - ffi::secret_service_ensure_session( - self.as_ref().to_glib_none().0, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - Some(callback), - Box_::into_raw(user_data) as *mut _, - ); - } - } - - fn ensure_session_future( - &self, - ) -> Pin<Box_<dyn std::future::Future<Output = Result<(), glib::Error>> + 'static>> { - Box_::pin(gio::GioFuture::new(self, move |obj, cancellable, send| { - obj.ensure_session(Some(cancellable), move |res| { - send.resolve(res); - }); - })) - } - - #[doc(alias = "secret_service_ensure_session_sync")] - fn ensure_session_sync( - &self, - cancellable: Option<&impl IsA<gio::Cancellable>>, - ) -> Result<(), glib::Error> { - unsafe { - let mut error = std::ptr::null_mut(); - let is_ok = ffi::secret_service_ensure_session_sync( - self.as_ref().to_glib_none().0, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); - debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - } - } - } - - #[doc(alias = "secret_service_get_collection_gtype")] - #[doc(alias = "get_collection_gtype")] - fn collection_gtype(&self) -> glib::types::Type { - unsafe { - from_glib(ffi::secret_service_get_collection_gtype( - self.as_ref().to_glib_none().0, - )) - } - } - - #[doc(alias = "secret_service_get_collections")] - #[doc(alias = "get_collections")] - fn collections(&self) -> Vec<Collection> { - unsafe { - FromGlibPtrContainer::from_glib_full(ffi::secret_service_get_collections( - self.as_ref().to_glib_none().0, - )) - } - } - - #[doc(alias = "secret_service_get_flags")] - #[doc(alias = "get_flags")] - fn flags(&self) -> ServiceFlags { - unsafe { - from_glib(ffi::secret_service_get_flags( - self.as_ref().to_glib_none().0, - )) - } - } - - #[doc(alias = "secret_service_get_item_gtype")] - #[doc(alias = "get_item_gtype")] - fn item_gtype(&self) -> glib::types::Type { - unsafe { - from_glib(ffi::secret_service_get_item_gtype( - self.as_ref().to_glib_none().0, - )) - } - } - - #[doc(alias = "secret_service_get_secret_for_dbus_path")] - #[doc(alias = "get_secret_for_dbus_path")] - fn secret_for_dbus_path<P: FnOnce(Result<Option<Value>, glib::Error>) + 'static>( - &self, - item_path: &str, - cancellable: Option<&impl IsA<gio::Cancellable>>, - callback: P, - ) { - let main_context = glib::MainContext::ref_thread_default(); - let is_main_context_owner = main_context.is_owner(); - let has_acquired_main_context = (!is_main_context_owner) - .then(|| main_context.acquire().ok()) - .flatten(); - assert!( - is_main_context_owner || has_acquired_main_context.is_some(), - "Async operations only allowed if the thread is owning the MainContext" - ); - - let user_data: Box_<glib::thread_guard::ThreadGuard<P>> = - Box_::new(glib::thread_guard::ThreadGuard::new(callback)); - unsafe extern "C" fn secret_for_dbus_path_trampoline< - P: FnOnce(Result<Option<Value>, glib::Error>) + 'static, - >( - _source_object: *mut glib::gobject_ffi::GObject, - res: *mut gio::ffi::GAsyncResult, - user_data: glib::ffi::gpointer, - ) { - let mut error = std::ptr::null_mut(); - let ret = ffi::secret_service_get_secret_for_dbus_path_finish( - _source_object as *mut _, - res, - &mut error, - ); - let result = if error.is_null() { - Ok(from_glib_full(ret)) - } else { - Err(from_glib_full(error)) - }; - let callback: Box_<glib::thread_guard::ThreadGuard<P>> = - Box_::from_raw(user_data as *mut _); - let callback: P = callback.into_inner(); - callback(result); - } - let callback = secret_for_dbus_path_trampoline::<P>; - unsafe { - ffi::secret_service_get_secret_for_dbus_path( - self.as_ref().to_glib_none().0, - item_path.to_glib_none().0, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - Some(callback), - Box_::into_raw(user_data) as *mut _, - ); - } - } - - fn secret_for_dbus_path_future( - &self, - item_path: &str, - ) -> Pin<Box_<dyn std::future::Future<Output = Result<Option<Value>, glib::Error>> + 'static>> - { - let item_path = String::from(item_path); - Box_::pin(gio::GioFuture::new(self, move |obj, cancellable, send| { - obj.secret_for_dbus_path(&item_path, Some(cancellable), move |res| { - send.resolve(res); - }); - })) - } - - #[doc(alias = "secret_service_get_secret_for_dbus_path_sync")] - #[doc(alias = "get_secret_for_dbus_path_sync")] - fn secret_for_dbus_path_sync( - &self, - item_path: &str, - cancellable: Option<&impl IsA<gio::Cancellable>>, - ) -> Result<Option<Value>, glib::Error> { - unsafe { - let mut error = std::ptr::null_mut(); - let ret = ffi::secret_service_get_secret_for_dbus_path_sync( - self.as_ref().to_glib_none().0, - item_path.to_glib_none().0, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); - if error.is_null() { - Ok(from_glib_full(ret)) - } else { - Err(from_glib_full(error)) - } - } - } - - //#[doc(alias = "secret_service_get_secrets_for_dbus_paths_sync")] - //#[doc(alias = "get_secrets_for_dbus_paths_sync")] - //fn secrets_for_dbus_paths_sync(&self, item_paths: &str, cancellable: Option<&impl IsA<gio::Cancellable>>) -> Result</*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 0, id: 28 }/TypeId { ns_id: 1, id: 3 }, glib::Error> { - // unsafe { TODO: call ffi:secret_service_get_secrets_for_dbus_paths_sync() } - //} - - #[doc(alias = "secret_service_get_session_algorithms")] - #[doc(alias = "get_session_algorithms")] - fn session_algorithms(&self) -> Option<glib::GString> { - unsafe { - from_glib_none(ffi::secret_service_get_session_algorithms( - self.as_ref().to_glib_none().0, - )) - } - } - - #[doc(alias = "secret_service_get_session_dbus_path")] - #[doc(alias = "get_session_dbus_path")] - fn session_dbus_path(&self) -> Option<glib::GString> { - unsafe { - from_glib_none(ffi::secret_service_get_session_dbus_path( - self.as_ref().to_glib_none().0, - )) - } - } - - #[doc(alias = "secret_service_load_collections")] - fn load_collections<P: FnOnce(Result<(), glib::Error>) + 'static>( - &self, - cancellable: Option<&impl IsA<gio::Cancellable>>, - callback: P, - ) { - let main_context = glib::MainContext::ref_thread_default(); - let is_main_context_owner = main_context.is_owner(); - let has_acquired_main_context = (!is_main_context_owner) - .then(|| main_context.acquire().ok()) - .flatten(); - assert!( - is_main_context_owner || has_acquired_main_context.is_some(), - "Async operations only allowed if the thread is owning the MainContext" - ); - - let user_data: Box_<glib::thread_guard::ThreadGuard<P>> = - Box_::new(glib::thread_guard::ThreadGuard::new(callback)); - unsafe extern "C" fn load_collections_trampoline< - P: FnOnce(Result<(), glib::Error>) + 'static, - >( - _source_object: *mut glib::gobject_ffi::GObject, - res: *mut gio::ffi::GAsyncResult, - user_data: glib::ffi::gpointer, - ) { - let mut error = std::ptr::null_mut(); - let _ = ffi::secret_service_load_collections_finish( - _source_object as *mut _, - res, - &mut error, - ); - let result = if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - }; - let callback: Box_<glib::thread_guard::ThreadGuard<P>> = - Box_::from_raw(user_data as *mut _); - let callback: P = callback.into_inner(); - callback(result); - } - let callback = load_collections_trampoline::<P>; - unsafe { - ffi::secret_service_load_collections( - self.as_ref().to_glib_none().0, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - Some(callback), - Box_::into_raw(user_data) as *mut _, - ); - } - } - - fn load_collections_future( - &self, - ) -> Pin<Box_<dyn std::future::Future<Output = Result<(), glib::Error>> + 'static>> { - Box_::pin(gio::GioFuture::new(self, move |obj, cancellable, send| { - obj.load_collections(Some(cancellable), move |res| { - send.resolve(res); - }); - })) - } - - #[doc(alias = "secret_service_load_collections_sync")] - fn load_collections_sync( - &self, - cancellable: Option<&impl IsA<gio::Cancellable>>, - ) -> Result<(), glib::Error> { - unsafe { - let mut error = std::ptr::null_mut(); - let is_ok = ffi::secret_service_load_collections_sync( - self.as_ref().to_glib_none().0, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); - debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - } - } - } - - //#[doc(alias = "secret_service_lock_sync")] - //fn lock_sync(&self, objects: &[gio::DBusProxy], cancellable: Option<&impl IsA<gio::Cancellable>>, locked: /*Unimplemented*/Vec<gio::DBusProxy>) -> Result<i32, glib::Error> { - // unsafe { TODO: call ffi:secret_service_lock_sync() } - //} - - //#[doc(alias = "secret_service_lookup_sync")] - //fn lookup_sync(&self, schema: Option<&Schema>, attributes: /*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 0, id: 28 }/TypeId { ns_id: 0, id: 28 }, cancellable: Option<&impl IsA<gio::Cancellable>>) -> Result<Value, glib::Error> { - // unsafe { TODO: call ffi:secret_service_lookup_sync() } - //} - - #[doc(alias = "secret_service_prompt")] - fn prompt<P: FnOnce(Result<glib::Variant, glib::Error>) + 'static>( - &self, - prompt: &impl IsA<Prompt>, - return_type: Option<&glib::VariantTy>, - cancellable: Option<&impl IsA<gio::Cancellable>>, - callback: P, - ) { - let main_context = glib::MainContext::ref_thread_default(); - let is_main_context_owner = main_context.is_owner(); - let has_acquired_main_context = (!is_main_context_owner) - .then(|| main_context.acquire().ok()) - .flatten(); - assert!( - is_main_context_owner || has_acquired_main_context.is_some(), - "Async operations only allowed if the thread is owning the MainContext" - ); - - let user_data: Box_<glib::thread_guard::ThreadGuard<P>> = - Box_::new(glib::thread_guard::ThreadGuard::new(callback)); - unsafe extern "C" fn prompt_trampoline< - P: FnOnce(Result<glib::Variant, glib::Error>) + 'static, - >( - _source_object: *mut glib::gobject_ffi::GObject, - res: *mut gio::ffi::GAsyncResult, - user_data: glib::ffi::gpointer, - ) { - let mut error = std::ptr::null_mut(); - let ret = ffi::secret_service_prompt_finish(_source_object as *mut _, res, &mut error); - let result = if error.is_null() { - Ok(from_glib_full(ret)) - } else { - Err(from_glib_full(error)) - }; - let callback: Box_<glib::thread_guard::ThreadGuard<P>> = - Box_::from_raw(user_data as *mut _); - let callback: P = callback.into_inner(); - callback(result); - } - let callback = prompt_trampoline::<P>; - unsafe { - ffi::secret_service_prompt( - self.as_ref().to_glib_none().0, - prompt.as_ref().to_glib_none().0, - return_type.to_glib_none().0, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - Some(callback), - Box_::into_raw(user_data) as *mut _, - ); - } - } - - fn prompt_future( - &self, - prompt: &(impl IsA<Prompt> + Clone + 'static), - return_type: Option<&glib::VariantTy>, - ) -> Pin<Box_<dyn std::future::Future<Output = Result<glib::Variant, glib::Error>> + 'static>> - { - let prompt = prompt.clone(); - let return_type = return_type.map(ToOwned::to_owned); - Box_::pin(gio::GioFuture::new(self, move |obj, cancellable, send| { - obj.prompt( - &prompt, - return_type.as_ref().map(::std::borrow::Borrow::borrow), - Some(cancellable), - move |res| { - send.resolve(res); - }, - ); - })) - } - - #[doc(alias = "secret_service_prompt_at_dbus_path")] - fn prompt_at_dbus_path<P: FnOnce(Result<Option<glib::Variant>, glib::Error>) + 'static>( - &self, - prompt_path: &str, - return_type: Option<&glib::VariantTy>, - cancellable: Option<&impl IsA<gio::Cancellable>>, - callback: P, - ) { - let main_context = glib::MainContext::ref_thread_default(); - let is_main_context_owner = main_context.is_owner(); - let has_acquired_main_context = (!is_main_context_owner) - .then(|| main_context.acquire().ok()) - .flatten(); - assert!( - is_main_context_owner || has_acquired_main_context.is_some(), - "Async operations only allowed if the thread is owning the MainContext" - ); - - let user_data: Box_<glib::thread_guard::ThreadGuard<P>> = - Box_::new(glib::thread_guard::ThreadGuard::new(callback)); - unsafe extern "C" fn prompt_at_dbus_path_trampoline< - P: FnOnce(Result<Option<glib::Variant>, glib::Error>) + 'static, - >( - _source_object: *mut glib::gobject_ffi::GObject, - res: *mut gio::ffi::GAsyncResult, - user_data: glib::ffi::gpointer, - ) { - let mut error = std::ptr::null_mut(); - let ret = ffi::secret_service_prompt_at_dbus_path_finish( - _source_object as *mut _, - res, - &mut error, - ); - let result = if error.is_null() { - Ok(from_glib_full(ret)) - } else { - Err(from_glib_full(error)) - }; - let callback: Box_<glib::thread_guard::ThreadGuard<P>> = - Box_::from_raw(user_data as *mut _); - let callback: P = callback.into_inner(); - callback(result); - } - let callback = prompt_at_dbus_path_trampoline::<P>; - unsafe { - ffi::secret_service_prompt_at_dbus_path( - self.as_ref().to_glib_none().0, - prompt_path.to_glib_none().0, - return_type.to_glib_none().0, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - Some(callback), - Box_::into_raw(user_data) as *mut _, - ); - } - } - - fn prompt_at_dbus_path_future( - &self, - prompt_path: &str, - return_type: Option<&glib::VariantTy>, - ) -> Pin< - Box_< - dyn std::future::Future<Output = Result<Option<glib::Variant>, glib::Error>> + 'static, - >, - > { - let prompt_path = String::from(prompt_path); - let return_type = return_type.map(ToOwned::to_owned); - Box_::pin(gio::GioFuture::new(self, move |obj, cancellable, send| { - obj.prompt_at_dbus_path( - &prompt_path, - return_type.as_ref().map(::std::borrow::Borrow::borrow), - Some(cancellable), - move |res| { - send.resolve(res); - }, - ); - })) - } - - #[doc(alias = "secret_service_prompt_at_dbus_path_sync")] - fn prompt_at_dbus_path_sync( - &self, - prompt_path: &str, - cancellable: Option<&impl IsA<gio::Cancellable>>, - return_type: Option<&glib::VariantTy>, - ) -> Result<Option<glib::Variant>, glib::Error> { - unsafe { - let mut error = std::ptr::null_mut(); - let ret = ffi::secret_service_prompt_at_dbus_path_sync( - self.as_ref().to_glib_none().0, - prompt_path.to_glib_none().0, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - return_type.to_glib_none().0, - &mut error, - ); - if error.is_null() { - Ok(from_glib_full(ret)) - } else { - Err(from_glib_full(error)) - } - } - } - - #[doc(alias = "secret_service_prompt_sync")] - fn prompt_sync( - &self, - prompt: &impl IsA<Prompt>, - cancellable: Option<&impl IsA<gio::Cancellable>>, - return_type: &glib::VariantTy, - ) -> Result<glib::Variant, glib::Error> { - unsafe { - let mut error = std::ptr::null_mut(); - let ret = ffi::secret_service_prompt_sync( - self.as_ref().to_glib_none().0, - prompt.as_ref().to_glib_none().0, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - return_type.to_glib_none().0, - &mut error, - ); - if error.is_null() { - Ok(from_glib_full(ret)) - } else { - Err(from_glib_full(error)) - } - } - } - - #[doc(alias = "secret_service_read_alias_dbus_path")] - fn read_alias_dbus_path<P: FnOnce(Result<Option<glib::GString>, glib::Error>) + 'static>( - &self, - alias: &str, - cancellable: Option<&impl IsA<gio::Cancellable>>, - callback: P, - ) { - let main_context = glib::MainContext::ref_thread_default(); - let is_main_context_owner = main_context.is_owner(); - let has_acquired_main_context = (!is_main_context_owner) - .then(|| main_context.acquire().ok()) - .flatten(); - assert!( - is_main_context_owner || has_acquired_main_context.is_some(), - "Async operations only allowed if the thread is owning the MainContext" - ); - - let user_data: Box_<glib::thread_guard::ThreadGuard<P>> = - Box_::new(glib::thread_guard::ThreadGuard::new(callback)); - unsafe extern "C" fn read_alias_dbus_path_trampoline< - P: FnOnce(Result<Option<glib::GString>, glib::Error>) + 'static, - >( - _source_object: *mut glib::gobject_ffi::GObject, - res: *mut gio::ffi::GAsyncResult, - user_data: glib::ffi::gpointer, - ) { - let mut error = std::ptr::null_mut(); - let ret = ffi::secret_service_read_alias_dbus_path_finish( - _source_object as *mut _, - res, - &mut error, - ); - let result = if error.is_null() { - Ok(from_glib_full(ret)) - } else { - Err(from_glib_full(error)) - }; - let callback: Box_<glib::thread_guard::ThreadGuard<P>> = - Box_::from_raw(user_data as *mut _); - let callback: P = callback.into_inner(); - callback(result); - } - let callback = read_alias_dbus_path_trampoline::<P>; - unsafe { - ffi::secret_service_read_alias_dbus_path( - self.as_ref().to_glib_none().0, - alias.to_glib_none().0, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - Some(callback), - Box_::into_raw(user_data) as *mut _, - ); - } - } - - fn read_alias_dbus_path_future( - &self, - alias: &str, - ) -> Pin< - Box_< - dyn std::future::Future<Output = Result<Option<glib::GString>, glib::Error>> + 'static, - >, - > { - let alias = String::from(alias); - Box_::pin(gio::GioFuture::new(self, move |obj, cancellable, send| { - obj.read_alias_dbus_path(&alias, Some(cancellable), move |res| { - send.resolve(res); - }); - })) - } - - #[doc(alias = "secret_service_read_alias_dbus_path_sync")] - fn read_alias_dbus_path_sync( - &self, - alias: &str, - cancellable: Option<&impl IsA<gio::Cancellable>>, - ) -> Result<Option<glib::GString>, glib::Error> { - unsafe { - let mut error = std::ptr::null_mut(); - let ret = ffi::secret_service_read_alias_dbus_path_sync( - self.as_ref().to_glib_none().0, - alias.to_glib_none().0, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); - if error.is_null() { - Ok(from_glib_full(ret)) - } else { - Err(from_glib_full(error)) - } - } - } - - //#[doc(alias = "secret_service_search_for_dbus_paths_sync")] - //fn search_for_dbus_paths_sync(&self, schema: Option<&Schema>, attributes: /*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 0, id: 28 }/TypeId { ns_id: 0, id: 28 }, cancellable: Option<&impl IsA<gio::Cancellable>>) -> Result<(Vec<glib::GString>, Vec<glib::GString>), glib::Error> { - // unsafe { TODO: call ffi:secret_service_search_for_dbus_paths_sync() } - //} - - //#[doc(alias = "secret_service_search_sync")] - //fn search_sync(&self, schema: Option<&Schema>, attributes: /*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 0, id: 28 }/TypeId { ns_id: 0, id: 28 }, flags: SearchFlags, cancellable: Option<&impl IsA<gio::Cancellable>>) -> Result<Vec<Item>, glib::Error> { - // unsafe { TODO: call ffi:secret_service_search_sync() } - //} - - #[doc(alias = "secret_service_set_alias")] - fn set_alias<P: FnOnce(Result<(), glib::Error>) + 'static>( - &self, - alias: &str, - collection: Option<&impl IsA<Collection>>, - cancellable: Option<&impl IsA<gio::Cancellable>>, - callback: P, - ) { - let main_context = glib::MainContext::ref_thread_default(); - let is_main_context_owner = main_context.is_owner(); - let has_acquired_main_context = (!is_main_context_owner) - .then(|| main_context.acquire().ok()) - .flatten(); - assert!( - is_main_context_owner || has_acquired_main_context.is_some(), - "Async operations only allowed if the thread is owning the MainContext" - ); - - let user_data: Box_<glib::thread_guard::ThreadGuard<P>> = - Box_::new(glib::thread_guard::ThreadGuard::new(callback)); - unsafe extern "C" fn set_alias_trampoline<P: FnOnce(Result<(), glib::Error>) + 'static>( - _source_object: *mut glib::gobject_ffi::GObject, - res: *mut gio::ffi::GAsyncResult, - user_data: glib::ffi::gpointer, - ) { - let mut error = std::ptr::null_mut(); - let _ = ffi::secret_service_set_alias_finish(_source_object as *mut _, res, &mut error); - let result = if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - }; - let callback: Box_<glib::thread_guard::ThreadGuard<P>> = - Box_::from_raw(user_data as *mut _); - let callback: P = callback.into_inner(); - callback(result); - } - let callback = set_alias_trampoline::<P>; - unsafe { - ffi::secret_service_set_alias( - self.as_ref().to_glib_none().0, - alias.to_glib_none().0, - collection.map(|p| p.as_ref()).to_glib_none().0, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - Some(callback), - Box_::into_raw(user_data) as *mut _, - ); - } - } - - fn set_alias_future( - &self, - alias: &str, - collection: Option<&(impl IsA<Collection> + Clone + 'static)>, - ) -> Pin<Box_<dyn std::future::Future<Output = Result<(), glib::Error>> + 'static>> { - let alias = String::from(alias); - let collection = collection.map(ToOwned::to_owned); - Box_::pin(gio::GioFuture::new(self, move |obj, cancellable, send| { - obj.set_alias( - &alias, - collection.as_ref().map(::std::borrow::Borrow::borrow), - Some(cancellable), - move |res| { - send.resolve(res); - }, - ); - })) - } - - #[doc(alias = "secret_service_set_alias_sync")] - fn set_alias_sync( - &self, - alias: &str, - collection: Option<&impl IsA<Collection>>, - cancellable: Option<&impl IsA<gio::Cancellable>>, - ) -> Result<(), glib::Error> { - unsafe { - let mut error = std::ptr::null_mut(); - let is_ok = ffi::secret_service_set_alias_sync( - self.as_ref().to_glib_none().0, - alias.to_glib_none().0, - collection.map(|p| p.as_ref()).to_glib_none().0, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); - debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - } - } - } - - #[doc(alias = "secret_service_set_alias_to_dbus_path")] - fn set_alias_to_dbus_path<P: FnOnce(Result<(), glib::Error>) + 'static>( - &self, - alias: &str, - collection_path: Option<&str>, - cancellable: Option<&impl IsA<gio::Cancellable>>, - callback: P, - ) { - let main_context = glib::MainContext::ref_thread_default(); - let is_main_context_owner = main_context.is_owner(); - let has_acquired_main_context = (!is_main_context_owner) - .then(|| main_context.acquire().ok()) - .flatten(); - assert!( - is_main_context_owner || has_acquired_main_context.is_some(), - "Async operations only allowed if the thread is owning the MainContext" - ); - - let user_data: Box_<glib::thread_guard::ThreadGuard<P>> = - Box_::new(glib::thread_guard::ThreadGuard::new(callback)); - unsafe extern "C" fn set_alias_to_dbus_path_trampoline< - P: FnOnce(Result<(), glib::Error>) + 'static, - >( - _source_object: *mut glib::gobject_ffi::GObject, - res: *mut gio::ffi::GAsyncResult, - user_data: glib::ffi::gpointer, - ) { - let mut error = std::ptr::null_mut(); - let _ = ffi::secret_service_set_alias_to_dbus_path_finish( - _source_object as *mut _, - res, - &mut error, - ); - let result = if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - }; - let callback: Box_<glib::thread_guard::ThreadGuard<P>> = - Box_::from_raw(user_data as *mut _); - let callback: P = callback.into_inner(); - callback(result); - } - let callback = set_alias_to_dbus_path_trampoline::<P>; - unsafe { - ffi::secret_service_set_alias_to_dbus_path( - self.as_ref().to_glib_none().0, - alias.to_glib_none().0, - collection_path.to_glib_none().0, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - Some(callback), - Box_::into_raw(user_data) as *mut _, - ); - } - } - - fn set_alias_to_dbus_path_future( - &self, - alias: &str, - collection_path: Option<&str>, - ) -> Pin<Box_<dyn std::future::Future<Output = Result<(), glib::Error>> + 'static>> { - let alias = String::from(alias); - let collection_path = collection_path.map(ToOwned::to_owned); - Box_::pin(gio::GioFuture::new(self, move |obj, cancellable, send| { - obj.set_alias_to_dbus_path( - &alias, - collection_path.as_ref().map(::std::borrow::Borrow::borrow), - Some(cancellable), - move |res| { - send.resolve(res); - }, - ); - })) - } - - #[doc(alias = "secret_service_set_alias_to_dbus_path_sync")] - fn set_alias_to_dbus_path_sync( - &self, - alias: &str, - collection_path: Option<&str>, - cancellable: Option<&impl IsA<gio::Cancellable>>, - ) -> Result<(), glib::Error> { - unsafe { - let mut error = std::ptr::null_mut(); - let is_ok = ffi::secret_service_set_alias_to_dbus_path_sync( - self.as_ref().to_glib_none().0, - alias.to_glib_none().0, - collection_path.to_glib_none().0, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); - debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - } - } - } - - //#[doc(alias = "secret_service_store_sync")] - //fn store_sync(&self, schema: Option<&Schema>, attributes: /*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 0, id: 28 }/TypeId { ns_id: 0, id: 28 }, collection: Option<&str>, label: &str, value: &Value, cancellable: Option<&impl IsA<gio::Cancellable>>) -> Result<(), glib::Error> { - // unsafe { TODO: call ffi:secret_service_store_sync() } - //} - - #[doc(alias = "secret_service_unlock_dbus_paths_sync")] - fn unlock_dbus_paths_sync( - &self, - paths: &[&str], - cancellable: Option<&impl IsA<gio::Cancellable>>, - ) -> Result<(i32, Vec<glib::GString>), glib::Error> { - unsafe { - let mut unlocked = std::ptr::null_mut(); - let mut error = std::ptr::null_mut(); - let ret = ffi::secret_service_unlock_dbus_paths_sync( - self.as_ref().to_glib_none().0, - paths.to_glib_none().0, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut unlocked, - &mut error, - ); - if error.is_null() { - Ok((ret, FromGlibPtrContainer::from_glib_full(unlocked))) - } else { - Err(from_glib_full(error)) - } - } - } - - //#[doc(alias = "secret_service_unlock_sync")] - //fn unlock_sync(&self, objects: &[gio::DBusProxy], cancellable: Option<&impl IsA<gio::Cancellable>>, unlocked: /*Unimplemented*/Vec<gio::DBusProxy>) -> Result<i32, glib::Error> { - // unsafe { TODO: call ffi:secret_service_unlock_sync() } - //} -} - -impl<O: IsA<Service>> ServiceExt for O {} diff --git a/libsecret/src/auto/versions.txt b/libsecret/src/auto/versions.txt deleted file mode 100644 index 21d9cc7..0000000 --- a/libsecret/src/auto/versions.txt +++ /dev/null @@ -1,3 +0,0 @@ -Generated by gir (https://github.com/gtk-rs/gir @ 4dd714f7f3b1) -from -from gir-files (https://github.com/gtk-rs/gir-files.git @ b9db716f1bb7) |