mirror of https://github.com/GNOME/gimp.git
libgimpwidgets: add GimpChainButton::active property
... which corresponds to the button's toggle state.
This commit is contained in:
parent
8d6c7e42bf
commit
9c3f150e25
|
@ -55,7 +55,8 @@ enum
|
|||
{
|
||||
PROP_0,
|
||||
PROP_POSITION,
|
||||
PROP_ICON_SIZE
|
||||
PROP_ICON_SIZE,
|
||||
PROP_ACTIVE
|
||||
};
|
||||
|
||||
enum
|
||||
|
@ -163,6 +164,21 @@ gimp_chain_button_class_init (GimpChainButtonClass *klass)
|
|||
GTK_ICON_SIZE_BUTTON,
|
||||
G_PARAM_CONSTRUCT |
|
||||
GIMP_PARAM_READWRITE));
|
||||
|
||||
/**
|
||||
* GimpChainButton:active:
|
||||
*
|
||||
* The toggled state of the chain button.
|
||||
*
|
||||
* Since: 2.10.10
|
||||
*/
|
||||
g_object_class_install_property (object_class, PROP_ACTIVE,
|
||||
g_param_spec_boolean ("active",
|
||||
"Active",
|
||||
"The chain's toggled state",
|
||||
FALSE,
|
||||
G_PARAM_CONSTRUCT |
|
||||
GIMP_PARAM_READWRITE));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -231,7 +247,8 @@ gimp_chain_button_set_property (GObject *object,
|
|||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GimpChainButtonPrivate *private = GET_PRIVATE (object);
|
||||
GimpChainButton *button = GIMP_CHAIN_BUTTON (object);
|
||||
GimpChainButtonPrivate *private = GET_PRIVATE (button);
|
||||
|
||||
switch (property_id)
|
||||
{
|
||||
|
@ -243,6 +260,10 @@ gimp_chain_button_set_property (GObject *object,
|
|||
g_object_set_property (G_OBJECT (private->image), "icon-size", value);
|
||||
break;
|
||||
|
||||
case PROP_ACTIVE:
|
||||
gimp_chain_button_set_active (button, g_value_get_boolean (value));
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
break;
|
||||
|
@ -255,7 +276,8 @@ gimp_chain_button_get_property (GObject *object,
|
|||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GimpChainButtonPrivate *private = GET_PRIVATE (object);
|
||||
GimpChainButton *button = GIMP_CHAIN_BUTTON (object);
|
||||
GimpChainButtonPrivate *private = GET_PRIVATE (button);
|
||||
|
||||
switch (property_id)
|
||||
{
|
||||
|
@ -267,6 +289,10 @@ gimp_chain_button_get_property (GObject *object,
|
|||
g_object_get_property (G_OBJECT (private->image), "icon-size", value);
|
||||
break;
|
||||
|
||||
case PROP_ACTIVE:
|
||||
g_value_set_boolean (value, gimp_chain_button_get_active (button));
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
break;
|
||||
|
@ -366,6 +392,8 @@ gimp_chain_button_set_active (GimpChainButton *button,
|
|||
private->active = active ? TRUE : FALSE;
|
||||
|
||||
gimp_chain_button_update_image (button);
|
||||
|
||||
g_object_notify (G_OBJECT (button), "active");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue