[gimp] libgimpwidgets: new gimp_prop_label_color_new().
- From: Jehan <jehanp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] libgimpwidgets: new gimp_prop_label_color_new().
- Date: Thu, 17 Feb 2022 22:14:01 +0000 (UTC)
commit 1c03df05c5d57ca08b585b1d640ff8242a4c8f69
Author: Jehan <jehan girinstud io>
Date: Thu Feb 17 18:45:12 2022 +0100
libgimpwidgets: new gimp_prop_label_color_new().
libgimpwidgets/gimppropwidgets.c | 45 ++++++++++++++++++++++++++++++++++++++++
libgimpwidgets/gimppropwidgets.h | 4 ++++
2 files changed, 49 insertions(+)
---
diff --git a/libgimpwidgets/gimppropwidgets.c b/libgimpwidgets/gimppropwidgets.c
index c624cd48e2..2a37139fb5 100644
--- a/libgimpwidgets/gimppropwidgets.c
+++ b/libgimpwidgets/gimppropwidgets.c
@@ -3855,6 +3855,51 @@ gimp_prop_color_select_new (GObject *config,
return button;
}
+/**
+ * gimp_prop_label_color_new:
+ * @config: Object to which property is attached.
+ * @property_name: Name of RGB property.
+ *
+ * Creates a #GimpLabelColor to set and display the value of an RGB
+ * property.
+ *
+ * Returns: (transfer full): A new #GimpLabelColor widget.
+ *
+ * Since: 3.0
+ */
+GtkWidget *
+gimp_prop_label_color_new (GObject *config,
+ const gchar *property_name)
+{
+ GParamSpec *param_spec;
+ GtkWidget *prop_widget;
+ const gchar *label;
+ GimpRGB *value;
+
+ param_spec = check_param_spec_w (config, property_name,
+ GIMP_TYPE_PARAM_RGB, G_STRFUNC);
+ if (! param_spec)
+ return NULL;
+
+ g_object_get (config,
+ property_name, &value,
+ NULL);
+
+ label = g_param_spec_get_nick (param_spec);
+
+ prop_widget = gimp_label_color_new (label, value);
+ g_free (value);
+
+ g_object_bind_property (config, property_name,
+ prop_widget, "value",
+ G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
+
+
+ gtk_widget_show (prop_widget);
+
+ return prop_widget;
+}
+
/********************/
/* unit combo box */
/********************/
diff --git a/libgimpwidgets/gimppropwidgets.h b/libgimpwidgets/gimppropwidgets.h
index 8bfdf99e24..aac15037f6 100644
--- a/libgimpwidgets/gimppropwidgets.h
+++ b/libgimpwidgets/gimppropwidgets.h
@@ -222,6 +222,10 @@ GtkWidget * gimp_prop_color_select_new (GObject *config,
gint height,
GimpColorAreaType type);
+GtkWidget * gimp_prop_label_color_new (GObject *config,
+ const gchar *property_name);
+
+
/* GimpParamUnit */
GtkWidget * gimp_prop_unit_combo_box_new (GObject *config,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]