From fcc0f189a3a09fa781331ea6e424dc2a97e084c1 Mon Sep 17 00:00:00 2001 From: Antoine Fontaine <antoine.fontaine@epfl.ch> Date: Sun, 29 Sep 2019 13:21:21 +0200 Subject: [PATCH] Cleanup code and make it builds on Alpine (without warnings) --- ch.gnugen.Moody.json | 7 +++++-- meson.build | 3 --- src/gui-course.c | 7 ++++--- src/gui-window.c | 19 +++++++++++-------- 4 files changed, 20 insertions(+), 16 deletions(-) diff --git a/ch.gnugen.Moody.json b/ch.gnugen.Moody.json index f32597d..570e0c1 100644 --- a/ch.gnugen.Moody.json +++ b/ch.gnugen.Moody.json @@ -3,7 +3,6 @@ "runtime" : "org.gnome.Platform", "runtime-version" : "3.30", "sdk" : "org.gnome.Sdk", - "license" : "GPL-3.0+", "command" : "moody", "tags" : [ "devel", @@ -50,7 +49,11 @@ { "name" : "myhtml", "buildsystem" : "simple", - "build-commands" : ["make library", "make install", "cp *.pc /app/lib/pkgconfig/"], + "build-commands" : [ + "make library", + "make install", + "cp *.pc /app/lib/pkgconfig/" + ], "sources" : [ { "type" : "git", diff --git a/meson.build b/meson.build index a352714..9428b56 100644 --- a/meson.build +++ b/meson.build @@ -79,9 +79,6 @@ if get_option('buildtype') != 'plain' test_c_args += '-fstack-protector-strong' endif endif -#if get_option('profiling') - test_c_args += '-pg' -#endif foreach arg: test_c_args if cc.has_multi_arguments(arg) diff --git a/src/gui-course.c b/src/gui-course.c index f6beb9f..944f833 100644 --- a/src/gui-course.c +++ b/src/gui-course.c @@ -55,6 +55,10 @@ gui_course_new (struct Course course_info) NULL); } +static void destroy_widget (GtkWidget *w, gpointer nothing) { + gtk_widget_destroy (w); +} + void update_course_content (GtkWidget *self_widget, gpointer unused) { @@ -64,9 +68,6 @@ update_course_content (GtkWidget *self_widget, gpointer unused) GtkStack *stack = GTK_STACK (gtk_widget_get_parent (self_widget)); // clean up the current content - void destroy_widget (GtkWidget *w, gpointer nothing) { - gtk_widget_destroy (w); - } gtk_container_foreach (GTK_CONTAINER (self->box_week), &destroy_widget, NULL); if (self_widget != gtk_stack_get_visible_child (stack)) diff --git a/src/gui-window.c b/src/gui-window.c index 4f3f36c..1a23cb7 100644 --- a/src/gui-window.c +++ b/src/gui-window.c @@ -202,14 +202,21 @@ update_header_bar (GuiWindow *self) // g_str_equal (visible_child_name, "search-bar")); } +static void +destroy_widget (GtkWidget *w, gpointer unused) { + gtk_widget_destroy (w); +} +static void +ellipsize_label (GtkWidget *list_item, gpointer unused) { + GtkLabel *label = GTK_LABEL (gtk_bin_get_child (GTK_BIN (list_item))); + gtk_label_set_ellipsize (label, PANGO_ELLIPSIZE_END); +} + static void update_courses (GuiWindow *self) { // clean up the current stack - void destroy_widget (GtkWidget *w, gpointer unused) { - gtk_widget_destroy (w); - } - gtk_container_foreach (GTK_CONTAINER (self->stack), &destroy_widget, NULL); + gtk_container_foreach (GTK_CONTAINER (self->stack), destroy_widget, NULL); // and replace its content for (int i=0; i<self->course_count; i++) { @@ -227,10 +234,6 @@ update_courses (GuiWindow *self) GtkWidget *viewport = gtk_bin_get_child (GTK_BIN (scrolled_win)); GtkWidget *label_list = gtk_bin_get_child (GTK_BIN (viewport)); - void ellipsize_label (GtkWidget *list_item, gpointer unused) { - GtkLabel *label = GTK_LABEL (gtk_bin_get_child (GTK_BIN (list_item))); - gtk_label_set_ellipsize (label, PANGO_ELLIPSIZE_END); - } gtk_container_foreach (GTK_CONTAINER (label_list), ellipsize_label, NULL); } -- GitLab