Been there done that with my 3rd pregnancy - that cutie DS in my siggie.
I had to have my gall bladder removed when I was 17 weeks pregnant because my gall bladder attacks were so bad.
There is NOTHING you can do to stop a gall bladder attack other than take pain killers and muscle relaxers and the ones that are approved to take during pregnancy don't do much.
Once I was diagnosed I had to wait a couple of weeks for the surgery and followed what my surgeon called a "monk's diet" to keep from having another attack. It was hard but it worked!
I eliminated anything fried including anything like chips, hush puppies, doughnuts, etc.. Also I had to eliminate anything with white flour, white sugar (especially high fructose corn syrup), dairy, artificial sweetners and anything "spicy". I drank nothing but unsweet tea flavored with lemon and water. I ate salads, fresh fruits, veggies, wheat bread, grilled chicken, lean steak and things like that. Once I started that diet I didn't have another attack so it did work but it was very extreme especially with my pregnancy cravings!
With only 4 weeks to go until you deliver I would highly doubt they would be able to remove the gall bladder anyway b/c the baby would be in the way. You will have to wait until after you deliver unless there is an emergency situation and you sure don't want that to happen. Modify the diet to avoid that at all costs!!
Good luck! DS is 15 months old now and my gall bladder scars are practically invisible already.