diff options
Diffstat (limited to 'source/widgets')
-rw-r--r-- | source/widgets/box.c | 6 | ||||
-rw-r--r-- | source/widgets/listview.c | 12 | ||||
-rw-r--r-- | source/widgets/widget.c | 6 |
3 files changed, 16 insertions, 8 deletions
diff --git a/source/widgets/box.c b/source/widgets/box.c index 6f5b12de..bb36f292 100644 --- a/source/widgets/box.c +++ b/source/widgets/box.c @@ -202,13 +202,15 @@ static void box_free ( widget *wid ) widget * child = (widget *) iter->data; widget_free ( child ); } - + g_list_free ( b->children ); g_free ( b ); } void box_add ( box *box, widget *child, gboolean expand, gboolean end ) { - if ( box == NULL ) return; + if ( box == NULL ) { + return; + } child->expand = expand; child->end = end; child->parent = WIDGET ( box ); diff --git a/source/widgets/listview.c b/source/widgets/listview.c index 055be2f6..ce6072e0 100644 --- a/source/widgets/listview.c +++ b/source/widgets/listview.c @@ -71,9 +71,15 @@ struct _listview void *mouse_activated_data; }; -static void listview_free ( widget *widget ) +static void listview_free ( widget *wid ) { - listview *lv = (listview *) widget; + listview *lv = (listview *) wid; + for ( unsigned int i = 0; i < lv->cur_elements; i++ ) { + widget_free ( WIDGET ( lv->boxes [i] ) ); + } + g_free ( lv->boxes ); + + widget_free ( WIDGET ( lv->scrollbar ) ); g_free ( lv ); } static unsigned int scroll_per_page ( listview * lv ) @@ -237,7 +243,7 @@ static void listview_resize ( widget *wid, short w, short h ) lv->max_rows = ( lv->padding + lv->widget.h ) / ( lv->element_height + lv->padding ); lv->max_elements = lv->max_rows * lv->menu_columns; - widget_move ( WIDGET ( lv->scrollbar ), lv->widget.w - widget_get_width ( WIDGET (lv->scrollbar ) ), 0 ); + widget_move ( WIDGET ( lv->scrollbar ), lv->widget.w - widget_get_width ( WIDGET ( lv->scrollbar ) ), 0 ); widget_resize ( WIDGET ( lv->scrollbar ), widget_get_width ( WIDGET ( lv->scrollbar ) ), h ); listview_recompute_elements ( lv ); diff --git a/source/widgets/widget.c b/source/widgets/widget.c index 48642cb7..0aee2e70 100644 --- a/source/widgets/widget.c +++ b/source/widgets/widget.c @@ -66,10 +66,10 @@ void widget_draw ( widget *widget, cairo_t *d ) widget->need_redraw = FALSE; } } -void widget_free ( widget *widget ) +void widget_free ( widget *wid ) { - if ( widget && widget->free ) { - widget->free ( widget ); + if ( wid && wid->free ) { + wid->free ( wid ); } } |