Search code examples
gtk3vala

No default icons in Vala on macOS


I have this super simple Vala with Gtk 3 application that shows a basic window with a header bar, nothing less, nothing more.

int main(string[] args) {
  Gtk.init(ref args);
  var header = new Gtk.HeaderBar();
  header.set_show_close_button(true);
  header.title = "Hello";
  var window = new Gtk.Window();
  window.set_titlebar(header);
  window.destroy.connect(Gtk.main_quit);
  window.show_all();
  Gtk.main();
  return 0;
}

It's compiled on a macOS 10.11.6 box with valac --pkg gtk+-3.0 hello.vala and Vala is installed via homebrew (which installed version 0.34.4). The application works but the minimize, maximaze and close icon images are missing.

Same problem when I run any of the applications it came with like gtk3-icon-browser: works but no icons.

I am new to Vala so I might be missing a dependency I don't know about... or is this a bug?

The terminal spits out the following warning when I run the application, no warnings when compiling.

hello[10331:362029] *** WARNING: Method userSpaceScaleFactor in class NSView is deprecated on 10.7 and later. It should not be used in new applications. Use convertRectToBacking: instead. 
(hello:10331): Gdk-WARNING **: GdkQuartzDisplay does not implement the monitor vfuncs

The warning does not seem related as far as I can tell. It's a Retina MBP, maybe the 2x assets are missing?

gtk3-icon-browser without icons


Solution

  • I'd recommend installing GTK via the officially supported method or using these custom JHBuild modules that I developed. Both of these methods will build and install the adwaita-icon-theme module, which provides the icons for GTK.

    You may also be able to build this module via Homebrew in your existing setup, but I don't know for sure.