Two constructions I've often seen used in French are histoire de and histoire que, for example:
Je me promène dans la rue, histoire de passer le temps.
Tu n'as qu'à amener du vin, histoire que tout le monde soit satisfait.
From an answer given to this question, I think I've figured out that these two constructions are basically the same expression, but histoire de is used when followed by an infinitive, whereas histoire que is used when followed by a verb phrase; in English these roughly translate to "just to [...]" and "just so that [...]". Therefore, the translations of the above examples are:
I stroll down the street, just to pass the time.
You only have to bring some wine, just so that everyone will be satisfied.
Am I right in my above reasoning?
And what do these constructions really mean? Also, how did they come to mean what they do in contemporary French? They seem rather random.