New gobject types test
authordanigm <dani@danigm.net>
Sat, 14 Aug 2010 11:48:33 +0000 (13:48 +0200)
committerdanigm <dani@danigm.net>
Sat, 14 Aug 2010 11:48:33 +0000 (13:48 +0200)
src/Makefile.am
src/typestest.c [new file with mode: 0644]

index 437859a..ceefe2c 100644 (file)
@@ -1,14 +1,13 @@
 ## Process this file with automake to generate a Makefile.in
 ## To build all programs with GTK+ uncomment these lines.
-##AM_CPPFLAGS = @GTK_CFLAGS@
-##AM_LDADD = @GTK_LIBS@
 
 AM_CPPFLAGS = -I$(top_srcdir) -I$(includedir) $(GNOME_INCLUDEDIR) \
          -DG_LOG_DOMAIN=\"tbo\"
 
 bin_PROGRAMS = tbo
+noinst_PROGRAMS = typestest
 
-tbo_SOURCES = \
+SOURCES = \
        tbo-window.c \
        comic.c \
        comic-new-dialog.c \
@@ -16,7 +15,6 @@ tbo_SOURCES = \
        comic-open-dialog.c \
        frame.c \
        page.c \
-       tbo.c \
        ui-drawing.c \
        ui-menu.c \
        ui-toolbar.c \
@@ -64,14 +62,22 @@ tbo_SOURCES = \
        tbo-utils.h \
        export.h \
        tbo-ui-utils.h \
+       tbo-object-base.h \
+       tbo-object-base.c \
+       tbo-object-svg.h \
+       tbo-object-svg.c \
        custom-stock.h
 
-tbo_CFLAGS = @GTK_CFLAGS@ \
+AM_CFLAGS = @GTK_CFLAGS@ \
                         $(PACKAGE_CFLAGS) \
                        -DGNOMELOCALEDIR=\"$(datadir)/locale\" \
                        -DDATA_DIR=\""$(pkgdatadir)"\"
-
 tbo_LDADD = @GTK_LIBS@ \
                        $(PACKAGE_LIBS)
+typestest_LDADD = @GTK_LIBS@ \
+                               $(PACKAGE_LIBS)
+
+typestest_SOURCES = $(SOURCES) typestest.c
+tbo_SOURCES = $(SOURCES) tbo.c
 
 CLEANFILES = *~
diff --git a/src/typestest.c b/src/typestest.c
new file mode 100644 (file)
index 0000000..7953905
--- /dev/null
@@ -0,0 +1,35 @@
+#include <stdio.h>
+#include "tbo-object-base.h"
+#include "tbo-object-svg.h"
+
+void
+print_tbo_object (TboObjectBase *obj)
+{
+    printf ("obj:\n x, y: (%d, %d)\n w, h: (%d, %d)\n",
+            obj->x, obj->y, obj->width, obj->height);
+}
+
+int
+main (int argc, char **argv)
+{
+    g_type_init ();
+
+    /* simple svg object */
+    TboObjectSvg *svg = TBO_OBJECT_SVG (tbo_object_svg_new ());
+
+    print_tbo_object (TBO_OBJECT_BASE (svg));
+    printf ("path: '%s'\n", svg->path->str);
+
+    g_object_unref (svg);
+
+    /* svg object with params */
+    svg = TBO_OBJECT_SVG (tbo_object_svg_new_with_params (100, 200,
+                                150, 300, "/path/to/svgfile.svg"));
+
+    print_tbo_object (TBO_OBJECT_BASE (svg));
+    printf ("path: '%s'\n", svg->path->str);
+
+    g_object_unref (svg);
+
+    return 0;
+}