1 Take logging changes from
3 commit fe00334409cdfd0a7640fc76ad66c5b629b8e3bc
4 Author: Eric Koegel <eric.koegel@gmail.com>
5 Date: Sun Oct 19 12:15:35 2014 +0300
7 Make the inhibit locks inhibit the actions
9 Also refactors some of the logging code to remove duplications.
10 Not sure if the can or auth checks should return FALSE if there's
11 an inhibit lock on the action... but that can be easily added in
14 diff --git a/src/ck-manager.c b/src/ck-manager.c
15 index 2670304..3ff8ec7 100644
16 --- a/src/ck-manager.c
17 +++ b/src/ck-manager.c
18 @@ -458,8 +458,11 @@ log_seat_removed_event (CkManager *manager,
22 +/* Generic logger for system actions such as CK_LOG_EVENT_SYSTEM_STOP,
23 + * restart, hibernate, and suspend */
25 -log_system_stop_event (CkManager *manager)
26 +log_system_action_event (CkManager *manager,
27 + CkLogEventType type)
31 @@ -467,73 +470,7 @@ log_system_stop_event (CkManager *manager)
33 memset (&event, 0, sizeof (CkLogEvent));
35 - event.type = CK_LOG_EVENT_SYSTEM_STOP;
36 - g_get_current_time (&event.timestamp);
39 - res = ck_event_logger_queue_event (manager->priv->logger, &event, &error);
41 - g_debug ("Unable to log event: %s", error->message);
42 - g_error_free (error);
45 - /* FIXME: in this case we should block and wait for log to flush */
49 -log_system_restart_event (CkManager *manager)
55 - memset (&event, 0, sizeof (CkLogEvent));
57 - event.type = CK_LOG_EVENT_SYSTEM_RESTART;
58 - g_get_current_time (&event.timestamp);
61 - res = ck_event_logger_queue_event (manager->priv->logger, &event, &error);
63 - g_debug ("Unable to log event: %s", error->message);
64 - g_error_free (error);
67 - /* FIXME: in this case we should block and wait for log to flush */
71 -log_system_suspend_event (CkManager *manager)
77 - memset (&event, 0, sizeof (CkLogEvent));
79 - event.type = CK_LOG_EVENT_SYSTEM_SUSPEND;
80 - g_get_current_time (&event.timestamp);
83 - res = ck_event_logger_queue_event (manager->priv->logger, &event, &error);
85 - g_debug ("Unable to log event: %s", error->message);
86 - g_error_free (error);
89 - /* FIXME: in this case we should block and wait for log to flush */
93 -log_system_hibernate_event (CkManager *manager)
99 - memset (&event, 0, sizeof (CkLogEvent));
101 - event.type = CK_LOG_EVENT_SYSTEM_HIBERNATE;
103 g_get_current_time (&event.timestamp);
106 @@ -1138,7 +1075,7 @@ do_restart (CkManager *manager,
108 g_debug ("ConsoleKit preforming Restart");
110 - log_system_restart_event (manager);
111 + log_system_action_event (manager, CK_LOG_EVENT_SYSTEM_RESTART);
114 res = g_spawn_command_line_async (PREFIX "/lib/ConsoleKit/scripts/ck-system-restart",
115 @@ -1225,7 +1169,7 @@ do_stop (CkManager *manager,
117 g_debug ("Stopping system");
119 - log_system_stop_event (manager);
120 + log_system_action_event (manager, CK_LOG_EVENT_SYSTEM_STOP);
123 res = g_spawn_command_line_async (PREFIX "/lib/ConsoleKit/scripts/ck-system-stop",
124 @@ -1301,7 +1252,7 @@ do_suspend (CkManager *manager,
126 g_debug ("ConsoleKit preforming Suspend");
128 - log_system_suspend_event (manager);
129 + log_system_action_event (manager, CK_LOG_EVENT_SYSTEM_SUSPEND);
132 res = g_spawn_command_line_async (PREFIX "/lib/ConsoleKit/scripts/ck-system-suspend",
133 @@ -1402,7 +1360,7 @@ do_hibernate (CkManager *manager,
135 g_debug ("ConsoleKit preforming Hibernate");
137 - log_system_hibernate_event (manager);
138 + log_system_action_event (manager, CK_LOG_EVENT_SYSTEM_HIBERNATE);
141 res = g_spawn_command_line_async (PREFIX "/lib/ConsoleKit/scripts/ck-system-hibernate",