elementary / granite

Library that extends GTK with common widgets and utilities
https://elementary.io
GNU Lesser General Public License v3.0
289 stars 61 forks source link

Existence of possiblity to induce incoherency between style and state in Granite.ValidatedEntry #587

Open adithyankv opened 2 years ago

adithyankv commented 2 years ago

What Happened?

Currently it is possible to set the is_valid property of Granite.ValidatedEntry independent of its changed signal, however the style is only updated in the connect_after callback for the changed signal, so it the style only changes when the text attribute is changed. This has the possibility of leaving the widget in an incoherent state where the style doesn't reflect the value of the is_valid property.

Steps to Reproduce

change the is_valid property without using the changed signal

var entry = new Granite.ValidatedEntry ();
entry.text = "text";
entry.is_valid = false;

here even though the state is invalid the styling would reflect a valid state

Expected Behavior

I'm not entirely sure as to what the expected behavior here is, as this is more of a developer facing issue than a user facing issue. This is not even really an issue if the intended behavior is to use the is_valid property exclusively inside the changed signal. But it is weird that the API allows for the incoherence.

Supporting the change of is_valid outside the changed signal could be useful in cases where the validation condition might change outside of the widget without the value inside the widget changing. However this could be outside the scope of Granite.ValidatedEntry.

OS Version

6.x (Odin)

Software Version

Latest release (I have run all updates)

Log Output

No response

Hardware Info

No response