7a3db413e996d3564fcae92d495149b5747bba09
Currently, when the user enters an invalid URL -- a URL that does not pass SoupURI's URI format validation -- then we set the error style class on the URL entry to turn the border of the entry red. For example, if I try to enter "dog" then GNOME Calendar catches this and flags the entry as red. But there are some problems. First of all, GNOME Calendar doesn't do anything to prevent users from entering URLs that are syntatically valid but not usable as calendars. The code knows whether the URL was successfully parsed as a calendar file, it just doesn't do anything with this information. So there is no red warning if I try to use https://example.com as a calendar, even though the dialog knows that it didn't work. Secondly, GNOME Calendar allows pressing the Add button even if the URL entry contains invalid input, but only if the Calendar Name has been entered. The dialog thinks: "if I have a name, but not a valid URL, then the user wants to create a new, empty local calendar!" But this is not right. If the user has typed anything in the URL entry, then the goal is to import a new calendar, not to create a new one. This commit changes set_url_entry_error() into update_url_entry_state(), and gives it responsibility for updating the add button sensitivity and URL entry pulsing in addition to the URL entry style class, solving both of the above problems. As a side effect, this also closes a race window where the Add button remains sensitive for half a second after typing new text in the URL entry. At this point, we don't yet know whether the URL is valid, because we wait half a second before validating the URL, so we shouldn't allow the user to activate the Add button during this race window. Fixes #481
GNOME Calendar
GNOME Calendar is a simple and beautiful calendar application for GNOME. We give a lot of attention to details, and as such, design is an essential and ongoing effort.
Useful links
- Homepage: https://wiki.gnome.org/Apps/Calendar
- Report issues: https://gitlab.gnome.org/GNOME/gnome-calendar/issues/
- Donate: https://www.gnome.org/friends/
- Translate: https://wiki.gnome.org/TranslationProject
Languages
C
97.6%
Meson
1.2%
CSS
0.7%
Python
0.3%
Shell
0.2%