[gnome-contacts/feature/birthday-reminder] sheet: Add reminder if a contact's birthday is today
- From: Niels De Graef <nielsdg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-contacts/feature/birthday-reminder] sheet: Add reminder if a contact's birthday is today
- Date: Wed, 12 Jan 2022 12:36:35 +0000 (UTC)
commit 6caa70758f9d98e00d94f7062f812458ffdb69db
Author: Niels De Graef <nielsdegraef gmail com>
Date: Wed Jan 12 13:34:35 2022 +0100
sheet: Add reminder if a contact's birthday is today
src/contacts-contact-sheet.vala | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
---
diff --git a/src/contacts-contact-sheet.vala b/src/contacts-contact-sheet.vala
index 43aae398..c7a7eb15 100644
--- a/src/contacts-contact-sheet.vala
+++ b/src/contacts-contact-sheet.vala
@@ -333,7 +333,18 @@ public class Contacts.ContactSheet : Gtk.Grid {
return;
var birthday_str = birthday_details.birthday.to_local ().format ("%x");
- var row = new ContactSheetRow (property, birthday_str);
+
+ // Compare month and date so we can put a reminder
+ string? subtitle = null;
+ int bd_m, bd_d, now_m, now_d;
+ birthday_details.birthday.to_local ().get_ymd (null, out bd_m, out bd_d);
+ new DateTime.now_local ().get_ymd (null, out now_m, out now_d);
+
+ if (bd_m == now_m && bd_d == now_d) {
+ subtitle = _("Their birthday is today! 🎉");
+ }
+
+ var row = new ContactSheetRow (property, birthday_str, subtitle);
this.attach_row (row);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]