You could connect a function to a signal which is fired whenever the current layer changes. You could add some logic to this function which would always be selected and if you tried to select another layer, it would trigger the Toggle Editing button which if any changes were made would prompt the user to save or discard the changes.
def check_edit():
layers = iface.editableLayers()
if layers:
iface.legendInterface().setCurrentLayer(layers[0])
iface.actionToggleEditing().trigger()
iface.legendInterface().currentLayerChanged.connect(check_edit)
Edit:
You could create a startup.py script so that the above code is executed when GOMap is initiated. You will need to modify the code slightly to import the relevant module:
from qgis.utils import iface
def check_edit():
layers = iface.editableLayers()
if layers:
iface.legendInterface().setCurrentLayer(layers[0])
iface.actionToggleEditing().trigger()
iface.legendInterface().currentLayerChanged.connect(check_edit)
And save this as a python script in your C:/Users/you/.qgis2/python/
directory.