Skip to content

Commit

Permalink
cocoaui: undo grouping when adding files from medialib
Browse files Browse the repository at this point in the history
  • Loading branch information
Oleksiy-Yakovenko committed Feb 2, 2024
1 parent ecffd7d commit b90e459
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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;
Expand All @@ -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);
}
Expand Down

0 comments on commit b90e459

Please sign in to comment.