mirror of
https://github.com/Rafostar/clapper.git
synced 2025-08-29 23:32:04 +02:00
Remove app usage as a pre-made widget
This seemed like a good idea when the app still used GTK3, but GTK4 already has a built-in video widget. Maintaning this single functionality would be hard and I cannot promise a stable API anyway. The app main and only purpose will be a video player from now on.
This commit is contained in:
@@ -1,48 +0,0 @@
|
||||
imports.gi.versions.Gtk = '4.0';
|
||||
|
||||
const Gtk = imports.gi.Gtk;
|
||||
const Clapper = imports.clapper;
|
||||
|
||||
let app = new Gtk.Application({
|
||||
application_id: 'com.clapper.AppExample'
|
||||
});
|
||||
|
||||
app.connect('activate', () => {
|
||||
let window = new Gtk.ApplicationWindow({
|
||||
application: app,
|
||||
title: 'Clapper App Example',
|
||||
});
|
||||
let grid = new Gtk.Grid({
|
||||
halign: Gtk.Align.CENTER,
|
||||
valign: Gtk.Align.CENTER,
|
||||
margin_start: 20,
|
||||
margin_end: 20,
|
||||
margin_top: 10,
|
||||
margin_bottom: 10,
|
||||
});
|
||||
let box = new Gtk.Box({
|
||||
orientation: Gtk.Orientation.HORIZONTAL,
|
||||
spacing: 8,
|
||||
});
|
||||
let button = new Gtk.Button({
|
||||
icon_name: 'folder-videos-symbolic',
|
||||
});
|
||||
let label = new Gtk.Label({
|
||||
label: 'Click this button to play Big Buck Bunny!',
|
||||
});
|
||||
|
||||
button.connect('clicked', () => {
|
||||
let clapper = new Clapper.App({
|
||||
playlist: ['http://distribution.bbb3d.renderfarming.net/video/mp4/bbb_sunflower_1080p_30fps_normal.mp4']
|
||||
});
|
||||
clapper.run();
|
||||
});
|
||||
|
||||
box.append(label);
|
||||
box.append(button);
|
||||
grid.attach(box, 0, 0, 1, 1);
|
||||
|
||||
window.set_child(grid);
|
||||
window.present();
|
||||
});
|
||||
app.run([]);
|
@@ -1,40 +0,0 @@
|
||||
imports.gi.versions.Gtk = '4.0';
|
||||
|
||||
const Gtk = imports.gi.Gtk;
|
||||
const Clapper = imports.clapper;
|
||||
|
||||
let app = new Gtk.Application({
|
||||
application_id: 'com.clapper.WidgetExample'
|
||||
});
|
||||
|
||||
app.connect('activate', () => {
|
||||
let window = new Gtk.ApplicationWindow({
|
||||
application: app,
|
||||
title: 'Clapper Widget Example',
|
||||
width_request: 460,
|
||||
height_request: 390,
|
||||
});
|
||||
let box = new Gtk.Box({
|
||||
orientation: Gtk.Orientation.VERTICAL,
|
||||
});
|
||||
let label = new Gtk.Label({
|
||||
label: [
|
||||
'Clapper is used as a widget and placed below.',
|
||||
'Double click it to enter fullscreen!',
|
||||
].join('\n')
|
||||
});
|
||||
let widget = new Clapper.Widget();
|
||||
|
||||
window.bind('fullscreened', label, 'visible', GObject.BindingFlags.INVERT_BOOLEAN);
|
||||
window.connect('show', () => {
|
||||
let media = 'http://distribution.bbb3d.renderfarming.net/video/mp4/bbb_sunflower_1080p_30fps_normal.mp4';
|
||||
widget.player.set_media(media);
|
||||
});
|
||||
|
||||
box.append(label);
|
||||
box.append(widget);
|
||||
|
||||
window.set_child(box);
|
||||
window.present();
|
||||
});
|
||||
app.run([]);
|
Reference in New Issue
Block a user