change sort order
This commit is contained in:
parent
8047d4c75a
commit
bddeabe365
@ -1,31 +1,31 @@
|
||||
#ifndef EDAPI_JOURNAL_JOURNAL_H
|
||||
#define EDAPI_JOURNAL_JOURNAL_H
|
||||
|
||||
#include <edapi/error.h>
|
||||
|
||||
#include <glib.h>
|
||||
#include <glib-object.h>
|
||||
|
||||
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 <edapi/error.h>
|
||||
|
||||
#include <glib.h>
|
||||
#include <glib-object.h>
|
||||
|
||||
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
|
||||
|
@ -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:
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user