summaryrefslogtreecommitdiff
path: root/src/events/EventsDirectoryPage.vala
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff.email>2023-06-14 20:36:17 +0200
committerJörg Frings-Fürst <debian@jff.email>2023-06-14 20:36:17 +0200
commit31804433d72460cbe0a39f9f8ea5e76058d84cda (patch)
tree2084a84c39f159c6aea254775dc0880d52579d45 /src/events/EventsDirectoryPage.vala
parenta9898fb3f39c44a85876930ef6b2558052569ae6 (diff)
parentd443a3c2509889533ca812c163056bace396b586 (diff)
Update upstream source from tag 'upstream/0.32.1'
Update to upstream version '0.32.1' with Debian dir c460ad6e13d3c39eaa2d5399059385e64e6fba4c
Diffstat (limited to 'src/events/EventsDirectoryPage.vala')
-rw-r--r--src/events/EventsDirectoryPage.vala40
1 files changed, 27 insertions, 13 deletions
diff --git a/src/events/EventsDirectoryPage.vala b/src/events/EventsDirectoryPage.vala
index 7ead1a0..c00e4bf 100644
--- a/src/events/EventsDirectoryPage.vala
+++ b/src/events/EventsDirectoryPage.vala
@@ -88,10 +88,10 @@ public abstract class EventsDirectoryPage : CheckerboardPage {
}
private static int64 event_ascending_comparator(void *a, void *b) {
- time_t start_a = ((EventDirectoryItem *) a)->event.get_start_time();
- time_t start_b = ((EventDirectoryItem *) b)->event.get_start_time();
+ DateTime start_a = ((EventDirectoryItem *) a)->event.get_start_time();
+ DateTime start_b = ((EventDirectoryItem *) b)->event.get_start_time();
- return start_a - start_b;
+ return start_a.compare(start_b);
}
private static int64 event_descending_comparator(void *a, void *b) {
@@ -239,21 +239,21 @@ public class SubEventsDirectoryPage : EventsDirectoryPage {
}
public const string UNDATED_PAGE_NAME = _("Undated");
- public const string YEAR_FORMAT = _("%Y");
- public const string MONTH_FORMAT = _("%B");
+ public const string YEAR_FORMAT = "%Y";
+ public const string MONTH_FORMAT = "%0B";
private class SubEventDirectoryManager : EventsDirectoryPage.EventDirectoryManager {
private int month = 0;
private int year = 0;
DirectoryType type;
- public SubEventDirectoryManager(DirectoryType type, Time time) {
+ public SubEventDirectoryManager(DirectoryType type, DateTime time) {
base();
if (type == DirectoryType.MONTH)
- month = time.month;
+ month = time.get_month();
this.type = type;
- year = time.year;
+ year = time.get_year();
}
public override bool include_in_view(DataSource source) {
@@ -261,10 +261,10 @@ public class SubEventsDirectoryPage : EventsDirectoryPage {
return false;
EventSource event = (EventSource) source;
- Time event_time = Time.local(event.get_start_time());
- if (event_time.year == year) {
+ var event_time = event.get_start_time().to_local();
+ if (event_time.get_year() == year) {
if (type == DirectoryType.MONTH) {
- return (event_time.month == month);
+ return (event_time.get_month() == month);
}
return true;
}
@@ -284,12 +284,26 @@ public class SubEventsDirectoryPage : EventsDirectoryPage {
}
}
- public SubEventsDirectoryPage(DirectoryType type, Time time) {
+ public SubEventsDirectoryPage(DirectoryType type, DateTime time) {
string page_name;
if (type == SubEventsDirectoryPage.DirectoryType.UNDATED) {
page_name = UNDATED_PAGE_NAME;
} else {
- page_name = time.format((type == DirectoryType.YEAR) ? YEAR_FORMAT : MONTH_FORMAT);
+ switch (type) {
+ case DirectoryType.MONTH: {
+ page_name = time.format(MONTH_FORMAT);
+ if (page_name.index_of("%0B") != -1) {
+ page_name = time.format("%B");
+ }
+ }
+ break;
+ case DirectoryType.YEAR: {
+ page_name = time.format(YEAR_FORMAT);
+ }
+ break;
+ default:
+ assert_not_reached();
+ }
}
base(page_name, new SubEventDirectoryManager(type, time), null);