glibmm 2.61.1

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Examples

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Static Public Member Functions | Protected Member Functions | Related Functions | List of all members
Gio::PropertyAction Class Reference

An Action reflecting a Glib::Object property. More...

`#include </home/kjell/checkout/gnome/glibmm/gio/giomm/propertyaction.h>`

Inheritance diagram for Gio::PropertyAction:
[legend]

## Public Member Functions
| PropertyAction (PropertyAction&& src) noexcept
PropertyAction& | operator= (PropertyAction&& src) noexcept
| ~PropertyAction () noexcept override
GPropertyAction* | gobj ()
| Provides access to the underlying C GObject. More...
const GPropertyAction* | gobj () const
| Provides access to the underlying C GObject. More...
GPropertyAction* | gobj_copy ()
| Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. More...
Glib::PropertyProxy_ReadOnly< Glib::ustring > | property_name () const
| The name of the action. More...
Glib::PropertyProxy_ReadOnly< Glib::VariantType > | property_parameter_type () const
| The type of the parameter that must be given when activating the action. More...
Glib::PropertyProxy_ReadOnly< bool > | property_enabled () const
| If action is currently enabled. More...
Glib::PropertyProxy_ReadOnly< Glib::VariantType > | property_state_type () const
| The VariantType of the state that the action has, or `nullptr` if the action is stateless. More...
Glib::PropertyProxy_ReadOnly< Glib::VariantBase > | property_state () const
| The state of the action, or `nullptr` if the action is stateless. More...
Glib::PropertyProxy_ReadOnly< bool > | property_invert_boolean () const
| If `true`, the state of the action will be the negation of the property value, provided the property is boolean. More...
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 (const Quark& key, void* data, DestroyNotify notify)
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. More...
void | get_property_value (const Glib::ustring& property_name, Glib::ValueBase& value) const
| You probably want to use a specific property_*() accessor method instead. More...
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. More...
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. More...
template<class PropertyType >
PropertyType | get_property (const Glib::ustring& property_name) const
| You probably want to use a specific property_*() accessor method instead. More...
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. More...
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. More...
void | freeze_notify ()
| Increases the freeze count on object. More...
void | thaw_notify ()
| Reverts the effect of a previous call to freeze_notify(). More...
virtual void | reference () const
| Increment the reference count for this object. More...
virtual void | unreference () const
| Decrement the reference count for this object. More...
GObject* | gobj ()
| Provides access to the underlying C GObject. More...
const GObject* | gobj () const
| Provides access to the underlying C GObject. More...
GObject* | gobj_copy () const
| Give a ref-ed copy to someone. Use for direct struct access. More...
Public Member Functions inherited from sigc::trackable
| trackable () noexcept
| trackable (const trackable &src) noexcept
| trackable (trackable &&src) noexcept
| ~trackable ()
void | add_destroy_notify_callback (notifiable *data, func_destroy_notify func) const
void | notify_callbacks ()
trackable & | operator= (const trackable &src)
trackable & | operator= (trackable &&src) noexcept
void | remove_destroy_notify_callback (notifiable *data) const
Public Member Functions inherited from Gio::Action
| Action (Action&& src) noexcept
Action& | operator= (Action&& src) noexcept
| ~Action () noexcept override
GAction* | gobj ()
| Provides access to the underlying C GObject. More...
const GAction* | gobj () const
| Provides access to the underlying C GObject. More...
Glib::ustring | get_name () const
| Queries the name of action. More...
Glib::VariantType | get_parameter_type () const
| Queries the type of the parameter that must be given when activating action. More...
Glib::VariantType | get_state_type () const
| Queries the type of the state of action. More...
template<typename T_Value >
void | get_state_hint (T_Value& value) const
| Requests a hint about the valid range of values for the state of the action. More...
Glib::VariantContainerBase | get_state_hint_variant () const
| Requests a hint about the valid range of values for the state of action. More...
bool | get_enabled () const
| Checks if action is currently enabled. More...
template<typename T_Value >
void | change_state (const T_Value& value)
| Request for the state of action to be changed to value, assuming that the action has the expected state type. More...
template<typename T_Value >
void | change_state (const Glib::Variant< T_Value >& value)
void | change_state_variant (const Glib::VariantBase& value)
| Request for the state of action to be changed to value. More...
template<typename T_Value >
void | get_state (T_Value& value) const
| Queries the current state of the action. More...
Glib::VariantBase | get_state_variant () const
| Queries the current state of action. More...
void | activate ()
| Activates the action. More...
template<typename T_Value >
void | activate (const T_Value& parameter)
| Activates the action. More...
template<typename T_Value >
void | activate (const Glib::Variant< T_Value >& parameter)
void | activate_variant (const Glib::VariantBase& parameter)
| Activates the action. More...
template<typename T_Value >
Glib::ustring | print_detailed_name (const T_Value& target_value)
| Formats a detailed action name from the action's action_name and target_value. More...
Glib::PropertyProxy_ReadOnly< bool > | property_enabled () const
| If action is currently enabled. More...
Glib::PropertyProxy_ReadOnly< Glib::ustring > | property_name () const
| The name of the action. More...
Glib::PropertyProxy_ReadOnly< Glib::VariantType > | property_parameter_type () const
| The type of the parameter that must be given when activating the action. More...
Glib::PropertyProxy_ReadOnly< Glib::VariantBase > | property_state () const
| The state of the action, or `nullptr` if the action is stateless. More...
Glib::PropertyProxy_ReadOnly< Glib::VariantType > | property_state_type () const
| The VariantType of the state that the action has, or `nullptr` if the action is stateless. More...
Public Member Functions inherited from Glib::Interface
| Interface ()
| A Default constructor. More...
| Interface (Interface&& src) noexcept
Interface& | operator= (Interface&& src) noexcept
| Interface (const Glib::Interface_Class& interface_class)
| Called by constructors of derived classes. More...
| Interface (GObject* castitem)
| Called by constructors of derived classes. More...
| ~Interface () noexcept override
| Interface (const Interface&)=delete
Interface& | operator= (const Interface&)=delete
GObject* | gobj ()
const GObject* | gobj () const

## Static Public Member Functions
static GType | get_type ()
| Get the GType for this class, for use with the underlying GObject type system. More...
static Glib::RefPtr< PropertyAction > | create (const Glib::ustring& name, const Glib::PropertyProxy_Base& property_proxy, bool invert_boolean=false)
| Creates an Action corresponding to the value of property property_proxy. More...
Static Public Member Functions inherited from Gio::Action
static void | add_interface (GType gtype_implementer)
static GType | get_type ()
| Get the GType for this class, for use with the underlying GObject type system. More...
static bool | name_is_valid (const Glib::ustring& action_name)
| Checks if action_name is valid. More...
template<typename T_Value >
static void | parse_detailed_name (const Glib::ustring& detailed_name, Glib::ustring& action_name, T_Value& target_value)
| Parses a detailed action name into its separate name and target components. More...
static void | parse_detailed_name_variant (const Glib::ustring& detailed_name, Glib::ustring& action_name, Glib::VariantBase& target_value)
| Parses a detailed action name into its separate name and target components. More...
static Glib::ustring | print_detailed_name_variant (const Glib::ustring& action_name, const Glib::VariantBase& target_value)
| Formats a detailed action name from action_name and target_value. More...

## Protected Member Functions
| PropertyAction (const Glib::ustring& name, const Glib::PropertyProxy_Base& property_proxy, bool invert_boolean=false)
Protected Member Functions inherited from Glib::Object
| Object ()
| Object (const Glib::ConstructParams& construct_params)
| Object (GObject* castitem)
| ~Object () noexcept override
Protected Member Functions inherited from Glib::ObjectBase
| ObjectBase ()
| This default constructor is called implicitly from the constructor of user-derived classes, even if, for instance, Gtk::Button calls a different ObjectBase constructor. More...
| ObjectBase (const char* custom_type_name)
| A derived constructor always overrides this choice. More...
| ObjectBase (const std::type_info& custom_type_info)
| This constructor is a special feature to allow creation of derived types on the fly, without having to use g_object_new() manually. More...
| ObjectBase (ObjectBase&& src) noexcept
ObjectBase& | operator= (ObjectBase&& src) noexcept
virtual | ~ObjectBase () noexcept=0
void | initialize (GObject* castitem)
void | initialize_move (GObject* castitem, Glib::ObjectBase* previous_wrapper)
Protected Member Functions inherited from Gio::Action
| Action ()
| You should derive from this class to use it. More...
virtual Glib::ustring | get_name_vfunc () const
virtual Glib::VariantType | get_parameter_type_vfunc () const
virtual Glib::VariantType | get_state_type_vfunc () const
virtual Glib::VariantBase | get_state_hint_vfunc () const
virtual bool | get_enabled_vfunc () const
virtual Glib::VariantBase | get_state_vfunc () const
virtual void | change_state_vfunc (const Glib::VariantBase& value)
virtual void | activate_vfunc (const Glib::VariantBase& parameter)

## Related Functions
(Note that these are not member functions.)
Glib::RefPtr< Gio::PropertyAction > | wrap (GPropertyAction* object, bool take_copy=false)
| A Glib::wrap() method for this object. More...
Related Functions inherited from Glib::Object
Glib::RefPtr< Glib::Object > | wrap (GObject* object, bool take_copy=false)
Related Functions inherited from Gio::Action
Glib::RefPtr< Gio::Action > | wrap (GAction* object, bool take_copy=false)
| A Glib::wrap() method for this object. More...

## Additional Inherited Members
Public Types inherited from Glib::Object
using | DestroyNotify = void(*)(gpointer data)
Public Types inherited from sigc::trackable
typedef internal::func_destroy_notify | func_destroy_notify
Public Types inherited from sigc::notifiable
typedef internal::func_destroy_notify | func_destroy_notify

## Detailed Description

An Action reflecting a Glib::Object property.

A PropertyAction is a way to get an Action with a state value reflecting and controlling the value of a Glib::Object property.

The state of the action will correspond to the value of the property. Changing it will change the property (assuming the requested value matches the requirements as specified in the GParamSpec, used when the property was installed).

Only the most common types are presently supported. Booleans are mapped to booleans, strings to strings, signed/unsigned integers to int32/uint32 and floats and doubles to doubles.

If the property is an enum then the state will be string-typed and conversion will automatically be performed between the enum value and "nick" string as per the GEnumValue table.

Flags types are not currently supported.

Properties of object types, boxed types and pointer types are not supported and probably never will be.

Properties of Glib::Variant types are not currently supported.

If the property is boolean-valued then the action will have a nullptr parameter type, and activating the action (with no parameter) will toggle the value of the property.

In all other cases, the parameter type will correspond to the type of the property.

The general idea here is to reduce the number of locations where a particular piece of state is kept (and therefore has to be synchronised between). PropertyAction does not have a separate state that is kept in sync with the property value – its state is the property value.

For example, it might be useful to create an Action corresponding to property_visible_child_name() of a Gtk::Stack so that the current page can be switched from a menu. The active radio indication in the menu is then directly determined from the active page of the Gtk::Stack.

An anti-example would be binding property_active_id() on a Gtk::ComboBox. This is because the state of the combobox itself is probably uninteresting and is actually being used to control something else.

Another anti-example would be to bind to property_visible_child_name() of a Gtk::Stack if this value is actually stored in Gio::Settings. In that case, the real source of the value is Gio::Settings. If you want an Action to control a setting stored in Gio::Settings, see Gio::Settings::create_action() instead, and possibly combine its use with Gio::Settings::bind().

Since glibmm 2.58:

## Constructor & Destructor Documentation

Gio::PropertyAction::PropertyAction | ( | PropertyAction&& | src | ) |
| noexcept

Gio::PropertyAction::~PropertyAction | ( |  | ) |
| override noexcept

Gio::PropertyAction::PropertyAction | ( | const Glib::ustring& | name,
|  | const Glib::PropertyProxy_Base& | property_proxy,
|  | bool | invert_boolean = `false`
| ) |  |
| protected

## Member Function Documentation

static Glib::RefPtr<PropertyAction> Gio::PropertyAction::create | ( | const Glib::ustring& | name,
|  | const Glib::PropertyProxy_Base& | property_proxy,
|  | bool | invert_boolean = `false`
| ) |  |
| static

Creates an Action corresponding to the value of property property_proxy.

The property must be existent and readable and writable (and not construct-only).

This function takes a reference on the property's object and doesn't release it until the action is destroyed.

Parameters

  name | The name of the action to create.
  property_proxy | The property to bind.
  invert_boolean | If `true`, the state of the action will be the negation of the property value, provided the property is boolean.

Returns
  A new PropertyAction.

Since glibmm 2.58:

static GType Gio::PropertyAction::get_type | ( |  | ) |
| static

Get the GType for this class, for use with the underlying GObject type system.

GPropertyAction* Gio::PropertyAction::gobj | ( |  | ) |
| inline

Provides access to the underlying C GObject.

const GPropertyAction* Gio::PropertyAction::gobj | ( |  | ) | const
| inline

Provides access to the underlying C GObject.

GPropertyAction* Gio::PropertyAction::gobj_copy | ( |  | ) |

Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.

PropertyAction& Gio::PropertyAction::operator= | ( | PropertyAction&& | src | ) |
| noexcept

Glib::PropertyProxy_ReadOnly< bool > Gio::PropertyAction::property_enabled | ( |  | ) | const

If action is currently enabled.

If the action is disabled then calls to g_action_activate() and g_action_change_state() have no effect.

Since glibmm 2.58:

Default value: `true`

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly< bool > Gio::PropertyAction::property_invert_boolean | ( |  | ) | const

If `true`, the state of the action will be the negation of the property value, provided the property is boolean.

Since glibmm 2.58:

Default value: `false`

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly< Glib::ustring > Gio::PropertyAction::property_name | ( |  | ) | const

The name of the action.

This is mostly meaningful for identifying the action once it has been added to a ActionMap.

Since glibmm 2.58:

Default value: ""

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly< Glib::VariantType > Gio::PropertyAction::property_parameter_type | ( |  | ) | const

The type of the parameter that must be given when activating the action.

Since glibmm 2.58:

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly< Glib::VariantBase > Gio::PropertyAction::property_state | ( |  | ) | const

The state of the action, or `nullptr` if the action is stateless.

Since glibmm 2.58:

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly< Glib::VariantType > Gio::PropertyAction::property_state_type | ( |  | ) | const

The VariantType of the state that the action has, or `nullptr` if the action is stateless.

Since glibmm 2.58:

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

## Friends And Related Function Documentation

Glib::RefPtr< Gio::PropertyAction > wrap | ( | GPropertyAction * | object,
|  | bool | take_copy = `false`
| ) |  |
| related

A Glib::wrap() method for this object.

Parameters

  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.

Returns
  A C++ instance that wraps this C instance.