Check if handler_id is connected before disconnect

Closes #40
https://github.com/mate-desktop/mate-document-viewer/issues/40
Add check for zlib and add to linker

Should solve https://bugs.gentoo.org/show_bug.cgi?id=480464 and
https://github.com/Sabayon/mate-overlay/issues/46