shared-macros.mk: simplify java settings
[oi-userland.git] / components / library / ConsoleKit / patches / 25-inhibit-locks.patch
blobb5f750d32e4ed74ead7e592954fcefd58e92e039
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
12 the future.
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,
19 g_free (sid);
22 +/* Generic logger for system actions such as CK_LOG_EVENT_SYSTEM_STOP,
23 + * restart, hibernate, and suspend */
24 static void
25 -log_system_stop_event (CkManager *manager)
26 +log_system_action_event (CkManager *manager,
27 + CkLogEventType type)
29 CkLogEvent event;
30 gboolean res;
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);
38 - error = NULL;
39 - res = ck_event_logger_queue_event (manager->priv->logger, &event, &error);
40 - if (! res) {
41 - g_debug ("Unable to log event: %s", error->message);
42 - g_error_free (error);
43 - }
45 - /* FIXME: in this case we should block and wait for log to flush */
48 -static void
49 -log_system_restart_event (CkManager *manager)
51 - CkLogEvent event;
52 - gboolean res;
53 - GError *error;
55 - memset (&event, 0, sizeof (CkLogEvent));
57 - event.type = CK_LOG_EVENT_SYSTEM_RESTART;
58 - g_get_current_time (&event.timestamp);
60 - error = NULL;
61 - res = ck_event_logger_queue_event (manager->priv->logger, &event, &error);
62 - if (! res) {
63 - g_debug ("Unable to log event: %s", error->message);
64 - g_error_free (error);
65 - }
67 - /* FIXME: in this case we should block and wait for log to flush */
70 -static void
71 -log_system_suspend_event (CkManager *manager)
73 - CkLogEvent event;
74 - gboolean res;
75 - GError *error;
77 - memset (&event, 0, sizeof (CkLogEvent));
79 - event.type = CK_LOG_EVENT_SYSTEM_SUSPEND;
80 - g_get_current_time (&event.timestamp);
82 - error = NULL;
83 - res = ck_event_logger_queue_event (manager->priv->logger, &event, &error);
84 - if (! res) {
85 - g_debug ("Unable to log event: %s", error->message);
86 - g_error_free (error);
87 - }
89 - /* FIXME: in this case we should block and wait for log to flush */
92 -static void
93 -log_system_hibernate_event (CkManager *manager)
95 - CkLogEvent event;
96 - gboolean res;
97 - GError *error;
99 - memset (&event, 0, sizeof (CkLogEvent));
101 - event.type = CK_LOG_EVENT_SYSTEM_HIBERNATE;
102 + event.type = type;
103 g_get_current_time (&event.timestamp);
105 error = NULL;
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);
113 error = NULL;
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);
122 error = NULL;
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);
131 error = NULL;
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);
140 error = NULL;
141 res = g_spawn_command_line_async (PREFIX "/lib/ConsoleKit/scripts/ck-system-hibernate",