diff --git a/lib/include/edapi/journal/journal.h b/lib/include/edapi/journal/journal.h index 277edcd..68ee2f3 100644 --- a/lib/include/edapi/journal/journal.h +++ b/lib/include/edapi/journal/journal.h @@ -1,31 +1,31 @@ -#ifndef EDAPI_JOURNAL_JOURNAL_H -#define EDAPI_JOURNAL_JOURNAL_H - -#include - -#include -#include - -G_BEGIN_DECLS - -G_DECLARE_FINAL_TYPE( - EDJournal, ed_journal, ED, JOURNAL, GObject); - -#define ED_TYPE_JOURNAL ed_journal_get_type() - -EDJournal *ed_journal_new(void); - -EDJournal *ed_journal_new_with_location(gchar const *dir); - -gchar const *ed_journal_get_location(EDJournal *j); -EDErrorCode ed_journal_set_location(EDJournal *j, gchar const *dir); - -/** - * Get a list of files. Files are sorted in descending order, with - * newer files first in the list. - */ -GList *ed_journal_get_files(EDJournal *self); - -G_END_DECLS - -#endif +#ifndef EDAPI_JOURNAL_JOURNAL_H +#define EDAPI_JOURNAL_JOURNAL_H + +#include + +#include +#include + +G_BEGIN_DECLS + +G_DECLARE_FINAL_TYPE( + EDJournal, ed_journal, ED, JOURNAL, GObject); + +#define ED_TYPE_JOURNAL ed_journal_get_type() + +EDJournal *ed_journal_new(void); + +EDJournal *ed_journal_new_with_location(gchar const *dir); + +gchar const *ed_journal_get_location(EDJournal *j); +EDErrorCode ed_journal_set_location(EDJournal *j, gchar const *dir); + +/** + * Get a list of files. Files are sorted in ascending order, with + * newer files last in the doubly linked list + */ +GList *ed_journal_get_files(EDJournal *self); + +G_END_DECLS + +#endif diff --git a/lib/src/journal/journal.c b/lib/src/journal/journal.c index 25b29e2..b1d0ac6 100644 --- a/lib/src/journal/journal.c +++ b/lib/src/journal/journal.c @@ -154,7 +154,7 @@ static void ed_journal_load_files(EDJournal *self) } p->files = g_list_sort( - p->files, (GCompareFunc)ed_journal_file_compare_desc); + p->files, (GCompareFunc)ed_journal_file_compare_asc); done: diff --git a/lib/tests/test-journal.c b/lib/tests/test-journal.c index d2f4c04..1a60fdd 100644 --- a/lib/tests/test-journal.c +++ b/lib/tests/test-journal.c @@ -43,7 +43,7 @@ static void test_file_sorting(void **state) ED_JOURNALFILE(files->data) ); assert_non_null(datetime); - assert_int_equal(g_date_time_get_year(datetime), 2025); + assert_int_equal(g_date_time_get_year(datetime), 2023); datetime = ed_journal_file_get_datetime( ED_JOURNALFILE(files->next->data) @@ -55,7 +55,7 @@ static void test_file_sorting(void **state) ED_JOURNALFILE(files->next->next->data) ); assert_non_null(datetime); - assert_int_equal(g_date_time_get_year(datetime), 2023); + assert_int_equal(g_date_time_get_year(datetime), 2025); g_clear_object(&journal); }