mirror of
https://github.com/Rafostar/clapper.git
synced 2025-08-30 07:42:23 +02:00
Prepare resume playback dialog
This commit is contained in:
@@ -162,6 +162,45 @@ class ClapperUriDialog extends Gtk.Dialog
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
var ResumeDialog = GObject.registerClass(
|
||||||
|
class ClapperResumeDialog extends Gtk.MessageDialog
|
||||||
|
{
|
||||||
|
_init(window, resumeInfo)
|
||||||
|
{
|
||||||
|
const percentage = Math.round((resumeInfo.time / resumeInfo.duration) * 100);
|
||||||
|
|
||||||
|
const msg = [
|
||||||
|
`<b>Title:</b> ${resumeInfo.title}`,
|
||||||
|
`<b>Completed:</b> ${percentage}%`
|
||||||
|
].join('\n');
|
||||||
|
|
||||||
|
super._init({
|
||||||
|
transient_for: window,
|
||||||
|
modal: true,
|
||||||
|
message_type: Gtk.MessageType.QUESTION,
|
||||||
|
buttons: Gtk.ButtonsType.YES_NO,
|
||||||
|
text: 'Resume playback?',
|
||||||
|
secondary_use_markup: true,
|
||||||
|
secondary_text: msg,
|
||||||
|
});
|
||||||
|
|
||||||
|
this.resumeInfo = resumeInfo;
|
||||||
|
this.connect('response', this._onResponse.bind(this));
|
||||||
|
|
||||||
|
this.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
_onResponse(dialog, respId)
|
||||||
|
{
|
||||||
|
const { player } = this.transient_for.child;
|
||||||
|
|
||||||
|
if(respId === Gtk.ResponseType.YES)
|
||||||
|
player.seek_seconds(this.resumeInfo.time);
|
||||||
|
|
||||||
|
this.destroy();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
var PrefsDialog = GObject.registerClass(
|
var PrefsDialog = GObject.registerClass(
|
||||||
class ClapperPrefsDialog extends Gtk.Dialog
|
class ClapperPrefsDialog extends Gtk.Dialog
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user