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);
}
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);
}