Michael Catanzaro 7a3db413e9 new-calendar-page: properly track state of URL entry and Add button
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
2020-04-02 03:09:06 +00:00
2020-03-06 22:34:50 -03:00
2020-04-01 15:49:30 +00:00
2020-04-01 21:06:50 -03:00
2019-05-04 12:05:39 -03:00
2018-07-31 12:35:56 -03:00
2018-02-23 16:11:36 -03:00
2012-04-25 23:56:34 -04:00
2018-01-28 00:32:07 -02:00
2017-09-08 21:34:52 -03:00
2020-03-06 22:34:50 -03:00
2019-09-13 21:13:35 +00:00
2018-01-16 08:32:43 -02:00

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.

Flatpak

S
Description
No description provided
Readme
19 MiB
Languages
C 97.6%
Meson 1.2%
CSS 0.7%
Python 0.3%
Shell 0.2%