Don't emit notify::state from a thread

The ui code assumes that it can do GTK+ calls in response to
this signal, so you can't just emit it from the worker thread
and expect things to work.

https://bugzilla.gnome.org/show_bug.cgi?id=709306
Fix a refcounting error

pending_apps has g_object_unref as free func, which means
g_ptr_array_remove will drop a reference. That won't end well
unless you take a reference when adding apps to the array.

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