[gimp] app, libgimpwidgets: allow NULL labels in some gimp_prop_foo_new() functions
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app, libgimpwidgets: allow NULL labels in some gimp_prop_foo_new() functions
- Date: Tue, 9 Feb 2016 22:36:16 +0000 (UTC)
commit 9c4dd960a0d6b96dafa9d066687362e4e715ff68
Author: Michael Natterer <mitch gimp org>
Date: Tue Feb 9 23:35:06 2016 +0100
app, libgimpwidgets: allow NULL labels in some gimp_prop_foo_new() functions
and fall back to the GParamSpec's nick.
app/widgets/gimppropwidgets.c | 24 ++++++++++++++++--------
libgimpwidgets/gimppropwidgets.c | 18 ++++++++++++++++++
2 files changed, 34 insertions(+), 8 deletions(-)
---
diff --git a/app/widgets/gimppropwidgets.c b/app/widgets/gimppropwidgets.c
index f1305e9..eac1f57 100644
--- a/app/widgets/gimppropwidgets.c
+++ b/app/widgets/gimppropwidgets.c
@@ -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);
diff --git a/libgimpwidgets/gimppropwidgets.c b/libgimpwidgets/gimppropwidgets.c
index 96f9a11..e8b5d25 100644
--- a/libgimpwidgets/gimppropwidgets.c
+++ b/libgimpwidgets/gimppropwidgets.c
@@ -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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]