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.
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user