Add Clapper usage as GTK widget

This commit is contained in:
Rafostar
2020-10-21 12:24:42 +02:00
parent 0291377389
commit 0b1864378b
11 changed files with 159 additions and 64 deletions

View File

@@ -1,4 +1,4 @@
const { GLib, GObject, Gst, Gtk, Pango } = imports.gi;
const { GObject, Gtk, Pango } = imports.gi;
var HeaderBar = GObject.registerClass(
class ClapperHeaderBar extends Gtk.HeaderBar
@@ -25,27 +25,8 @@ class ClapperHeaderBar extends Gtk.HeaderBar
this.pack_end(fullscreenButton);
}
updateHeaderBar(mediaInfo)
updateHeaderBar(title, subtitle)
{
let title = mediaInfo.get_title();
let subtitle = mediaInfo.get_uri();
if(Gst.Uri.get_protocol(subtitle) === 'file') {
subtitle = GLib.path_get_basename(
GLib.filename_from_uri(subtitle)[0]
);
}
if(!title) {
title = (!subtitle)
? this.defaultTitle
: (subtitle.includes('.'))
? subtitle.split('.').slice(0, -1).join('.')
: subtitle;
subtitle = null;
}
this.titleLabel.label = title;
this.subtitleLabel.visible = (subtitle !== null);