|
37 | 37 | from .login import LoginDialog |
38 | 38 | # from .new_playlist import NewPlaylistWindow |
39 | 39 |
|
40 | | -from .pages import HTNotLoggedInPage, HTGenericPage, HTExplorePage |
| 40 | +from .pages import HTGenericPage |
| 41 | +from .pages import HTExplorePage |
| 42 | +from .pages import HTNotLoggedInPage |
41 | 43 | from .pages import HTCollectionPage |
42 | | -from .pages import HTArtistPage, HTMixPage, HTHrackRadioPage, HTPlaylistPage |
| 44 | +from .pages import HTArtistPage |
| 45 | +from .pages import HTMixPage |
| 46 | +from .pages import HTPlaylistPage |
43 | 47 | from .pages import HTAlbumPage |
44 | 48 |
|
45 | 49 | from .widgets import HTGenericTrackWidget |
@@ -89,6 +93,9 @@ class HighTideWindow(Adw.ApplicationWindow): |
89 | 93 | sidebar_stack = Gtk.Template.Child() |
90 | 94 | go_next_button = Gtk.Template.Child() |
91 | 95 | go_prev_button = Gtk.Template.Child() |
| 96 | + track_radio_button = Gtk.Template.Child() |
| 97 | + album_button = Gtk.Template.Child() |
| 98 | + copy_share_link = Gtk.Template.Child() |
92 | 99 |
|
93 | 100 | app_id_dialog = Gtk.Template.Child() |
94 | 101 |
|
@@ -126,7 +133,13 @@ def __init__(self, **kwargs): |
126 | 133 | self.create_action_with_target( |
127 | 134 | "push-track-radio-page", |
128 | 135 | GLib.VariantType.new("s"), |
129 | | - self.on_push_track_radio_page, |
| 136 | + self.on_push_track_radio_page |
| 137 | + ) |
| 138 | + |
| 139 | + self.create_action_with_target( |
| 140 | + "push-artist-radio-page", |
| 141 | + GLib.VariantType.new("s"), |
| 142 | + self.on_push_artist_radio_page |
130 | 143 | ) |
131 | 144 |
|
132 | 145 | # self.create_action_with_target( |
@@ -344,6 +357,11 @@ def on_song_changed(self, *args): |
344 | 357 |
|
345 | 358 | self.set_quality_label() |
346 | 359 |
|
| 360 | + self.track_radio_button.set_action_target_value( |
| 361 | + GLib.Variant("s", str(track.id))) |
| 362 | + self.album_button.set_action_target_value( |
| 363 | + GLib.Variant("s", str(album.id))) |
| 364 | + |
347 | 365 | if utils.is_favourited(track): |
348 | 366 | self.in_my_collection_button.set_icon_name("heart-filled-symbolic") |
349 | 367 | else: |
@@ -508,18 +526,6 @@ def on_share_clicked(self, *args): |
508 | 526 | if track: |
509 | 527 | utils.share_this(track) |
510 | 528 |
|
511 | | - @Gtk.Template.Callback("on_track_radio_button_clicked") |
512 | | - def on_track_radio_button_clicked_func(self, widget): |
513 | | - track = self.player_object.playing_track |
514 | | - page = HTHrackRadioPage.new_from_id(track.id).load() |
515 | | - self.navigation_view.push(page) |
516 | | - |
517 | | - @Gtk.Template.Callback("on_album_button_clicked") |
518 | | - def on_album_button_clicked_func(self, widget): |
519 | | - track = self.player_object.playing_track |
520 | | - page = HTAlbumPage.new_from_id(track.album.id).load() |
521 | | - self.navigation_view.push(page) |
522 | | - |
523 | 529 | @Gtk.Template.Callback("on_skip_forward_button_clicked") |
524 | 530 | def on_skip_forward_button_clicked_func(self, widget): |
525 | 531 | self.player_object.play_next() |
@@ -746,23 +752,39 @@ def change_discord_rpc_enabled(self, state): |
746 | 752 | # |
747 | 753 |
|
748 | 754 | def on_push_artist_page(self, action, parameter): |
| 755 | + if parameter.get_string() == "": |
| 756 | + return |
749 | 757 | page = HTArtistPage.new_from_id(parameter.get_string()).load() |
750 | 758 | self.navigation_view.push(page) |
751 | 759 |
|
752 | 760 | def on_push_album_page(self, action, parameter): |
| 761 | + if parameter.get_string() == "": |
| 762 | + return |
753 | 763 | page = HTAlbumPage.new_from_id(parameter.get_string()).load() |
754 | 764 | self.navigation_view.push(page) |
755 | 765 |
|
756 | 766 | def on_push_playlist_page(self, action, parameter): |
| 767 | + if parameter.get_string() == "": |
| 768 | + return |
757 | 769 | page = HTPlaylistPage.new_from_id(parameter.get_string()).load() |
758 | 770 | self.navigation_view.push(page) |
759 | 771 |
|
760 | 772 | def on_push_mix_page(self, action, parameter): |
| 773 | + if parameter.get_string() == "": |
| 774 | + return |
761 | 775 | page = HTMixPage.new_from_id(parameter.get_string()).load() |
762 | 776 | self.navigation_view.push(page) |
763 | 777 |
|
764 | 778 | def on_push_track_radio_page(self, action, parameter): |
765 | | - page = HTHrackRadioPage.new_from_id(parameter.get_string()).load() |
| 779 | + if parameter.get_string() == "": |
| 780 | + return |
| 781 | + page = HTMixPage.new_from_track(parameter.get_string()).load() |
| 782 | + self.navigation_view.push(page) |
| 783 | + |
| 784 | + def on_push_artist_radio_page(self, action, parameter): |
| 785 | + if parameter.get_string() == "": |
| 786 | + return |
| 787 | + page = HTMixPage.new_from_artist(parameter.get_string()).load() |
766 | 788 | self.navigation_view.push(page) |
767 | 789 |
|
768 | 790 | # |
|
0 commit comments