diff --git a/.gitignore b/.gitignore
index ab14003..d7f2dd8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -31,6 +31,10 @@ Makefile.in
/compile
/tags
+# Generated files
+/src/ag-resources.c
+/src/ag-resources.h
+
# Geonames related things
/data/geonames/*.txt
/data/geonames/geodata.xml
diff --git a/src/Makefile.am b/src/Makefile.am
index 7cbb7fa..39d4cc9 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,7 +1,25 @@
+resource_files = $(shell glib-compile-resources --sourcedir=$(srcdir) --generate-dependencies $(srcdir)/ag.gresource.xml)
+
+ag-resources.c: ag.gresource.xml $(resource_files)
+ glib-compile-resources --target=$@ --sourcedir=$(srcdir) --generate-source --c-name ag $(srcdir)/ag.gresource.xml
+
+ag-resources.h: ag.gresource.xml $(resource_files)
+ glib-compile-resources --target=$@ --sourcedir=$(srcdir) --generate-header --c-name ag $(srcdir)/ag.gresource.xml
+
+BUILT_SOURCES = \
+ ag-resources.h \
+ ag-resources.c \
+ $(NULL)
+
+EXTRA_DIST = \
+ $(resource_files) \
+ ag.gresource.xml \
+ $(NULL)
+
AM_CPPFLAGS = -DG_LOG_DOMAIN=\"Astrognome\" -DLOCALEDIR=\"$(localedir)\" -DPKGDATADIR=\"$(pkgdatadir)\"
bin_PROGRAMS = astrognome
-astrognome_SOURCES = astrognome.c
+astrognome_SOURCES = ag-app.c astrognome.c $(BUILT_SOURCES)
astrognome_LDADD = $(SWE_GLIB_LIBS) $(GTK_LIBS)
astrognome_LDFLAGS = -rdynamic
astrognome_CFLAGS = $(SWE_GLIB_CFLAGS) $(CFLAGS) $(GTK_CFLAGS) -Wall
@@ -9,4 +27,4 @@ astrognome_CFLAGS = $(SWE_GLIB_CFLAGS) $(CFLAGS) $(GTK_CFLAGS) -Wall
guidir = $(pkgdatadir)
gui_DATA = astrognome.ui
-EXTRA_DIST = $(gui_DATA)
+EXTRA_DIST += $(gui_DATA)
diff --git a/src/ag.gresource.xml b/src/ag.gresource.xml
new file mode 100644
index 0000000..6466ba3
--- /dev/null
+++ b/src/ag.gresource.xml
@@ -0,0 +1,6 @@
+
+
+
+ astrognome.ui
+
+
diff --git a/src/astrognome.ui b/src/astrognome.ui
index cc27e4a..d99edcb 100644
--- a/src/astrognome.ui
+++ b/src/astrognome.ui
@@ -1,6 +1,33 @@
+