[Utils] Add a paramter to specify GMainContext to removeEventSourceIfNeeded().

g_source_remove() is only able to remove events attached to the
defualt context. This modification enables removeEventSourceIfNeeded()
to remove events attached to any contexnt.