summaryrefslogtreecommitdiff
path: root/libmate-desktop/mate-desktop-item.c
diff options
context:
space:
mode:
authorrbuj <[email protected]>2020-02-03 23:09:51 +0100
committerraveit65 <[email protected]>2020-02-16 13:55:25 +0100
commite8fbac2ce193f5c2c93fdecb7ca0e14c1152ace6 (patch)
treef352830733cbf6ccf755a5cbe98d68ce9d4b3889 /libmate-desktop/mate-desktop-item.c
parent2edc2a7dfbf95cf710002d633ca11530ef094ce8 (diff)
downloadmate-desktop-e8fbac2ce193f5c2c93fdecb7ca0e14c1152ace6.tar.bz2
mate-desktop-e8fbac2ce193f5c2c93fdecb7ca0e14c1152ace6.tar.xz
Remove GTimeVal deprecation warning for GLib 2.61.2+
Diffstat (limited to 'libmate-desktop/mate-desktop-item.c')
-rw-r--r--libmate-desktop/mate-desktop-item.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/libmate-desktop/mate-desktop-item.c b/libmate-desktop/mate-desktop-item.c
index f7b1154..616020b 100644
--- a/libmate-desktop/mate-desktop-item.c
+++ b/libmate-desktop/mate-desktop-item.c
@@ -1578,26 +1578,41 @@ startup_timeout (void *data)
{
StartupTimeoutData *std = data;
GSList *tmp;
- GTimeVal now;
int min_timeout;
min_timeout = STARTUP_TIMEOUT_LENGTH;
+#if GLIB_CHECK_VERSION(2,61,2)
+ gint64 now = g_get_real_time ();
+#else
+ GTimeVal now;
g_get_current_time (&now);
+#endif
tmp = std->contexts;
while (tmp != NULL) {
SnLauncherContext *sn_context = tmp->data;
GSList *next = tmp->next;
- long tv_sec, tv_usec;
double elapsed;
+#if GLIB_CHECK_VERSION(2,61,2)
+ time_t tv_sec;
+ suseconds_t tv_usec;
+ gint64 tv;
+
+ sn_launcher_context_get_last_active_time (sn_context, &tv_sec, &tv_usec);
+ tv = (tv_sec * G_USEC_PER_SEC) + tv_usec;
+ elapsed = (double) (now - tv) / 1000.0;
+#else
+ long tv_sec, tv_usec;
+
sn_launcher_context_get_last_active_time (sn_context,
&tv_sec, &tv_usec);
elapsed =
((((double)now.tv_sec - tv_sec) * G_USEC_PER_SEC +
(now.tv_usec - tv_usec))) / 1000.0;
+#endif
if (elapsed >= STARTUP_TIMEOUT_LENGTH) {
std->contexts = g_slist_remove (std->contexts,