Get to the point where we are fairly happy with our uncrustify config. Fixes #6.

This commit is contained in:
Joshua Strobl 2021-05-11 20:05:04 +03:00
parent d07d3dfe50
commit 62de9c2032
58 changed files with 4811 additions and 1946 deletions

View file

@ -21,13 +21,13 @@
#include "koto-button.h"
#include "koto-track-item.h"
extern KotoAddRemoveTrackPopover *koto_add_remove_track_popup;
extern KotoAddRemoveTrackPopover * koto_add_remove_track_popup;
struct _KotoTrackItem {
GtkBox parent_instance;
KotoIndexedTrack *track;
KotoIndexedTrack * track;
GtkWidget *track_label;
GtkWidget * track_label;
};
struct _KotoTrackItemClass {
@ -40,15 +40,30 @@ enum {
N_PROPERTIES
};
static GParamSpec *props[N_PROPERTIES] = { NULL, };
static GParamSpec * props[N_PROPERTIES] = {
NULL,
};
G_DEFINE_TYPE(KotoTrackItem, koto_track_item, GTK_TYPE_BOX);
static void koto_track_item_get_property(GObject *obj, guint prop_id, GValue *val, GParamSpec *spec);
static void koto_track_item_set_property(GObject *obj, guint prop_id, const GValue *val, GParamSpec *spec);
static void koto_track_item_get_property(
GObject * obj,
guint prop_id,
GValue * val,
GParamSpec * spec
);
static void koto_track_item_set_property(
GObject * obj,
guint prop_id,
const GValue * val,
GParamSpec * spec
);
static void koto_track_item_class_init(KotoTrackItemClass * c) {
GObjectClass * gobject_class;
static void koto_track_item_class_init(KotoTrackItemClass *c) {
GObjectClass *gobject_class;
gobject_class = G_OBJECT_CLASS(c);
gobject_class->set_property = koto_track_item_set_property;
gobject_class->get_property = koto_track_item_get_property;
@ -58,14 +73,20 @@ static void koto_track_item_class_init(KotoTrackItemClass *c) {
"Track",
"Track",
KOTO_TYPE_INDEXED_TRACK,
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_track_item_get_property(GObject *obj, guint prop_id, GValue *val, GParamSpec *spec) {
KotoTrackItem *self = KOTO_TRACK_ITEM(obj);
static void koto_track_item_get_property(
GObject * obj,
guint prop_id,
GValue * val,
GParamSpec * spec
) {
KotoTrackItem * self = KOTO_TRACK_ITEM(obj);
switch (prop_id) {
case PROP_TRACK:
@ -77,8 +98,14 @@ static void koto_track_item_get_property(GObject *obj, guint prop_id, GValue *va
}
}
static void koto_track_item_set_property(GObject *obj, guint prop_id, const GValue *val, GParamSpec *spec) {
KotoTrackItem *self = KOTO_TRACK_ITEM(obj);
static void koto_track_item_set_property(
GObject * obj,
guint prop_id,
const GValue * val,
GParamSpec * spec
) {
KotoTrackItem * self = KOTO_TRACK_ITEM(obj);
switch (prop_id) {
case PROP_TRACK:
@ -90,7 +117,7 @@ static void koto_track_item_set_property(GObject *obj, guint prop_id, const GVal
}
}
static void koto_track_item_init(KotoTrackItem *self) {
static void koto_track_item_init(KotoTrackItem * self) {
self->track_label = gtk_label_new(NULL); // Create with no track name
gtk_label_set_xalign(GTK_LABEL(self->track_label), 0.0);
@ -101,23 +128,29 @@ static void koto_track_item_init(KotoTrackItem *self) {
gtk_box_prepend(GTK_BOX(self), self->track_label);
}
KotoIndexedTrack* koto_track_item_get_track(KotoTrackItem *self) {
KotoIndexedTrack * koto_track_item_get_track(KotoTrackItem * self) {
return self->track;
}
void koto_track_item_set_track(KotoTrackItem *self, KotoIndexedTrack *track) {
void koto_track_item_set_track(
KotoTrackItem * self,
KotoIndexedTrack * track
) {
if (track == NULL) { // Not a track
return;
}
self->track = track;
gchar *track_name;
gchar * track_name;
g_object_get(self->track, "parsed-name", &track_name, NULL);
gtk_label_set_text(GTK_LABEL(self->track_label), track_name); // Update the text
}
KotoTrackItem* koto_track_item_new(KotoIndexedTrack *track) {
return g_object_new(KOTO_TYPE_TRACK_ITEM,
KotoTrackItem * koto_track_item_new(KotoIndexedTrack * track) {
return g_object_new(
KOTO_TYPE_TRACK_ITEM,
"track",
track,
NULL