Some apps on the gnome desktop like the image viewer use a dark variation of the theme. What code is required to make my own gtk program use this dark variation of the theme?
Use the gtk-application-prefer-dark-theme
setting. This ought to do it:
g_object_set(gtk_settings_get_default(),
"gtk-application-prefer-dark-theme", TRUE,
NULL);
You may need to make sure you do it before you create any widgets.