Preliminary work for abstract signals handlers

This is the plumbing part, without actual significant code generation
changes, of the work on abstracting signal handlers. The end goal of
this work is to allow for generic "onFoo" handlers for every object
that support a "foo" signal, without always having to specify
the widget type, as in "onWidgetFoo".

This commit cleans up and abstracts the relevant code, without adding
actual support for abstract signals yet.