From: Ira W. Snyder Date: Fri, 11 Jan 2008 04:45:23 +0000 (-0800) Subject: Move main() into its own file X-Git-Url: https://www.irasnyder.com/gitweb/?p=tilda-gobject.git;a=commitdiff_plain;h=087f41d0249ab8bb5c2fb122af1204e7183d3d7f Move main() into its own file This moves main() into its own file, which paves the way for a little more realism in the design, and gets us set up for trying out DBus. --- diff --git a/Makefile b/Makefile index 1396ced..5136211 100644 --- a/Makefile +++ b/Makefile @@ -6,32 +6,28 @@ GOBJ_LIBS=`pkg-config --libs gobject-2.0` ALL_CFLAGS=`pkg-config --cflags gtk+-2.0 vte` ALL_LIBS=`pkg-config --libs gtk+-2.0 vte` -.PHONY: all memcheck-tt memcheck-tw memcheck clean +.PHONY: all memcheck clean -all: tilda-window +all: tilda -tilda-window: tilda-window.o tilda-terminal.o +tilda: tilda.o tilda-window.o tilda-terminal.o $(GCC) $(CFLAGS) $^ -o $@ $(ALL_LIBS) -tilda-window.o: tilda-window.c tilda-window.h +tilda.o: tilda.c $(GCC) $(CFLAGS) -c -o $@ $< $(ALL_CFLAGS) -tilda-terminal: tilda-terminal.o - $(GCC) $(CFLAGS) $^ -o $@ $(ALL_LIBS) +tilda-window.o: tilda-window.c tilda-window.h + $(GCC) $(CFLAGS) -c -o $@ $< $(ALL_CFLAGS) tilda-terminal.o: tilda-terminal.c tilda-terminal.h $(GCC) $(CFLAGS) -c -o $@ $< $(ALL_CFLAGS) -memcheck-tw: tilda-window - valgrind --tool=memcheck ./tilda-window - -memcheck-tt: tilda-terminal - valgrind --tool=memcheck ./tilda-terminal - -memcheck: memcheck-tt memcheck-tw +memcheck: tilda + valgrind --tool=memcheck ./tilda clean: rm -f *.o rm -f tilda-window rm -f tilda-terminal + rm -f tilda diff --git a/tilda-window.c b/tilda-window.c index fdf2376..a9a2a79 100644 --- a/tilda-window.c +++ b/tilda-window.c @@ -243,6 +243,8 @@ tilda_window_get_type (void) return type; } +#if 0 + int main (int argc, char *argv[]) { GObject *tw; @@ -269,4 +271,6 @@ int main (int argc, char *argv[]) return 0; } +#endif + /* vim: set ts=4 sts=4 sw=4 noet tw=112: */ diff --git a/tilda.c b/tilda.c new file mode 100644 index 0000000..fc0497d --- /dev/null +++ b/tilda.c @@ -0,0 +1,27 @@ +#include + +#include "tilda-window.h" +#include "tilda-terminal.h" + +int main (int argc, char *argv[]) +{ + TildaWindow *tw; + + /* Initialize GTK+ (and the GObject system) */ + gtk_init (&argc, &argv); + + /* Create a TildaWindow, run it, and exit when it does, basically. + * + * This is nothing like what the real main() will be, but it's + * a good start for testing and integration of more of TildaWindow + * and TildaTerminal. */ + tw = g_object_new (TILDA_TYPE_WINDOW, "number", 0, NULL); + + gtk_main (); + + g_object_unref (G_OBJECT (tw)); + + return 0; +} + +/* vim: set ts=4 sts=4 sw=4 noet tw=112: */