Commit 8d6c7e42 authored by Ell's avatar Ell

libgimpwidgets: add GimpChainButton::icon-size property

... and corresponding gimp_chain_button_{get,size}_icon_size()
functions, which control the chain-button's icon size.
parent d5494406
......@@ -54,7 +54,8 @@
enum
{
PROP_0,
PROP_POSITION
PROP_POSITION,
PROP_ICON_SIZE
};
enum
......@@ -146,6 +147,22 @@ gimp_chain_button_class_init (GimpChainButtonClass *klass)
GIMP_CHAIN_TOP,
G_PARAM_CONSTRUCT_ONLY |
GIMP_PARAM_READWRITE));
/**
* GimpChainButton:icon-size:
*
* The chain button icon size.
*
* Since: 2.10.10
*/
g_object_class_install_property (object_class, PROP_ICON_SIZE,
g_param_spec_enum ("icon-size",
"Icon Size",
"The chain's icon size",
GTK_TYPE_ICON_SIZE,
GTK_ICON_SIZE_BUTTON,
G_PARAM_CONSTRUCT |
GIMP_PARAM_READWRITE));
}
static void
......@@ -222,6 +239,10 @@ gimp_chain_button_set_property (GObject *object,
private->position = g_value_get_enum (value);
break;
case PROP_ICON_SIZE:
g_object_set_property (G_OBJECT (private->image), "icon-size", value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
......@@ -242,6 +263,10 @@ gimp_chain_button_get_property (GObject *object,
g_value_set_enum (value, private->position);
break;
case PROP_ICON_SIZE:
g_object_get_property (G_OBJECT (private->image), "icon-size", value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
......@@ -274,6 +299,50 @@ gimp_chain_button_new (GimpChainPosition position)
NULL);
}
/**
* gimp_chain_button_set_icon_size:
* @button: Pointer to a #GimpChainButton.
* @size: The new icon size.
*
* Sets the icon size of the #GimpChainButton.
*
* Since: 2.10.10
*/
void
gimp_chain_button_set_icon_size (GimpChainButton *button,
GtkIconSize size)
{
g_return_if_fail (GIMP_IS_CHAIN_BUTTON (button));
g_object_set (button,
"icon-size", size,
NULL);
}
/**
* gimp_chain_button_get_icon_size:
* @button: Pointer to a #GimpChainButton.
*
* Gets the icon size of the #GimpChainButton.
*
* Returns: The icon size.
*
* Since: 2.10.10
*/
GtkIconSize
gimp_chain_button_get_icon_size (GimpChainButton *button)
{
GtkIconSize size;
g_return_val_if_fail (GIMP_IS_CHAIN_BUTTON (button), GTK_ICON_SIZE_BUTTON);
g_object_get (button,
"icon-size", &size,
NULL);
return size;
}
/**
* gimp_chain_button_set_active:
* @button: Pointer to a #GimpChainButton.
......@@ -364,7 +433,7 @@ gimp_chain_button_update_image (GimpChainButton *button)
gtk_image_set_from_icon_name (GTK_IMAGE (private->image),
gimp_chain_icon_names[i],
GTK_ICON_SIZE_BUTTON);
gimp_chain_button_get_icon_size (button));
}
......
......@@ -73,13 +73,17 @@ struct _GimpChainButtonClass
};
GType gimp_chain_button_get_type (void) G_GNUC_CONST;
GType gimp_chain_button_get_type (void) G_GNUC_CONST;
GtkWidget * gimp_chain_button_new (GimpChainPosition position);
GtkWidget * gimp_chain_button_new (GimpChainPosition position);
void gimp_chain_button_set_active (GimpChainButton *button,
gboolean active);
gboolean gimp_chain_button_get_active (GimpChainButton *button);
void gimp_chain_button_set_icon_size (GimpChainButton *button,
GtkIconSize size);
GtkIconSize gimp_chain_button_get_icon_size (GimpChainButton *button);
void gimp_chain_button_set_active (GimpChainButton *button,
gboolean active);
gboolean gimp_chain_button_get_active (GimpChainButton *button);
GtkWidget * gimp_chain_button_get_button (GimpChainButton *button);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment