Misc fixes backported from upstream svn
- Fixes Upstream Bug #723568
- Fixes Bug #1071689
- Fixes a bug that left development enabled (#1066710, #1068719)
- Fix an issue in get_toplevel_name_for_uri()
- Make sure filetreemodel_build_dir() can handle a NULL (invalid) toplevel
- Fix a couple of miscellaneous bugs