[seahorse] util: Remove get_display_date_string()
- From: Niels De Graef <nielsdg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [seahorse] util: Remove get_display_date_string()
- Date: Sun, 15 Aug 2021 13:12:12 +0000 (UTC)
commit e306bb43a1c08010543e73f7071630614fe6b8c9
Author: Niels De Graef <nielsdegraef gmail com>
Date: Sun Aug 15 15:07:13 2021 +0200
util: Remove get_display_date_string()
There was only one use left (in gkr-keyring-properties) and that even
did its own 0-timestamp checking. It's a tiny function, so just do it at
the correct place.
common/util.vala | 8 --------
gkr/gkr-keyring-properties.vala | 9 +++++++--
2 files changed, 7 insertions(+), 10 deletions(-)
---
diff --git a/common/util.vala b/common/util.vala
index 533d3ffe..78706572 100644
--- a/common/util.vala
+++ b/common/util.vala
@@ -46,12 +46,4 @@ namespace Seahorse.Util {
dialog.run();
dialog.destroy();
}
-
- public string get_display_date_string (uint64 time)
- {
- if (time == 0)
- return "";
- var created_date = new DateTime.from_unix_utc((int64) time);
- return created_date.format("%x");
- }
}
diff --git a/gkr/gkr-keyring-properties.vala b/gkr/gkr-keyring-properties.vala
index e1a2c679..a7f97e5d 100644
--- a/gkr/gkr-keyring-properties.vala
+++ b/gkr/gkr-keyring-properties.vala
@@ -61,8 +61,13 @@ public class Seahorse.Gkr.KeyringProperties : Gtk.Dialog {
}
private void set_created(uint64 timestamp) {
- this.created_label.label = (timestamp != 0)? Util.get_display_date_string((long) timestamp)
- : _("Unknown date");
+ if (timestamp == 0) {
+ this.created_label.label = _("Unknown date");
+ return;
+ }
+
+ var datetime = new DateTime.from_unix_utc((int64) timestamp);
+ this.created_label.label = datetime.format("%x");
}
[GtkCallback]
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]