[gtk/prop-list] expression: Add a new property expression constructor
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/prop-list] expression: Add a new property expression constructor
- Date: Mon, 23 Dec 2019 23:06:46 +0000 (UTC)
commit 055f3c9f2f0aa2a88a5a11d52dce0d20a71db4a1
Author: Matthias Clasen <mclasen redhat com>
Date: Mon Dec 23 16:11:36 2019 -0500
expression: Add a new property expression constructor
Allow creating property expresions from a GParamSpec.
This lets us avoid a critical, and instead report an
error in GtkBuilder if the property does not exist.
gtk/gtkexpression.c | 10 +++++++++-
gtk/gtkexpression.h | 3 +++
2 files changed, 12 insertions(+), 1 deletion(-)
---
diff --git a/gtk/gtkexpression.c b/gtk/gtkexpression.c
index 0caddd6168..d92cba035b 100644
--- a/gtk/gtkexpression.c
+++ b/gtk/gtkexpression.c
@@ -694,7 +694,6 @@ gtk_property_expression_new (GType this_type,
GtkExpression *expression,
const char *property_name)
{
- GtkPropertyExpression *result;
GParamSpec *pspec;
if (g_type_is_a (this_type, G_TYPE_OBJECT))
@@ -721,6 +720,15 @@ gtk_property_expression_new (GType this_type,
return NULL;
}
+ return gtk_property_expression_new_for_pspec (expression, pspec);
+}
+
+GtkExpression *
+gtk_property_expression_new_for_pspec (GtkExpression *expression,
+ GParamSpec *pspec)
+{
+ GtkPropertyExpression *result;
+
result = gtk_expression_alloc (>K_PROPERTY_EXPRESSION_CLASS, pspec->value_type);
result->pspec = pspec;
diff --git a/gtk/gtkexpression.h b/gtk/gtkexpression.h
index ddffee6706..8772954396 100644
--- a/gtk/gtkexpression.h
+++ b/gtk/gtkexpression.h
@@ -84,6 +84,9 @@ GtkExpression * gtk_property_expression_new (GType
GtkExpression *expression,
const char
*property_name);
GDK_AVAILABLE_IN_ALL
+GtkExpression * gtk_property_expression_new_for_pspec (GtkExpression *expression,
+ GParamSpec *pspec);
+GDK_AVAILABLE_IN_ALL
GtkExpression * gtk_constant_expression_new (GType value_type,
...);
GDK_AVAILABLE_IN_ALL
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]