Pass GioFiles from FileChooser instead of URIs

Otherwise they are converted back to GioFile to check their existance and back again to URI which is unefficient. This change avoids doing that.
This commit is contained in:
Rafostar
2020-12-24 15:08:01 +01:00
parent a096c43b97
commit 117a372189
2 changed files with 7 additions and 4 deletions

View File

@@ -52,18 +52,17 @@ class ClapperFileChooser extends Gtk.FileChooserNative
let playlist = [];
while((file = files.get_item(index))) {
let uri = file.get_uri();
let filename = file.get_basename();
let [type, isUncertain] = Gio.content_type_guess(filename, null);
if(this.subsMimes.includes(type)) {
subs = uri;
subs = file;
files.remove(index);
continue;
}
playlist.push(uri);
playlist.push(file);
index++;
}

View File

@@ -156,8 +156,12 @@ class ClapperPlayer extends PlayerBase
return this._playlist;
}
set_subtitles(uri)
set_subtitles(source)
{
let uri = (source.get_uri)
? source.get_uri()
: source;
this.set_subtitle_uri(uri);
this.set_subtitle_track_enabled(true);