From b90e459cb546df5e5f5cfa31a4a77f4acd7c1d39 Mon Sep 17 00:00:00 2001 From: Oleksiy Yakovenko Date: Fri, 2 Feb 2024 11:50:42 +0100 Subject: [PATCH] cocoaui: undo grouping when adding files from medialib --- .../MediaLibrary/MediaLibraryOutlineViewController.m | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/plugins/cocoaui/MediaLibrary/MediaLibraryOutlineViewController.m b/plugins/cocoaui/MediaLibrary/MediaLibraryOutlineViewController.m index 957433a77d..9bc83cb0c3 100644 --- a/plugins/cocoaui/MediaLibrary/MediaLibraryOutlineViewController.m +++ b/plugins/cocoaui/MediaLibrary/MediaLibraryOutlineViewController.m @@ -18,6 +18,8 @@ #import "MedialibItemDragDropHolder.h" #import "TrackContextMenu.h" #import "TrackPropertiesWindowController.h" +#import "undo/undobuffer.h" +#import "undo/undomanager.h" extern DB_functions_t *deadbeef; @@ -372,6 +374,9 @@ - (int)addSelectionToPlaylist:(ddb_playlist_t *)plt { int count = 0; + ddb_undobuffer_t *undobuffer = ddb_undomanager_get_buffer (ddb_undomanager_shared ()); + ddb_undobuffer_group_begin (undobuffer); + ddb_playItem_t *prev = deadbeef->plt_get_last(plt, PL_MAIN); for (item in items) { ddb_playItem_t *playItem = item.playItem; @@ -387,6 +392,9 @@ - (int)addSelectionToPlaylist:(ddb_playlist_t *)plt { prev = it; count += 1; } + + ddb_undobuffer_group_end (undobuffer); + if (prev != NULL) { deadbeef->pl_item_unref (prev); }