Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve responsiveness when opening many files #827

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/celluloid-controller.c
Original file line number Diff line number Diff line change
Expand Up @@ -1040,7 +1040,15 @@ metadata_cache_update_handler(CelluloidModel *model, gint64 pos, gpointer data)
GPtrArray *playlist = NULL;

g_object_get(G_OBJECT(model), "playlist", &playlist, NULL);
celluloid_view_update_playlist(view, playlist);

/* Update the playlist widget view only once, when
* handling the final entry in the playlist.
*/
gint64 playlist_count = playlist ? playlist->len : 0;
if (pos == playlist_count - 1)
{
celluloid_view_update_playlist(view, playlist);
}
}

static void
Expand Down
13 changes: 4 additions & 9 deletions src/celluloid-player.c
Original file line number Diff line number Diff line change
Expand Up @@ -657,15 +657,10 @@ load_file(CelluloidMpv *mpv, const gchar *uri, gboolean append)
->load_file(mpv, uri, append);
}

/* Playlist items added when mpv is idle doesn't get added directly to
* its internal playlist, so the property change signal won't be fired.
* We need to emit notify signal here manually to ensure that the
* playlist widget gets updated.
*/
if(idle_active)
{
g_object_notify(G_OBJECT(player), "playlist");
}
/* The playlist will be notified when idle due to
* update_playlist(), when mpv_property_changed signals.
* The playlist view should not be regenerated for every loaded file.
*/
}

static void
Expand Down