Move main() into its own file
authorIra W. Snyder <devel@irasnyder.com>
Fri, 11 Jan 2008 04:45:23 +0000 (20:45 -0800)
committerIra W. Snyder <devel@irasnyder.com>
Fri, 11 Jan 2008 04:46:32 +0000 (20:46 -0800)
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.

Makefile
tilda-window.c
tilda.c [new file with mode: 0644]

index 1396ced..5136211 100644 (file)
--- 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
 
index fdf2376..a9a2a79 100644 (file)
@@ -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 (file)
index 0000000..fc0497d
--- /dev/null
+++ b/tilda.c
@@ -0,0 +1,27 @@
+#include <glib.h>
+
+#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: */