Implement modified signal for playlist and hook it into nav and playlist page.
Fixes #4.
This commit is contained in:
parent
b4ffba62c7
commit
a3632b8757
5 changed files with 85 additions and 0 deletions
|
@ -310,6 +310,27 @@ void koto_playlist_page_handle_edit_button_clicked(GtkGestureClick *gesture, int
|
|||
koto_window_show_dialog(main_window, "create-modify-playlist");
|
||||
}
|
||||
|
||||
void koto_playlist_page_handle_playlist_modified(KotoPlaylist *playlist, gpointer user_data) {
|
||||
if (!KOTO_IS_PLAYLIST(playlist)) {
|
||||
return;
|
||||
}
|
||||
|
||||
KotoPlaylistPage *self = user_data;
|
||||
if (!KOTO_IS_PLAYLIST_PAGE(self)) {
|
||||
return;
|
||||
}
|
||||
|
||||
gchar *artwork = koto_playlist_get_artwork(playlist); // Get the artwork
|
||||
if (koto_utils_is_string_valid(artwork)) { // Have valid artwork
|
||||
koto_cover_art_button_set_art_path(self->playlist_image, artwork); // Update our Koto Cover Art Button
|
||||
}
|
||||
|
||||
gchar *name = koto_playlist_get_name(playlist); // Get the name
|
||||
if (koto_utils_is_string_valid(name)) { // Have valid name
|
||||
gtk_label_set_label(GTK_LABEL(self->name_label), name); // Update the name label
|
||||
}
|
||||
}
|
||||
|
||||
void koto_playlist_page_handle_track_album_clicked(GtkGestureClick *gesture, int n_press, double x, double y, gpointer user_data) {
|
||||
(void) gesture; (void) n_press; (void) x; (void) y;
|
||||
KotoPlaylistPage *self = user_data;
|
||||
|
@ -411,6 +432,8 @@ void koto_playlist_page_set_playlist_uuid(KotoPlaylistPage *self, gchar *playlis
|
|||
self->playlist = playlist;
|
||||
koto_playlist_page_set_playlist_model(self, KOTO_PREFERRED_MODEL_TYPE_DEFAULT); // TODO: Enable this to be changed
|
||||
koto_playlist_page_update_header(self); // Update our header
|
||||
|
||||
g_signal_connect(playlist, "modified", G_CALLBACK(koto_playlist_page_handle_playlist_modified), self); // Handle playlist modification
|
||||
}
|
||||
|
||||
void koto_playlist_page_set_playlist_model(KotoPlaylistPage *self, KotoPreferredModelType model) {
|
||||
|
|
|
@ -38,6 +38,7 @@ GtkWidget* koto_playlist_page_get_main(KotoPlaylistPage *self);
|
|||
void koto_playlist_page_handle_action_bar_closed(KotoActionBar *bar, gpointer data);
|
||||
void koto_playlist_page_handle_cover_art_clicked(GtkGestureClick *gesture, int n_press, double x, double y, gpointer user_data);
|
||||
void koto_playlist_page_handle_edit_button_clicked(GtkGestureClick *gesture, int n_press, double x, double y, gpointer user_data);
|
||||
void koto_playlist_page_handle_playlist_modified(KotoPlaylist *playlist, gpointer user_data);
|
||||
void koto_playlist_page_handle_track_album_clicked(GtkGestureClick *gesture, int n_press, double x, double y, gpointer user_data);
|
||||
void koto_playlist_page_handle_track_artist_clicked(GtkGestureClick *gesture, int n_press, double x, double y, gpointer user_data);
|
||||
void koto_playlist_page_handle_track_name_clicked(GtkGestureClick *gesture, int n_press, double x, double y, gpointer user_data);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue