Be more careful with XIDs

When an invalid XID is specified, we end up calling
gdk_window_set_transient_for with a NULL window. This leads
to a crash, so don't do it, and instead silently ignore
the invalid XID.

https://bugzilla.gnome.org/show_bug.cgi?id=721278
Make dialog work with --xid again

When triggering an async operation from a GApplicationCommandline,
we must use g_application_hold/release to ensure the application
instance stays around until the operation is done.

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