[gnome-flashback] notifications: avoid deprecated g_get_current_time



commit 6e5b226d7066646bc1f516b429754a34d0615e30
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Fri Aug 16 16:32:09 2019 +0300

    notifications: avoid deprecated g_get_current_time

 gnome-flashback/libnotifications/nd-notification.c | 18 ++++++------------
 gnome-flashback/libnotifications/nd-notification.h |  3 +--
 gnome-flashback/libnotifications/nd-queue.c        | 11 ++++++-----
 3 files changed, 13 insertions(+), 19 deletions(-)
---
diff --git a/gnome-flashback/libnotifications/nd-notification.c 
b/gnome-flashback/libnotifications/nd-notification.c
index 544c395..5827b2f 100644
--- a/gnome-flashback/libnotifications/nd-notification.c
+++ b/gnome-flashback/libnotifications/nd-notification.c
@@ -40,7 +40,7 @@ struct _NdNotification {
         gboolean      is_queued;
         gboolean      is_closed;
 
-        GTimeVal      update_time;
+        gint64        update_time;
 
         char         *sender;
         guint32       id;
@@ -315,23 +315,17 @@ nd_notification_update (NdNotification     *notification,
 
         g_signal_emit (notification, signals[CHANGED], 0);
 
-        g_get_current_time (&notification->update_time);
+        notification->update_time = g_get_real_time ();
 
         return TRUE;
 }
 
-void
-nd_notification_get_update_time (NdNotification *notification,
-                                 GTimeVal       *tvp)
+gint64
+nd_notification_get_update_time (NdNotification *notification)
 {
-        g_return_if_fail (ND_IS_NOTIFICATION (notification));
-
-        if (tvp == NULL) {
-                return;
-        }
+        g_return_val_if_fail (ND_IS_NOTIFICATION (notification), 0);
 
-        tvp->tv_usec = notification->update_time.tv_usec;
-        tvp->tv_sec = notification->update_time.tv_sec;
+        return notification->update_time;
 }
 
 void
diff --git a/gnome-flashback/libnotifications/nd-notification.h 
b/gnome-flashback/libnotifications/nd-notification.h
index 1ed3a38..1ef341a 100644
--- a/gnome-flashback/libnotifications/nd-notification.h
+++ b/gnome-flashback/libnotifications/nd-notification.h
@@ -59,8 +59,7 @@ void                  nd_notification_set_is_queued       (NdNotification *notif
 gboolean              nd_notification_get_is_queued       (NdNotification *notification);
 
 gboolean              nd_notification_get_is_closed       (NdNotification *notification);
-void                  nd_notification_get_update_time     (NdNotification *notification,
-                                                           GTimeVal       *timeval);
+gint64                nd_notification_get_update_time     (NdNotification *notification);
 
 guint                 nd_notification_get_id              (NdNotification *notification);
 int                   nd_notification_get_timeout         (NdNotification *notification);
diff --git a/gnome-flashback/libnotifications/nd-queue.c b/gnome-flashback/libnotifications/nd-queue.c
index 0824b4f..4eb1e9a 100644
--- a/gnome-flashback/libnotifications/nd-queue.c
+++ b/gnome-flashback/libnotifications/nd-queue.c
@@ -612,12 +612,13 @@ static int
 collate_notifications (NdNotification *a,
                        NdNotification *b)
 {
-        GTimeVal tva;
-        GTimeVal tvb;
+        gint64 time_a;
+        gint64 time_b;
 
-        nd_notification_get_update_time (a, &tva);
-        nd_notification_get_update_time (b, &tvb);
-        if (tva.tv_sec > tvb.tv_sec) {
+        time_a = nd_notification_get_update_time (a);
+        time_b = nd_notification_get_update_time (b);
+
+        if (time_a > time_b) {
                 return 1;
         } else {
                 return -1;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]