glibmm 2.82.0
|
An object representing the permission to perform a certain action. More...
#include <giomm/permission.h>
Public Member Functions | |
Permission (Permission &&src) noexcept | |
Permission & | operator= (Permission &&src) noexcept |
~Permission () noexcept override | |
GPermission * | gobj () |
Provides access to the underlying C GObject. | |
const GPermission * | gobj () const |
Provides access to the underlying C GObject. | |
GPermission * | gobj_copy () |
Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. | |
bool | acquire (const Glib::RefPtr< Cancellable > &cancellable) |
Attempts to acquire the permission represented by permission. | |
bool | acquire () |
A acquire() convenience overload. | |
void | acquire_async (const SlotAsyncReady &slot, const Glib::RefPtr< Cancellable > &cancellable) |
Attempts to acquire the permission represented by permission. | |
void | acquire_async (const SlotAsyncReady &slot) |
A acquire_async() convenience overload. | |
bool | acquire_finish (const Glib::RefPtr< AsyncResult > &result) |
Collects the result of attempting to acquire the permission represented by permission. | |
bool | release (const Glib::RefPtr< Cancellable > &cancellable) |
Attempts to release the permission represented by permission. | |
bool | release () |
A release() convenience overload. | |
void | release_async (const SlotAsyncReady &slot, const Glib::RefPtr< Cancellable > &cancellable) |
Attempts to release the permission represented by permission. | |
void | release_async (const SlotAsyncReady &slot) |
A release_async() convenience overload. | |
bool | release_finish (const Glib::RefPtr< AsyncResult > &result) |
Collects the result of attempting to release the permission represented by permission. | |
bool | get_allowed () const |
Gets the value of the 'allowed' property. | |
bool | get_can_acquire () const |
Gets the value of the 'can-acquire' property. | |
bool | get_can_release () const |
Gets the value of the 'can-release' property. | |
Glib::PropertyProxy_ReadOnly< bool > | property_allowed () const |
true if the caller currently has permission to perform the action that permission represents the permission to perform. | |
Glib::PropertyProxy_ReadOnly< bool > | property_can_acquire () const |
true if it is generally possible to acquire the permission by calling g_permission_acquire(). | |
Glib::PropertyProxy_ReadOnly< bool > | property_can_release () const |
true if it is generally possible to release the permission by calling g_permission_release(). | |
Public Member Functions inherited from Glib::Object | |
Object (const Object &)=delete | |
Object & | operator= (const Object &)=delete |
Object (Object &&src) noexcept | |
Object & | operator= (Object &&src) noexcept |
void * | get_data (const QueryQuark & key) |
void | set_data (const Quark & key, void *data) |
void | set_data_with_c_callback (const Quark & key, void *data, GDestroyNotify notify) |
void | set_data (const Quark & key, void *data, DestroyNotify notify) |
Prefer set_data_with_c_callback() with a callback with C linkage. | |
void | remove_data (const QueryQuark &quark) |
void * | steal_data (const QueryQuark &quark) |
Public Member Functions inherited from Glib::ObjectBase | |
ObjectBase (const ObjectBase &)=delete | |
ObjectBase & | operator= (const ObjectBase &)=delete |
void | set_property_value (const Glib::ustring & property_name, const Glib::ValueBase & value) |
You probably want to use a specific property_*() accessor method instead. | |
void | get_property_value (const Glib::ustring & property_name, Glib::ValueBase & value) const |
You probably want to use a specific property_*() accessor method instead. | |
template<class PropertyType > | |
void | set_property (const Glib::ustring & property_name, const PropertyType & value) |
You probably want to use a specific property_*() accessor method instead. | |
template<class PropertyType > | |
void | get_property (const Glib::ustring & property_name, PropertyType & value) const |
You probably want to use a specific property_*() accessor method instead. | |
template<class PropertyType > | |
PropertyType | get_property (const Glib::ustring & property_name) const |
You probably want to use a specific property_*() accessor method instead. | |
sigc::connection | connect_property_changed (const Glib::ustring & property_name, const sigc::slot< void()> &slot) |
You can use the signal_changed() signal of the property proxy instead. | |
sigc::connection | connect_property_changed (const Glib::ustring & property_name, sigc::slot< void()> &&slot) |
You can use the signal_changed() signal of the property proxy instead. | |
void | freeze_notify () |
Increases the freeze count on object. | |
void | thaw_notify () |
Reverts the effect of a previous call to freeze_notify(). | |
virtual void | reference () const |
Increment the reference count for this object. | |
virtual void | unreference () const |
Decrement the reference count for this object. | |
GObject * | gobj () |
Provides access to the underlying C GObject. | |
const GObject * | gobj () const |
Provides access to the underlying C GObject. | |
GObject * | gobj_copy () const |
Give a ref-ed copy to someone. Use for direct struct access. | |
Static Public Member Functions | |
static GType | get_type () |
Get the GType for this class, for use with the underlying GObject type system. | |
Related Symbols | |
(Note that these are not member symbols.) | |
Glib::RefPtr< Gio::Permission > | wrap (GPermission *object, bool take_copy=false) |
A Glib::wrap() method for this object. | |
Related Symbols inherited from Glib::Object | |
Glib::RefPtr< Glib::Object > | wrap (GObject *object, bool take_copy=false) |
Additional Inherited Members | |
Public Types inherited from Glib::Object | |
using | DestroyNotify = void(*)(gpointer data) |
An object representing the permission to perform a certain action.
A Permission represents the status of the caller's permission to perform a certain action.
You can query if the action is currently allowed and if it is possible to acquire the permission so that the action will be allowed in the future.
There is also an API to actually acquire the permission and one to release it.
As an example, a Permission might represent the ability for the user to write to a Settings object. This Permission object could then be used to decide if it is appropriate to show a "Click here to unlock" button in a dialog and to provide the mechanism to invoke when that button is clicked.
|
noexcept |
|
overridenoexcept |
|
protected |
bool Gio::Permission::acquire | ( | ) |
A acquire() convenience overload.
bool Gio::Permission::acquire | ( | const Glib::RefPtr< Cancellable > & | cancellable | ) |
Attempts to acquire the permission represented by permission.
The precise method by which this happens depends on the permission and the underlying authentication mechanism. A simple example is that a dialog may appear asking the user to enter their password.
You should check with g_permission_get_can_acquire() before calling this function.
If the permission is acquired then true
is returned. Otherwise, false
is returned and error is set appropriately.
This call is blocking, likely for a very long time (in the case that user interaction is required). See g_permission_acquire_async() for the non-blocking version.
cancellable | A Cancellable, or nullptr . |
true
if the permission was successfully acquired.Glib::Error |
A acquire_async() convenience overload.
void Gio::Permission::acquire_async | ( | const SlotAsyncReady & | slot, |
const Glib::RefPtr< Cancellable > & | cancellable | ||
) |
Attempts to acquire the permission represented by permission.
This is the first half of the asynchronous version of g_permission_acquire().
cancellable | A Cancellable, or nullptr . |
slot | The SlotAsyncReady to call when done. |
|
protectedvirtual |
bool Gio::Permission::acquire_finish | ( | const Glib::RefPtr< AsyncResult > & | result | ) |
Collects the result of attempting to acquire the permission represented by permission.
This is the second half of the asynchronous version of g_permission_acquire().
result | The AsyncResult given to the SlotAsyncReady. |
true
if the permission was successfully acquired.Glib::Error |
|
protectedvirtual |
Glib::Error. |
|
protectedvirtual |
Glib::Error. |
bool Gio::Permission::get_allowed | ( | ) | const |
Gets the value of the 'allowed' property.
This property is true
if the caller currently has permission to perform the action that permission represents the permission to perform.
bool Gio::Permission::get_can_acquire | ( | ) | const |
Gets the value of the 'can-acquire' property.
This property is true
if it is generally possible to acquire the permission by calling g_permission_acquire().
bool Gio::Permission::get_can_release | ( | ) | const |
Gets the value of the 'can-release' property.
This property is true
if it is generally possible to release the permission by calling g_permission_release().
Get the GType for this class, for use with the underlying GObject type system.
|
inline |
Provides access to the underlying C GObject.
|
inline |
Provides access to the underlying C GObject.
GPermission * Gio::Permission::gobj_copy | ( | ) |
Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
|
protected |
This function is called by the Permission implementation to update the properties of the permission.
You should never call this function except from a Permission implementation.
GObject notify signals are generated, as appropriate.
allowed | The new value for the 'allowed' property. |
can_acquire | The new value for the 'can-acquire' property. |
can_release | The new value for the 'can-release' property. |
|
noexcept |
Glib::PropertyProxy_ReadOnly< bool > Gio::Permission::property_allowed | ( | ) | const |
true
if the caller currently has permission to perform the action that permission represents the permission to perform.
Default value: false
Glib::PropertyProxy_ReadOnly< bool > Gio::Permission::property_can_acquire | ( | ) | const |
true
if it is generally possible to acquire the permission by calling g_permission_acquire().
Default value: false
Glib::PropertyProxy_ReadOnly< bool > Gio::Permission::property_can_release | ( | ) | const |
true
if it is generally possible to release the permission by calling g_permission_release().
Default value: false
bool Gio::Permission::release | ( | ) |
A release() convenience overload.
bool Gio::Permission::release | ( | const Glib::RefPtr< Cancellable > & | cancellable | ) |
Attempts to release the permission represented by permission.
The precise method by which this happens depends on the permission and the underlying authentication mechanism. In most cases the permission will be dropped immediately without further action.
You should check with g_permission_get_can_release() before calling this function.
If the permission is released then true
is returned. Otherwise, false
is returned and error is set appropriately.
This call is blocking, likely for a very long time (in the case that user interaction is required). See g_permission_release_async() for the non-blocking version.
cancellable | A Cancellable, or nullptr . |
true
if the permission was successfully released.Glib::Error |
A release_async() convenience overload.
void Gio::Permission::release_async | ( | const SlotAsyncReady & | slot, |
const Glib::RefPtr< Cancellable > & | cancellable | ||
) |
Attempts to release the permission represented by permission.
This is the first half of the asynchronous version of g_permission_release().
cancellable | A Cancellable, or nullptr . |
slot | The SlotAsyncReady to call when done. |
|
protectedvirtual |
bool Gio::Permission::release_finish | ( | const Glib::RefPtr< AsyncResult > & | result | ) |
Collects the result of attempting to release the permission represented by permission.
This is the second half of the asynchronous version of g_permission_release().
result | The AsyncResult given to the SlotAsyncReady. |
true
if the permission was successfully released.Glib::Error |
|
protectedvirtual |
Glib::Error. |
|
protectedvirtual |
Glib::Error. |
|
related |
A Glib::wrap() method for this object.
object | The C instance. |
take_copy | False if the result should take ownership of the C instance. True if it should take a new copy or ref. |