diff options
author | Thomas White <taw@bitwiz.org.uk> | 2011-10-03 15:11:14 +0200 |
---|---|---|
committer | Thomas White <taw@bitwiz.org.uk> | 2011-10-03 15:11:14 +0200 |
commit | 7c04fa7edd76c6a06121a88b8a346d45917af0dc (patch) | |
tree | bfcf21d8f2941667c08eb76215a5dde89a4fb470 /src/objects.c | |
parent | f4ff26c955729f8b068c64fff806216eb6e34bd4 (diff) |
More fun with methods
Diffstat (limited to 'src/objects.c')
-rw-r--r-- | src/objects.c | 33 |
1 files changed, 5 insertions, 28 deletions
diff --git a/src/objects.c b/src/objects.c index 4d18df1..a38341c 100644 --- a/src/objects.c +++ b/src/objects.c @@ -34,44 +34,20 @@ #include "mainwindow.h" -struct object *new_object(enum objtype t, struct style *sty) -{ - struct object *new; - - new = calloc(1, sizeof(struct object)); - if ( new == NULL ) return NULL; - - new->type = t; - new->empty = 1; - new->parent = NULL; - new->style = sty; - - return new; -} - - -void free_object(struct object *o) -{ - if ( o->layout != NULL ) g_object_unref(o->layout); - if ( o->fontdesc != NULL ) pango_font_description_free(o->fontdesc); - free(o); -} - - struct object *add_image_object(struct slide *s, double x, double y, const char *filename, double width, double height) { struct object *new; - new = new_object(IMAGE, NULL); + new = NULL; /* FIXME! Generally */ new->x = x; new->y = y; new->bb_width = width; new->bb_height = height; if ( add_object_to_slide(s, new) ) { - free_object(new); + delete_object(new); return NULL; } s->object_seq++; @@ -111,6 +87,7 @@ void notify_style_update(struct presentation *p, struct style *sty) void delete_object(struct object *o) { - remove_object_from_slide(o->parent, o); - free_object(o); + if ( o->parent != NULL ) remove_object_from_slide(o->parent, o); + o->delete_object(o); + free(o); } |