Bug 973466 - [settings] refactor wifi panel with AMD pattern

This patch is still under WIP.
We should let the function name reflect what it does. Take this function for example, as the execution of the function does not necessary and should not depend on the states of other objects. we should simply name this function to `connect`. And it would be better to take a callback or return a promise so that the user of this module could do the following when the connection completed or failed.