Thanks!
I was indeed able to style it with CSS (for the most part – it seems resistant to certain types of styling, but that’s a different question):
For anyone curious, in my executable’s directory, I made a prototype.css
file with:
/* Style menus */
.menu {
margin: 50px;
}
/* Style menu entries */
.menu * {
color: white;
background-color: red;
}
Note: The margin: 50px;
is why the menu in the screenshot’s surrounded by a huge black square. Ordinarily, the black area would be transparent, but I have my desktop environment’s compositor disabled. That disables transparency, rendering the transparent area solid black.
Then, in the callback function connected to my GtkApplication
’s activate
signal:
// Apply CSS stylesheet.
GdkDisplay* display = gdk_display_get_default();
GtkCssProvider* css_provider = gtk_css_provider_new();
GFile* css_stylesheet = g_file_new_for_path("./prototype.css");
gtk_css_provider_load_from_file(css_provider,
css_stylesheet);
gtk_style_context_add_provider_for_display(display,
GTK_STYLE_PROVIDER(css_provider),
GTK_STYLE_PROVIDER_PRIORITY_FALLBACK);
g_object_unref(css_stylesheet);
g_object_unref(css_provider);