0

I'm using cmake and following the instructions per Elementary OS site (https://elementary.io/docs/code/getting-started#building-and-installing-with-cmake).

Everything looks good when compiling the app, but when building and installing the app the styles are missing. Perhaps I'm missing a step? Here's my code:

var css_provider = new Gtk.CssProvider(); try { css_provider.load_from_path("style.css"); } catch (GLib.Error e) { stderr.printf("%s", e.message); } Gtk.StyleContext.add_provider_for_screen(Gdk.Screen.get_default(), css_provider, Gtk.STYLE_PROVIDER_PRIORITY_USER);

1 Answer 1

0

I was able to find my own answer.

What I needed to do was install it in CMakeLists.txt

# install css
INSTALL(FILES src/style.css DESTINATION ${PKGDATADIR})

Then in the vala file I needed to call it where the destination would be:

try {
    css_provider.load_from_path(DESTINATION + "/style.css");
  } catch (GLib.Error e) {
    stderr.printf("%s", e.message);
  }

DESTINATION should be the location in the directory where you are saving the file. This can be done by assigning variables or hardcoding it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.