From 82db7788d2cde9df885a9fcb2c90b87fe9a52ecf Mon Sep 17 00:00:00 2001 From: Nikias Bassen Date: Sun, 27 Dec 2009 15:12:48 +0100 Subject: Allow adding items to empty icon lists --- src/sbmanager.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/sbmanager.c b/src/sbmanager.c index 5ef3d04..ed860eb 100644 --- a/src/sbmanager.c +++ b/src/sbmanager.c @@ -647,9 +647,13 @@ static void redraw_icons() static GList *insert_into_icon_list(GList *iconlist, SBItem *newitem, gfloat item_x, gfloat item_y) { - if (!newitem || !iconlist) { + if (!newitem) { return iconlist; } + if (!iconlist) { + /* for empty lists just add the element */ + return g_list_append(iconlist, newitem); + } gint i; gint count = g_list_length(iconlist); gint newpos = count; @@ -682,7 +686,7 @@ static GList *insert_into_icon_list(GList *iconlist, SBItem *newitem, gfloat ite } } - return g_list_insert(iconlist, selected_item, newpos); + return g_list_insert(iconlist, newitem, newpos); } static gboolean stage_motion(ClutterActor *actor, ClutterMotionEvent *event, gpointer user_data) -- cgit v1.1-32-gdbae