finish porting playbar
This commit is contained in:
parent
74b0183e1c
commit
e5871e0bfc
1 changed files with 1 additions and 93 deletions
|
@ -1,100 +1,8 @@
|
||||||
// [GtkTemplate (ui = "/eu/callcc/audrey/playbar.ui")]
|
|
||||||
[CCode (cheader_filename = "ui/playbar.h")]
|
[CCode (cheader_filename = "ui/playbar.h")]
|
||||||
public class Audrey.Ui.Playbar : Adw.Bin {
|
public class Audrey.Ui.Playbar : Adw.Bin {
|
||||||
public PlaybinSong? song {
|
public PlaybinSong? song { get; set; }
|
||||||
get;
|
|
||||||
set;
|
|
||||||
}
|
|
||||||
public Gdk.Paintable? playing_cover_art { get; set; }
|
public Gdk.Paintable? playing_cover_art { get; set; }
|
||||||
public weak Playbin playbin { get; set; }
|
public weak Playbin playbin { get; set; }
|
||||||
public bool show_cover_art { get; set; /*default = true;*/ }
|
public bool show_cover_art { get; set; /*default = true;*/ }
|
||||||
|
|
||||||
public int volume { get; set; }
|
public int volume { get; set; }
|
||||||
/*{
|
|
||||||
get { return playbin == null ? 100 : playbin.volume; }
|
|
||||||
set { playbin.volume = value; }
|
|
||||||
}*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
[GtkCallback] private string format_timestamp (double s) {
|
|
||||||
return "%02d:%02d".printf (((int) s)/60, ((int) s)%60);
|
|
||||||
}
|
|
||||||
|
|
||||||
[GtkCallback] private bool on_play_position_seek (Gtk.Range range, Gtk.ScrollType scroll_type, double value) {
|
|
||||||
if (range.adjustment.lower < range.adjustment.upper) {
|
|
||||||
this.playbin.seek ((int64) value);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
[GtkCallback] private void on_play_pause_clicked () {
|
|
||||||
if (this.playbin.state == PlaybinState.PLAYING) {
|
|
||||||
this.playbin.pause();
|
|
||||||
} else {
|
|
||||||
this.playbin.play();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[GtkCallback] private string play_pause_icon_name (PlaybinState state) {
|
|
||||||
if (state == PlaybinState.PLAYING) {
|
|
||||||
return "media-playback-pause";
|
|
||||||
} else {
|
|
||||||
return "media-playback-start";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[GtkCallback] private bool playbin_active (PlaybinState state) {
|
|
||||||
return state != PlaybinState.STOPPED;
|
|
||||||
}
|
|
||||||
|
|
||||||
[GtkCallback] private bool can_press_play (PlaybinState state, uint n_items) {
|
|
||||||
return !(state == PlaybinState.STOPPED && n_items == 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
[GtkCallback] private string mute_button_icon_name (bool mute) {
|
|
||||||
return mute ? "audio-volume-muted" : "audio-volume-high";
|
|
||||||
}
|
|
||||||
|
|
||||||
[GtkCallback] private void on_mute_toggle () {
|
|
||||||
this.playbin.mute = !this.playbin.mute;
|
|
||||||
}
|
|
||||||
|
|
||||||
[GtkCallback] private void on_skip_forward_clicked () {
|
|
||||||
this.playbin.go_to_next_track ();
|
|
||||||
}
|
|
||||||
|
|
||||||
[GtkCallback] private void on_skip_backward_clicked () {
|
|
||||||
this.playbin.go_to_prev_track ();
|
|
||||||
}
|
|
||||||
|
|
||||||
[GtkCallback] private void seek_backward () {
|
|
||||||
// 10 seconds
|
|
||||||
double new_position = playbin.position - 10.0;
|
|
||||||
if (new_position < 0.0) new_position = 0.0;
|
|
||||||
this.playbin.seek (new_position);
|
|
||||||
}
|
|
||||||
|
|
||||||
[GtkCallback] private void seek_forward () {
|
|
||||||
// 10 seconds
|
|
||||||
double new_position = playbin.position + 10.0;
|
|
||||||
if (new_position > this.playbin.duration) new_position = this.playbin.duration;
|
|
||||||
this.playbin.seek (new_position);
|
|
||||||
}
|
|
||||||
|
|
||||||
[GtkCallback] private string song_title (PlaybinSong? song) {
|
|
||||||
return song == null ? "" : song.title;
|
|
||||||
}
|
|
||||||
|
|
||||||
[GtkCallback] private string song_artist (PlaybinSong? song) {
|
|
||||||
return song == null ? "" : song.artist;
|
|
||||||
}
|
|
||||||
|
|
||||||
[GtkCallback] private string song_album (PlaybinSong? song) {
|
|
||||||
return song == null ? "" : song.album;
|
|
||||||
}
|
|
||||||
|
|
||||||
~Playbar () {
|
|
||||||
debug ("destroying playbar widget");
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue