[almanah/9-remove-deprecated-g-time-val: 1/2] [import] Remove deprecated GTimeVal
- From: Álvaro Peña <alvaropg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [almanah/9-remove-deprecated-g-time-val: 1/2] [import] Remove deprecated GTimeVal
- Date: Mon, 10 May 2021 21:22:14 +0000 (UTC)
commit a7189ace805364d5df7cd3ab9c48d176fe19224d
Author: Álvaro Peña <alvaropg gmail com>
Date: Mon May 10 23:19:20 2021 +0200
[import] Remove deprecated GTimeVal
Using GDateTime instead to get the file modification datetime
src/import-operation.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/src/import-operation.c b/src/import-operation.c
index 70770be..3c0c34a 100644
--- a/src/import-operation.c
+++ b/src/import-operation.c
@@ -351,7 +351,7 @@ import_text_files (AlmanahImportOperation *self, GFile *source, AlmanahImportPro
while ((file_info = g_file_enumerator_next_file (enumerator, NULL, &child_error)) != NULL) {
AlmanahEntry *entry;
GDate parsed_date, last_edited;
- GTimeVal modification_time;
+ GDateTime *modification_date_time = NULL;
GFile *file;
gchar *contents, *message = NULL;
gsize length;
@@ -393,8 +393,8 @@ import_text_files (AlmanahImportOperation *self, GFile *source, AlmanahImportPro
g_free (contents);
/* Set the entry's last-edited date */
- g_file_info_get_modification_time (file_info, &modification_time);
- g_date_set_time_val (&last_edited, &modification_time);
+ modification_date_time = g_file_info_get_modification_date_time (file_info);
+ g_date_set_time_t (&last_edited, g_date_time_to_unix (modification_date_time));
almanah_entry_set_last_edited (entry, &last_edited);
/* Store the entry */
@@ -404,6 +404,7 @@ import_text_files (AlmanahImportOperation *self, GFile *source, AlmanahImportPro
g_object_unref (entry);
g_object_unref (file_info);
+ g_date_time_unref (modification_date_time);
/* Check for cancellation */
if (cancellable != NULL && g_cancellable_set_error_if_cancelled (cancellable, &child_error)
== TRUE)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]