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
|
@ -26,52 +26,55 @@
|
|||
#include "../koto-utils.h"
|
||||
#include "../koto-window.h"
|
||||
|
||||
extern KotoAddRemoveTrackPopover *koto_add_remove_track_popup;
|
||||
extern KotoCartographer *koto_maps;
|
||||
extern KotoPageMusicLocal *music_local_page;
|
||||
extern KotoPlaybackEngine *playback_engine;
|
||||
extern KotoWindow *main_window;
|
||||
extern KotoAddRemoveTrackPopover * koto_add_remove_track_popup;
|
||||
extern KotoCartographer * koto_maps;
|
||||
extern KotoPageMusicLocal * music_local_page;
|
||||
extern KotoPlaybackEngine * playback_engine;
|
||||
extern KotoWindow * main_window;
|
||||
|
||||
enum {
|
||||
SIGNAL_CLOSED,
|
||||
N_SIGNALS
|
||||
};
|
||||
|
||||
static guint actionbar_signals[N_SIGNALS] = { 0 };
|
||||
static guint actionbar_signals[N_SIGNALS] = {
|
||||
0
|
||||
};
|
||||
|
||||
struct _KotoActionBar {
|
||||
GObject parent_instance;
|
||||
|
||||
GtkActionBar *main;
|
||||
GtkActionBar * main;
|
||||
|
||||
GtkWidget *center_box_content;
|
||||
GtkWidget *start_box_content;
|
||||
GtkWidget *stop_box_content;
|
||||
GtkWidget * center_box_content;
|
||||
GtkWidget * start_box_content;
|
||||
GtkWidget * stop_box_content;
|
||||
|
||||
KotoButton *close_button;
|
||||
GtkWidget *go_to_artist;
|
||||
GtkWidget *playlists;
|
||||
GtkWidget *play_track;
|
||||
GtkWidget *remove_from_playlist;
|
||||
KotoButton * close_button;
|
||||
GtkWidget * go_to_artist;
|
||||
GtkWidget * playlists;
|
||||
GtkWidget * play_track;
|
||||
GtkWidget * remove_from_playlist;
|
||||
|
||||
GList *current_list;
|
||||
gchar *current_album_uuid;
|
||||
gchar *current_playlist_uuid;
|
||||
GList * current_list;
|
||||
gchar * current_album_uuid;
|
||||
gchar * current_playlist_uuid;
|
||||
KotoActionBarRelative relative;
|
||||
};
|
||||
|
||||
struct _KotoActionBarClass {
|
||||
GObjectClass parent_class;
|
||||
|
||||
void (* closed) (KotoActionBar *self);
|
||||
void (* closed) (KotoActionBar * self);
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE(KotoActionBar, koto_action_bar, G_TYPE_OBJECT);
|
||||
|
||||
KotoActionBar* action_bar;
|
||||
|
||||
static void koto_action_bar_class_init(KotoActionBarClass *c) {
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS(c);
|
||||
static void koto_action_bar_class_init(KotoActionBarClass * c) {
|
||||
GObjectClass * gobject_class = G_OBJECT_CLASS(c);
|
||||
|
||||
|
||||
actionbar_signals[SIGNAL_CLOSED] = g_signal_new(
|
||||
"closed",
|
||||
|
@ -86,7 +89,7 @@ static void koto_action_bar_class_init(KotoActionBarClass *c) {
|
|||
);
|
||||
}
|
||||
|
||||
static void koto_action_bar_init(KotoActionBar *self) {
|
||||
static void koto_action_bar_init(KotoActionBar * self) {
|
||||
self->main = GTK_ACTION_BAR(gtk_action_bar_new()); // Create a new action bar
|
||||
self->current_list = NULL;
|
||||
|
||||
|
@ -135,7 +138,7 @@ static void koto_action_bar_init(KotoActionBar *self) {
|
|||
koto_action_bar_toggle_reveal(self, FALSE); // Hide by default
|
||||
}
|
||||
|
||||
void koto_action_bar_close(KotoActionBar *self) {
|
||||
void koto_action_bar_close(KotoActionBar * self) {
|
||||
if (!KOTO_IS_ACTION_BAR(self)) {
|
||||
return;
|
||||
}
|
||||
|
@ -151,7 +154,7 @@ void koto_action_bar_close(KotoActionBar *self) {
|
|||
);
|
||||
}
|
||||
|
||||
GtkActionBar* koto_action_bar_get_main(KotoActionBar *self) {
|
||||
GtkActionBar * koto_action_bar_get_main(KotoActionBar * self) {
|
||||
if (!KOTO_IS_ACTION_BAR(self)) {
|
||||
return NULL;
|
||||
}
|
||||
|
@ -159,14 +162,27 @@ GtkActionBar* koto_action_bar_get_main(KotoActionBar *self) {
|
|||
return self->main;
|
||||
}
|
||||
|
||||
void koto_action_bar_handle_close_button_clicked(GtkGestureClick *gesture, int n_press, double x, double y, gpointer data) {
|
||||
(void) gesture; (void) n_press; (void) x; (void) y;
|
||||
void koto_action_bar_handle_close_button_clicked(
|
||||
GtkGestureClick * gesture,
|
||||
int n_press,
|
||||
double x,
|
||||
double y,
|
||||
gpointer data
|
||||
) {
|
||||
(void) gesture;
|
||||
(void) n_press;
|
||||
(void) x;
|
||||
(void) y;
|
||||
koto_action_bar_close(data);
|
||||
}
|
||||
|
||||
void koto_action_bar_handle_go_to_artist_button_clicked(GtkButton *button, gpointer data) {
|
||||
void koto_action_bar_handle_go_to_artist_button_clicked(
|
||||
GtkButton * button,
|
||||
gpointer data
|
||||
) {
|
||||
(void) button;
|
||||
KotoActionBar *self = data;
|
||||
KotoActionBar * self = data;
|
||||
|
||||
|
||||
if (!KOTO_IS_ACTION_BAR(self)) {
|
||||
return;
|
||||
|
@ -176,13 +192,16 @@ void koto_action_bar_handle_go_to_artist_button_clicked(GtkButton *button, gpoin
|
|||
return;
|
||||
}
|
||||
|
||||
KotoIndexedTrack *selected_track = g_list_nth_data(self->current_list, 0); // Get the first item
|
||||
KotoIndexedTrack * selected_track = g_list_nth_data(self->current_list, 0); // Get the first item
|
||||
|
||||
|
||||
if (!KOTO_IS_INDEXED_TRACK(selected_track)) { // Not a track
|
||||
return;
|
||||
}
|
||||
|
||||
gchar *artist_uuid = NULL;
|
||||
gchar * artist_uuid = NULL;
|
||||
|
||||
|
||||
g_object_get(
|
||||
selected_track,
|
||||
"artist-uuid",
|
||||
|
@ -190,13 +209,17 @@ void koto_action_bar_handle_go_to_artist_button_clicked(GtkButton *button, gpoin
|
|||
NULL
|
||||
);
|
||||
|
||||
koto_page_music_local_go_to_artist_by_uuid(music_local_page, artist_uuid); // Go to the artist
|
||||
koto_page_music_local_go_to_artist_by_uuid(music_local_page, artist_uuid); // Go to the artist
|
||||
koto_window_go_to_page(main_window, "music.local"); // Navigate to the local music stack so we can see the substack page
|
||||
koto_action_bar_close(self); // Close the action bar
|
||||
}
|
||||
void koto_action_bar_handle_playlists_button_clicked(GtkButton *button, gpointer data) {
|
||||
void koto_action_bar_handle_playlists_button_clicked(
|
||||
GtkButton * button,
|
||||
gpointer data
|
||||
) {
|
||||
(void) button;
|
||||
KotoActionBar *self = data;
|
||||
KotoActionBar * self = data;
|
||||
|
||||
|
||||
if (!KOTO_IS_ACTION_BAR(self)) {
|
||||
return;
|
||||
|
@ -211,9 +234,13 @@ void koto_action_bar_handle_playlists_button_clicked(GtkButton *button, gpointer
|
|||
gtk_widget_show(GTK_WIDGET(koto_add_remove_track_popup));
|
||||
}
|
||||
|
||||
void koto_action_bar_handle_play_track_button_clicked(GtkButton *button, gpointer data) {
|
||||
void koto_action_bar_handle_play_track_button_clicked(
|
||||
GtkButton * button,
|
||||
gpointer data
|
||||
) {
|
||||
(void) button;
|
||||
KotoActionBar *self = data;
|
||||
KotoActionBar * self = data;
|
||||
|
||||
|
||||
if (!KOTO_IS_ACTION_BAR(self)) {
|
||||
return;
|
||||
|
@ -223,7 +250,8 @@ void koto_action_bar_handle_play_track_button_clicked(GtkButton *button, gpointe
|
|||
goto doclose;
|
||||
}
|
||||
|
||||
KotoIndexedTrack *track = g_list_nth_data(self->current_list, 0); // Get the first track
|
||||
KotoIndexedTrack * track = g_list_nth_data(self->current_list, 0); // Get the first track
|
||||
|
||||
|
||||
if (!KOTO_IS_INDEXED_TRACK(track)) { // Not a track
|
||||
goto doclose;
|
||||
|
@ -235,9 +263,13 @@ doclose:
|
|||
koto_action_bar_close(self);
|
||||
}
|
||||
|
||||
void koto_action_bar_handle_remove_from_playlist_button_clicked(GtkButton *button, gpointer data) {
|
||||
void koto_action_bar_handle_remove_from_playlist_button_clicked(
|
||||
GtkButton * button,
|
||||
gpointer data
|
||||
) {
|
||||
(void) button;
|
||||
KotoActionBar *self = data;
|
||||
KotoActionBar * self = data;
|
||||
|
||||
|
||||
if (!KOTO_IS_ACTION_BAR(self)) {
|
||||
return;
|
||||
|
@ -251,15 +283,18 @@ void koto_action_bar_handle_remove_from_playlist_button_clicked(GtkButton *butto
|
|||
goto doclose;
|
||||
}
|
||||
|
||||
KotoPlaylist *playlist = koto_cartographer_get_playlist_by_uuid(koto_maps, self->current_playlist_uuid);
|
||||
KotoPlaylist * playlist = koto_cartographer_get_playlist_by_uuid(koto_maps, self->current_playlist_uuid);
|
||||
|
||||
|
||||
if (!KOTO_IS_PLAYLIST(playlist)) { // Not a playlist
|
||||
goto doclose;
|
||||
}
|
||||
|
||||
GList *cur_list;
|
||||
GList * cur_list;
|
||||
|
||||
|
||||
for (cur_list = self->current_list; cur_list != NULL; cur_list = cur_list->next) { // For each KotoIndexedTrack
|
||||
KotoIndexedTrack *track = cur_list->data;
|
||||
KotoIndexedTrack * track = cur_list->data;
|
||||
koto_playlist_remove_track_by_uuid(playlist, koto_indexed_track_get_uuid(track)); // Remove this track
|
||||
}
|
||||
|
||||
|
@ -267,7 +302,11 @@ doclose:
|
|||
koto_action_bar_close(self);
|
||||
}
|
||||
|
||||
void koto_action_bar_set_tracks_in_album_selection(KotoActionBar *self, gchar *album_uuid, GList *tracks) {
|
||||
void koto_action_bar_set_tracks_in_album_selection(
|
||||
KotoActionBar * self,
|
||||
gchar * album_uuid,
|
||||
GList * tracks
|
||||
) {
|
||||
if (!KOTO_IS_ACTION_BAR(self)) {
|
||||
return;
|
||||
}
|
||||
|
@ -297,7 +336,11 @@ void koto_action_bar_set_tracks_in_album_selection(KotoActionBar *self, gchar *a
|
|||
gtk_widget_hide(GTK_WIDGET(self->remove_from_playlist));
|
||||
}
|
||||
|
||||
void koto_action_bar_set_tracks_in_playlist_selection(KotoActionBar *self, gchar *playlist_uuid, GList *tracks) {
|
||||
void koto_action_bar_set_tracks_in_playlist_selection(
|
||||
KotoActionBar * self,
|
||||
gchar * playlist_uuid,
|
||||
GList * tracks
|
||||
) {
|
||||
if (!KOTO_IS_ACTION_BAR(self)) {
|
||||
return;
|
||||
}
|
||||
|
@ -318,13 +361,18 @@ void koto_action_bar_set_tracks_in_playlist_selection(KotoActionBar *self, gchar
|
|||
self->current_list = g_list_copy(tracks);
|
||||
|
||||
gboolean single_selected = g_list_length(tracks) == 1;
|
||||
|
||||
|
||||
koto_action_bar_toggle_go_to_artist_visibility(self, single_selected);
|
||||
koto_action_bar_toggle_play_button_visibility(self, single_selected);
|
||||
gtk_widget_hide(GTK_WIDGET(self->playlists));
|
||||
gtk_widget_show(GTK_WIDGET(self->remove_from_playlist));
|
||||
}
|
||||
|
||||
void koto_action_bar_toggle_go_to_artist_visibility(KotoActionBar *self, gboolean visible) {
|
||||
void koto_action_bar_toggle_go_to_artist_visibility(
|
||||
KotoActionBar * self,
|
||||
gboolean visible
|
||||
) {
|
||||
if (!KOTO_IS_ACTION_BAR(self)) {
|
||||
return;
|
||||
}
|
||||
|
@ -332,7 +380,10 @@ void koto_action_bar_toggle_go_to_artist_visibility(KotoActionBar *self, gboolea
|
|||
(visible) ? gtk_widget_show(GTK_WIDGET(self->go_to_artist)) : gtk_widget_hide(GTK_WIDGET(self->go_to_artist));
|
||||
}
|
||||
|
||||
void koto_action_bar_toggle_play_button_visibility(KotoActionBar *self, gboolean visible) {
|
||||
void koto_action_bar_toggle_play_button_visibility(
|
||||
KotoActionBar * self,
|
||||
gboolean visible
|
||||
) {
|
||||
if (!KOTO_IS_ACTION_BAR(self)) {
|
||||
return;
|
||||
}
|
||||
|
@ -340,7 +391,10 @@ void koto_action_bar_toggle_play_button_visibility(KotoActionBar *self, gboolean
|
|||
(visible) ? gtk_widget_show(GTK_WIDGET(self->play_track)) : gtk_widget_hide(GTK_WIDGET(self->play_track));
|
||||
}
|
||||
|
||||
void koto_action_bar_toggle_reveal(KotoActionBar *self, gboolean state) {
|
||||
void koto_action_bar_toggle_reveal(
|
||||
KotoActionBar * self,
|
||||
gboolean state
|
||||
) {
|
||||
if (!KOTO_IS_ACTION_BAR(self)) {
|
||||
return;
|
||||
}
|
||||
|
@ -348,7 +402,7 @@ void koto_action_bar_toggle_reveal(KotoActionBar *self, gboolean state) {
|
|||
gtk_action_bar_set_revealed(self->main, state);
|
||||
}
|
||||
|
||||
KotoActionBar* koto_action_bar_new() {
|
||||
KotoActionBar * koto_action_bar_new() {
|
||||
return g_object_new(
|
||||
KOTO_TYPE_ACTION_BAR,
|
||||
NULL
|
||||
|
|
|
@ -39,20 +39,67 @@ GType koto_action_bar_get_type(void) G_GNUC_CONST;
|
|||
|
||||
/**
|
||||
* Action Bar Functions
|
||||
**/
|
||||
**/
|
||||
|
||||
KotoActionBar* koto_action_bar_new(void);
|
||||
void koto_action_bar_close(KotoActionBar *self);
|
||||
GtkActionBar* koto_action_bar_get_main(KotoActionBar *self);
|
||||
void koto_action_bar_handle_close_button_clicked(GtkGestureClick *gesture, int n_press, double x, double y, gpointer data);
|
||||
void koto_action_bar_handle_go_to_artist_button_clicked(GtkButton *button, gpointer data);
|
||||
void koto_action_bar_handle_playlists_button_clicked(GtkButton *button, gpointer data);
|
||||
void koto_action_bar_handle_play_track_button_clicked(GtkButton *button, gpointer data);
|
||||
void koto_action_bar_handle_remove_from_playlist_button_clicked(GtkButton *button, gpointer data);
|
||||
void koto_action_bar_set_tracks_in_album_selection(KotoActionBar *self, gchar *album_uuid, GList *tracks);
|
||||
void koto_action_bar_set_tracks_in_playlist_selection(KotoActionBar *self, gchar *playlist_uuid, GList *tracks);
|
||||
void koto_action_bar_toggle_go_to_artist_visibility(KotoActionBar *self, gboolean visible);
|
||||
void koto_action_bar_toggle_play_button_visibility(KotoActionBar *self, gboolean visible);
|
||||
void koto_action_bar_toggle_reveal(KotoActionBar *self, gboolean state);
|
||||
KotoActionBar * koto_action_bar_new(void);
|
||||
|
||||
void koto_action_bar_close(KotoActionBar * self);
|
||||
|
||||
GtkActionBar * koto_action_bar_get_main(KotoActionBar * self);
|
||||
|
||||
void koto_action_bar_handle_close_button_clicked(
|
||||
GtkGestureClick * gesture,
|
||||
int n_press,
|
||||
double x,
|
||||
double y,
|
||||
gpointer data
|
||||
);
|
||||
|
||||
void koto_action_bar_handle_go_to_artist_button_clicked(
|
||||
GtkButton * button,
|
||||
gpointer data
|
||||
);
|
||||
|
||||
void koto_action_bar_handle_playlists_button_clicked(
|
||||
GtkButton * button,
|
||||
gpointer data
|
||||
);
|
||||
|
||||
void koto_action_bar_handle_play_track_button_clicked(
|
||||
GtkButton * button,
|
||||
gpointer data
|
||||
);
|
||||
|
||||
void koto_action_bar_handle_remove_from_playlist_button_clicked(
|
||||
GtkButton * button,
|
||||
gpointer data
|
||||
);
|
||||
|
||||
void koto_action_bar_set_tracks_in_album_selection(
|
||||
KotoActionBar * self,
|
||||
gchar * album_uuid,
|
||||
GList * tracks
|
||||
);
|
||||
|
||||
void koto_action_bar_set_tracks_in_playlist_selection(
|
||||
KotoActionBar * self,
|
||||
gchar * playlist_uuid,
|
||||
GList * tracks
|
||||
);
|
||||
|
||||
void koto_action_bar_toggle_go_to_artist_visibility(
|
||||
KotoActionBar * self,
|
||||
gboolean visible
|
||||
);
|
||||
|
||||
void koto_action_bar_toggle_play_button_visibility(
|
||||
KotoActionBar * self,
|
||||
gboolean visible
|
||||
);
|
||||
|
||||
void koto_action_bar_toggle_reveal(
|
||||
KotoActionBar * self,
|
||||
gboolean state
|
||||
);
|
||||
|
||||
G_END_DECLS
|
|
@ -24,10 +24,10 @@
|
|||
struct _KotoCoverArtButton {
|
||||
GObject parent_instance;
|
||||
|
||||
GtkWidget *art;
|
||||
GtkWidget *main;
|
||||
GtkWidget *revealer;
|
||||
KotoButton *play_pause_button;
|
||||
GtkWidget * art;
|
||||
GtkWidget * main;
|
||||
GtkWidget * revealer;
|
||||
KotoButton * play_pause_button;
|
||||
|
||||
guint height;
|
||||
guint width;
|
||||
|
@ -43,12 +43,27 @@ enum {
|
|||
N_PROPERTIES
|
||||
};
|
||||
|
||||
static GParamSpec *props[N_PROPERTIES] = { NULL, };
|
||||
static void koto_cover_art_button_get_property(GObject *obj, guint prop_id, GValue *val, GParamSpec *spec);
|
||||
static void koto_cover_art_button_set_property(GObject *obj, guint prop_id, const GValue *val, GParamSpec *spec);
|
||||
static GParamSpec * props[N_PROPERTIES] = {
|
||||
NULL,
|
||||
};
|
||||
static void koto_cover_art_button_get_property(
|
||||
GObject * obj,
|
||||
guint prop_id,
|
||||
GValue * val,
|
||||
GParamSpec * spec
|
||||
);
|
||||
|
||||
static void koto_cover_art_button_set_property(
|
||||
GObject * obj,
|
||||
guint prop_id,
|
||||
const GValue * val,
|
||||
GParamSpec * spec
|
||||
);
|
||||
|
||||
static void koto_cover_art_button_class_init(KotoCoverArtButtonClass * c) {
|
||||
GObjectClass * gobject_class;
|
||||
|
||||
|
||||
static void koto_cover_art_button_class_init(KotoCoverArtButtonClass *c) {
|
||||
GObjectClass *gobject_class;
|
||||
gobject_class = G_OBJECT_CLASS(c);
|
||||
gobject_class->get_property = koto_cover_art_button_get_property;
|
||||
gobject_class->set_property = koto_cover_art_button_set_property;
|
||||
|
@ -60,7 +75,7 @@ static void koto_cover_art_button_class_init(KotoCoverArtButtonClass *c) {
|
|||
0,
|
||||
G_MAXUINT,
|
||||
0,
|
||||
G_PARAM_CONSTRUCT|G_PARAM_EXPLICIT_NOTIFY|G_PARAM_WRITABLE
|
||||
G_PARAM_CONSTRUCT | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_WRITABLE
|
||||
);
|
||||
|
||||
props[PROP_DESIRED_WIDTH] = g_param_spec_uint(
|
||||
|
@ -70,7 +85,7 @@ static void koto_cover_art_button_class_init(KotoCoverArtButtonClass *c) {
|
|||
0,
|
||||
G_MAXUINT,
|
||||
0,
|
||||
G_PARAM_CONSTRUCT|G_PARAM_EXPLICIT_NOTIFY|G_PARAM_WRITABLE
|
||||
G_PARAM_CONSTRUCT | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_WRITABLE
|
||||
);
|
||||
|
||||
props[PROP_ART_PATH] = g_param_spec_string(
|
||||
|
@ -78,20 +93,22 @@ static void koto_cover_art_button_class_init(KotoCoverArtButtonClass *c) {
|
|||
"Path to art",
|
||||
"Path to art",
|
||||
NULL,
|
||||
G_PARAM_CONSTRUCT|G_PARAM_EXPLICIT_NOTIFY|G_PARAM_WRITABLE
|
||||
G_PARAM_CONSTRUCT | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_WRITABLE
|
||||
);
|
||||
|
||||
g_object_class_install_properties(gobject_class, N_PROPERTIES, props);
|
||||
}
|
||||
|
||||
static void koto_cover_art_button_init(KotoCoverArtButton *self) {
|
||||
static void koto_cover_art_button_init(KotoCoverArtButton * self) {
|
||||
self->main = gtk_overlay_new(); // Create our overlay container
|
||||
gtk_widget_add_css_class(self->main, "cover-art-button");
|
||||
self->revealer = gtk_revealer_new(); // Create a new revealer
|
||||
gtk_revealer_set_transition_type(GTK_REVEALER(self->revealer), GTK_REVEALER_TRANSITION_TYPE_CROSSFADE);
|
||||
gtk_revealer_set_transition_duration(GTK_REVEALER(self->revealer), 400);
|
||||
|
||||
GtkWidget *controls = gtk_center_box_new(); // Create a center box for the controls
|
||||
GtkWidget * controls = gtk_center_box_new(); // Create a center box for the controls
|
||||
|
||||
|
||||
self->play_pause_button = koto_button_new_with_icon("", "media-playback-start-symbolic", "media-playback-pause-symbolic", KOTO_BUTTON_PIXBUF_SIZE_NORMAL);
|
||||
gtk_center_box_set_center_widget(GTK_CENTER_BOX(controls), GTK_WIDGET(self->play_pause_button));
|
||||
|
||||
|
@ -99,13 +116,20 @@ static void koto_cover_art_button_init(KotoCoverArtButton *self) {
|
|||
koto_cover_art_button_hide_overlay_controls(NULL, self); // Hide by default
|
||||
gtk_overlay_add_overlay(GTK_OVERLAY(self->main), self->revealer); // Add our revealer as the overlay
|
||||
|
||||
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_cover_art_button_show_overlay_controls), self);
|
||||
g_signal_connect(motion_controller, "leave", G_CALLBACK(koto_cover_art_button_hide_overlay_controls), self);
|
||||
gtk_widget_add_controller(self->main, motion_controller);
|
||||
}
|
||||
|
||||
static void koto_cover_art_button_get_property(GObject *obj, guint prop_id, GValue *val, GParamSpec *spec) {
|
||||
static void koto_cover_art_button_get_property(
|
||||
GObject * obj,
|
||||
guint prop_id,
|
||||
GValue * val,
|
||||
GParamSpec * spec
|
||||
) {
|
||||
(void) val;
|
||||
|
||||
switch (prop_id) {
|
||||
|
@ -115,8 +139,14 @@ static void koto_cover_art_button_get_property(GObject *obj, guint prop_id, GVal
|
|||
}
|
||||
}
|
||||
|
||||
static void koto_cover_art_button_set_property(GObject *obj, guint prop_id, const GValue *val, GParamSpec *spec) {
|
||||
KotoCoverArtButton *self = KOTO_COVER_ART_BUTTON(obj);
|
||||
static void koto_cover_art_button_set_property(
|
||||
GObject * obj,
|
||||
guint prop_id,
|
||||
const GValue * val,
|
||||
GParamSpec * spec
|
||||
) {
|
||||
KotoCoverArtButton * self = KOTO_COVER_ART_BUTTON(obj);
|
||||
|
||||
|
||||
switch (prop_id) {
|
||||
case PROP_ART_PATH:
|
||||
|
@ -134,13 +164,18 @@ static void koto_cover_art_button_set_property(GObject *obj, guint prop_id, cons
|
|||
}
|
||||
}
|
||||
|
||||
void koto_cover_art_button_hide_overlay_controls(GtkEventControllerFocus *controller, gpointer data) {
|
||||
void koto_cover_art_button_hide_overlay_controls(
|
||||
GtkEventControllerFocus * controller,
|
||||
gpointer data
|
||||
) {
|
||||
(void) controller;
|
||||
KotoCoverArtButton* self = data;
|
||||
|
||||
|
||||
gtk_revealer_set_reveal_child(GTK_REVEALER(self->revealer), FALSE);
|
||||
}
|
||||
|
||||
KotoButton* koto_cover_art_button_get_button(KotoCoverArtButton *self) {
|
||||
KotoButton * koto_cover_art_button_get_button(KotoCoverArtButton * self) {
|
||||
if (!KOTO_IS_COVER_ART_BUTTON(self)) {
|
||||
return NULL;
|
||||
}
|
||||
|
@ -148,7 +183,7 @@ KotoButton* koto_cover_art_button_get_button(KotoCoverArtButton *self) {
|
|||
return self->play_pause_button;
|
||||
}
|
||||
|
||||
GtkWidget* koto_cover_art_button_get_main(KotoCoverArtButton *self) {
|
||||
GtkWidget * koto_cover_art_button_get_main(KotoCoverArtButton * self) {
|
||||
if (!KOTO_IS_COVER_ART_BUTTON(self)) {
|
||||
return NULL;
|
||||
}
|
||||
|
@ -156,13 +191,17 @@ GtkWidget* koto_cover_art_button_get_main(KotoCoverArtButton *self) {
|
|||
return self->main;
|
||||
}
|
||||
|
||||
void koto_cover_art_button_set_art_path(KotoCoverArtButton *self, gchar *art_path) {
|
||||
void koto_cover_art_button_set_art_path(
|
||||
KotoCoverArtButton * self,
|
||||
gchar * art_path
|
||||
) {
|
||||
if (!KOTO_IS_COVER_ART_BUTTON(self)) {
|
||||
return;
|
||||
}
|
||||
|
||||
gboolean defined_artwork = koto_utils_is_string_valid(art_path);
|
||||
|
||||
|
||||
if (GTK_IS_IMAGE(self->art)) { // Already have an image
|
||||
if (!defined_artwork) { // No art path or empty string
|
||||
gtk_image_set_from_icon_name(GTK_IMAGE(self->art), "audio-x-generic-symbolic");
|
||||
|
@ -175,7 +214,11 @@ void koto_cover_art_button_set_art_path(KotoCoverArtButton *self, gchar *art_pat
|
|||
}
|
||||
}
|
||||
|
||||
void koto_cover_art_button_set_dimensions(KotoCoverArtButton *self, guint height, guint width) {
|
||||
void koto_cover_art_button_set_dimensions(
|
||||
KotoCoverArtButton * self,
|
||||
guint height,
|
||||
guint width
|
||||
) {
|
||||
if (!KOTO_IS_COVER_ART_BUTTON(self)) {
|
||||
return;
|
||||
}
|
||||
|
@ -197,15 +240,24 @@ void koto_cover_art_button_set_dimensions(KotoCoverArtButton *self, guint height
|
|||
}
|
||||
}
|
||||
|
||||
void koto_cover_art_button_show_overlay_controls(GtkEventControllerFocus *controller, gpointer data) {
|
||||
void koto_cover_art_button_show_overlay_controls(
|
||||
GtkEventControllerFocus * controller,
|
||||
gpointer data
|
||||
) {
|
||||
(void) controller;
|
||||
KotoCoverArtButton* self = data;
|
||||
|
||||
|
||||
gtk_revealer_set_reveal_child(GTK_REVEALER(self->revealer), TRUE);
|
||||
}
|
||||
|
||||
KotoCoverArtButton* koto_cover_art_button_new(guint height, guint width, gchar *art_path) {
|
||||
return g_object_new(KOTO_TYPE_COVER_ART_BUTTON,
|
||||
KotoCoverArtButton * koto_cover_art_button_new(
|
||||
guint height,
|
||||
guint width,
|
||||
gchar * art_path
|
||||
) {
|
||||
return g_object_new(
|
||||
KOTO_TYPE_COVER_ART_BUTTON,
|
||||
"desired-height",
|
||||
height,
|
||||
"desired-width",
|
||||
|
|
|
@ -27,14 +27,37 @@ G_DECLARE_FINAL_TYPE(KotoCoverArtButton, koto_cover_art_button, KOTO, COVER_ART_
|
|||
|
||||
/**
|
||||
* Cover Art Functions
|
||||
**/
|
||||
**/
|
||||
|
||||
KotoCoverArtButton* koto_cover_art_button_new(guint height, guint width, gchar *art_path);
|
||||
KotoButton* koto_cover_art_button_get_button(KotoCoverArtButton *self);
|
||||
GtkWidget* koto_cover_art_button_get_main(KotoCoverArtButton *self);
|
||||
void koto_cover_art_button_hide_overlay_controls(GtkEventControllerFocus *controller, gpointer data);
|
||||
void koto_cover_art_button_set_art_path(KotoCoverArtButton *self, gchar *art_path);
|
||||
void koto_cover_art_button_set_dimensions(KotoCoverArtButton *self, guint height, guint width);
|
||||
void koto_cover_art_button_show_overlay_controls(GtkEventControllerFocus *controller, gpointer data);
|
||||
KotoCoverArtButton * koto_cover_art_button_new(
|
||||
guint height,
|
||||
guint width,
|
||||
gchar * art_path
|
||||
);
|
||||
|
||||
KotoButton * koto_cover_art_button_get_button(KotoCoverArtButton * self);
|
||||
|
||||
GtkWidget * koto_cover_art_button_get_main(KotoCoverArtButton * self);
|
||||
|
||||
void koto_cover_art_button_hide_overlay_controls(
|
||||
GtkEventControllerFocus * controller,
|
||||
gpointer data
|
||||
);
|
||||
|
||||
void koto_cover_art_button_set_art_path(
|
||||
KotoCoverArtButton * self,
|
||||
gchar * art_path
|
||||
);
|
||||
|
||||
void koto_cover_art_button_set_dimensions(
|
||||
KotoCoverArtButton * self,
|
||||
guint height,
|
||||
guint width
|
||||
);
|
||||
|
||||
void koto_cover_art_button_show_overlay_controls(
|
||||
GtkEventControllerFocus * controller,
|
||||
gpointer data
|
||||
);
|
||||
|
||||
G_END_DECLS
|
Loading…
Add table
Add a link
Reference in a new issue