app, libgimpwidgets: allow NULL labels in some gimp_prop_foo_new() functions

and fall back to the GParamSpec's nick.
This commit is contained in:
Michael Natterer
2016-02-09 23:35:06 +01:00
parent a3f127bf5f
commit 9c4dd960a0
2 changed files with 34 additions and 8 deletions

View File

@ -92,14 +92,19 @@ gimp_prop_expanding_frame_new (GObject *config,
GtkWidget *child,
GtkWidget **button)
{
GtkWidget *frame;
GtkWidget *toggle;
gboolean value;
GParamSpec *param_spec;
GtkWidget *frame;
GtkWidget *toggle;
gboolean value;
if (! check_param_spec_w (config, property_name,
G_TYPE_PARAM_BOOLEAN, G_STRFUNC))
param_spec = check_param_spec_w (config, property_name,
G_TYPE_PARAM_BOOLEAN, G_STRFUNC);
if (! param_spec)
return NULL;
if (! button_label)
button_label = g_param_spec_get_nick (param_spec);
frame = gimp_frame_new (NULL);
toggle = gimp_prop_check_button_new (config, property_name, button_label);
@ -272,6 +277,9 @@ gimp_prop_color_button_new (GObject *config,
if (! param_spec)
return NULL;
if (! title)
title = g_param_spec_get_nick (param_spec);
g_object_get (config,
property_name, &value,
NULL);
@ -494,12 +502,12 @@ gimp_prop_spin_scale_new (GObject *config,
G_STRFUNC))
return NULL;
if (! G_IS_PARAM_SPEC_DOUBLE (param_spec))
digits = 0;
if (! label)
label = g_param_spec_get_nick (param_spec);
if (! G_IS_PARAM_SPEC_DOUBLE (param_spec))
digits = 0;
adjustment = (GtkAdjustment *)
gtk_adjustment_new (value, lower, upper,
step_increment, page_increment, 0.0);

View File

@ -125,6 +125,9 @@ gimp_prop_check_button_new (GObject *config,
if (! param_spec)
return NULL;
if (! label)
label = g_param_spec_get_nick (param_spec);
g_object_get (config,
property_name, &value,
NULL);
@ -232,6 +235,9 @@ gimp_prop_enum_check_button_new (GObject *config,
if (! param_spec)
return NULL;
if (! label)
label = g_param_spec_get_nick (param_spec);
g_object_get (config,
property_name, &value,
NULL);
@ -783,6 +789,9 @@ gimp_prop_enum_radio_frame_new (GObject *config,
if (! param_spec)
return NULL;
if (! title)
title = g_param_spec_get_nick (param_spec);
g_object_get (config,
property_name, &value,
NULL);
@ -987,6 +996,9 @@ gimp_prop_boolean_radio_frame_new (GObject *config,
if (! param_spec)
return NULL;
if (! title)
title = g_param_spec_get_nick (param_spec);
g_object_get (config,
property_name, &value,
NULL);
@ -1341,6 +1353,9 @@ gimp_prop_scale_entry_new (GObject *config,
param_spec, &value, &lower, &upper, G_STRFUNC))
return NULL;
if (! label)
label = g_param_spec_get_nick (param_spec);
tooltip = g_param_spec_get_blurb (param_spec);
if (! limit_scale)
@ -3975,6 +3990,9 @@ gimp_prop_expander_new (GObject *config,
if (! param_spec)
return NULL;
if (! label)
label = g_param_spec_get_nick (param_spec);
g_object_get (config,
property_name, &value,
NULL);