diff options
Diffstat (limited to 'src/gs-listener-dbus.c')
-rw-r--r-- | src/gs-listener-dbus.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/src/gs-listener-dbus.c b/src/gs-listener-dbus.c index f14bb9f..520926d 100644 --- a/src/gs-listener-dbus.c +++ b/src/gs-listener-dbus.c @@ -1,6 +1,7 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- * * Copyright (C) 2004-2006 William Jon McCann <[email protected]> + * Copyright (C) 2012-2021 MATE Developers * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -105,7 +106,7 @@ typedef struct char *connection; guint32 cookie; guint32 foreign_cookie; - GTimeVal since; + gint64 since; } GSListenerRefEntry; enum @@ -362,7 +363,7 @@ gs_listener_set_throttle (GSListener *listener, { gs_debug ("Changing throttle status: %d", throttled); - listener->priv->throttled = throttled; + listener->priv->throttled = (throttled != FALSE); g_signal_emit (listener, signals [THROTTLE_CHANGED], 0, throttled); } @@ -389,7 +390,7 @@ static gboolean listener_set_session_idle_internal (GSListener *listener, gboolean idle) { - listener->priv->session_idle = idle; + listener->priv->session_idle = (idle != FALSE); if (idle) { @@ -407,7 +408,7 @@ static gboolean listener_set_active_internal (GSListener *listener, gboolean active) { - listener->priv->active = active; + listener->priv->active = (active != FALSE); /* if idle not in sync with active, change it */ if (listener->priv->session_idle != active) @@ -495,7 +496,7 @@ gs_listener_set_session_idle (GSListener *listener, } } - listener->priv->session_idle = idle; + listener->priv->session_idle = (idle != FALSE); res = listener_check_activation (listener); /* if activation fails then don't set idle */ @@ -540,7 +541,7 @@ gs_listener_set_activation_enabled (GSListener *listener, if (listener->priv->activation_enabled != enabled) { - listener->priv->activation_enabled = enabled; + listener->priv->activation_enabled = (enabled != FALSE); } } @@ -829,10 +830,12 @@ accumulate_ref_entry (gpointer key, GSListenerRefEntry *entry, DBusMessageIter *iter) { + GDateTime *dt; char *description; char *time; - time = g_time_val_to_iso8601 (&entry->since); + dt = g_date_time_new_from_unix_utc (entry->since); + time = g_date_time_format_iso8601 (dt); description = g_strdup_printf ("Application=\"%s\"; Since=\"%s\"; Reason=\"%s\";", entry->application, @@ -843,6 +846,7 @@ accumulate_ref_entry (gpointer key, g_free (description); g_free (time); + g_date_time_unref (dt); } static DBusHandlerResult @@ -905,7 +909,7 @@ listener_add_ck_ref_entry (GSListener *listener, entry->cookie = listener_generate_unique_key (listener, entry_type); entry->application = g_strdup ("ConsoleKit"); entry->reason = g_strdup ("Session is not active"); - g_get_current_time (&entry->since); + entry->since = g_get_real_time () / G_USEC_PER_SEC; /* takes ownership of entry */ listener_add_ref_entry (listener, entry_type, entry); @@ -972,7 +976,7 @@ listener_dbus_add_ref_entry (GSListener *listener, entry->cookie = listener_generate_unique_key (listener, entry_type); entry->application = g_strdup (application); entry->reason = g_strdup (reason); - g_get_current_time (&entry->since); + entry->since = g_get_real_time () / G_USEC_PER_SEC; listener_add_ref_entry (listener, entry_type, entry); @@ -2207,7 +2211,6 @@ gs_listener_class_init (GSListenerClass *klass) G_PARAM_READWRITE)); } - static gboolean screensaver_is_running (DBusConnection *connection) { |