Replace default player

Signed-off-by: Vasiliy Doylov <nekocwd@mainlining.org>
This commit is contained in:
Vasiliy Doylov 2025-07-10 19:56:28 +03:00
parent 65ece768c6
commit 8aeef05084
2 changed files with 13 additions and 2 deletions

View file

@ -192,6 +192,7 @@ public class MediaPlayer.Player : Gtk.Box {
}
public void bind_to_player (Gtk.Box player) {
player.bind_property ("visible", this, "visible", BindingFlags.SYNC_CREATE);
foreach (var child in player.get_children ()) {
switch (child.get_name ()) {
case "btn_details":

View file

@ -79,6 +79,7 @@ public class MediaPlayer.QuickSetting : Phosh.QuickSetting {
var b = (Gtk.Box) container;
b.reorder_child (player, i);
hiden_player = child;
container.remove (hiden_player);
}
if (child.get_type ().is_a (typeof (Gtk.Container))) {
find_player ((Gtk.Container) child);
@ -89,8 +90,17 @@ public class MediaPlayer.QuickSetting : Phosh.QuickSetting {
void clean_up () {
player.dispose ();
if (player.parent != null)
player.parent.remove (player);
if (player.parent != null) {
var i = 0;
foreach (var child in player.parent.get_children ()) {
if (child == player) {
parent.add (hiden_player);
((Gtk.Box) parent).reorder_child (hiden_player, i);
player.parent.remove (player);
}
i++;
}
}
hiden_player = null;
}
}