Embed glade file in executable
authorKeith Packard <keithp@keithp.com>
Mon, 18 May 2009 06:13:20 +0000 (23:13 -0700)
committerKeith Packard <keithp@keithp.com>
Mon, 18 May 2009 06:13:20 +0000 (23:13 -0700)
This eliminates install issues nicely.

Signed-off-by: Keith Packard <keithp@keithp.com>
aoview/Makefile
aoview/aoview_main.c

index 8f9c08df1e355730155936b7b79b561cb1cfe8a5..1941b080a4026ff67a67db699d46a14b1ee2897c 100644 (file)
@@ -30,5 +30,10 @@ $(PROG): $(OBJ)
 
 $(OBJ): $(INC)
 
+aoview_main.o: aoview_glade.h
+
 clean:
        rm -f $(OBJ) $(PROG)
+
+aoview_glade.h: aoview.glade
+       sed -e 's/"/\\"/g' -e 's/^/"/' -e 's/$$/"/' $< > $@
index e2164e05ec166037ad5b534e48fabaab47532b37..a3dc95441ed2a9c261d26e49f8e202dc2cb0724f 100644 (file)
 
 #include "aoview.h"
 
+static const char aoview_glade[] = {
+#include "aoview_glade.h"
+};
+
 static void usage(void) {
        printf("aoview [--device|-d device_file]");
        exit(1);
@@ -57,7 +61,8 @@ int main(int argc, char **argv)
        gtk_init(&argc, &argv);
        glade_init();
 
-       xml = glade_xml_new("aoview.glade", NULL, NULL);
+       xml = glade_xml_new_from_buffer(aoview_glade, sizeof (aoview_glade), NULL, NULL);
+
        /* connect the signals in the interface */
        glade_xml_signal_autoconnect(xml);