Initial GTK4 port

Port most of the player to GTK4. Some things are still broken or disabled due to GTK change, but will be gradually fixed.
This commit is contained in:
Rafostar
2020-10-05 21:19:29 +02:00
parent e7e9b9c07d
commit bae0b805ea
10 changed files with 229 additions and 121 deletions

View File

@@ -9,26 +9,26 @@ class BoxedIconButton extends Gtk.Button
margin_top: 4,
margin_bottom: 4,
can_focus: false,
can_default: false,
//can_default: false,
});
this.isFullscreen = isFullscreen || false;
size = size || Gtk.IconSize.SMALL_TOOLBAR;
let image = Gtk.Image.new_from_icon_name(icon, size);
if(image)
this.set_image(image);
let image = Gtk.Image.new_from_icon_name(icon);
//if(image)
//this.set_image(image);
/*
this.image.defaultSize = size;
this.image.fullscreenSize = (size === Gtk.IconSize.SMALL_TOOLBAR)
? Gtk.IconSize.LARGE_TOOLBAR
: Gtk.IconSize.DND;
this.get_style_context().add_class('flat');
*/
this.add_css_class('flat');
this.box = new Gtk.Box();
this.box.pack_start(this, false, false, 0);
this.box.append(this);
super.show();
}
@@ -49,12 +49,12 @@ class BoxedIconButton extends Gtk.Button
this.isFullscreen = isFullscreen;
}
/*
show_all()
{
this.box.show_all();
}
*/
show()
{
this.box.show();
@@ -74,16 +74,16 @@ class BoxedPopoverButton extends BoxedIconButton
super._init(icon, size, isFullscreen);
this.popover = new Gtk.Popover({
relative_to: this.box
default_widget: this.box
});
this.popoverBox = new Gtk.Box({
orientation: Gtk.Orientation.VERTICAL
});
this.popover.add(this.popoverBox);
this.popover.set_child(this.popoverBox);
this.popoverBox.show();
if(this.isFullscreen)
this.popover.get_style_context().add_class('osd');
this.popover.add_css_class('osd');
}
setFullscreenMode(isEnabled)
@@ -91,8 +91,8 @@ class BoxedPopoverButton extends BoxedIconButton
if(this.isFullscreen === isEnabled)
return;
let action = (isEnabled) ? 'add_class' : 'remove_class';
this.popover.get_style_context()[action]('osd');
let action = (isEnabled) ? 'add' : 'remove';
this.popover[action + '_css_class']('osd');
super.setFullscreenMode(isEnabled);
}