[gnome-notes/wip/sadiq/modernize: 2/2] libbiji: Use the new API to get human time
- From: Mohammed Sadiq <pksadiq src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-notes/wip/sadiq/modernize: 2/2] libbiji: Use the new API to get human time
- Date: Wed, 2 Jan 2019 09:46:15 +0000 (UTC)
commit 53a028ec58c6aa034566686bcfc0bb3cac319242
Author: Mohammed Sadiq <sadiq sadiqpk org>
Date: Wed Jan 2 15:08:10 2019 +0530
libbiji: Use the new API to get human time
... which has better time resolution like showing time, which is included
in the latest design.
src/bjb-main-toolbar.c | 5 +++--
src/bjb-main-view.c | 5 +++--
src/libbiji/biji-note-obj.c | 8 ++++----
src/libbiji/biji-note-obj.h | 2 +-
4 files changed, 11 insertions(+), 9 deletions(-)
---
diff --git a/src/bjb-main-toolbar.c b/src/bjb-main-toolbar.c
index 7836a81..5d39e39 100644
--- a/src/bjb-main-toolbar.c
+++ b/src/bjb-main-toolbar.c
@@ -420,14 +420,15 @@ on_last_updated_cb (BijiItem *note,
BjbMainToolbar *self)
{
g_autofree gchar *label;
+ g_autofree gchar *time_str = NULL;
+ time_str = biji_note_obj_get_last_change_date_string (self->note);
/* Translators: %s is the note last recency description.
* Last updated is placed as in left to right language
* right to left languages might move %s
* '%s Last Updated'
*/
- label = g_strdup_printf (_("Last updated %s"),
- biji_note_obj_get_last_change_date_string (self->note));
+ label = g_strdup_printf (_("Last updated %s"), time_str);
gtk_label_set_text (GTK_LABEL (self->last_update_item), label);
}
diff --git a/src/bjb-main-view.c b/src/bjb-main-view.c
index 5513393..b257cdb 100644
--- a/src/bjb-main-view.c
+++ b/src/bjb-main-view.c
@@ -24,6 +24,7 @@
#include "bjb-controller.h"
#include "bjb-load-more-button.h"
#include "bjb-main-toolbar.h"
+#include "gn-utils.h"
#include "bjb-main-view.h"
#include "bjb-note-view.h"
#include "bjb-organize-dialog.h"
@@ -502,7 +503,6 @@ render_date (GtkTreeViewColumn *tree_column,
gpointer data)
{
BijiItem *item;
- const gchar *str;
BjbMainView *self;
self = data;
@@ -510,7 +510,8 @@ render_date (GtkTreeViewColumn *tree_column,
if (item != NULL)
{
- str = biji_get_time_diff_with_time (biji_item_get_mtime (item));
+ g_autofree gchar *str = NULL;
+ str = gn_utils_get_human_time (biji_item_get_mtime (item));
g_object_set (cell, "text", str, NULL);
}
}
diff --git a/src/libbiji/biji-note-obj.c b/src/libbiji/biji-note-obj.c
index b84e368..329c988 100644
--- a/src/libbiji/biji-note-obj.c
+++ b/src/libbiji/biji-note-obj.c
@@ -18,6 +18,7 @@
#include "biji-date-time.h"
#include "biji-note-id.h"
#include "biji-manager.h"
+#include "../gn-utils.h"
#include "biji-note-obj.h"
#include "biji-timeout.h"
#include "biji-tracker.h"
@@ -357,17 +358,16 @@ biji_note_obj_get_mtime (BijiItem *note)
return biji_note_id_get_mtime (priv->id);
}
-const gchar *
+gchar *
biji_note_obj_get_last_change_date_string (BijiNoteObj *self)
{
BijiNoteObjPrivate *priv;
- g_return_val_if_fail (BIJI_IS_NOTE_OBJ (self), "");
+ g_return_val_if_fail (BIJI_IS_NOTE_OBJ (self), g_strdup (""));
priv = biji_note_obj_get_instance_private (self);
- return biji_get_time_diff_with_time (
- biji_note_id_get_mtime (priv->id));
+ return gn_utils_get_human_time (biji_note_id_get_mtime (priv->id));
}
diff --git a/src/libbiji/biji-note-obj.h b/src/libbiji/biji-note-obj.h
index 77c995a..e1b9a01 100644
--- a/src/libbiji/biji-note-obj.h
+++ b/src/libbiji/biji-note-obj.h
@@ -97,7 +97,7 @@ gboolean biji_note_obj_set_mtime (BijiNoteObj* n,
gint64 time);
-const gchar *biji_note_obj_get_last_change_date_string (BijiNoteObj *self);
+gchar *biji_note_obj_get_last_change_date_string (BijiNoteObj *self);
gint64 biji_note_obj_get_last_metadata_change_date (BijiNoteObj *note);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]