Using a regular expression of blocked URIs makes it possible to
restrict the locations that can be visited. Any URI matching
the expression will be replaced with "http://.invalid".
The option works in --app and normal mode.
The extension is only needed for the --inactivity-reset option,
so most users building Midori won't need it.
We also need to check for the according header file.
The use case is kiosk systems where leaving the application
idle for a period of time means that the user left, and the
session is reset so the next user starts off clean.
The implementation uses libXss and uses XScreenSaverQueryExtension
which means it is for now supported on X11 only.
Right now reset means closing any opens web pages and opening
the original web page.
Currently --inactivity-reset is only supported with --app.
The modifier state does in fact incorporate modal keys such as
NumLock. So code assuming that state be 0 if no modifier is
pressed is wrong, if NumLock, CapsLock and the like are active.
The solution is to filter out these modal keys with
gtk_accelerator_get_default_mod_mask(), and compare the result.
This fixes the problem of being unable to type keys used as
single-letter shortcuts.
sokoke_prefetch_uri is extended take a callback and user data.
sokoke_resolve_hostname is implemented for resolving hostnames
based on a maximum timeout.
sokoke_magic_uri resolves localhost and uris with a / to verify
if there is a local domain, otherwise falls back to search.
Thanks to Andy Kittner <andkit@gmx.de> for input on proceeding
the event loop while resolving asynchronously.
We used to load special pages, such as error pages as 'blank'
pages internally and try to identify them indirectly. This
breaks navigating back to and forward to such pages and makes
it difficult to allow stock icons for them.
Now a boolean 'special' is used which is reset on any
navigation attempt and any finished load. It is set only
if a special page is loaded.
This should make icons in error pages work reliably.
As Midori may call external tools to open URIs it cannot handle,
and at the same time Midori is commonly the default browser,
this can end in recursion when the external tool also calls Midori.
See the description of sokoke_recursive_fork_protection().
MidoriView is the only place where icons are and should be
loaded, elsewhere we just use cached icons.
midori_view_get_icon_uri allows distinguishing whether a view
has an icon or a default icon, and using the filename.
We shouldn't honor user preferences for new tabs when loading
the session. Rather we append in the order they were saved in.
This is currently a hack. In the future we should consider
public API additions to insert tabs in a particular order.
Since the model was a static variable and only set when the
popup was created, we ended up using an obsolete model in
case multiple windows were opened and closed.
As a small optimization we don't need to retrieve the database
pointer except when compiling the statement initially.
We intentionally set a timeout before saving changes to avoid
continuous disc access and also in case opening or closing a tab
results in an immediate crash or freezing.
But closing Midori normally should save outstanding changes.