summaryrefslogtreecommitdiff
path: root/demos/constraint-editor/constraint-editor.c
diff options
context:
space:
mode:
Diffstat (limited to 'demos/constraint-editor/constraint-editor.c')
-rw-r--r--demos/constraint-editor/constraint-editor.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/demos/constraint-editor/constraint-editor.c b/demos/constraint-editor/constraint-editor.c
index ffbc6a15b0..6f897b2d8a 100644
--- a/demos/constraint-editor/constraint-editor.c
+++ b/demos/constraint-editor/constraint-editor.c
@@ -142,6 +142,9 @@ get_target (GListModel *model,
{
int i;
+ if (id == NULL)
+ return NULL;
+
if (strcmp ("super", id) == 0)
return NULL;
@@ -347,6 +350,7 @@ source_attr_changed (ConstraintEditor *editor)
{
gtk_widget_set_sensitive (editor->source, TRUE);
gtk_widget_set_sensitive (editor->multiplier, TRUE);
+ gtk_editable_set_text (GTK_EDITABLE (editor->multiplier), "1");
}
}
@@ -457,8 +461,12 @@ update_preview (ConstraintEditor *editor)
static void
update_button (ConstraintEditor *editor)
{
- if (gtk_combo_box_get_active_id (GTK_COMBO_BOX (editor->target)) != NULL &&
- gtk_combo_box_get_active_id (GTK_COMBO_BOX (editor->source)) != NULL)
+ const char *target = gtk_combo_box_get_active_id (GTK_COMBO_BOX (editor->target));
+ const char *source = gtk_combo_box_get_active_id (GTK_COMBO_BOX (editor->source));
+ const char *source_attr = gtk_combo_box_get_active_id (GTK_COMBO_BOX (editor->source_attr));
+
+ if (target &&
+ (source || (source_attr && get_target_attr (source_attr) == GTK_CONSTRAINT_ATTRIBUTE_NONE)))
gtk_widget_set_sensitive (editor->button, TRUE);
else
gtk_widget_set_sensitive (editor->button, FALSE);