From: Olaf Wintermann Date: Fri, 7 Apr 2023 13:37:20 +0000 (+0200) Subject: implement playlist remove X-Git-Url: https://uap-core.de/gitweb/?a=commitdiff_plain;h=ac79c9d337cc83d38b530a8ba06fdca15ffe217e;p=uwplayer.git implement playlist remove --- diff --git a/application/Sidebar.c b/application/Sidebar.c index 733e21a..145bea6 100644 --- a/application/Sidebar.c +++ b/application/Sidebar.c @@ -217,8 +217,17 @@ static void sidebar_resize(Widget widget) { static void remove_cb(Widget item, XtPointer index, XtPointer cd) { - printf("test_cb\n"); - fflush(stdout); + Widget parent = XtParent(item); + Sidebar sb = NULL; + XtVaGetValues(parent, XmNuserData, &sb, NULL); + + int currentTrack = sb->sidebar.window->playlist.current_track; + cxListRemove(sb->sidebar.window->playlist.tracks, sb->sidebar.select2); + if(sb->sidebar.select2 == currentTrack) { + PlayListPlayNext(sb->sidebar.window, true); + } + sb->sidebar.select2 = -1; + SidebarRepaint((Widget)sb); } @@ -260,9 +269,9 @@ static void sidebar_realize(Widget widget, XtValueMask *mask, XSetWindowAttribut XmString s1 = XmStringCreateSimple("Remove"); sb->sidebar.popupMenu = XmVaCreateSimplePopupMenu( widget, "popup", remove_cb, - //XmNuserData, widget, XmVaPUSHBUTTON, s1, 'R', NULL, NULL, NULL); + XtVaSetValues(sb->sidebar.popupMenu, XmNuserData, sb, NULL); XmStringFree(s1); }