It comes from the Asian Art Museum. Sultan Mahmud I was a sultan of the Ottoman Empire between 1730 and 1754.
The gun is amazing because of the various compartments behind some of the jewels. For example, you' see pen knife come out one compartment abnd a ceremonial dagger from another compartment.
Thanks to Joshua Fahler for the link.