Get to the point where we are fairly happy with our uncrustify config. Fixes #6.
This commit is contained in:
parent
d07d3dfe50
commit
62de9c2032
58 changed files with 4811 additions and 1946 deletions
|
@ -25,23 +25,23 @@
|
|||
#include "koto-config.h"
|
||||
#include "koto-utils.h"
|
||||
|
||||
extern KotoCartographer *koto_maps;
|
||||
extern KotoCartographer * koto_maps;
|
||||
|
||||
struct _KotoAlbumView {
|
||||
GObject parent_instance;
|
||||
KotoIndexedAlbum *album;
|
||||
GtkWidget *main;
|
||||
GtkWidget *album_tracks_box;
|
||||
GtkWidget *discs;
|
||||
KotoIndexedAlbum * album;
|
||||
GtkWidget * main;
|
||||
GtkWidget * album_tracks_box;
|
||||
GtkWidget * discs;
|
||||
|
||||
GtkWidget *album_overlay_art;
|
||||
GtkWidget *album_overlay_container;
|
||||
GtkWidget *album_overlay_controls;
|
||||
GtkWidget *album_overlay_revealer;
|
||||
KotoButton *play_pause_button;
|
||||
GtkWidget * album_overlay_art;
|
||||
GtkWidget * album_overlay_container;
|
||||
GtkWidget * album_overlay_controls;
|
||||
GtkWidget * album_overlay_revealer;
|
||||
KotoButton * play_pause_button;
|
||||
|
||||
GtkWidget *album_label;
|
||||
GHashTable *cd_to_track_listbox;
|
||||
GtkWidget * album_label;
|
||||
GHashTable * cd_to_track_listbox;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE(KotoAlbumView, koto_album_view, G_TYPE_OBJECT);
|
||||
|
@ -52,12 +52,27 @@ enum {
|
|||
N_PROPERTIES
|
||||
};
|
||||
|
||||
static GParamSpec *props[N_PROPERTIES] = { NULL, };
|
||||
static void koto_album_view_get_property(GObject *obj, guint prop_id, GValue *val, GParamSpec *spec);
|
||||
static void koto_album_view_set_property(GObject *obj, guint prop_id, const GValue *val, GParamSpec *spec);
|
||||
static GParamSpec * props[N_PROPERTIES] = {
|
||||
NULL,
|
||||
};
|
||||
static void koto_album_view_get_property(
|
||||
GObject * obj,
|
||||
guint prop_id,
|
||||
GValue * val,
|
||||
GParamSpec * spec
|
||||
);
|
||||
|
||||
static void koto_album_view_set_property(
|
||||
GObject * obj,
|
||||
guint prop_id,
|
||||
const GValue * val,
|
||||
GParamSpec * spec
|
||||
);
|
||||
|
||||
static void koto_album_view_class_init(KotoAlbumViewClass * c) {
|
||||
GObjectClass * gobject_class;
|
||||
|
||||
|
||||
static void koto_album_view_class_init(KotoAlbumViewClass *c) {
|
||||
GObjectClass *gobject_class;
|
||||
gobject_class = G_OBJECT_CLASS(c);
|
||||
gobject_class->set_property = koto_album_view_set_property;
|
||||
gobject_class->get_property = koto_album_view_get_property;
|
||||
|
@ -67,13 +82,13 @@ static void koto_album_view_class_init(KotoAlbumViewClass *c) {
|
|||
"Album",
|
||||
"Album",
|
||||
KOTO_TYPE_INDEXED_ALBUM,
|
||||
G_PARAM_CONSTRUCT_ONLY|G_PARAM_EXPLICIT_NOTIFY|G_PARAM_READWRITE
|
||||
G_PARAM_CONSTRUCT_ONLY | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_READWRITE
|
||||
);
|
||||
|
||||
g_object_class_install_properties(gobject_class, N_PROPERTIES, props);
|
||||
}
|
||||
|
||||
static void koto_album_view_init(KotoAlbumView *self) {
|
||||
static void koto_album_view_init(KotoAlbumView * self) {
|
||||
self->cd_to_track_listbox = g_hash_table_new(g_str_hash, g_str_equal);
|
||||
self->main = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
|
||||
gtk_widget_add_css_class(self->main, "album-view");
|
||||
|
@ -113,7 +128,9 @@ static void koto_album_view_init(KotoAlbumView *self) {
|
|||
gtk_overlay_add_overlay(GTK_OVERLAY(self->album_overlay_container), self->album_overlay_revealer); // Add our revealer as the overlay
|
||||
gtk_box_prepend(GTK_BOX(self->main), self->album_overlay_container); // Add our album overlay container
|
||||
|
||||
GtkEventController *motion_controller = gtk_event_controller_motion_new(); // Create our new motion event controller to track mouse leave and enter
|
||||
GtkEventController * motion_controller = gtk_event_controller_motion_new(); // Create our new motion event controller to track mouse leave and enter
|
||||
|
||||
|
||||
g_signal_connect(motion_controller, "enter", G_CALLBACK(koto_album_view_show_overlay_controls), self);
|
||||
g_signal_connect(motion_controller, "leave", G_CALLBACK(koto_album_view_hide_overlay_controls), self);
|
||||
gtk_widget_add_controller(self->album_overlay_container, motion_controller);
|
||||
|
@ -121,12 +138,18 @@ static void koto_album_view_init(KotoAlbumView *self) {
|
|||
koto_button_add_click_handler(self->play_pause_button, KOTO_BUTTON_CLICK_TYPE_PRIMARY, G_CALLBACK(koto_album_view_toggle_album_playback), self);
|
||||
}
|
||||
|
||||
GtkWidget* koto_album_view_get_main(KotoAlbumView *self) {
|
||||
GtkWidget * koto_album_view_get_main(KotoAlbumView * self) {
|
||||
return self->main;
|
||||
}
|
||||
|
||||
static void koto_album_view_get_property(GObject *obj, guint prop_id, GValue *val, GParamSpec *spec) {
|
||||
KotoAlbumView *self = KOTO_ALBUM_VIEW(obj);
|
||||
static void koto_album_view_get_property(
|
||||
GObject * obj,
|
||||
guint prop_id,
|
||||
GValue * val,
|
||||
GParamSpec * spec
|
||||
) {
|
||||
KotoAlbumView * self = KOTO_ALBUM_VIEW(obj);
|
||||
|
||||
|
||||
switch (prop_id) {
|
||||
case PROP_ALBUM:
|
||||
|
@ -138,8 +161,14 @@ static void koto_album_view_get_property(GObject *obj, guint prop_id, GValue *va
|
|||
}
|
||||
}
|
||||
|
||||
static void koto_album_view_set_property(GObject *obj, guint prop_id, const GValue *val, GParamSpec *spec) {
|
||||
KotoAlbumView *self = KOTO_ALBUM_VIEW(obj);
|
||||
static void koto_album_view_set_property(
|
||||
GObject * obj,
|
||||
guint prop_id,
|
||||
const GValue * val,
|
||||
GParamSpec * spec
|
||||
) {
|
||||
KotoAlbumView * self = KOTO_ALBUM_VIEW(obj);
|
||||
|
||||
|
||||
switch (prop_id) {
|
||||
case PROP_ALBUM:
|
||||
|
@ -151,58 +180,75 @@ static void koto_album_view_set_property(GObject *obj, guint prop_id, const GVal
|
|||
}
|
||||
}
|
||||
|
||||
void koto_album_view_add_track_to_listbox(KotoIndexedAlbum *self, KotoIndexedTrack *track) {
|
||||
(void) self; (void) track;
|
||||
void koto_album_view_add_track_to_listbox(
|
||||
KotoIndexedAlbum * self,
|
||||
KotoIndexedTrack * track
|
||||
) {
|
||||
(void) self;
|
||||
(void) track;
|
||||
}
|
||||
|
||||
void koto_album_view_hide_overlay_controls(GtkEventControllerFocus *controller, gpointer data) {
|
||||
void koto_album_view_hide_overlay_controls(
|
||||
GtkEventControllerFocus * controller,
|
||||
gpointer data
|
||||
) {
|
||||
(void) controller;
|
||||
KotoAlbumView* self = data;
|
||||
|
||||
|
||||
gtk_revealer_set_reveal_child(GTK_REVEALER(self->album_overlay_revealer), FALSE);
|
||||
}
|
||||
|
||||
void koto_album_view_set_album(KotoAlbumView *self, KotoIndexedAlbum *album) {
|
||||
void koto_album_view_set_album(
|
||||
KotoAlbumView * self,
|
||||
KotoIndexedAlbum * album
|
||||
) {
|
||||
if (album == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
self->album = album;
|
||||
|
||||
gchar *album_art = koto_indexed_album_get_album_art(self->album); // Get the art for the album
|
||||
gchar * album_art = koto_indexed_album_get_album_art(self->album); // Get the art for the album
|
||||
|
||||
|
||||
gtk_image_set_from_file(GTK_IMAGE(self->album_overlay_art), album_art);
|
||||
|
||||
gchar *album_name;
|
||||
gchar * album_name;
|
||||
|
||||
|
||||
g_object_get(album, "name", &album_name, NULL); // Get the album name
|
||||
|
||||
self->album_label = gtk_label_new(album_name);
|
||||
gtk_widget_set_halign(self->album_label, GTK_ALIGN_START);
|
||||
gtk_box_prepend(GTK_BOX(self->album_tracks_box), self->album_label); // Prepend our new label to the album + tracks box
|
||||
|
||||
GHashTable *discs = g_hash_table_new(g_str_hash, g_str_equal);
|
||||
GList *tracks = koto_indexed_album_get_tracks(album); // Get the tracks for this album
|
||||
GHashTable * discs = g_hash_table_new(g_str_hash, g_str_equal);
|
||||
GList * tracks = koto_indexed_album_get_tracks(album); // Get the tracks for this album
|
||||
|
||||
|
||||
for (guint i = 0; i < g_list_length(tracks); i++) {
|
||||
KotoIndexedTrack *track = koto_cartographer_get_track_by_uuid(koto_maps, (gchar*) g_list_nth_data(tracks, i)); // Get the track by its UUID
|
||||
KotoIndexedTrack * track = koto_cartographer_get_track_by_uuid(koto_maps, (gchar*) g_list_nth_data(tracks, i)); // Get the track by its UUID
|
||||
|
||||
if (track == NULL) { // Track doesn't exist
|
||||
continue;
|
||||
}
|
||||
|
||||
guint *disc_number;
|
||||
guint * disc_number;
|
||||
g_object_get(track, "cd", &disc_number, NULL);
|
||||
gchar *disc_num_as_str = g_strdup_printf("%u", GPOINTER_TO_UINT(disc_number));
|
||||
gchar * disc_num_as_str = g_strdup_printf("%u", GPOINTER_TO_UINT(disc_number));
|
||||
|
||||
if (g_hash_table_contains(discs, disc_num_as_str)) { // Already have this added
|
||||
continue; // Skip
|
||||
}
|
||||
|
||||
g_hash_table_insert(discs, disc_num_as_str, "0"); // Mark this disc number in the hash table
|
||||
KotoDiscView *disc_view = koto_disc_view_new(album, disc_number);
|
||||
KotoDiscView * disc_view = koto_disc_view_new(album, disc_number);
|
||||
gtk_list_box_append(GTK_LIST_BOX(self->discs), GTK_WIDGET(disc_view)); // Add the Disc View to the List Box
|
||||
}
|
||||
|
||||
if (g_list_length(g_hash_table_get_keys(discs)) == 1) { // Only have one album
|
||||
GtkListBoxRow *row = gtk_list_box_get_row_at_index(GTK_LIST_BOX(self->discs), 0); // Get the first item
|
||||
GtkListBoxRow * row = gtk_list_box_get_row_at_index(GTK_LIST_BOX(self->discs), 0); // Get the first item
|
||||
|
||||
if (GTK_IS_LIST_BOX_ROW(row)) { // Is a row
|
||||
koto_disc_view_set_disc_label_visible((KotoDiscView*) gtk_list_box_row_get_child(row), FALSE); // Get
|
||||
|
@ -212,21 +258,30 @@ void koto_album_view_set_album(KotoAlbumView *self, KotoIndexedAlbum *album) {
|
|||
g_hash_table_destroy(discs);
|
||||
}
|
||||
|
||||
void koto_album_view_show_overlay_controls(GtkEventControllerFocus *controller, gpointer data) {
|
||||
void koto_album_view_show_overlay_controls(
|
||||
GtkEventControllerFocus * controller,
|
||||
gpointer data
|
||||
) {
|
||||
(void) controller;
|
||||
KotoAlbumView* self = data;
|
||||
|
||||
|
||||
gtk_revealer_set_reveal_child(GTK_REVEALER(self->album_overlay_revealer), TRUE);
|
||||
}
|
||||
|
||||
int koto_album_view_sort_discs(GtkListBoxRow *disc1, GtkListBoxRow *disc2, gpointer user_data) {
|
||||
int koto_album_view_sort_discs(
|
||||
GtkListBoxRow * disc1,
|
||||
GtkListBoxRow * disc2,
|
||||
gpointer user_data
|
||||
) {
|
||||
(void) user_data;
|
||||
KotoDiscView *disc1_item = KOTO_DISC_VIEW(gtk_list_box_row_get_child(disc1));
|
||||
KotoDiscView *disc2_item = KOTO_DISC_VIEW(gtk_list_box_row_get_child(disc2));
|
||||
KotoDiscView * disc1_item = KOTO_DISC_VIEW(gtk_list_box_row_get_child(disc1));
|
||||
KotoDiscView * disc2_item = KOTO_DISC_VIEW(gtk_list_box_row_get_child(disc2));
|
||||
|
||||
guint disc1_num;
|
||||
guint disc2_num;
|
||||
|
||||
|
||||
g_object_get(disc1_item, "disc", &disc1_num, NULL);
|
||||
g_object_get(disc2_item, "disc", &disc2_num, NULL);
|
||||
|
||||
|
@ -239,14 +294,24 @@ int koto_album_view_sort_discs(GtkListBoxRow *disc1, GtkListBoxRow *disc2, gpoin
|
|||
}
|
||||
}
|
||||
|
||||
void koto_album_view_toggle_album_playback(GtkGestureClick *gesture, int n_press, double x, double y, gpointer data) {
|
||||
(void) gesture; (void) n_press; (void) x; (void) y;
|
||||
void koto_album_view_toggle_album_playback(
|
||||
GtkGestureClick * gesture,
|
||||
int n_press,
|
||||
double x,
|
||||
double y,
|
||||
gpointer data
|
||||
) {
|
||||
(void) gesture;
|
||||
(void) n_press;
|
||||
(void) x;
|
||||
(void) y;
|
||||
KotoAlbumView* self = data;
|
||||
|
||||
|
||||
koto_button_show_image(KOTO_BUTTON(self->play_pause_button), TRUE);
|
||||
koto_indexed_album_set_as_current_playlist(self->album); // Set as the current playlist
|
||||
}
|
||||
|
||||
KotoAlbumView* koto_album_view_new(KotoIndexedAlbum *album) {
|
||||
KotoAlbumView * koto_album_view_new(KotoIndexedAlbum * album) {
|
||||
return g_object_new(KOTO_TYPE_ALBUM_VIEW, "album", album, NULL);
|
||||
}
|
||||
|
|
|
@ -27,13 +27,41 @@ G_BEGIN_DECLS
|
|||
|
||||
G_DECLARE_FINAL_TYPE(KotoAlbumView, koto_album_view, KOTO, ALBUM_VIEW, GObject)
|
||||
|
||||
KotoAlbumView* koto_album_view_new(KotoIndexedAlbum *album);
|
||||
GtkWidget* koto_album_view_get_main(KotoAlbumView *self);
|
||||
void koto_album_view_add_track_to_listbox(KotoIndexedAlbum *self, KotoIndexedTrack *track);
|
||||
void koto_album_view_hide_overlay_controls(GtkEventControllerFocus *controller, gpointer data);
|
||||
void koto_album_view_set_album(KotoAlbumView *self, KotoIndexedAlbum *album);
|
||||
void koto_album_view_show_overlay_controls(GtkEventControllerFocus *controller, gpointer data);
|
||||
void koto_album_view_toggle_album_playback(GtkGestureClick *gesture, int n_press, double x, double y, gpointer data);
|
||||
int koto_album_view_sort_discs(GtkListBoxRow *track1, GtkListBoxRow *track2, gpointer user_data);
|
||||
KotoAlbumView* koto_album_view_new(KotoIndexedAlbum * album);
|
||||
GtkWidget * koto_album_view_get_main(KotoAlbumView * self);
|
||||
|
||||
void koto_album_view_add_track_to_listbox(
|
||||
KotoIndexedAlbum * self,
|
||||
KotoIndexedTrack * track
|
||||
);
|
||||
|
||||
void koto_album_view_hide_overlay_controls(
|
||||
GtkEventControllerFocus * controller,
|
||||
gpointer data
|
||||
);
|
||||
|
||||
void koto_album_view_set_album(
|
||||
KotoAlbumView * self,
|
||||
KotoIndexedAlbum * album
|
||||
);
|
||||
|
||||
void koto_album_view_show_overlay_controls(
|
||||
GtkEventControllerFocus * controller,
|
||||
gpointer data
|
||||
);
|
||||
|
||||
void koto_album_view_toggle_album_playback(
|
||||
GtkGestureClick * gesture,
|
||||
int n_press,
|
||||
double x,
|
||||
double y,
|
||||
gpointer data
|
||||
);
|
||||
|
||||
int koto_album_view_sort_discs(
|
||||
GtkListBoxRow * track1,
|
||||
GtkListBoxRow * track2,
|
||||
gpointer user_data
|
||||
);
|
||||
|
||||
G_END_DECLS
|
||||
|
|
|
@ -24,17 +24,17 @@
|
|||
#include "koto-config.h"
|
||||
#include "koto-utils.h"
|
||||
|
||||
extern KotoCartographer *koto_maps;
|
||||
extern KotoCartographer * koto_maps;
|
||||
|
||||
struct _KotoArtistView {
|
||||
GObject parent_instance;
|
||||
KotoIndexedArtist *artist;
|
||||
GtkWidget *scrolled_window;
|
||||
GtkWidget *content;
|
||||
GtkWidget *favorites_list;
|
||||
GtkWidget *album_list;
|
||||
KotoIndexedArtist * artist;
|
||||
GtkWidget * scrolled_window;
|
||||
GtkWidget * content;
|
||||
GtkWidget * favorites_list;
|
||||
GtkWidget * album_list;
|
||||
|
||||
GHashTable *albums_to_component;
|
||||
GHashTable * albums_to_component;
|
||||
|
||||
gboolean constructed;
|
||||
};
|
||||
|
@ -47,13 +47,29 @@ enum {
|
|||
N_PROPERTIES
|
||||
};
|
||||
|
||||
static GParamSpec *props[N_PROPERTIES] = { NULL, };
|
||||
static void koto_artist_view_constructed(GObject *obj);
|
||||
static void koto_artist_view_get_property(GObject *obj, guint prop_id, GValue *val, GParamSpec *spec);
|
||||
static void koto_artist_view_set_property(GObject *obj, guint prop_id, const GValue *val, GParamSpec *spec);
|
||||
static GParamSpec * props[N_PROPERTIES] = {
|
||||
NULL,
|
||||
};
|
||||
static void koto_artist_view_constructed(GObject * obj);
|
||||
|
||||
static void koto_artist_view_get_property(
|
||||
GObject * obj,
|
||||
guint prop_id,
|
||||
GValue * val,
|
||||
GParamSpec * spec
|
||||
);
|
||||
|
||||
static void koto_artist_view_set_property(
|
||||
GObject * obj,
|
||||
guint prop_id,
|
||||
const GValue * val,
|
||||
GParamSpec * spec
|
||||
);
|
||||
|
||||
static void koto_artist_view_class_init(KotoArtistViewClass * c) {
|
||||
GObjectClass * gobject_class;
|
||||
|
||||
|
||||
static void koto_artist_view_class_init(KotoArtistViewClass *c) {
|
||||
GObjectClass *gobject_class;
|
||||
gobject_class = G_OBJECT_CLASS(c);
|
||||
gobject_class->constructed = koto_artist_view_constructed;
|
||||
gobject_class->set_property = koto_artist_view_set_property;
|
||||
|
@ -64,14 +80,20 @@ static void koto_artist_view_class_init(KotoArtistViewClass *c) {
|
|||
"Artist",
|
||||
"Artist",
|
||||
KOTO_TYPE_INDEXED_ARTIST,
|
||||
G_PARAM_CONSTRUCT_ONLY|G_PARAM_EXPLICIT_NOTIFY|G_PARAM_READWRITE
|
||||
G_PARAM_CONSTRUCT_ONLY | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_READWRITE
|
||||
);
|
||||
|
||||
g_object_class_install_properties(gobject_class, N_PROPERTIES, props);
|
||||
}
|
||||
|
||||
static void koto_artist_view_get_property(GObject *obj, guint prop_id, GValue *val, GParamSpec *spec) {
|
||||
KotoArtistView *self = KOTO_ARTIST_VIEW(obj);
|
||||
static void koto_artist_view_get_property(
|
||||
GObject * obj,
|
||||
guint prop_id,
|
||||
GValue * val,
|
||||
GParamSpec * spec
|
||||
) {
|
||||
KotoArtistView * self = KOTO_ARTIST_VIEW(obj);
|
||||
|
||||
|
||||
switch (prop_id) {
|
||||
case PROP_ARTIST:
|
||||
|
@ -83,8 +105,14 @@ static void koto_artist_view_get_property(GObject *obj, guint prop_id, GValue *v
|
|||
}
|
||||
}
|
||||
|
||||
static void koto_artist_view_set_property(GObject *obj, guint prop_id, const GValue *val, GParamSpec *spec) {
|
||||
KotoArtistView *self = KOTO_ARTIST_VIEW(obj);
|
||||
static void koto_artist_view_set_property(
|
||||
GObject * obj,
|
||||
guint prop_id,
|
||||
const GValue * val,
|
||||
GParamSpec * spec
|
||||
) {
|
||||
KotoArtistView * self = KOTO_ARTIST_VIEW(obj);
|
||||
|
||||
|
||||
switch (prop_id) {
|
||||
case PROP_ARTIST:
|
||||
|
@ -96,13 +124,15 @@ static void koto_artist_view_set_property(GObject *obj, guint prop_id, const GVa
|
|||
}
|
||||
}
|
||||
|
||||
static void koto_artist_view_init(KotoArtistView *self) {
|
||||
static void koto_artist_view_init(KotoArtistView * self) {
|
||||
self->artist = NULL;
|
||||
self->constructed = FALSE;
|
||||
}
|
||||
|
||||
static void koto_artist_view_constructed(GObject *obj) {
|
||||
KotoArtistView *self = KOTO_ARTIST_VIEW(obj);
|
||||
static void koto_artist_view_constructed(GObject * obj) {
|
||||
KotoArtistView * self = KOTO_ARTIST_VIEW(obj);
|
||||
|
||||
|
||||
self->albums_to_component = g_hash_table_new(g_str_hash, g_str_equal);
|
||||
self->scrolled_window = gtk_scrolled_window_new(); // Create our scrolled window
|
||||
self->content = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); // Create our content as a GtkBox
|
||||
|
@ -132,23 +162,33 @@ static void koto_artist_view_constructed(GObject *obj) {
|
|||
gtk_widget_set_hexpand(GTK_WIDGET(self->favorites_list), TRUE);
|
||||
gtk_widget_set_hexpand(GTK_WIDGET(self->album_list), TRUE);
|
||||
|
||||
G_OBJECT_CLASS (koto_artist_view_parent_class)->constructed (obj);
|
||||
G_OBJECT_CLASS(koto_artist_view_parent_class)->constructed(obj);
|
||||
self->constructed = TRUE;
|
||||
}
|
||||
|
||||
void koto_artist_view_add_album(KotoArtistView *self, KotoIndexedAlbum *album) {
|
||||
gchar *album_art = koto_indexed_album_get_album_art(album); // Get the art for the album
|
||||
void koto_artist_view_add_album(
|
||||
KotoArtistView * self,
|
||||
KotoIndexedAlbum * album
|
||||
) {
|
||||
gchar * album_art = koto_indexed_album_get_album_art(album); // Get the art for the album
|
||||
|
||||
GtkWidget * art_image = koto_utils_create_image_from_filepath(album_art, "audio-x-generic-symbolic", 220, 220);
|
||||
|
||||
|
||||
GtkWidget *art_image = koto_utils_create_image_from_filepath(album_art, "audio-x-generic-symbolic", 220, 220);
|
||||
gtk_widget_set_halign(art_image, GTK_ALIGN_START); // Align to start
|
||||
gtk_flow_box_insert(GTK_FLOW_BOX(self->favorites_list), art_image, -1); // Append the album art
|
||||
|
||||
KotoAlbumView* album_view = koto_album_view_new(album); // Create our new album view
|
||||
GtkWidget* album_view_main = koto_album_view_get_main(album_view);
|
||||
|
||||
|
||||
gtk_flow_box_insert(GTK_FLOW_BOX(self->album_list), album_view_main, -1); // Append the album view to the album list
|
||||
}
|
||||
|
||||
void koto_artist_view_add_artist(KotoArtistView *self, KotoIndexedArtist *artist) {
|
||||
void koto_artist_view_add_artist(
|
||||
KotoArtistView * self,
|
||||
KotoIndexedArtist * artist
|
||||
) {
|
||||
if (artist == NULL) {
|
||||
return;
|
||||
}
|
||||
|
@ -159,11 +199,13 @@ void koto_artist_view_add_artist(KotoArtistView *self, KotoIndexedArtist *artist
|
|||
return;
|
||||
}
|
||||
|
||||
GList *albums = koto_indexed_artist_get_albums(self->artist); // Get the albums
|
||||
GList * albums = koto_indexed_artist_get_albums(self->artist); // Get the albums
|
||||
|
||||
GList * a;
|
||||
|
||||
|
||||
GList *a;
|
||||
for (a = albums; a != NULL; a = a->next) {
|
||||
KotoIndexedAlbum *album = koto_cartographer_get_album_by_uuid(koto_maps, (gchar*) a->data);
|
||||
KotoIndexedAlbum * album = koto_cartographer_get_album_by_uuid(koto_maps, (gchar*) a->data);
|
||||
|
||||
if (album != NULL) {
|
||||
koto_artist_view_add_album(self, album); // Add the album
|
||||
|
@ -171,10 +213,10 @@ void koto_artist_view_add_artist(KotoArtistView *self, KotoIndexedArtist *artist
|
|||
}
|
||||
}
|
||||
|
||||
GtkWidget* koto_artist_view_get_main(KotoArtistView *self) {
|
||||
GtkWidget * koto_artist_view_get_main(KotoArtistView * self) {
|
||||
return self->scrolled_window;
|
||||
}
|
||||
|
||||
KotoArtistView* koto_artist_view_new() {
|
||||
KotoArtistView * koto_artist_view_new() {
|
||||
return g_object_new(KOTO_TYPE_ARTIST_VIEW, NULL);
|
||||
}
|
||||
|
|
|
@ -25,11 +25,19 @@ G_BEGIN_DECLS
|
|||
|
||||
#define KOTO_TYPE_ARTIST_VIEW (koto_artist_view_get_type())
|
||||
|
||||
G_DECLARE_FINAL_TYPE (KotoArtistView, koto_artist_view, KOTO, ARTIST_VIEW, GObject)
|
||||
G_DECLARE_FINAL_TYPE(KotoArtistView, koto_artist_view, KOTO, ARTIST_VIEW, GObject)
|
||||
|
||||
KotoArtistView* koto_artist_view_new();
|
||||
void koto_artist_view_add_album(KotoArtistView *self, KotoIndexedAlbum *album);
|
||||
void koto_artist_view_add_artist(KotoArtistView *self, KotoIndexedArtist *artist);
|
||||
GtkWidget* koto_artist_view_get_main(KotoArtistView *self);
|
||||
void koto_artist_view_add_album(
|
||||
KotoArtistView * self,
|
||||
KotoIndexedAlbum * album
|
||||
);
|
||||
|
||||
void koto_artist_view_add_artist(
|
||||
KotoArtistView * self,
|
||||
KotoIndexedArtist * artist
|
||||
);
|
||||
|
||||
GtkWidget * koto_artist_view_get_main(KotoArtistView * self);
|
||||
|
||||
G_END_DECLS
|
||||
|
|
|
@ -23,17 +23,17 @@
|
|||
#include "../../koto-utils.h"
|
||||
#include "disc-view.h"
|
||||
|
||||
extern KotoActionBar *action_bar;
|
||||
extern KotoCartographer *koto_maps;
|
||||
extern KotoActionBar * action_bar;
|
||||
extern KotoCartographer * koto_maps;
|
||||
|
||||
struct _KotoDiscView {
|
||||
GtkBox parent_instance;
|
||||
KotoIndexedAlbum *album;
|
||||
GtkWidget *header;
|
||||
GtkWidget *label;
|
||||
GtkWidget *list;
|
||||
KotoIndexedAlbum * album;
|
||||
GtkWidget * header;
|
||||
GtkWidget * label;
|
||||
GtkWidget * list;
|
||||
|
||||
guint *disc_number;
|
||||
guint * disc_number;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE(KotoDiscView, koto_disc_view, GTK_TYPE_BOX);
|
||||
|
@ -45,12 +45,27 @@ enum {
|
|||
N_PROPERTIES
|
||||
};
|
||||
|
||||
static GParamSpec *props[N_PROPERTIES] = { NULL, };
|
||||
static void koto_disc_view_get_property(GObject *obj, guint prop_id, GValue *val, GParamSpec *spec);
|
||||
static void koto_disc_view_set_property(GObject *obj, guint prop_id, const GValue *val, GParamSpec *spec);
|
||||
static GParamSpec * props[N_PROPERTIES] = {
|
||||
NULL,
|
||||
};
|
||||
static void koto_disc_view_get_property(
|
||||
GObject * obj,
|
||||
guint prop_id,
|
||||
GValue * val,
|
||||
GParamSpec * spec
|
||||
);
|
||||
|
||||
static void koto_disc_view_set_property(
|
||||
GObject * obj,
|
||||
guint prop_id,
|
||||
const GValue * val,
|
||||
GParamSpec * spec
|
||||
);
|
||||
|
||||
static void koto_disc_view_class_init(KotoDiscViewClass * c) {
|
||||
GObjectClass * gobject_class;
|
||||
|
||||
|
||||
static void koto_disc_view_class_init(KotoDiscViewClass *c) {
|
||||
GObjectClass *gobject_class;
|
||||
gobject_class = G_OBJECT_CLASS(c);
|
||||
gobject_class->set_property = koto_disc_view_set_property;
|
||||
gobject_class->get_property = koto_disc_view_get_property;
|
||||
|
@ -62,7 +77,7 @@ static void koto_disc_view_class_init(KotoDiscViewClass *c) {
|
|||
0,
|
||||
G_MAXUINT16,
|
||||
1,
|
||||
G_PARAM_CONSTRUCT|G_PARAM_EXPLICIT_NOTIFY|G_PARAM_READWRITE
|
||||
G_PARAM_CONSTRUCT | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_READWRITE
|
||||
);
|
||||
|
||||
props[PROP_ALBUM] = g_param_spec_object(
|
||||
|
@ -70,14 +85,20 @@ static void koto_disc_view_class_init(KotoDiscViewClass *c) {
|
|||
"Album",
|
||||
"Album",
|
||||
KOTO_TYPE_INDEXED_ALBUM,
|
||||
G_PARAM_CONSTRUCT|G_PARAM_EXPLICIT_NOTIFY|G_PARAM_READWRITE
|
||||
G_PARAM_CONSTRUCT | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_READWRITE
|
||||
);
|
||||
|
||||
g_object_class_install_properties(gobject_class, N_PROPERTIES, props);
|
||||
}
|
||||
|
||||
static void koto_disc_view_get_property(GObject *obj, guint prop_id, GValue *val, GParamSpec *spec) {
|
||||
KotoDiscView *self = KOTO_DISC_VIEW(obj);
|
||||
static void koto_disc_view_get_property(
|
||||
GObject * obj,
|
||||
guint prop_id,
|
||||
GValue * val,
|
||||
GParamSpec * spec
|
||||
) {
|
||||
KotoDiscView * self = KOTO_DISC_VIEW(obj);
|
||||
|
||||
|
||||
switch (prop_id) {
|
||||
case PROP_DISC:
|
||||
|
@ -92,8 +113,14 @@ static void koto_disc_view_get_property(GObject *obj, guint prop_id, GValue *val
|
|||
}
|
||||
}
|
||||
|
||||
static void koto_disc_view_set_property(GObject *obj, guint prop_id, const GValue *val, GParamSpec *spec) {
|
||||
KotoDiscView *self = KOTO_DISC_VIEW(obj);
|
||||
static void koto_disc_view_set_property(
|
||||
GObject * obj,
|
||||
guint prop_id,
|
||||
const GValue * val,
|
||||
GParamSpec * spec
|
||||
) {
|
||||
KotoDiscView * self = KOTO_DISC_VIEW(obj);
|
||||
|
||||
|
||||
switch (prop_id) {
|
||||
case PROP_DISC:
|
||||
|
@ -108,14 +135,16 @@ static void koto_disc_view_set_property(GObject *obj, guint prop_id, const GValu
|
|||
}
|
||||
}
|
||||
|
||||
static void koto_disc_view_init(KotoDiscView *self) {
|
||||
static void koto_disc_view_init(KotoDiscView * self) {
|
||||
gtk_widget_add_css_class(GTK_WIDGET(self), "disc-view");
|
||||
gtk_widget_set_can_focus(GTK_WIDGET(self), FALSE);
|
||||
self->header = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
|
||||
gtk_widget_set_hexpand(self->header, TRUE);
|
||||
gtk_widget_set_size_request(self->header, 16, -1);
|
||||
|
||||
GtkWidget *ico = gtk_image_new_from_icon_name("drive-optical-symbolic");
|
||||
GtkWidget * ico = gtk_image_new_from_icon_name("drive-optical-symbolic");
|
||||
|
||||
|
||||
gtk_box_prepend(GTK_BOX(self->header), ico);
|
||||
|
||||
self->label = gtk_label_new(NULL); // Create an empty label
|
||||
|
@ -137,41 +166,55 @@ static void koto_disc_view_init(KotoDiscView *self) {
|
|||
g_signal_connect(self->list, "selected-rows-changed", G_CALLBACK(koto_disc_view_handle_selected_rows_changed), self);
|
||||
}
|
||||
|
||||
void koto_disc_view_list_tracks(gpointer data, gpointer selfptr) {
|
||||
KotoDiscView *self = (KotoDiscView*) selfptr;
|
||||
KotoIndexedTrack *track = koto_cartographer_get_track_by_uuid(koto_maps, (gchar*) data); // Get the track by its UUID
|
||||
void koto_disc_view_list_tracks(
|
||||
gpointer data,
|
||||
gpointer selfptr
|
||||
) {
|
||||
KotoDiscView * self = (KotoDiscView*) selfptr;
|
||||
KotoIndexedTrack * track = koto_cartographer_get_track_by_uuid(koto_maps, (gchar*) data); // Get the track by its UUID
|
||||
|
||||
guint * disc_number;
|
||||
|
||||
|
||||
guint *disc_number;
|
||||
g_object_get(track, "cd", &disc_number, NULL); // get the disc number
|
||||
|
||||
if (GPOINTER_TO_UINT(self->disc_number) != GPOINTER_TO_UINT(disc_number)) { // Track does not belong to this CD
|
||||
return;
|
||||
}
|
||||
|
||||
KotoTrackItem *track_item = koto_track_item_new(track); // Create our new track item
|
||||
KotoTrackItem * track_item = koto_track_item_new(track); // Create our new track item
|
||||
|
||||
|
||||
gtk_list_box_append(GTK_LIST_BOX(self->list), GTK_WIDGET(track_item)); // Add to our tracks list box
|
||||
}
|
||||
|
||||
void koto_disc_view_handle_selected_rows_changed(GtkListBox *box, gpointer user_data) {
|
||||
KotoDiscView *self = user_data;
|
||||
void koto_disc_view_handle_selected_rows_changed(
|
||||
GtkListBox * box,
|
||||
gpointer user_data
|
||||
) {
|
||||
KotoDiscView * self = user_data;
|
||||
|
||||
gchar * album_uuid = koto_indexed_album_get_album_uuid(self->album); // Get the UUID
|
||||
|
||||
gchar *album_uuid = koto_indexed_album_get_album_uuid(self->album); // Get the UUID
|
||||
|
||||
if (!koto_utils_is_string_valid(album_uuid)) { // Not set
|
||||
return;
|
||||
}
|
||||
|
||||
GList *selected_rows = gtk_list_box_get_selected_rows(box); // Get the selected rows
|
||||
GList * selected_rows = gtk_list_box_get_selected_rows(box); // Get the selected rows
|
||||
|
||||
|
||||
if (g_list_length(selected_rows) == 0) { // No rows selected
|
||||
koto_action_bar_toggle_reveal(action_bar, FALSE); // Close the action bar
|
||||
return;
|
||||
}
|
||||
|
||||
GList *selected_tracks = NULL; // Create our list of KotoIndexedTracks
|
||||
GList *cur_selected_rows;
|
||||
GList * selected_tracks = NULL; // Create our list of KotoIndexedTracks
|
||||
GList * cur_selected_rows;
|
||||
|
||||
|
||||
for (cur_selected_rows = selected_rows; cur_selected_rows != NULL; cur_selected_rows = cur_selected_rows->next) { // Iterate over the rows
|
||||
KotoTrackItem *track_item = (KotoTrackItem*) gtk_list_box_row_get_child(cur_selected_rows->data);
|
||||
KotoTrackItem * track_item = (KotoTrackItem*) gtk_list_box_row_get_child(cur_selected_rows->data);
|
||||
selected_tracks = g_list_append(selected_tracks, koto_track_item_get_track(track_item)); // Add the KotoIndexedTrack to our list
|
||||
}
|
||||
|
||||
|
@ -181,7 +224,10 @@ void koto_disc_view_handle_selected_rows_changed(GtkListBox *box, gpointer user_
|
|||
koto_action_bar_toggle_reveal(action_bar, TRUE); // Show the action bar
|
||||
}
|
||||
|
||||
void koto_disc_view_set_album(KotoDiscView *self, KotoIndexedAlbum *album) {
|
||||
void koto_disc_view_set_album(
|
||||
KotoDiscView * self,
|
||||
KotoIndexedAlbum * album
|
||||
) {
|
||||
if (album == NULL) {
|
||||
return;
|
||||
}
|
||||
|
@ -195,28 +241,43 @@ void koto_disc_view_set_album(KotoDiscView *self, KotoIndexedAlbum *album) {
|
|||
g_list_foreach(koto_indexed_album_get_tracks(self->album), koto_disc_view_list_tracks, self);
|
||||
}
|
||||
|
||||
void koto_disc_view_set_disc_number(KotoDiscView *self, guint disc_number) {
|
||||
void koto_disc_view_set_disc_number(
|
||||
KotoDiscView * self,
|
||||
guint disc_number
|
||||
) {
|
||||
if (disc_number == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
self->disc_number = GUINT_TO_POINTER(disc_number);
|
||||
|
||||
gchar *disc_label = g_strdup_printf("Disc %u", disc_number);
|
||||
gtk_label_set_text(GTK_LABEL(self->label), disc_label); // Set the label
|
||||
gchar * disc_label = g_strdup_printf("Disc %u", disc_number);
|
||||
|
||||
|
||||
gtk_label_set_text(GTK_LABEL(self->label), disc_label); // Set the label
|
||||
|
||||
g_free(disc_label);
|
||||
}
|
||||
|
||||
void koto_disc_view_set_disc_label_visible(KotoDiscView *self, gboolean visible) {
|
||||
void koto_disc_view_set_disc_label_visible(
|
||||
KotoDiscView * self,
|
||||
gboolean visible
|
||||
) {
|
||||
(visible) ? gtk_widget_show(self->header) : gtk_widget_hide(self->header);
|
||||
}
|
||||
|
||||
KotoDiscView* koto_disc_view_new(KotoIndexedAlbum *album, guint *disc_number) {
|
||||
return g_object_new(KOTO_TYPE_DISC_VIEW,
|
||||
"disc", disc_number,
|
||||
"album", album,
|
||||
"orientation", GTK_ORIENTATION_VERTICAL,
|
||||
KotoDiscView * koto_disc_view_new(
|
||||
KotoIndexedAlbum * album,
|
||||
guint * disc_number
|
||||
) {
|
||||
return g_object_new(
|
||||
KOTO_TYPE_DISC_VIEW,
|
||||
"disc",
|
||||
disc_number,
|
||||
"album",
|
||||
album,
|
||||
"orientation",
|
||||
GTK_ORIENTATION_VERTICAL,
|
||||
NULL
|
||||
);
|
||||
}
|
||||
|
|
|
@ -27,11 +27,30 @@ G_BEGIN_DECLS
|
|||
|
||||
G_DECLARE_FINAL_TYPE(KotoDiscView, koto_disc_view, KOTO, DISC_VIEW, GtkBox)
|
||||
|
||||
KotoDiscView* koto_disc_view_new(KotoIndexedAlbum *album, guint *disc);
|
||||
void koto_disc_view_handle_selected_rows_changed(GtkListBox *box, gpointer user_data);
|
||||
void koto_disc_view_list_tracks(gpointer data, gpointer selfptr);
|
||||
void koto_disc_view_set_album(KotoDiscView *self, KotoIndexedAlbum *album);
|
||||
void koto_disc_view_set_disc_label_visible(KotoDiscView *self, gboolean visible);
|
||||
void koto_disc_view_set_disc_number(KotoDiscView *self, guint disc_number);
|
||||
KotoDiscView* koto_disc_view_new(KotoIndexedAlbum * album, guint * disc);
|
||||
void koto_disc_view_handle_selected_rows_changed(
|
||||
GtkListBox * box,
|
||||
gpointer user_data
|
||||
);
|
||||
|
||||
void koto_disc_view_list_tracks(
|
||||
gpointer data,
|
||||
gpointer selfptr
|
||||
);
|
||||
|
||||
void koto_disc_view_set_album(
|
||||
KotoDiscView * self,
|
||||
KotoIndexedAlbum * album
|
||||
);
|
||||
|
||||
void koto_disc_view_set_disc_label_visible(
|
||||
KotoDiscView * self,
|
||||
gboolean visible
|
||||
);
|
||||
|
||||
void koto_disc_view_set_disc_number(
|
||||
KotoDiscView * self,
|
||||
guint disc_number
|
||||
);
|
||||
|
||||
G_END_DECLS
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#include "../../koto-utils.h"
|
||||
#include "music-local.h"
|
||||
|
||||
extern KotoCartographer *koto_maps;
|
||||
extern KotoCartographer * koto_maps;
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
|
@ -32,15 +32,17 @@ enum {
|
|||
N_PROPERTIES
|
||||
};
|
||||
|
||||
static GParamSpec *props[N_PROPERTIES] = { NULL, };
|
||||
static GParamSpec * props[N_PROPERTIES] = {
|
||||
NULL,
|
||||
};
|
||||
|
||||
struct _KotoPageMusicLocal {
|
||||
GtkBox parent_instance;
|
||||
GtkWidget *scrolled_window;
|
||||
GtkWidget *artist_list;
|
||||
GtkWidget *stack;
|
||||
GtkWidget * scrolled_window;
|
||||
GtkWidget * artist_list;
|
||||
GtkWidget * stack;
|
||||
|
||||
KotoIndexedLibrary *lib;
|
||||
KotoIndexedLibrary * lib;
|
||||
gboolean constructed;
|
||||
};
|
||||
|
||||
|
@ -50,14 +52,28 @@ struct _KotoPageMusicLocalClass {
|
|||
|
||||
G_DEFINE_TYPE(KotoPageMusicLocal, koto_page_music_local, GTK_TYPE_BOX);
|
||||
|
||||
KotoPageMusicLocal *music_local_page;
|
||||
KotoPageMusicLocal * music_local_page;
|
||||
|
||||
static void koto_page_music_local_constructed(GObject * obj);
|
||||
|
||||
static void koto_page_music_local_get_property(
|
||||
GObject * obj,
|
||||
guint prop_id,
|
||||
GValue * val,
|
||||
GParamSpec * spec
|
||||
);
|
||||
|
||||
static void koto_page_music_local_set_property(
|
||||
GObject * obj,
|
||||
guint prop_id,
|
||||
const GValue * val,
|
||||
GParamSpec * spec
|
||||
);
|
||||
|
||||
static void koto_page_music_local_class_init(KotoPageMusicLocalClass * c) {
|
||||
GObjectClass * gobject_class;
|
||||
|
||||
static void koto_page_music_local_constructed(GObject *obj);
|
||||
static void koto_page_music_local_get_property(GObject *obj, guint prop_id, GValue *val, GParamSpec *spec);
|
||||
static void koto_page_music_local_set_property(GObject *obj, guint prop_id, const GValue *val, GParamSpec *spec);
|
||||
|
||||
static void koto_page_music_local_class_init(KotoPageMusicLocalClass *c) {
|
||||
GObjectClass *gobject_class;
|
||||
gobject_class = G_OBJECT_CLASS(c);
|
||||
gobject_class->constructed = koto_page_music_local_constructed;
|
||||
gobject_class->set_property = koto_page_music_local_set_property;
|
||||
|
@ -68,14 +84,20 @@ static void koto_page_music_local_class_init(KotoPageMusicLocalClass *c) {
|
|||
"Library",
|
||||
"Library",
|
||||
KOTO_TYPE_INDEXED_LIBRARY,
|
||||
G_PARAM_CONSTRUCT|G_PARAM_EXPLICIT_NOTIFY|G_PARAM_READWRITE
|
||||
G_PARAM_CONSTRUCT | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_READWRITE
|
||||
);
|
||||
|
||||
g_object_class_install_properties(gobject_class, N_PROPERTIES, props);
|
||||
}
|
||||
|
||||
static void koto_page_music_local_get_property(GObject *obj, guint prop_id, GValue *val, GParamSpec *spec) {
|
||||
KotoPageMusicLocal *self = KOTO_PAGE_MUSIC_LOCAL(obj);
|
||||
static void koto_page_music_local_get_property(
|
||||
GObject * obj,
|
||||
guint prop_id,
|
||||
GValue * val,
|
||||
GParamSpec * spec
|
||||
) {
|
||||
KotoPageMusicLocal * self = KOTO_PAGE_MUSIC_LOCAL(obj);
|
||||
|
||||
|
||||
switch (prop_id) {
|
||||
case PROP_LIB:
|
||||
|
@ -87,8 +109,14 @@ static void koto_page_music_local_get_property(GObject *obj, guint prop_id, GVal
|
|||
}
|
||||
}
|
||||
|
||||
static void koto_page_music_local_set_property(GObject *obj, guint prop_id, const GValue *val, GParamSpec *spec) {
|
||||
KotoPageMusicLocal *self = KOTO_PAGE_MUSIC_LOCAL(obj);
|
||||
static void koto_page_music_local_set_property(
|
||||
GObject * obj,
|
||||
guint prop_id,
|
||||
const GValue * val,
|
||||
GParamSpec * spec
|
||||
) {
|
||||
KotoPageMusicLocal * self = KOTO_PAGE_MUSIC_LOCAL(obj);
|
||||
|
||||
|
||||
switch (prop_id) {
|
||||
case PROP_LIB:
|
||||
|
@ -100,7 +128,7 @@ static void koto_page_music_local_set_property(GObject *obj, guint prop_id, cons
|
|||
}
|
||||
}
|
||||
|
||||
static void koto_page_music_local_init(KotoPageMusicLocal *self) {
|
||||
static void koto_page_music_local_init(KotoPageMusicLocal * self) {
|
||||
self->lib = NULL;
|
||||
self->constructed = FALSE;
|
||||
|
||||
|
@ -130,36 +158,55 @@ static void koto_page_music_local_init(KotoPageMusicLocal *self) {
|
|||
gtk_box_append(GTK_BOX(self), self->stack);
|
||||
}
|
||||
|
||||
static void koto_page_music_local_constructed(GObject *obj) {
|
||||
KotoPageMusicLocal *self = KOTO_PAGE_MUSIC_LOCAL(obj);
|
||||
static void koto_page_music_local_constructed(GObject * obj) {
|
||||
KotoPageMusicLocal * self = KOTO_PAGE_MUSIC_LOCAL(obj);
|
||||
|
||||
G_OBJECT_CLASS (koto_page_music_local_parent_class)->constructed (obj);
|
||||
|
||||
G_OBJECT_CLASS(koto_page_music_local_parent_class)->constructed(obj);
|
||||
self->constructed = TRUE;
|
||||
}
|
||||
|
||||
void koto_page_music_local_add_artist(KotoPageMusicLocal *self, KotoIndexedArtist *artist) {
|
||||
gchar *artist_name;
|
||||
void koto_page_music_local_add_artist(
|
||||
KotoPageMusicLocal * self,
|
||||
KotoIndexedArtist * artist
|
||||
) {
|
||||
gchar * artist_name;
|
||||
|
||||
|
||||
g_object_get(artist, "name", &artist_name, NULL);
|
||||
KotoButton *artist_button = koto_button_new_plain(artist_name);
|
||||
KotoButton * artist_button = koto_button_new_plain(artist_name);
|
||||
|
||||
|
||||
gtk_list_box_prepend(GTK_LIST_BOX(self->artist_list), GTK_WIDGET(artist_button));
|
||||
|
||||
KotoArtistView *artist_view = koto_artist_view_new(); // Create our new artist view
|
||||
KotoArtistView * artist_view = koto_artist_view_new(); // Create our new artist view
|
||||
|
||||
|
||||
koto_artist_view_add_artist(artist_view, artist); // Add the artist
|
||||
gtk_stack_add_named(GTK_STACK(self->stack), koto_artist_view_get_main(artist_view), artist_name);
|
||||
}
|
||||
|
||||
void koto_page_music_local_go_to_artist_by_name(KotoPageMusicLocal *self, gchar *artist_name) {
|
||||
void koto_page_music_local_go_to_artist_by_name(
|
||||
KotoPageMusicLocal * self,
|
||||
gchar * artist_name
|
||||
) {
|
||||
gtk_stack_set_visible_child_name(GTK_STACK(self->stack), artist_name);
|
||||
}
|
||||
|
||||
void koto_page_music_local_go_to_artist_by_uuid(KotoPageMusicLocal *self, gchar *artist_uuid) {
|
||||
KotoIndexedArtist *artist = koto_cartographer_get_artist_by_uuid(koto_maps, artist_uuid); // Get the artist
|
||||
void koto_page_music_local_go_to_artist_by_uuid(
|
||||
KotoPageMusicLocal * self,
|
||||
gchar * artist_uuid
|
||||
) {
|
||||
KotoIndexedArtist * artist = koto_cartographer_get_artist_by_uuid(koto_maps, artist_uuid); // Get the artist
|
||||
|
||||
|
||||
if (!KOTO_IS_INDEXED_ARTIST(artist)) { // No artist for this UUID
|
||||
return;
|
||||
}
|
||||
|
||||
gchar *artist_name = NULL;
|
||||
gchar * artist_name = NULL;
|
||||
|
||||
|
||||
g_object_get(
|
||||
artist,
|
||||
"name",
|
||||
|
@ -174,17 +221,26 @@ void koto_page_music_local_go_to_artist_by_uuid(KotoPageMusicLocal *self, gchar
|
|||
koto_page_music_local_go_to_artist_by_name(self, artist_name);
|
||||
}
|
||||
|
||||
void koto_page_music_local_handle_artist_click(GtkListBox *box, GtkListBoxRow *row, gpointer data) {
|
||||
void koto_page_music_local_handle_artist_click(
|
||||
GtkListBox * box,
|
||||
GtkListBoxRow * row,
|
||||
gpointer data
|
||||
) {
|
||||
(void) box;
|
||||
KotoPageMusicLocal *self = (KotoPageMusicLocal*) data;
|
||||
KotoButton *btn = KOTO_BUTTON(gtk_list_box_row_get_child(row));
|
||||
KotoPageMusicLocal * self = (KotoPageMusicLocal*) data;
|
||||
KotoButton * btn = KOTO_BUTTON(gtk_list_box_row_get_child(row));
|
||||
|
||||
gchar * artist_name;
|
||||
|
||||
|
||||
gchar *artist_name;
|
||||
g_object_get(btn, "button-text", &artist_name, NULL);
|
||||
koto_page_music_local_go_to_artist_by_name(self, artist_name);
|
||||
}
|
||||
|
||||
void koto_page_music_local_set_library(KotoPageMusicLocal *self, KotoIndexedLibrary *lib) {
|
||||
void koto_page_music_local_set_library(
|
||||
KotoPageMusicLocal * self,
|
||||
KotoIndexedLibrary * lib
|
||||
) {
|
||||
if (lib == NULL) {
|
||||
return;
|
||||
}
|
||||
|
@ -203,11 +259,12 @@ void koto_page_music_local_set_library(KotoPageMusicLocal *self, KotoIndexedLibr
|
|||
gpointer artist_key;
|
||||
gpointer artist_data;
|
||||
|
||||
GHashTable *artists = koto_indexed_library_get_artists(self->lib); // Get the artists
|
||||
GHashTable * artists = koto_indexed_library_get_artists(self->lib); // Get the artists
|
||||
|
||||
|
||||
g_hash_table_iter_init(&artist_list_iter, artists);
|
||||
while (g_hash_table_iter_next(&artist_list_iter, &artist_key, &artist_data)) { // For each of the music artists
|
||||
KotoIndexedArtist *artist = koto_cartographer_get_artist_by_uuid(koto_maps, (gchar*) artist_data); // Cast our data as a KotoIndexedArtist
|
||||
KotoIndexedArtist * artist = koto_cartographer_get_artist_by_uuid(koto_maps, (gchar*) artist_data); // Cast our data as a KotoIndexedArtist
|
||||
|
||||
if (artist != NULL) {
|
||||
koto_page_music_local_add_artist(self, artist);
|
||||
|
@ -215,13 +272,18 @@ void koto_page_music_local_set_library(KotoPageMusicLocal *self, KotoIndexedLibr
|
|||
}
|
||||
}
|
||||
|
||||
int koto_page_music_local_sort_artists(GtkListBoxRow *artist1, GtkListBoxRow *artist2, gpointer user_data) {
|
||||
int koto_page_music_local_sort_artists(
|
||||
GtkListBoxRow * artist1,
|
||||
GtkListBoxRow * artist2,
|
||||
gpointer user_data
|
||||
) {
|
||||
(void) user_data;
|
||||
KotoButton *artist1_btn = KOTO_BUTTON(gtk_list_box_row_get_child(artist1));
|
||||
KotoButton *artist2_btn = KOTO_BUTTON(gtk_list_box_row_get_child(artist2));
|
||||
KotoButton * artist1_btn = KOTO_BUTTON(gtk_list_box_row_get_child(artist1));
|
||||
KotoButton * artist2_btn = KOTO_BUTTON(gtk_list_box_row_get_child(artist2));
|
||||
|
||||
gchar * artist1_text;
|
||||
gchar * artist2_text;
|
||||
|
||||
gchar *artist1_text;
|
||||
gchar *artist2_text;
|
||||
|
||||
g_object_get(artist1_btn, "button-text", &artist1_text, NULL);
|
||||
g_object_get(artist2_btn, "button-text", &artist2_text, NULL);
|
||||
|
@ -229,9 +291,11 @@ int koto_page_music_local_sort_artists(GtkListBoxRow *artist1, GtkListBoxRow *ar
|
|||
return g_utf8_collate(artist1_text, artist2_text);
|
||||
}
|
||||
|
||||
KotoPageMusicLocal* koto_page_music_local_new() {
|
||||
return g_object_new(KOTO_TYPE_PAGE_MUSIC_LOCAL,
|
||||
"orientation", GTK_ORIENTATION_HORIZONTAL,
|
||||
KotoPageMusicLocal * koto_page_music_local_new() {
|
||||
return g_object_new(
|
||||
KOTO_TYPE_PAGE_MUSIC_LOCAL,
|
||||
"orientation",
|
||||
GTK_ORIENTATION_HORIZONTAL,
|
||||
NULL
|
||||
);
|
||||
}
|
||||
|
|
|
@ -26,14 +26,39 @@ G_BEGIN_DECLS
|
|||
|
||||
#define KOTO_TYPE_PAGE_MUSIC_LOCAL (koto_page_music_local_get_type())
|
||||
|
||||
G_DECLARE_FINAL_TYPE (KotoPageMusicLocal, koto_page_music_local, KOTO, PAGE_MUSIC_LOCAL, GtkBox)
|
||||
G_DECLARE_FINAL_TYPE(KotoPageMusicLocal, koto_page_music_local, KOTO, PAGE_MUSIC_LOCAL, GtkBox)
|
||||
|
||||
KotoPageMusicLocal* koto_page_music_local_new();
|
||||
void koto_page_music_local_add_artist(KotoPageMusicLocal *self, KotoIndexedArtist *artist);
|
||||
void koto_page_music_local_handle_artist_click(GtkListBox *box, GtkListBoxRow *row, gpointer data);
|
||||
void koto_page_music_local_go_to_artist_by_name(KotoPageMusicLocal *self, gchar *artist_name);
|
||||
void koto_page_music_local_go_to_artist_by_uuid(KotoPageMusicLocal *self, gchar *artist_uuid);
|
||||
void koto_page_music_local_set_library(KotoPageMusicLocal *self, KotoIndexedLibrary *lib);
|
||||
int koto_page_music_local_sort_artists(GtkListBoxRow *artist1, GtkListBoxRow *artist2, gpointer user_data);
|
||||
void koto_page_music_local_add_artist(
|
||||
KotoPageMusicLocal * self,
|
||||
KotoIndexedArtist * artist
|
||||
);
|
||||
|
||||
void koto_page_music_local_handle_artist_click(
|
||||
GtkListBox * box,
|
||||
GtkListBoxRow * row,
|
||||
gpointer data
|
||||
);
|
||||
|
||||
void koto_page_music_local_go_to_artist_by_name(
|
||||
KotoPageMusicLocal * self,
|
||||
gchar * artist_name
|
||||
);
|
||||
|
||||
void koto_page_music_local_go_to_artist_by_uuid(
|
||||
KotoPageMusicLocal * self,
|
||||
gchar * artist_uuid
|
||||
);
|
||||
|
||||
void koto_page_music_local_set_library(
|
||||
KotoPageMusicLocal * self,
|
||||
KotoIndexedLibrary * lib
|
||||
);
|
||||
|
||||
int koto_page_music_local_sort_artists(
|
||||
GtkListBoxRow * artist1,
|
||||
GtkListBoxRow * artist2,
|
||||
gpointer user_data
|
||||
);
|
||||
|
||||
G_END_DECLS
|
||||
|
|
|
@ -27,11 +27,11 @@
|
|||
#include "../../playlist/create-modify-dialog.h"
|
||||
#include "list.h"
|
||||
|
||||
extern KotoActionBar *action_bar;
|
||||
extern KotoCartographer *koto_maps;
|
||||
extern KotoCreateModifyPlaylistDialog *playlist_create_modify_dialog;
|
||||
extern KotoCurrentPlaylist *current_playlist;
|
||||
extern KotoWindow *main_window;
|
||||
extern KotoActionBar * action_bar;
|
||||
extern KotoCartographer * koto_maps;
|
||||
extern KotoCreateModifyPlaylistDialog * playlist_create_modify_dialog;
|
||||
extern KotoCurrentPlaylist * current_playlist;
|
||||
extern KotoWindow * main_window;
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
|
@ -39,41 +39,43 @@ enum {
|
|||
N_PROPERTIES
|
||||
};
|
||||
|
||||
static GParamSpec *props[N_PROPERTIES] = { NULL, };
|
||||
static GParamSpec * props[N_PROPERTIES] = {
|
||||
NULL,
|
||||
};
|
||||
|
||||
struct _KotoPlaylistPage {
|
||||
GObject parent_instance;
|
||||
KotoPlaylist *playlist;
|
||||
gchar *uuid;
|
||||
KotoPlaylist * playlist;
|
||||
gchar * uuid;
|
||||
|
||||
GtkWidget *main; // Our Scrolled Window
|
||||
GtkWidget *content; // Content inside scrolled window
|
||||
GtkWidget *header;
|
||||
GtkWidget * main; // Our Scrolled Window
|
||||
GtkWidget * content; // Content inside scrolled window
|
||||
GtkWidget * header;
|
||||
|
||||
KotoCoverArtButton *playlist_image;
|
||||
GtkWidget *name_label;
|
||||
GtkWidget *tracks_count_label;
|
||||
GtkWidget *type_label;
|
||||
KotoButton *favorite_button;
|
||||
KotoButton *edit_button;
|
||||
KotoCoverArtButton * playlist_image;
|
||||
GtkWidget * name_label;
|
||||
GtkWidget * tracks_count_label;
|
||||
GtkWidget * type_label;
|
||||
KotoButton * favorite_button;
|
||||
KotoButton * edit_button;
|
||||
|
||||
GtkListItemFactory *item_factory;
|
||||
GListModel *model;
|
||||
GtkSelectionModel *selection_model;
|
||||
GtkListItemFactory * item_factory;
|
||||
GListModel * model;
|
||||
GtkSelectionModel * selection_model;
|
||||
|
||||
GtkWidget *track_list_content;
|
||||
GtkWidget *track_list_header;
|
||||
GtkWidget *track_list_view;
|
||||
GtkWidget * track_list_content;
|
||||
GtkWidget * track_list_header;
|
||||
GtkWidget * track_list_view;
|
||||
|
||||
KotoButton *track_num_button;
|
||||
KotoButton *track_title_button;
|
||||
KotoButton *track_album_button;
|
||||
KotoButton *track_artist_button;
|
||||
KotoButton * track_num_button;
|
||||
KotoButton * track_title_button;
|
||||
KotoButton * track_album_button;
|
||||
KotoButton * track_artist_button;
|
||||
|
||||
GtkSizeGroup *track_pos_size_group;
|
||||
GtkSizeGroup *track_name_size_group;
|
||||
GtkSizeGroup *track_album_size_group;
|
||||
GtkSizeGroup *track_artist_size_group;
|
||||
GtkSizeGroup * track_pos_size_group;
|
||||
GtkSizeGroup * track_name_size_group;
|
||||
GtkSizeGroup * track_album_size_group;
|
||||
GtkSizeGroup * track_artist_size_group;
|
||||
};
|
||||
|
||||
struct _KotoPlaylistPageClass {
|
||||
|
@ -82,11 +84,24 @@ struct _KotoPlaylistPageClass {
|
|||
|
||||
G_DEFINE_TYPE(KotoPlaylistPage, koto_playlist_page, G_TYPE_OBJECT);
|
||||
|
||||
static void koto_playlist_page_get_property(GObject *obj, guint prop_id, GValue *val, GParamSpec *spec);
|
||||
static void koto_playlist_page_set_property(GObject *obj, guint prop_id, const GValue *val, GParamSpec *spec);
|
||||
static void koto_playlist_page_get_property(
|
||||
GObject * obj,
|
||||
guint prop_id,
|
||||
GValue * val,
|
||||
GParamSpec * spec
|
||||
);
|
||||
|
||||
static void koto_playlist_page_set_property(
|
||||
GObject * obj,
|
||||
guint prop_id,
|
||||
const GValue * val,
|
||||
GParamSpec * spec
|
||||
);
|
||||
|
||||
static void koto_playlist_page_class_init(KotoPlaylistPageClass * c) {
|
||||
GObjectClass * gobject_class;
|
||||
|
||||
|
||||
static void koto_playlist_page_class_init(KotoPlaylistPageClass *c) {
|
||||
GObjectClass *gobject_class;
|
||||
gobject_class = G_OBJECT_CLASS(c);
|
||||
gobject_class->get_property = koto_playlist_page_get_property;
|
||||
gobject_class->set_property = koto_playlist_page_set_property;
|
||||
|
@ -96,13 +111,13 @@ static void koto_playlist_page_class_init(KotoPlaylistPageClass *c) {
|
|||
"UUID of associated Playlist",
|
||||
"UUID of associated Playlist",
|
||||
NULL,
|
||||
G_PARAM_CONSTRUCT_ONLY|G_PARAM_EXPLICIT_NOTIFY|G_PARAM_READWRITE
|
||||
G_PARAM_CONSTRUCT_ONLY | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_READWRITE
|
||||
);
|
||||
|
||||
g_object_class_install_properties(gobject_class, N_PROPERTIES, props);
|
||||
}
|
||||
|
||||
static void koto_playlist_page_init(KotoPlaylistPage *self) {
|
||||
static void koto_playlist_page_init(KotoPlaylistPage * self) {
|
||||
self->track_name_size_group = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
|
||||
self->track_pos_size_group = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
|
||||
self->track_album_size_group = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
|
||||
|
@ -119,10 +134,14 @@ static void koto_playlist_page_init(KotoPlaylistPage *self) {
|
|||
gtk_box_prepend(GTK_BOX(self->content), self->header);
|
||||
|
||||
self->playlist_image = koto_cover_art_button_new(220, 220, NULL); // Create our Cover Art Button with no art by default
|
||||
KotoButton *cover_art_button = koto_cover_art_button_get_button(self->playlist_image); // Get the button for the cover art
|
||||
KotoButton * cover_art_button = koto_cover_art_button_get_button(self->playlist_image); // Get the button for the cover art
|
||||
|
||||
|
||||
koto_button_add_click_handler(cover_art_button, KOTO_BUTTON_CLICK_TYPE_PRIMARY, G_CALLBACK(koto_playlist_page_handle_cover_art_clicked), self);
|
||||
|
||||
GtkWidget *info_box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
|
||||
GtkWidget * info_box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
|
||||
|
||||
|
||||
gtk_widget_set_size_request(info_box, -1, 220);
|
||||
gtk_widget_add_css_class(info_box, "playlist-page-header-info");
|
||||
gtk_widget_set_hexpand(info_box, TRUE);
|
||||
|
@ -176,8 +195,14 @@ static void koto_playlist_page_init(KotoPlaylistPage *self) {
|
|||
g_signal_connect(action_bar, "closed", G_CALLBACK(koto_playlist_page_handle_action_bar_closed), self); // Handle closed action bar
|
||||
}
|
||||
|
||||
static void koto_playlist_page_get_property(GObject *obj, guint prop_id, GValue *val, GParamSpec *spec) {
|
||||
KotoPlaylistPage *self = KOTO_PLAYLIST_PAGE(obj);
|
||||
static void koto_playlist_page_get_property(
|
||||
GObject * obj,
|
||||
guint prop_id,
|
||||
GValue * val,
|
||||
GParamSpec * spec
|
||||
) {
|
||||
KotoPlaylistPage * self = KOTO_PLAYLIST_PAGE(obj);
|
||||
|
||||
|
||||
switch (prop_id) {
|
||||
case PROP_PLAYLIST_UUID:
|
||||
|
@ -189,8 +214,15 @@ static void koto_playlist_page_get_property(GObject *obj, guint prop_id, GValue
|
|||
}
|
||||
}
|
||||
|
||||
static void koto_playlist_page_set_property(GObject *obj, guint prop_id, const GValue *val, GParamSpec *spec) {
|
||||
KotoPlaylistPage *self = KOTO_PLAYLIST_PAGE(obj);
|
||||
static void koto_playlist_page_set_property(
|
||||
GObject * obj,
|
||||
guint prop_id,
|
||||
const GValue * val,
|
||||
GParamSpec * spec
|
||||
) {
|
||||
KotoPlaylistPage * self = KOTO_PLAYLIST_PAGE(obj);
|
||||
|
||||
|
||||
switch (prop_id) {
|
||||
case PROP_PLAYLIST_UUID:
|
||||
koto_playlist_page_set_playlist_uuid(self, g_strdup(g_value_get_string(val))); // Call to our playlist UUID set function
|
||||
|
@ -201,23 +233,29 @@ static void koto_playlist_page_set_property(GObject *obj, guint prop_id, const G
|
|||
}
|
||||
}
|
||||
|
||||
void koto_playlist_page_bind_track_item(GtkListItemFactory *factory, GtkListItem *item, KotoPlaylistPage *self) {
|
||||
void koto_playlist_page_bind_track_item(
|
||||
GtkListItemFactory * factory,
|
||||
GtkListItem * item,
|
||||
KotoPlaylistPage * self
|
||||
) {
|
||||
(void) factory;
|
||||
|
||||
GtkWidget *track_position_label = gtk_widget_get_first_child(gtk_list_item_get_child(item));
|
||||
GtkWidget *track_name_label = gtk_widget_get_next_sibling(track_position_label);
|
||||
GtkWidget *track_album_label = gtk_widget_get_next_sibling(track_name_label);
|
||||
GtkWidget *track_artist_label = gtk_widget_get_next_sibling(track_album_label);
|
||||
GtkWidget * track_position_label = gtk_widget_get_first_child(gtk_list_item_get_child(item));
|
||||
GtkWidget * track_name_label = gtk_widget_get_next_sibling(track_position_label);
|
||||
GtkWidget * track_album_label = gtk_widget_get_next_sibling(track_name_label);
|
||||
GtkWidget * track_artist_label = gtk_widget_get_next_sibling(track_album_label);
|
||||
|
||||
KotoIndexedTrack * track = gtk_list_item_get_item(item); // Get the track UUID from our model
|
||||
|
||||
KotoIndexedTrack *track = gtk_list_item_get_item(item); // Get the track UUID from our model
|
||||
|
||||
if (!KOTO_IS_INDEXED_TRACK(track)) {
|
||||
return;
|
||||
}
|
||||
|
||||
gchar *track_name = NULL;
|
||||
gchar *album_uuid = NULL;
|
||||
gchar *artist_uuid = NULL;
|
||||
gchar * track_name = NULL;
|
||||
gchar * album_uuid = NULL;
|
||||
gchar * artist_uuid = NULL;
|
||||
|
||||
|
||||
g_object_get(
|
||||
track,
|
||||
|
@ -232,23 +270,26 @@ void koto_playlist_page_bind_track_item(GtkListItemFactory *factory, GtkListItem
|
|||
|
||||
guint track_position = koto_playlist_get_position_of_track(self->playlist, track);
|
||||
|
||||
|
||||
gtk_label_set_label(GTK_LABEL(track_position_label), g_strdup_printf("%u", track_position)); // Set the track position
|
||||
gtk_label_set_label(GTK_LABEL(track_name_label), track_name); // Set our track name
|
||||
|
||||
KotoIndexedAlbum *album = koto_cartographer_get_album_by_uuid(koto_maps, album_uuid);
|
||||
KotoIndexedAlbum * album = koto_cartographer_get_album_by_uuid(koto_maps, album_uuid);
|
||||
|
||||
|
||||
if (KOTO_IS_INDEXED_ALBUM(album)) {
|
||||
gtk_label_set_label(GTK_LABEL(track_album_label), koto_indexed_album_get_album_name(album)); // Get the name of the album and set it to the label
|
||||
}
|
||||
|
||||
KotoIndexedArtist *artist = koto_cartographer_get_artist_by_uuid(koto_maps, artist_uuid);
|
||||
KotoIndexedArtist * artist = koto_cartographer_get_artist_by_uuid(koto_maps, artist_uuid);
|
||||
|
||||
|
||||
if (KOTO_IS_INDEXED_ARTIST(artist)) {
|
||||
gtk_label_set_label(GTK_LABEL(track_artist_label), koto_indexed_artist_get_name(artist)); // Get the name of the artist and set it to the label
|
||||
}
|
||||
}
|
||||
|
||||
void koto_playlist_page_create_tracks_header(KotoPlaylistPage *self) {
|
||||
void koto_playlist_page_create_tracks_header(KotoPlaylistPage * self) {
|
||||
self->track_num_button = koto_button_new_with_icon("#", "pan-down-symbolic", "pan-up-symbolic", KOTO_BUTTON_PIXBUF_SIZE_SMALL);
|
||||
koto_button_add_click_handler(self->track_num_button, KOTO_BUTTON_CLICK_TYPE_PRIMARY, G_CALLBACK(koto_playlist_page_handle_track_num_clicked), self);
|
||||
koto_button_set_image_position(self->track_num_button, KOTO_BUTTON_IMAGE_POS_RIGHT); // Move the image to the right
|
||||
|
@ -276,13 +317,17 @@ void koto_playlist_page_create_tracks_header(KotoPlaylistPage *self) {
|
|||
gtk_box_append(GTK_BOX(self->track_list_header), GTK_WIDGET(self->track_artist_button));
|
||||
}
|
||||
|
||||
GtkWidget* koto_playlist_page_get_main(KotoPlaylistPage *self) {
|
||||
GtkWidget * koto_playlist_page_get_main(KotoPlaylistPage * self) {
|
||||
return self->main;
|
||||
}
|
||||
|
||||
void koto_playlist_page_handle_action_bar_closed(KotoActionBar *bar, gpointer data) {
|
||||
void koto_playlist_page_handle_action_bar_closed(
|
||||
KotoActionBar * bar,
|
||||
gpointer data
|
||||
) {
|
||||
(void) bar;
|
||||
KotoPlaylistPage *self = data;
|
||||
KotoPlaylistPage * self = data;
|
||||
|
||||
|
||||
if (!KOTO_IS_PLAYLIST(self->playlist)) { // No playlist set
|
||||
return;
|
||||
|
@ -292,9 +337,19 @@ void koto_playlist_page_handle_action_bar_closed(KotoActionBar *bar, gpointer da
|
|||
gtk_widget_grab_focus(GTK_WIDGET(main_window)); // Focus on the window
|
||||
}
|
||||
|
||||
void koto_playlist_page_handle_cover_art_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;
|
||||
void koto_playlist_page_handle_cover_art_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;
|
||||
|
||||
|
||||
if (!KOTO_IS_PLAYLIST(self->playlist)) { // No playlist set
|
||||
return;
|
||||
|
@ -303,64 +358,127 @@ void koto_playlist_page_handle_cover_art_clicked(GtkGestureClick *gesture, int n
|
|||
koto_current_playlist_set_playlist(current_playlist, self->playlist);
|
||||
}
|
||||
|
||||
void koto_playlist_page_handle_edit_button_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;
|
||||
void koto_playlist_page_handle_edit_button_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;
|
||||
|
||||
|
||||
koto_create_modify_playlist_dialog_set_playlist_uuid(playlist_create_modify_dialog, koto_playlist_get_uuid(self->playlist));
|
||||
koto_window_show_dialog(main_window, "create-modify-playlist");
|
||||
}
|
||||
|
||||
void koto_playlist_page_handle_playlist_modified(KotoPlaylist *playlist, gpointer user_data) {
|
||||
void koto_playlist_page_handle_playlist_modified(
|
||||
KotoPlaylist * playlist,
|
||||
gpointer user_data
|
||||
) {
|
||||
if (!KOTO_IS_PLAYLIST(playlist)) {
|
||||
return;
|
||||
}
|
||||
|
||||
KotoPlaylistPage *self = user_data;
|
||||
KotoPlaylistPage * self = user_data;
|
||||
|
||||
|
||||
if (!KOTO_IS_PLAYLIST_PAGE(self)) {
|
||||
return;
|
||||
}
|
||||
|
||||
gchar *artwork = koto_playlist_get_artwork(playlist); // Get the artwork
|
||||
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
|
||||
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;
|
||||
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;
|
||||
|
||||
|
||||
gtk_widget_add_css_class(GTK_WIDGET(self->track_album_button), "active");
|
||||
koto_button_hide_image(self->track_num_button); // Go back to hiding the image
|
||||
koto_playlist_page_set_playlist_model(self, KOTO_PREFERRED_MODEL_TYPE_SORT_BY_ALBUM);
|
||||
}
|
||||
|
||||
void koto_playlist_page_handle_track_artist_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;
|
||||
void koto_playlist_page_handle_track_artist_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;
|
||||
|
||||
|
||||
gtk_widget_add_css_class(GTK_WIDGET(self->track_artist_button), "active");
|
||||
koto_button_hide_image(self->track_num_button); // Go back to hiding the image
|
||||
koto_playlist_page_set_playlist_model(self, KOTO_PREFERRED_MODEL_TYPE_SORT_BY_ARTIST);
|
||||
}
|
||||
|
||||
void koto_playlist_page_handle_track_name_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;
|
||||
void koto_playlist_page_handle_track_name_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;
|
||||
|
||||
|
||||
gtk_widget_add_css_class(GTK_WIDGET(self->track_title_button), "active");
|
||||
koto_button_hide_image(self->track_num_button); // Go back to hiding the image
|
||||
koto_playlist_page_set_playlist_model(self, KOTO_PREFERRED_MODEL_TYPE_SORT_BY_TRACK_NAME);
|
||||
}
|
||||
|
||||
void koto_playlist_page_handle_track_num_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;
|
||||
void koto_playlist_page_handle_track_num_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;
|
||||
|
||||
KotoPreferredModelType current_model = koto_playlist_get_current_model(self->playlist);
|
||||
|
||||
|
||||
if (current_model == KOTO_PREFERRED_MODEL_TYPE_DEFAULT) { // Set to newest currently
|
||||
koto_playlist_page_set_playlist_model(self, KOTO_PREFERRED_MODEL_TYPE_OLDEST_FIRST); // Sort reversed (oldest)
|
||||
koto_button_show_image(self->track_num_button, TRUE); // Use inverted value (pan-up-symbolic)
|
||||
|
@ -370,21 +488,29 @@ void koto_playlist_page_handle_track_num_clicked(GtkGestureClick *gesture, int n
|
|||
}
|
||||
}
|
||||
|
||||
void koto_playlist_page_handle_tracks_selected(GtkSelectionModel *model, guint position, guint n_items, gpointer user_data) {
|
||||
void koto_playlist_page_handle_tracks_selected(
|
||||
GtkSelectionModel * model,
|
||||
guint position,
|
||||
guint n_items,
|
||||
gpointer user_data
|
||||
) {
|
||||
(void) position;
|
||||
KotoPlaylistPage *self = user_data;
|
||||
KotoPlaylistPage * self = user_data;
|
||||
|
||||
|
||||
if (n_items == 0) { // No items selected
|
||||
koto_action_bar_toggle_reveal(action_bar, FALSE); // Hide the action bar
|
||||
return;
|
||||
}
|
||||
|
||||
GtkBitset *selected_items_bitset = gtk_selection_model_get_selection(model); // Get the selected items as a GtkBitSet
|
||||
GtkBitset * selected_items_bitset = gtk_selection_model_get_selection(model); // Get the selected items as a GtkBitSet
|
||||
GtkBitsetIter iter;
|
||||
GList *selected_tracks = NULL;
|
||||
GList *selected_tracks_pos = NULL;
|
||||
GList * selected_tracks = NULL;
|
||||
GList * selected_tracks_pos = NULL;
|
||||
|
||||
guint first_track_pos;
|
||||
|
||||
|
||||
if (!gtk_bitset_iter_init_first(&iter, selected_items_bitset, &first_track_pos)) { // Failed to get the first item
|
||||
return;
|
||||
}
|
||||
|
@ -392,6 +518,8 @@ void koto_playlist_page_handle_tracks_selected(GtkSelectionModel *model, guint p
|
|||
selected_tracks_pos = g_list_append(selected_tracks_pos, GUINT_TO_POINTER(first_track_pos));
|
||||
|
||||
gboolean have_more_items = TRUE;
|
||||
|
||||
|
||||
while (have_more_items) { // While we are able to get selected items
|
||||
guint track_pos;
|
||||
have_more_items = gtk_bitset_iter_next(&iter, &track_pos);
|
||||
|
@ -400,9 +528,11 @@ void koto_playlist_page_handle_tracks_selected(GtkSelectionModel *model, guint p
|
|||
}
|
||||
}
|
||||
|
||||
GList *cur_pos_list;
|
||||
GList * cur_pos_list;
|
||||
|
||||
|
||||
for (cur_pos_list = selected_tracks_pos; cur_pos_list != NULL; cur_pos_list = cur_pos_list->next) { // Iterate over every position that we accumulated
|
||||
KotoIndexedTrack *selected_track = g_list_model_get_item(self->model, GPOINTER_TO_UINT(cur_pos_list->data)); // Get the KotoIndexedTrack in the GListModel for this current position
|
||||
KotoIndexedTrack * selected_track = g_list_model_get_item(self->model, GPOINTER_TO_UINT(cur_pos_list->data)); // Get the KotoIndexedTrack in the GListModel for this current position
|
||||
selected_tracks = g_list_append(selected_tracks, selected_track); // Add to selected tracks
|
||||
}
|
||||
|
||||
|
@ -410,7 +540,10 @@ void koto_playlist_page_handle_tracks_selected(GtkSelectionModel *model, guint p
|
|||
koto_action_bar_toggle_reveal(action_bar, TRUE); // Show the items
|
||||
}
|
||||
|
||||
void koto_playlist_page_set_playlist_uuid(KotoPlaylistPage *self, gchar *playlist_uuid) {
|
||||
void koto_playlist_page_set_playlist_uuid(
|
||||
KotoPlaylistPage * self,
|
||||
gchar * playlist_uuid
|
||||
) {
|
||||
if (!KOTO_IS_PLAYLIST_PAGE(self)) {
|
||||
return;
|
||||
}
|
||||
|
@ -428,7 +561,9 @@ void koto_playlist_page_set_playlist_uuid(KotoPlaylistPage *self, gchar *playlis
|
|||
}
|
||||
|
||||
self->uuid = g_strdup(playlist_uuid); // Duplicate the playlist UUID
|
||||
KotoPlaylist *playlist = koto_cartographer_get_playlist_by_uuid(koto_maps, self->uuid);
|
||||
KotoPlaylist * playlist = koto_cartographer_get_playlist_by_uuid(koto_maps, self->uuid);
|
||||
|
||||
|
||||
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
|
||||
|
@ -436,7 +571,10 @@ void koto_playlist_page_set_playlist_uuid(KotoPlaylistPage *self, gchar *playlis
|
|||
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) {
|
||||
void koto_playlist_page_set_playlist_model(
|
||||
KotoPlaylistPage * self,
|
||||
KotoPreferredModelType model
|
||||
) {
|
||||
if (!KOTO_IS_PLAYLIST_PAGE(self)) {
|
||||
return;
|
||||
}
|
||||
|
@ -447,11 +585,11 @@ void koto_playlist_page_set_playlist_model(KotoPlaylistPage *self, KotoPreferred
|
|||
if (model != KOTO_PREFERRED_MODEL_TYPE_SORT_BY_ALBUM) { // Not sorting by album currently
|
||||
gtk_widget_remove_css_class(GTK_WIDGET(self->track_album_button), "active");
|
||||
}
|
||||
|
||||
|
||||
if (model != KOTO_PREFERRED_MODEL_TYPE_SORT_BY_ARTIST) { // Not sorting by artist currently
|
||||
gtk_widget_remove_css_class(GTK_WIDGET(self->track_artist_button), "active");
|
||||
}
|
||||
|
||||
|
||||
if (model != KOTO_PREFERRED_MODEL_TYPE_SORT_BY_TRACK_NAME) { // Not sorting by track name
|
||||
gtk_widget_remove_css_class(GTK_WIDGET(self->track_title_button), "active");
|
||||
}
|
||||
|
@ -462,18 +600,27 @@ void koto_playlist_page_set_playlist_model(KotoPlaylistPage *self, KotoPreferred
|
|||
gtk_list_view_set_model(GTK_LIST_VIEW(self->track_list_view), self->selection_model); // Set our multi selection model to our provided model
|
||||
}
|
||||
|
||||
void koto_playlist_page_setup_track_item(GtkListItemFactory *factory, GtkListItem *item, gpointer user_data) {
|
||||
void koto_playlist_page_setup_track_item(
|
||||
GtkListItemFactory * factory,
|
||||
GtkListItem * item,
|
||||
gpointer user_data
|
||||
) {
|
||||
(void) factory;
|
||||
KotoPlaylistPage *self = user_data;
|
||||
KotoPlaylistPage * self = user_data;
|
||||
|
||||
|
||||
if (!KOTO_IS_PLAYLIST_PAGE(self)) {
|
||||
return;
|
||||
}
|
||||
|
||||
GtkWidget *item_content = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); // Have a horizontal box for our content
|
||||
GtkWidget * item_content = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); // Have a horizontal box for our content
|
||||
|
||||
|
||||
gtk_widget_add_css_class(item_content, "track-list-columned-item");
|
||||
|
||||
GtkWidget *track_number = gtk_label_new(NULL); // Our track number
|
||||
GtkWidget * track_number = gtk_label_new(NULL); // Our track number
|
||||
|
||||
|
||||
gtk_label_set_xalign(GTK_LABEL(track_number), 0);
|
||||
gtk_widget_add_css_class(track_number, "track-column-number");
|
||||
gtk_widget_set_halign(track_number, GTK_ALIGN_END);
|
||||
|
@ -482,7 +629,9 @@ void koto_playlist_page_setup_track_item(GtkListItemFactory *factory, GtkListIte
|
|||
gtk_box_append(GTK_BOX(item_content), track_number);
|
||||
gtk_size_group_add_widget(self->track_pos_size_group, track_number);
|
||||
|
||||
GtkWidget *track_name = gtk_label_new(NULL); // Our track name
|
||||
GtkWidget * track_name = gtk_label_new(NULL); // Our track name
|
||||
|
||||
|
||||
gtk_label_set_xalign(GTK_LABEL(track_name), 0);
|
||||
gtk_widget_add_css_class(track_name, "track-column-name");
|
||||
gtk_widget_set_halign(track_name, GTK_ALIGN_START);
|
||||
|
@ -491,7 +640,9 @@ void koto_playlist_page_setup_track_item(GtkListItemFactory *factory, GtkListIte
|
|||
gtk_box_append(GTK_BOX(item_content), track_name);
|
||||
gtk_size_group_add_widget(self->track_name_size_group, track_name);
|
||||
|
||||
GtkWidget *track_album = gtk_label_new(NULL); // Our track album
|
||||
GtkWidget * track_album = gtk_label_new(NULL); // Our track album
|
||||
|
||||
|
||||
gtk_label_set_xalign(GTK_LABEL(track_album), 0);
|
||||
gtk_widget_add_css_class(track_album, "track-column-album");
|
||||
gtk_widget_set_halign(track_album, GTK_ALIGN_START);
|
||||
|
@ -501,7 +652,9 @@ void koto_playlist_page_setup_track_item(GtkListItemFactory *factory, GtkListIte
|
|||
gtk_box_append(GTK_BOX(item_content), track_album);
|
||||
gtk_size_group_add_widget(self->track_album_size_group, track_album);
|
||||
|
||||
GtkWidget *track_artist = gtk_label_new(NULL); // Our track artist
|
||||
GtkWidget * track_artist = gtk_label_new(NULL); // Our track artist
|
||||
|
||||
|
||||
gtk_label_set_xalign(GTK_LABEL(track_artist), 0);
|
||||
gtk_widget_add_css_class(track_artist, "track-column-artist");
|
||||
gtk_widget_set_halign(track_artist, GTK_ALIGN_START);
|
||||
|
@ -514,7 +667,7 @@ void koto_playlist_page_setup_track_item(GtkListItemFactory *factory, GtkListIte
|
|||
gtk_list_item_set_child(item, item_content);
|
||||
}
|
||||
|
||||
void koto_playlist_page_update_header(KotoPlaylistPage *self) {
|
||||
void koto_playlist_page_update_header(KotoPlaylistPage * self) {
|
||||
if (!KOTO_IS_PLAYLIST_PAGE(self)) {
|
||||
return;
|
||||
}
|
||||
|
@ -524,6 +677,8 @@ void koto_playlist_page_update_header(KotoPlaylistPage *self) {
|
|||
}
|
||||
|
||||
gboolean ephemeral = TRUE;
|
||||
|
||||
|
||||
g_object_get(
|
||||
self->playlist,
|
||||
"ephemeral",
|
||||
|
@ -535,22 +690,28 @@ void koto_playlist_page_update_header(KotoPlaylistPage *self) {
|
|||
|
||||
gtk_label_set_text(GTK_LABEL(self->name_label), koto_playlist_get_name(self->playlist)); // Set the name label to our playlist name
|
||||
guint track_count = koto_playlist_get_length(self->playlist); // Get the number of tracks
|
||||
|
||||
|
||||
gtk_label_set_text(GTK_LABEL(self->tracks_count_label), g_strdup_printf(track_count != 1 ? "%u tracks" : "%u track", track_count)); // Set the text to "N tracks" where N is the number
|
||||
|
||||
gchar *artwork = koto_playlist_get_artwork(self->playlist);
|
||||
gchar * artwork = koto_playlist_get_artwork(self->playlist);
|
||||
|
||||
|
||||
if (koto_utils_is_string_valid(artwork)) { // Have artwork
|
||||
koto_cover_art_button_set_art_path(self->playlist_image, artwork); // Update our artwork
|
||||
}
|
||||
|
||||
KotoPreferredModelType current_model = koto_playlist_get_current_model(self->playlist); // Get the current model
|
||||
|
||||
|
||||
if (current_model == KOTO_PREFERRED_MODEL_TYPE_OLDEST_FIRST) {
|
||||
koto_button_show_image(self->track_num_button, TRUE); // Immediately use pan-up-symbolic
|
||||
}
|
||||
}
|
||||
|
||||
KotoPlaylistPage* koto_playlist_page_new(gchar *playlist_uuid) {
|
||||
return g_object_new(KOTO_TYPE_PLAYLIST_PAGE,
|
||||
KotoPlaylistPage * koto_playlist_page_new(gchar * playlist_uuid) {
|
||||
return g_object_new(
|
||||
KOTO_TYPE_PLAYLIST_PAGE,
|
||||
"uuid",
|
||||
playlist_uuid,
|
||||
NULL
|
||||
|
|
|
@ -26,31 +26,122 @@
|
|||
G_BEGIN_DECLS
|
||||
|
||||
#define KOTO_TYPE_PLAYLIST_PAGE koto_playlist_page_get_type()
|
||||
G_DECLARE_FINAL_TYPE (KotoPlaylistPage, koto_playlist_page, KOTO, PLAYLIST_PAGE, GObject);
|
||||
G_DECLARE_FINAL_TYPE(KotoPlaylistPage, koto_playlist_page, KOTO, PLAYLIST_PAGE, GObject);
|
||||
#define KOTO_IS_PLAYLIST_PAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), KOTO_TYPE_PLAYLIST_PAGE))
|
||||
|
||||
KotoPlaylistPage* koto_playlist_page_new(gchar *playlist_uuid);
|
||||
void koto_playlist_page_add_track(KotoPlaylistPage* self, const gchar *track_uuid);
|
||||
void koto_playlist_page_create_tracks_header(KotoPlaylistPage *self);
|
||||
void koto_playlist_page_bind_track_item(GtkListItemFactory *factory, GtkListItem *item, KotoPlaylistPage *self);
|
||||
void koto_playlist_page_remove_track(KotoPlaylistPage *self, const gchar *track_uuid);
|
||||
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);
|
||||
void koto_playlist_page_handle_track_num_clicked(GtkGestureClick *gesture, int n_press, double x, double y, gpointer user_data);
|
||||
void koto_playlist_page_handle_tracks_selected(GtkSelectionModel *model, guint position, guint n_items, gpointer user_data);
|
||||
void koto_playlist_page_hide_popover(KotoPlaylistPage *self);
|
||||
void koto_playlist_page_setup_track_item(GtkListItemFactory *factory, GtkListItem *item, gpointer user_data);
|
||||
void koto_playlist_page_set_playlist_uuid(KotoPlaylistPage *self, gchar *playlist_uuid);
|
||||
void koto_playlist_page_set_playlist_model(KotoPlaylistPage *self, KotoPreferredModelType model);
|
||||
void koto_playlist_page_show_popover(KotoPlaylistPage *self);
|
||||
void koto_playlist_page_update_header(KotoPlaylistPage *self);
|
||||
KotoPlaylistPage * koto_playlist_page_new(gchar * playlist_uuid);
|
||||
|
||||
void koto_playlist_page_handle_listitem_activate(GtkListView *list, guint position, gpointer user_data);
|
||||
void koto_playlist_page_add_track(
|
||||
KotoPlaylistPage* self,
|
||||
const gchar * track_uuid
|
||||
);
|
||||
|
||||
void koto_playlist_page_create_tracks_header(KotoPlaylistPage * self);
|
||||
|
||||
void koto_playlist_page_bind_track_item(
|
||||
GtkListItemFactory * factory,
|
||||
GtkListItem * item,
|
||||
KotoPlaylistPage * self
|
||||
);
|
||||
|
||||
void koto_playlist_page_remove_track(
|
||||
KotoPlaylistPage * self,
|
||||
const gchar * track_uuid
|
||||
);
|
||||
|
||||
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
|
||||
);
|
||||
|
||||
void koto_playlist_page_handle_track_num_clicked(
|
||||
GtkGestureClick * gesture,
|
||||
int n_press,
|
||||
double x,
|
||||
double y,
|
||||
gpointer user_data
|
||||
);
|
||||
|
||||
void koto_playlist_page_handle_tracks_selected(
|
||||
GtkSelectionModel * model,
|
||||
guint position,
|
||||
guint n_items,
|
||||
gpointer user_data
|
||||
);
|
||||
|
||||
void koto_playlist_page_hide_popover(KotoPlaylistPage * self);
|
||||
|
||||
void koto_playlist_page_setup_track_item(
|
||||
GtkListItemFactory * factory,
|
||||
GtkListItem * item,
|
||||
gpointer user_data
|
||||
);
|
||||
|
||||
void koto_playlist_page_set_playlist_uuid(
|
||||
KotoPlaylistPage * self,
|
||||
gchar * playlist_uuid
|
||||
);
|
||||
|
||||
void koto_playlist_page_set_playlist_model(
|
||||
KotoPlaylistPage * self,
|
||||
KotoPreferredModelType model
|
||||
);
|
||||
|
||||
void koto_playlist_page_show_popover(KotoPlaylistPage * self);
|
||||
|
||||
void koto_playlist_page_update_header(KotoPlaylistPage * self);
|
||||
|
||||
void koto_playlist_page_handle_listitem_activate(
|
||||
GtkListView * list,
|
||||
guint position,
|
||||
gpointer user_data
|
||||
);
|
||||
|
||||
G_END_DECLS
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue