diff --git a/.gitignore b/.gitignore index c88cc81eca2779091b1cb1416d6bf18abeb5b46c..eb15d0b07a79e6314cc0142106c99ea1acfb9edd 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ *.o rugby +rugby-resources.c diff --git a/Makefile b/Makefile index cb9448b6df8237158c9c9f8d90ba1ed53eba0787..6891e578a89cc9543cb2b4eb842c17b10afeb512 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,10 @@ LDLIBS = `pkg-config --libs gtk+-3.0` all: rugby -rugby: rugby-application.o rugby-cell-renderer-score.o rugby-score-store.o rugby-scoring.o rugby.o +rugby: rugby-application.o rugby-cell-renderer-score.o rugby-resources.o rugby-score-store.o rugby-scoring.o rugby.o + +rugby-resources.c: rugby.gresource.xml $(shell glib-compile-resources --generate-dependencies rugby.gresource.xml) + glib-compile-resources --generate-source rugby.gresource.xml --target $@ clean: - $(RM) rugby *.o + $(RM) rugby *.o rugby-resources.c diff --git a/rugby-application.c b/rugby-application.c index ff66154de48751f0543ac2c463a2c32c24f36c1f..087590e727a4bf013709f2d45a2919d0a0fc6471 100644 --- a/rugby-application.c +++ b/rugby-application.c @@ -137,7 +137,7 @@ rugby_application_startup (GApplication *application) g_action_map_add_action_entries (G_ACTION_MAP (application), app_entries, G_N_ELEMENTS (app_entries), application); builder = gtk_builder_new (); - if (!gtk_builder_add_from_file (builder, "interface.ui", &err)) + if (!gtk_builder_add_from_resource (builder, "/uk/me/bcowan/rugby/interface.ui", &err)) { g_error ("Error: %s", err->message); } @@ -161,7 +161,7 @@ rugby_application_activate (GApplication *app) GtkCssProvider *provider; builder = gtk_builder_new (); - if (!gtk_builder_add_from_file (builder, "interface.ui", &err)) + if (!gtk_builder_add_from_resource (builder, "/uk/me/bcowan/rugby/interface.ui", &err)) { g_error ("Error: %s", err->message); } @@ -202,6 +202,7 @@ rugby_application_activate (GApplication *app) /* init CSS */ provider = gtk_css_provider_new (); + /* TODO load this from resource */ gtk_css_provider_load_from_path (provider, "rugby.css", NULL); gtk_style_context_add_provider_for_screen (gdk_screen_get_default (), GTK_STYLE_PROVIDER (provider), diff --git a/rugby.gresource.xml b/rugby.gresource.xml new file mode 100644 index 0000000000000000000000000000000000000000..1c7c2f84953154abd8f5135f4c2967dde43b4e5d --- /dev/null +++ b/rugby.gresource.xml @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<gresources> + <gresource prefix="/uk/me/bcowan/rugby"> + <file preprocess="xml-stripblanks">interface.ui</file> + <file compressed="true">rugby.css</file> + </gresource> +</gresources>