Fix GCC warnings about unused typedefs for local includes

GCC was complaining with the following error:

 error: typedef 'GUPnPNetworkManager' locally defined but not used [-Werror=unused-local-typedefs]

Move the #include lines to the global scope to make it happy.

Alos use #ifdef/#if defined() consistently, instead of relying on the
defined values.

https://bugzilla.gnome.org/show_bug.cgi?id=708162