mirror of https://github.com/GNOME/gimp.git
libgimpwidgets: fix code duplication in gimp_prop_enum_combo_box_new()
This commit is contained in:
parent
2766a9f807
commit
db4e120b8b
|
@ -502,9 +502,10 @@ gimp_prop_enum_combo_box_new (GObject *config,
|
||||||
gint minimum,
|
gint minimum,
|
||||||
gint maximum)
|
gint maximum)
|
||||||
{
|
{
|
||||||
GParamSpec *param_spec;
|
GParamSpec *param_spec;
|
||||||
GtkWidget *combo_box;
|
GtkListStore *store = NULL;
|
||||||
gint value;
|
GtkWidget *combo_box;
|
||||||
|
gint value;
|
||||||
|
|
||||||
g_return_val_if_fail (G_IS_OBJECT (config), NULL);
|
g_return_val_if_fail (G_IS_OBJECT (config), NULL);
|
||||||
g_return_val_if_fail (property_name != NULL, NULL);
|
g_return_val_if_fail (property_name != NULL, NULL);
|
||||||
|
@ -520,23 +521,14 @@ gimp_prop_enum_combo_box_new (GObject *config,
|
||||||
|
|
||||||
if (minimum != maximum)
|
if (minimum != maximum)
|
||||||
{
|
{
|
||||||
GtkListStore *store;
|
|
||||||
|
|
||||||
store = gimp_enum_store_new_with_range (param_spec->value_type,
|
store = gimp_enum_store_new_with_range (param_spec->value_type,
|
||||||
minimum, maximum);
|
minimum, maximum);
|
||||||
|
|
||||||
combo_box = g_object_new (GIMP_TYPE_ENUM_COMBO_BOX,
|
|
||||||
"model", store,
|
|
||||||
NULL);
|
|
||||||
g_object_unref (store);
|
|
||||||
}
|
}
|
||||||
else if (param_spec->value_type == GIMP_TYPE_DESATURATE_MODE)
|
else if (param_spec->value_type == GIMP_TYPE_DESATURATE_MODE)
|
||||||
{
|
{
|
||||||
/* this is a bad hack, if we get more of those, we should probably
|
/* this is a bad hack, if we get more of those, we should probably
|
||||||
* think of something less ugly
|
* think of something less ugly
|
||||||
*/
|
*/
|
||||||
GtkListStore *store;
|
|
||||||
|
|
||||||
store = gimp_enum_store_new_with_values (param_spec->value_type,
|
store = gimp_enum_store_new_with_values (param_spec->value_type,
|
||||||
5,
|
5,
|
||||||
GIMP_DESATURATE_LUMINANCE,
|
GIMP_DESATURATE_LUMINANCE,
|
||||||
|
@ -544,7 +536,10 @@ gimp_prop_enum_combo_box_new (GObject *config,
|
||||||
GIMP_DESATURATE_LIGHTNESS,
|
GIMP_DESATURATE_LIGHTNESS,
|
||||||
GIMP_DESATURATE_AVERAGE,
|
GIMP_DESATURATE_AVERAGE,
|
||||||
GIMP_DESATURATE_VALUE);
|
GIMP_DESATURATE_VALUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (store)
|
||||||
|
{
|
||||||
combo_box = g_object_new (GIMP_TYPE_ENUM_COMBO_BOX,
|
combo_box = g_object_new (GIMP_TYPE_ENUM_COMBO_BOX,
|
||||||
"model", store,
|
"model", store,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
Loading…
Reference in New Issue