1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- |
---|
2 | * |
---|
3 | * Copyright (C) 2007 William Jon McCann <mccann@jhu.edu> |
---|
4 | * |
---|
5 | * This program is free software; you can redistribute it and/or modify |
---|
6 | * it under the terms of the GNU General Public License as published by |
---|
7 | * the Free Software Foundation; either version 2 of the License, or |
---|
8 | * (at your option) any later version. |
---|
9 | * |
---|
10 | * This program is distributed in the hope that it will be useful, |
---|
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
13 | * GNU General Public License for more details. |
---|
14 | * |
---|
15 | * You should have received a copy of the GNU General Public License |
---|
16 | * along with this program; if not, write to the Free Software |
---|
17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
---|
18 | * |
---|
19 | */ |
---|
20 | |
---|
21 | #include "config.h" |
---|
22 | |
---|
23 | #include <stdlib.h> |
---|
24 | #include <stdio.h> |
---|
25 | #include <fcntl.h> |
---|
26 | #include <unistd.h> |
---|
27 | #include <string.h> |
---|
28 | #include <signal.h> |
---|
29 | #include <sys/stat.h> |
---|
30 | #include <sys/types.h> |
---|
31 | |
---|
32 | #include <glib.h> |
---|
33 | #include <glib/gi18n.h> |
---|
34 | #include <glib-object.h> |
---|
35 | |
---|
36 | #include "gdm-display.h" |
---|
37 | #include "gdm-display-glue.h" |
---|
38 | #include "gdm-display-access-file.h" |
---|
39 | |
---|
40 | #include "gdm-settings-direct.h" |
---|
41 | #include "gdm-settings-keys.h" |
---|
42 | |
---|
43 | #include "gdm-slave-proxy.h" |
---|
44 | |
---|
45 | static guint32 display_serial = 1; |
---|
46 | |
---|
47 | #define GDM_DISPLAY_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GDM_TYPE_DISPLAY, GdmDisplayPrivate)) |
---|
48 | |
---|
49 | #define DEFAULT_SLAVE_COMMAND LIBEXECDIR "/gdm-simple-slave" |
---|
50 | |
---|
51 | struct GdmDisplayPrivate |
---|
52 | { |
---|
53 | char *id; |
---|
54 | char *seat_id; |
---|
55 | |
---|
56 | char *remote_hostname; |
---|
57 | int x11_display_number; |
---|
58 | char *x11_display_name; |
---|
59 | int status; |
---|
60 | time_t creation_time; |
---|
61 | GTimer *slave_timer; |
---|
62 | char *slave_command; |
---|
63 | |
---|
64 | char *x11_cookie; |
---|
65 | gsize x11_cookie_size; |
---|
66 | GdmDisplayAccessFile *access_file; |
---|
67 | |
---|
68 | gboolean is_local; |
---|
69 | guint finish_idle_id; |
---|
70 | |
---|
71 | GdmSlaveProxy *slave_proxy; |
---|
72 | DBusGConnection *connection; |
---|
73 | GdmDisplayAccessFile *user_access_file; |
---|
74 | }; |
---|
75 | |
---|
76 | enum { |
---|
77 | PROP_0, |
---|
78 | PROP_ID, |
---|
79 | PROP_STATUS, |
---|
80 | PROP_SEAT_ID, |
---|
81 | PROP_REMOTE_HOSTNAME, |
---|
82 | PROP_X11_DISPLAY_NUMBER, |
---|
83 | PROP_X11_DISPLAY_NAME, |
---|
84 | PROP_X11_COOKIE, |
---|
85 | PROP_X11_AUTHORITY_FILE, |
---|
86 | PROP_IS_LOCAL, |
---|
87 | PROP_SLAVE_COMMAND, |
---|
88 | }; |
---|
89 | |
---|
90 | static void gdm_display_class_init (GdmDisplayClass *klass); |
---|
91 | static void gdm_display_init (GdmDisplay *display); |
---|
92 | static void gdm_display_finalize (GObject *object); |
---|
93 | |
---|
94 | G_DEFINE_ABSTRACT_TYPE (GdmDisplay, gdm_display, G_TYPE_OBJECT) |
---|
95 | |
---|
96 | GQuark |
---|
97 | gdm_display_error_quark (void) |
---|
98 | { |
---|
99 | static GQuark ret = 0; |
---|
100 | if (ret == 0) { |
---|
101 | ret = g_quark_from_static_string ("gdm_display_error"); |
---|
102 | } |
---|
103 | |
---|
104 | return ret; |
---|
105 | } |
---|
106 | |
---|
107 | static guint32 |
---|
108 | get_next_display_serial (void) |
---|
109 | { |
---|
110 | guint32 serial; |
---|
111 | |
---|
112 | serial = display_serial++; |
---|
113 | |
---|
114 | if ((gint32)display_serial < 0) { |
---|
115 | display_serial = 1; |
---|
116 | } |
---|
117 | |
---|
118 | return serial; |
---|
119 | } |
---|
120 | |
---|
121 | time_t |
---|
122 | gdm_display_get_creation_time (GdmDisplay *display) |
---|
123 | { |
---|
124 | g_return_val_if_fail (GDM_IS_DISPLAY (display), 0); |
---|
125 | |
---|
126 | return display->priv->creation_time; |
---|
127 | } |
---|
128 | |
---|
129 | int |
---|
130 | gdm_display_get_status (GdmDisplay *display) |
---|
131 | { |
---|
132 | g_return_val_if_fail (GDM_IS_DISPLAY (display), 0); |
---|
133 | |
---|
134 | return display->priv->status; |
---|
135 | } |
---|
136 | |
---|
137 | static GdmDisplayAccessFile * |
---|
138 | _create_access_file_for_user (GdmDisplay *display, |
---|
139 | const char *username, |
---|
140 | GError **error) |
---|
141 | { |
---|
142 | GdmDisplayAccessFile *access_file; |
---|
143 | GError *file_error; |
---|
144 | |
---|
145 | access_file = gdm_display_access_file_new (username); |
---|
146 | |
---|
147 | file_error = NULL; |
---|
148 | if (!gdm_display_access_file_open (access_file, &file_error)) { |
---|
149 | g_propagate_error (error, file_error); |
---|
150 | return NULL; |
---|
151 | } |
---|
152 | |
---|
153 | return access_file; |
---|
154 | } |
---|
155 | |
---|
156 | static gboolean |
---|
157 | gdm_display_real_create_authority (GdmDisplay *display) |
---|
158 | { |
---|
159 | GdmDisplayAccessFile *access_file; |
---|
160 | GError *error; |
---|
161 | gboolean res; |
---|
162 | |
---|
163 | g_return_val_if_fail (GDM_IS_DISPLAY (display), FALSE); |
---|
164 | g_return_val_if_fail (display->priv->access_file == NULL, FALSE); |
---|
165 | |
---|
166 | error = NULL; |
---|
167 | access_file = _create_access_file_for_user (display, GDM_USERNAME, &error); |
---|
168 | |
---|
169 | if (access_file == NULL) { |
---|
170 | g_critical ("could not create display access file: %s", error->message); |
---|
171 | g_error_free (error); |
---|
172 | return FALSE; |
---|
173 | } |
---|
174 | |
---|
175 | g_free (display->priv->x11_cookie); |
---|
176 | display->priv->x11_cookie = NULL; |
---|
177 | res = gdm_display_access_file_add_display (access_file, |
---|
178 | display, |
---|
179 | &display->priv->x11_cookie, |
---|
180 | &display->priv->x11_cookie_size, |
---|
181 | &error); |
---|
182 | |
---|
183 | if (! res) { |
---|
184 | |
---|
185 | g_critical ("could not add display to access file: %s", error->message); |
---|
186 | g_error_free (error); |
---|
187 | gdm_display_access_file_close (access_file); |
---|
188 | g_object_unref (access_file); |
---|
189 | return FALSE; |
---|
190 | } |
---|
191 | |
---|
192 | display->priv->access_file = access_file; |
---|
193 | |
---|
194 | return TRUE; |
---|
195 | } |
---|
196 | |
---|
197 | gboolean |
---|
198 | gdm_display_create_authority (GdmDisplay *display) |
---|
199 | { |
---|
200 | gboolean ret; |
---|
201 | |
---|
202 | g_return_val_if_fail (GDM_IS_DISPLAY (display), FALSE); |
---|
203 | |
---|
204 | g_object_ref (display); |
---|
205 | ret = GDM_DISPLAY_GET_CLASS (display)->create_authority (display); |
---|
206 | g_object_unref (display); |
---|
207 | |
---|
208 | return ret; |
---|
209 | } |
---|
210 | |
---|
211 | static gboolean |
---|
212 | gdm_display_real_add_user_authorization (GdmDisplay *display, |
---|
213 | const char *username, |
---|
214 | char **filename, |
---|
215 | GError **error) |
---|
216 | { |
---|
217 | GdmDisplayAccessFile *access_file; |
---|
218 | GError *access_file_error; |
---|
219 | gboolean res; |
---|
220 | |
---|
221 | g_return_val_if_fail (GDM_IS_DISPLAY (display), FALSE); |
---|
222 | g_return_val_if_fail (display->priv->access_file != NULL, FALSE); |
---|
223 | |
---|
224 | g_debug ("GdmDisplay: Adding user authorization for %s", username); |
---|
225 | |
---|
226 | access_file_error = NULL; |
---|
227 | access_file = _create_access_file_for_user (display, |
---|
228 | username, |
---|
229 | &access_file_error); |
---|
230 | |
---|
231 | if (access_file == NULL) { |
---|
232 | g_propagate_error (error, access_file_error); |
---|
233 | return FALSE; |
---|
234 | } |
---|
235 | |
---|
236 | res = gdm_display_access_file_add_display_with_cookie (access_file, |
---|
237 | display, |
---|
238 | display->priv->x11_cookie, |
---|
239 | display->priv->x11_cookie_size, |
---|
240 | &access_file_error); |
---|
241 | if (! res) { |
---|
242 | g_debug ("GdmDisplay: Unable to add user authorization for %s: %s", |
---|
243 | username, |
---|
244 | access_file_error->message); |
---|
245 | g_propagate_error (error, access_file_error); |
---|
246 | gdm_display_access_file_close (access_file); |
---|
247 | g_object_unref (access_file); |
---|
248 | return FALSE; |
---|
249 | } |
---|
250 | |
---|
251 | *filename = gdm_display_access_file_get_path (access_file); |
---|
252 | display->priv->user_access_file = access_file; |
---|
253 | |
---|
254 | g_debug ("GdmDisplay: Added user authorization for %s: %s", username, *filename); |
---|
255 | |
---|
256 | return TRUE; |
---|
257 | } |
---|
258 | |
---|
259 | gboolean |
---|
260 | gdm_display_add_user_authorization (GdmDisplay *display, |
---|
261 | const char *username, |
---|
262 | char **filename, |
---|
263 | GError **error) |
---|
264 | { |
---|
265 | gboolean ret; |
---|
266 | |
---|
267 | g_return_val_if_fail (GDM_IS_DISPLAY (display), FALSE); |
---|
268 | |
---|
269 | g_debug ("GdmDisplay: Adding authorization for user:%s on display %s", username, display->priv->x11_display_name); |
---|
270 | |
---|
271 | g_object_ref (display); |
---|
272 | ret = GDM_DISPLAY_GET_CLASS (display)->add_user_authorization (display, username, filename, error); |
---|
273 | g_object_unref (display); |
---|
274 | |
---|
275 | return ret; |
---|
276 | } |
---|
277 | |
---|
278 | static gboolean |
---|
279 | gdm_display_real_set_slave_bus_name (GdmDisplay *display, |
---|
280 | const char *name, |
---|
281 | GError **error) |
---|
282 | { |
---|
283 | |
---|
284 | return TRUE; |
---|
285 | } |
---|
286 | |
---|
287 | gboolean |
---|
288 | gdm_display_set_slave_bus_name (GdmDisplay *display, |
---|
289 | const char *name, |
---|
290 | GError **error) |
---|
291 | { |
---|
292 | gboolean ret; |
---|
293 | |
---|
294 | g_return_val_if_fail (GDM_IS_DISPLAY (display), FALSE); |
---|
295 | |
---|
296 | g_debug ("GdmDisplay: Setting slave bus name:%s on display %s", name, display->priv->x11_display_name); |
---|
297 | |
---|
298 | g_object_ref (display); |
---|
299 | ret = GDM_DISPLAY_GET_CLASS (display)->set_slave_bus_name (display, name, error); |
---|
300 | g_object_unref (display); |
---|
301 | |
---|
302 | return ret; |
---|
303 | } |
---|
304 | |
---|
305 | static void |
---|
306 | gdm_display_real_get_timed_login_details (GdmDisplay *display, |
---|
307 | gboolean *enabledp, |
---|
308 | char **usernamep, |
---|
309 | int *delayp) |
---|
310 | { |
---|
311 | gboolean res; |
---|
312 | gboolean enabled; |
---|
313 | int delay; |
---|
314 | char *username; |
---|
315 | |
---|
316 | enabled = FALSE; |
---|
317 | username = NULL; |
---|
318 | delay = 0; |
---|
319 | |
---|
320 | res = gdm_settings_direct_get_boolean (GDM_KEY_AUTO_LOGIN_ENABLE, &enabled); |
---|
321 | if (enabled) { |
---|
322 | res = gdm_settings_direct_get_string (GDM_KEY_AUTO_LOGIN_USER, &username); |
---|
323 | } |
---|
324 | |
---|
325 | if (enabled && username != NULL && username[0] != '\0') { |
---|
326 | goto out; |
---|
327 | } |
---|
328 | |
---|
329 | g_free (username); |
---|
330 | username = NULL; |
---|
331 | enabled = FALSE; |
---|
332 | |
---|
333 | res = gdm_settings_direct_get_boolean (GDM_KEY_TIMED_LOGIN_ENABLE, &enabled); |
---|
334 | if (! enabled) { |
---|
335 | goto out; |
---|
336 | } |
---|
337 | |
---|
338 | res = gdm_settings_direct_get_string (GDM_KEY_TIMED_LOGIN_USER, &username); |
---|
339 | if (username == NULL || username[0] == '\0') { |
---|
340 | enabled = FALSE; |
---|
341 | g_free (username); |
---|
342 | username = NULL; |
---|
343 | goto out; |
---|
344 | } |
---|
345 | |
---|
346 | delay = 0; |
---|
347 | res = gdm_settings_direct_get_int (GDM_KEY_TIMED_LOGIN_DELAY, &delay); |
---|
348 | |
---|
349 | if (delay <= 0) { |
---|
350 | /* we don't allow the timed login to have a zero delay */ |
---|
351 | delay = 10; |
---|
352 | } |
---|
353 | |
---|
354 | out: |
---|
355 | if (enabledp != NULL) { |
---|
356 | *enabledp = enabled; |
---|
357 | } |
---|
358 | if (usernamep != NULL) { |
---|
359 | *usernamep = username; |
---|
360 | } else { |
---|
361 | g_free (username); |
---|
362 | } |
---|
363 | if (delayp != NULL) { |
---|
364 | *delayp = delay; |
---|
365 | } |
---|
366 | } |
---|
367 | |
---|
368 | gboolean |
---|
369 | gdm_display_get_timed_login_details (GdmDisplay *display, |
---|
370 | gboolean *enabled, |
---|
371 | char **username, |
---|
372 | int *delay, |
---|
373 | GError **error) |
---|
374 | { |
---|
375 | g_return_val_if_fail (GDM_IS_DISPLAY (display), FALSE); |
---|
376 | |
---|
377 | GDM_DISPLAY_GET_CLASS (display)->get_timed_login_details (display, enabled, username, delay); |
---|
378 | |
---|
379 | g_debug ("GdmSlave: Got timed login details for display %s: %d '%s' %d", |
---|
380 | display->priv->x11_display_name, |
---|
381 | *enabled, |
---|
382 | *username ? *username : "(null)", |
---|
383 | *delay); |
---|
384 | |
---|
385 | return TRUE; |
---|
386 | } |
---|
387 | |
---|
388 | static gboolean |
---|
389 | gdm_display_real_remove_user_authorization (GdmDisplay *display, |
---|
390 | const char *username, |
---|
391 | GError **error) |
---|
392 | { |
---|
393 | gdm_display_access_file_close (display->priv->user_access_file); |
---|
394 | |
---|
395 | return TRUE; |
---|
396 | } |
---|
397 | |
---|
398 | gboolean |
---|
399 | gdm_display_remove_user_authorization (GdmDisplay *display, |
---|
400 | const char *username, |
---|
401 | GError **error) |
---|
402 | { |
---|
403 | gboolean ret; |
---|
404 | |
---|
405 | g_return_val_if_fail (GDM_IS_DISPLAY (display), FALSE); |
---|
406 | |
---|
407 | g_debug ("GdmDisplay: Removing authorization for user:%s on display %s", username, display->priv->x11_display_name); |
---|
408 | |
---|
409 | g_object_ref (display); |
---|
410 | ret = GDM_DISPLAY_GET_CLASS (display)->remove_user_authorization (display, username, error); |
---|
411 | g_object_unref (display); |
---|
412 | |
---|
413 | return ret; |
---|
414 | } |
---|
415 | |
---|
416 | gboolean |
---|
417 | gdm_display_get_x11_cookie (GdmDisplay *display, |
---|
418 | GArray **x11_cookie, |
---|
419 | GError **error) |
---|
420 | { |
---|
421 | g_return_val_if_fail (GDM_IS_DISPLAY (display), FALSE); |
---|
422 | |
---|
423 | if (x11_cookie != NULL) { |
---|
424 | *x11_cookie = g_array_new (FALSE, FALSE, sizeof (char)); |
---|
425 | g_array_append_vals (*x11_cookie, |
---|
426 | display->priv->x11_cookie, |
---|
427 | display->priv->x11_cookie_size); |
---|
428 | } |
---|
429 | |
---|
430 | return TRUE; |
---|
431 | } |
---|
432 | |
---|
433 | gboolean |
---|
434 | gdm_display_get_x11_authority_file (GdmDisplay *display, |
---|
435 | char **filename, |
---|
436 | GError **error) |
---|
437 | { |
---|
438 | g_return_val_if_fail (GDM_IS_DISPLAY (display), FALSE); |
---|
439 | g_return_val_if_fail (filename != NULL, FALSE); |
---|
440 | |
---|
441 | if (display->priv->access_file != NULL) { |
---|
442 | *filename = gdm_display_access_file_get_path (display->priv->access_file); |
---|
443 | } else { |
---|
444 | *filename = NULL; |
---|
445 | } |
---|
446 | |
---|
447 | return TRUE; |
---|
448 | } |
---|
449 | |
---|
450 | gboolean |
---|
451 | gdm_display_get_remote_hostname (GdmDisplay *display, |
---|
452 | char **hostname, |
---|
453 | GError **error) |
---|
454 | { |
---|
455 | g_return_val_if_fail (GDM_IS_DISPLAY (display), FALSE); |
---|
456 | |
---|
457 | if (hostname != NULL) { |
---|
458 | *hostname = g_strdup (display->priv->remote_hostname); |
---|
459 | } |
---|
460 | |
---|
461 | return TRUE; |
---|
462 | } |
---|
463 | |
---|
464 | gboolean |
---|
465 | gdm_display_get_x11_display_number (GdmDisplay *display, |
---|
466 | int *number, |
---|
467 | GError **error) |
---|
468 | { |
---|
469 | g_return_val_if_fail (GDM_IS_DISPLAY (display), FALSE); |
---|
470 | |
---|
471 | if (number != NULL) { |
---|
472 | *number = display->priv->x11_display_number; |
---|
473 | } |
---|
474 | |
---|
475 | return TRUE; |
---|
476 | } |
---|
477 | |
---|
478 | gboolean |
---|
479 | gdm_display_get_seat_id (GdmDisplay *display, |
---|
480 | char **seat_id, |
---|
481 | GError **error) |
---|
482 | { |
---|
483 | g_return_val_if_fail (GDM_IS_DISPLAY (display), FALSE); |
---|
484 | |
---|
485 | if (seat_id != NULL) { |
---|
486 | *seat_id = g_strdup (display->priv->seat_id); |
---|
487 | } |
---|
488 | |
---|
489 | return TRUE; |
---|
490 | } |
---|
491 | |
---|
492 | static gboolean |
---|
493 | finish_idle (GdmDisplay *display) |
---|
494 | { |
---|
495 | display->priv->finish_idle_id = 0; |
---|
496 | /* finish may end up finalizing object */ |
---|
497 | gdm_display_finish (display); |
---|
498 | return FALSE; |
---|
499 | } |
---|
500 | |
---|
501 | static void |
---|
502 | queue_finish (GdmDisplay *display) |
---|
503 | { |
---|
504 | if (display->priv->finish_idle_id == 0) { |
---|
505 | display->priv->finish_idle_id = g_idle_add ((GSourceFunc)finish_idle, display); |
---|
506 | } |
---|
507 | } |
---|
508 | |
---|
509 | static void |
---|
510 | slave_exited (GdmSlaveProxy *proxy, |
---|
511 | int code, |
---|
512 | GdmDisplay *display) |
---|
513 | { |
---|
514 | g_debug ("GdmDisplay: Slave exited: %d", code); |
---|
515 | |
---|
516 | queue_finish (display); |
---|
517 | } |
---|
518 | |
---|
519 | static void |
---|
520 | slave_died (GdmSlaveProxy *proxy, |
---|
521 | int signum, |
---|
522 | GdmDisplay *display) |
---|
523 | { |
---|
524 | g_debug ("GdmDisplay: Slave died: %d", signum); |
---|
525 | |
---|
526 | queue_finish (display); |
---|
527 | } |
---|
528 | |
---|
529 | |
---|
530 | static void |
---|
531 | _gdm_display_set_status (GdmDisplay *display, |
---|
532 | int status) |
---|
533 | { |
---|
534 | if (status != display->priv->status) { |
---|
535 | display->priv->status = status; |
---|
536 | g_object_notify (G_OBJECT (display), "status"); |
---|
537 | } |
---|
538 | } |
---|
539 | |
---|
540 | static gboolean |
---|
541 | gdm_display_real_prepare (GdmDisplay *display) |
---|
542 | { |
---|
543 | char *command; |
---|
544 | char *log_file; |
---|
545 | char *log_path; |
---|
546 | |
---|
547 | g_return_val_if_fail (GDM_IS_DISPLAY (display), FALSE); |
---|
548 | |
---|
549 | g_debug ("GdmDisplay: prepare display"); |
---|
550 | |
---|
551 | g_assert (display->priv->slave_proxy == NULL); |
---|
552 | |
---|
553 | if (!gdm_display_create_authority (display)) { |
---|
554 | g_warning ("Unable to set up access control for display %d", |
---|
555 | display->priv->x11_display_number); |
---|
556 | return FALSE; |
---|
557 | } |
---|
558 | |
---|
559 | _gdm_display_set_status (display, GDM_DISPLAY_PREPARED); |
---|
560 | |
---|
561 | display->priv->slave_proxy = gdm_slave_proxy_new (); |
---|
562 | g_signal_connect (display->priv->slave_proxy, |
---|
563 | "exited", |
---|
564 | G_CALLBACK (slave_exited), |
---|
565 | display); |
---|
566 | g_signal_connect (display->priv->slave_proxy, |
---|
567 | "died", |
---|
568 | G_CALLBACK (slave_died), |
---|
569 | display); |
---|
570 | |
---|
571 | log_file = g_strdup_printf ("%s-slave.log", display->priv->x11_display_name); |
---|
572 | log_path = g_build_filename (LOGDIR, log_file, NULL); |
---|
573 | g_free (log_file); |
---|
574 | gdm_slave_proxy_set_log_path (display->priv->slave_proxy, log_path); |
---|
575 | g_free (log_path); |
---|
576 | |
---|
577 | command = g_strdup_printf ("%s --display-id %s", |
---|
578 | display->priv->slave_command, |
---|
579 | display->priv->id); |
---|
580 | gdm_slave_proxy_set_command (display->priv->slave_proxy, command); |
---|
581 | g_free (command); |
---|
582 | |
---|
583 | return TRUE; |
---|
584 | } |
---|
585 | |
---|
586 | gboolean |
---|
587 | gdm_display_prepare (GdmDisplay *display) |
---|
588 | { |
---|
589 | gboolean ret; |
---|
590 | |
---|
591 | g_return_val_if_fail (GDM_IS_DISPLAY (display), FALSE); |
---|
592 | |
---|
593 | g_debug ("GdmDisplay: Preparing display: %s", display->priv->id); |
---|
594 | |
---|
595 | g_object_ref (display); |
---|
596 | ret = GDM_DISPLAY_GET_CLASS (display)->prepare (display); |
---|
597 | g_object_unref (display); |
---|
598 | |
---|
599 | return ret; |
---|
600 | } |
---|
601 | |
---|
602 | |
---|
603 | static gboolean |
---|
604 | gdm_display_real_manage (GdmDisplay *display) |
---|
605 | { |
---|
606 | gboolean res; |
---|
607 | |
---|
608 | g_return_val_if_fail (GDM_IS_DISPLAY (display), FALSE); |
---|
609 | |
---|
610 | g_debug ("GdmDisplay: manage display"); |
---|
611 | |
---|
612 | /* If not explicitly prepared, do it now */ |
---|
613 | if (display->priv->status == GDM_DISPLAY_UNMANAGED) { |
---|
614 | res = gdm_display_prepare (display); |
---|
615 | if (! res) { |
---|
616 | return FALSE; |
---|
617 | } |
---|
618 | } |
---|
619 | |
---|
620 | g_assert (display->priv->slave_proxy != NULL); |
---|
621 | |
---|
622 | g_timer_start (display->priv->slave_timer); |
---|
623 | |
---|
624 | gdm_slave_proxy_start (display->priv->slave_proxy); |
---|
625 | |
---|
626 | return TRUE; |
---|
627 | } |
---|
628 | |
---|
629 | gboolean |
---|
630 | gdm_display_manage (GdmDisplay *display) |
---|
631 | { |
---|
632 | gboolean ret; |
---|
633 | |
---|
634 | g_return_val_if_fail (GDM_IS_DISPLAY (display), FALSE); |
---|
635 | |
---|
636 | g_debug ("GdmDisplay: Managing display: %s", display->priv->id); |
---|
637 | |
---|
638 | g_object_ref (display); |
---|
639 | ret = GDM_DISPLAY_GET_CLASS (display)->manage (display); |
---|
640 | g_object_unref (display); |
---|
641 | |
---|
642 | return ret; |
---|
643 | } |
---|
644 | |
---|
645 | static gboolean |
---|
646 | gdm_display_real_finish (GdmDisplay *display) |
---|
647 | { |
---|
648 | g_return_val_if_fail (GDM_IS_DISPLAY (display), FALSE); |
---|
649 | |
---|
650 | _gdm_display_set_status (display, GDM_DISPLAY_FINISHED); |
---|
651 | |
---|
652 | g_debug ("GdmDisplay: finish display"); |
---|
653 | |
---|
654 | return TRUE; |
---|
655 | } |
---|
656 | |
---|
657 | gboolean |
---|
658 | gdm_display_finish (GdmDisplay *display) |
---|
659 | { |
---|
660 | gboolean ret; |
---|
661 | |
---|
662 | g_return_val_if_fail (GDM_IS_DISPLAY (display), FALSE); |
---|
663 | |
---|
664 | g_debug ("GdmDisplay: Finishing display: %s", display->priv->id); |
---|
665 | |
---|
666 | g_object_ref (display); |
---|
667 | ret = GDM_DISPLAY_GET_CLASS (display)->finish (display); |
---|
668 | g_object_unref (display); |
---|
669 | |
---|
670 | return ret; |
---|
671 | } |
---|
672 | |
---|
673 | static gboolean |
---|
674 | gdm_display_real_unmanage (GdmDisplay *display) |
---|
675 | { |
---|
676 | gdouble elapsed; |
---|
677 | |
---|
678 | g_return_val_if_fail (GDM_IS_DISPLAY (display), FALSE); |
---|
679 | |
---|
680 | g_debug ("GdmDisplay: unmanage display"); |
---|
681 | |
---|
682 | g_timer_stop (display->priv->slave_timer); |
---|
683 | |
---|
684 | if (display->priv->slave_proxy != NULL) { |
---|
685 | gdm_slave_proxy_stop (display->priv->slave_proxy); |
---|
686 | |
---|
687 | g_object_unref (display->priv->slave_proxy); |
---|
688 | display->priv->slave_proxy = NULL; |
---|
689 | } |
---|
690 | |
---|
691 | if (display->priv->user_access_file != NULL) { |
---|
692 | gdm_display_access_file_close (display->priv->user_access_file); |
---|
693 | g_object_unref (display->priv->user_access_file); |
---|
694 | display->priv->user_access_file = NULL; |
---|
695 | } |
---|
696 | |
---|
697 | if (display->priv->access_file != NULL) { |
---|
698 | gdm_display_access_file_close (display->priv->access_file); |
---|
699 | g_object_unref (display->priv->access_file); |
---|
700 | display->priv->access_file = NULL; |
---|
701 | } |
---|
702 | |
---|
703 | elapsed = g_timer_elapsed (display->priv->slave_timer, NULL); |
---|
704 | if (elapsed < 3) { |
---|
705 | g_warning ("GdmDisplay: display lasted %lf seconds", elapsed); |
---|
706 | _gdm_display_set_status (display, GDM_DISPLAY_FAILED); |
---|
707 | } else { |
---|
708 | _gdm_display_set_status (display, GDM_DISPLAY_UNMANAGED); |
---|
709 | } |
---|
710 | |
---|
711 | return TRUE; |
---|
712 | } |
---|
713 | |
---|
714 | gboolean |
---|
715 | gdm_display_unmanage (GdmDisplay *display) |
---|
716 | { |
---|
717 | gboolean ret; |
---|
718 | |
---|
719 | g_return_val_if_fail (GDM_IS_DISPLAY (display), FALSE); |
---|
720 | |
---|
721 | g_debug ("GdmDisplay: Unmanaging display"); |
---|
722 | |
---|
723 | g_object_ref (display); |
---|
724 | ret = GDM_DISPLAY_GET_CLASS (display)->unmanage (display); |
---|
725 | g_object_unref (display); |
---|
726 | |
---|
727 | return ret; |
---|
728 | } |
---|
729 | |
---|
730 | gboolean |
---|
731 | gdm_display_get_id (GdmDisplay *display, |
---|
732 | char **id, |
---|
733 | GError **error) |
---|
734 | { |
---|
735 | g_return_val_if_fail (GDM_IS_DISPLAY (display), FALSE); |
---|
736 | |
---|
737 | if (id != NULL) { |
---|
738 | *id = g_strdup (display->priv->id); |
---|
739 | } |
---|
740 | |
---|
741 | return TRUE; |
---|
742 | } |
---|
743 | |
---|
744 | gboolean |
---|
745 | gdm_display_get_x11_display_name (GdmDisplay *display, |
---|
746 | char **x11_display, |
---|
747 | GError **error) |
---|
748 | { |
---|
749 | g_return_val_if_fail (GDM_IS_DISPLAY (display), FALSE); |
---|
750 | |
---|
751 | if (x11_display != NULL) { |
---|
752 | *x11_display = g_strdup (display->priv->x11_display_name); |
---|
753 | } |
---|
754 | |
---|
755 | return TRUE; |
---|
756 | } |
---|
757 | |
---|
758 | gboolean |
---|
759 | gdm_display_is_local (GdmDisplay *display, |
---|
760 | gboolean *local, |
---|
761 | GError **error) |
---|
762 | { |
---|
763 | g_return_val_if_fail (GDM_IS_DISPLAY (display), FALSE); |
---|
764 | |
---|
765 | if (local != NULL) { |
---|
766 | *local = display->priv->is_local; |
---|
767 | } |
---|
768 | |
---|
769 | return TRUE; |
---|
770 | } |
---|
771 | |
---|
772 | static void |
---|
773 | _gdm_display_set_id (GdmDisplay *display, |
---|
774 | const char *id) |
---|
775 | { |
---|
776 | g_free (display->priv->id); |
---|
777 | display->priv->id = g_strdup (id); |
---|
778 | } |
---|
779 | |
---|
780 | static void |
---|
781 | _gdm_display_set_seat_id (GdmDisplay *display, |
---|
782 | const char *seat_id) |
---|
783 | { |
---|
784 | g_free (display->priv->seat_id); |
---|
785 | display->priv->seat_id = g_strdup (seat_id); |
---|
786 | } |
---|
787 | |
---|
788 | static void |
---|
789 | _gdm_display_set_remote_hostname (GdmDisplay *display, |
---|
790 | const char *hostname) |
---|
791 | { |
---|
792 | g_free (display->priv->remote_hostname); |
---|
793 | display->priv->remote_hostname = g_strdup (hostname); |
---|
794 | } |
---|
795 | |
---|
796 | static void |
---|
797 | _gdm_display_set_x11_display_number (GdmDisplay *display, |
---|
798 | int num) |
---|
799 | { |
---|
800 | display->priv->x11_display_number = num; |
---|
801 | } |
---|
802 | |
---|
803 | static void |
---|
804 | _gdm_display_set_x11_display_name (GdmDisplay *display, |
---|
805 | const char *x11_display) |
---|
806 | { |
---|
807 | g_free (display->priv->x11_display_name); |
---|
808 | display->priv->x11_display_name = g_strdup (x11_display); |
---|
809 | } |
---|
810 | |
---|
811 | static void |
---|
812 | _gdm_display_set_x11_cookie (GdmDisplay *display, |
---|
813 | const char *x11_cookie) |
---|
814 | { |
---|
815 | g_free (display->priv->x11_cookie); |
---|
816 | display->priv->x11_cookie = g_strdup (x11_cookie); |
---|
817 | } |
---|
818 | |
---|
819 | static void |
---|
820 | _gdm_display_set_is_local (GdmDisplay *display, |
---|
821 | gboolean is_local) |
---|
822 | { |
---|
823 | display->priv->is_local = is_local; |
---|
824 | } |
---|
825 | |
---|
826 | static void |
---|
827 | _gdm_display_set_slave_command (GdmDisplay *display, |
---|
828 | const char *command) |
---|
829 | { |
---|
830 | g_free (display->priv->slave_command); |
---|
831 | display->priv->slave_command = g_strdup (command); |
---|
832 | } |
---|
833 | |
---|
834 | static void |
---|
835 | gdm_display_set_property (GObject *object, |
---|
836 | guint prop_id, |
---|
837 | const GValue *value, |
---|
838 | GParamSpec *pspec) |
---|
839 | { |
---|
840 | GdmDisplay *self; |
---|
841 | |
---|
842 | self = GDM_DISPLAY (object); |
---|
843 | |
---|
844 | switch (prop_id) { |
---|
845 | case PROP_ID: |
---|
846 | _gdm_display_set_id (self, g_value_get_string (value)); |
---|
847 | break; |
---|
848 | case PROP_STATUS: |
---|
849 | _gdm_display_set_status (self, g_value_get_int (value)); |
---|
850 | break; |
---|
851 | case PROP_SEAT_ID: |
---|
852 | _gdm_display_set_seat_id (self, g_value_get_string (value)); |
---|
853 | break; |
---|
854 | case PROP_REMOTE_HOSTNAME: |
---|
855 | _gdm_display_set_remote_hostname (self, g_value_get_string (value)); |
---|
856 | break; |
---|
857 | case PROP_X11_DISPLAY_NUMBER: |
---|
858 | _gdm_display_set_x11_display_number (self, g_value_get_int (value)); |
---|
859 | break; |
---|
860 | case PROP_X11_DISPLAY_NAME: |
---|
861 | _gdm_display_set_x11_display_name (self, g_value_get_string (value)); |
---|
862 | break; |
---|
863 | case PROP_X11_COOKIE: |
---|
864 | _gdm_display_set_x11_cookie (self, g_value_get_string (value)); |
---|
865 | break; |
---|
866 | case PROP_IS_LOCAL: |
---|
867 | _gdm_display_set_is_local (self, g_value_get_boolean (value)); |
---|
868 | break; |
---|
869 | case PROP_SLAVE_COMMAND: |
---|
870 | _gdm_display_set_slave_command (self, g_value_get_string (value)); |
---|
871 | break; |
---|
872 | default: |
---|
873 | G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); |
---|
874 | break; |
---|
875 | } |
---|
876 | } |
---|
877 | |
---|
878 | static void |
---|
879 | gdm_display_get_property (GObject *object, |
---|
880 | guint prop_id, |
---|
881 | GValue *value, |
---|
882 | GParamSpec *pspec) |
---|
883 | { |
---|
884 | GdmDisplay *self; |
---|
885 | |
---|
886 | self = GDM_DISPLAY (object); |
---|
887 | |
---|
888 | switch (prop_id) { |
---|
889 | case PROP_ID: |
---|
890 | g_value_set_string (value, self->priv->id); |
---|
891 | break; |
---|
892 | case PROP_STATUS: |
---|
893 | g_value_set_int (value, self->priv->status); |
---|
894 | break; |
---|
895 | case PROP_SEAT_ID: |
---|
896 | g_value_set_string (value, self->priv->seat_id); |
---|
897 | break; |
---|
898 | case PROP_REMOTE_HOSTNAME: |
---|
899 | g_value_set_string (value, self->priv->remote_hostname); |
---|
900 | break; |
---|
901 | case PROP_X11_DISPLAY_NUMBER: |
---|
902 | g_value_set_int (value, self->priv->x11_display_number); |
---|
903 | break; |
---|
904 | case PROP_X11_DISPLAY_NAME: |
---|
905 | g_value_set_string (value, self->priv->x11_display_name); |
---|
906 | break; |
---|
907 | case PROP_X11_COOKIE: |
---|
908 | g_value_set_string (value, self->priv->x11_cookie); |
---|
909 | break; |
---|
910 | case PROP_X11_AUTHORITY_FILE: |
---|
911 | g_value_take_string (value, |
---|
912 | gdm_display_access_file_get_path (self->priv->access_file)); |
---|
913 | break; |
---|
914 | case PROP_IS_LOCAL: |
---|
915 | g_value_set_boolean (value, self->priv->is_local); |
---|
916 | break; |
---|
917 | case PROP_SLAVE_COMMAND: |
---|
918 | g_value_set_string (value, self->priv->slave_command); |
---|
919 | break; |
---|
920 | default: |
---|
921 | G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); |
---|
922 | break; |
---|
923 | } |
---|
924 | } |
---|
925 | |
---|
926 | static gboolean |
---|
927 | register_display (GdmDisplay *display) |
---|
928 | { |
---|
929 | GError *error = NULL; |
---|
930 | |
---|
931 | error = NULL; |
---|
932 | display->priv->connection = dbus_g_bus_get (DBUS_BUS_SYSTEM, &error); |
---|
933 | if (display->priv->connection == NULL) { |
---|
934 | if (error != NULL) { |
---|
935 | g_critical ("error getting system bus: %s", error->message); |
---|
936 | g_error_free (error); |
---|
937 | } |
---|
938 | exit (1); |
---|
939 | } |
---|
940 | |
---|
941 | dbus_g_connection_register_g_object (display->priv->connection, display->priv->id, G_OBJECT (display)); |
---|
942 | |
---|
943 | return TRUE; |
---|
944 | } |
---|
945 | |
---|
946 | /* |
---|
947 | dbus-send --system --print-reply --dest=org.gnome.DisplayManager /org/gnome/DisplayManager/Display1 org.freedesktop.DBus.Introspectable.Introspect |
---|
948 | */ |
---|
949 | |
---|
950 | static GObject * |
---|
951 | gdm_display_constructor (GType type, |
---|
952 | guint n_construct_properties, |
---|
953 | GObjectConstructParam *construct_properties) |
---|
954 | { |
---|
955 | GdmDisplay *display; |
---|
956 | gboolean res; |
---|
957 | |
---|
958 | display = GDM_DISPLAY (G_OBJECT_CLASS (gdm_display_parent_class)->constructor (type, |
---|
959 | n_construct_properties, |
---|
960 | construct_properties)); |
---|
961 | |
---|
962 | g_free (display->priv->id); |
---|
963 | display->priv->id = g_strdup_printf ("/org/gnome/DisplayManager/Display%u", get_next_display_serial ()); |
---|
964 | |
---|
965 | res = register_display (display); |
---|
966 | if (! res) { |
---|
967 | g_warning ("Unable to register display with system bus"); |
---|
968 | } |
---|
969 | |
---|
970 | return G_OBJECT (display); |
---|
971 | } |
---|
972 | |
---|
973 | static void |
---|
974 | gdm_display_dispose (GObject *object) |
---|
975 | { |
---|
976 | GdmDisplay *display; |
---|
977 | |
---|
978 | display = GDM_DISPLAY (object); |
---|
979 | |
---|
980 | g_debug ("GdmDisplay: Disposing display"); |
---|
981 | |
---|
982 | if (display->priv->finish_idle_id > 0) { |
---|
983 | g_source_remove (display->priv->finish_idle_id); |
---|
984 | display->priv->finish_idle_id = 0; |
---|
985 | } |
---|
986 | |
---|
987 | if (display->priv->slave_proxy != NULL) { |
---|
988 | g_object_unref (display->priv->slave_proxy); |
---|
989 | display->priv->slave_proxy = NULL; |
---|
990 | } |
---|
991 | |
---|
992 | if (display->priv->user_access_file != NULL) { |
---|
993 | gdm_display_access_file_close (display->priv->user_access_file); |
---|
994 | g_object_unref (display->priv->user_access_file); |
---|
995 | display->priv->user_access_file = NULL; |
---|
996 | } |
---|
997 | |
---|
998 | if (display->priv->access_file != NULL) { |
---|
999 | gdm_display_access_file_close (display->priv->access_file); |
---|
1000 | g_object_unref (display->priv->access_file); |
---|
1001 | display->priv->access_file = NULL; |
---|
1002 | } |
---|
1003 | |
---|
1004 | G_OBJECT_CLASS (gdm_display_parent_class)->dispose (object); |
---|
1005 | } |
---|
1006 | |
---|
1007 | static void |
---|
1008 | gdm_display_class_init (GdmDisplayClass *klass) |
---|
1009 | { |
---|
1010 | GObjectClass *object_class = G_OBJECT_CLASS (klass); |
---|
1011 | |
---|
1012 | object_class->get_property = gdm_display_get_property; |
---|
1013 | object_class->set_property = gdm_display_set_property; |
---|
1014 | object_class->constructor = gdm_display_constructor; |
---|
1015 | object_class->dispose = gdm_display_dispose; |
---|
1016 | object_class->finalize = gdm_display_finalize; |
---|
1017 | |
---|
1018 | klass->create_authority = gdm_display_real_create_authority; |
---|
1019 | klass->add_user_authorization = gdm_display_real_add_user_authorization; |
---|
1020 | klass->remove_user_authorization = gdm_display_real_remove_user_authorization; |
---|
1021 | klass->set_slave_bus_name = gdm_display_real_set_slave_bus_name; |
---|
1022 | klass->get_timed_login_details = gdm_display_real_get_timed_login_details; |
---|
1023 | klass->prepare = gdm_display_real_prepare; |
---|
1024 | klass->manage = gdm_display_real_manage; |
---|
1025 | klass->finish = gdm_display_real_finish; |
---|
1026 | klass->unmanage = gdm_display_real_unmanage; |
---|
1027 | |
---|
1028 | g_object_class_install_property (object_class, |
---|
1029 | PROP_ID, |
---|
1030 | g_param_spec_string ("id", |
---|
1031 | "id", |
---|
1032 | "id", |
---|
1033 | NULL, |
---|
1034 | G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); |
---|
1035 | g_object_class_install_property (object_class, |
---|
1036 | PROP_REMOTE_HOSTNAME, |
---|
1037 | g_param_spec_string ("remote-hostname", |
---|
1038 | "remote-hostname", |
---|
1039 | "remote-hostname", |
---|
1040 | NULL, |
---|
1041 | G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); |
---|
1042 | g_object_class_install_property (object_class, |
---|
1043 | PROP_X11_DISPLAY_NUMBER, |
---|
1044 | g_param_spec_int ("x11-display-number", |
---|
1045 | "x11 display number", |
---|
1046 | "x11 display number", |
---|
1047 | -1, |
---|
1048 | G_MAXINT, |
---|
1049 | -1, |
---|
1050 | G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); |
---|
1051 | g_object_class_install_property (object_class, |
---|
1052 | PROP_X11_DISPLAY_NAME, |
---|
1053 | g_param_spec_string ("x11-display-name", |
---|
1054 | "x11-display-name", |
---|
1055 | "x11-display-name", |
---|
1056 | NULL, |
---|
1057 | G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); |
---|
1058 | g_object_class_install_property (object_class, |
---|
1059 | PROP_SEAT_ID, |
---|
1060 | g_param_spec_string ("seat-id", |
---|
1061 | "seat id", |
---|
1062 | "seat id", |
---|
1063 | NULL, |
---|
1064 | G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); |
---|
1065 | g_object_class_install_property (object_class, |
---|
1066 | PROP_X11_COOKIE, |
---|
1067 | g_param_spec_string ("x11-cookie", |
---|
1068 | "cookie", |
---|
1069 | "cookie", |
---|
1070 | NULL, |
---|
1071 | G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); |
---|
1072 | g_object_class_install_property (object_class, |
---|
1073 | PROP_X11_AUTHORITY_FILE, |
---|
1074 | g_param_spec_string ("x11-authority-file", |
---|
1075 | "authority file", |
---|
1076 | "authority file", |
---|
1077 | NULL, |
---|
1078 | G_PARAM_READABLE)); |
---|
1079 | |
---|
1080 | g_object_class_install_property (object_class, |
---|
1081 | PROP_IS_LOCAL, |
---|
1082 | g_param_spec_boolean ("is-local", |
---|
1083 | NULL, |
---|
1084 | NULL, |
---|
1085 | TRUE, |
---|
1086 | G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); |
---|
1087 | |
---|
1088 | g_object_class_install_property (object_class, |
---|
1089 | PROP_SLAVE_COMMAND, |
---|
1090 | g_param_spec_string ("slave-command", |
---|
1091 | "slave command", |
---|
1092 | "slave command", |
---|
1093 | DEFAULT_SLAVE_COMMAND, |
---|
1094 | G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); |
---|
1095 | g_object_class_install_property (object_class, |
---|
1096 | PROP_STATUS, |
---|
1097 | g_param_spec_int ("status", |
---|
1098 | "status", |
---|
1099 | "status", |
---|
1100 | -1, |
---|
1101 | G_MAXINT, |
---|
1102 | GDM_DISPLAY_UNMANAGED, |
---|
1103 | G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); |
---|
1104 | |
---|
1105 | g_type_class_add_private (klass, sizeof (GdmDisplayPrivate)); |
---|
1106 | |
---|
1107 | dbus_g_object_type_install_info (GDM_TYPE_DISPLAY, &dbus_glib_gdm_display_object_info); |
---|
1108 | } |
---|
1109 | |
---|
1110 | static void |
---|
1111 | gdm_display_init (GdmDisplay *display) |
---|
1112 | { |
---|
1113 | |
---|
1114 | display->priv = GDM_DISPLAY_GET_PRIVATE (display); |
---|
1115 | |
---|
1116 | display->priv->creation_time = time (NULL); |
---|
1117 | display->priv->slave_timer = g_timer_new (); |
---|
1118 | } |
---|
1119 | |
---|
1120 | static void |
---|
1121 | gdm_display_finalize (GObject *object) |
---|
1122 | { |
---|
1123 | GdmDisplay *display; |
---|
1124 | |
---|
1125 | g_return_if_fail (object != NULL); |
---|
1126 | g_return_if_fail (GDM_IS_DISPLAY (object)); |
---|
1127 | |
---|
1128 | display = GDM_DISPLAY (object); |
---|
1129 | |
---|
1130 | g_return_if_fail (display->priv != NULL); |
---|
1131 | |
---|
1132 | g_debug ("GdmDisplay: Finalizing display: %s", display->priv->id); |
---|
1133 | g_free (display->priv->id); |
---|
1134 | g_free (display->priv->seat_id); |
---|
1135 | g_free (display->priv->remote_hostname); |
---|
1136 | g_free (display->priv->x11_display_name); |
---|
1137 | g_free (display->priv->x11_cookie); |
---|
1138 | g_free (display->priv->slave_command); |
---|
1139 | |
---|
1140 | if (display->priv->access_file != NULL) { |
---|
1141 | g_object_unref (display->priv->access_file); |
---|
1142 | } |
---|
1143 | |
---|
1144 | if (display->priv->user_access_file != NULL) { |
---|
1145 | g_object_unref (display->priv->user_access_file); |
---|
1146 | } |
---|
1147 | |
---|
1148 | if (display->priv->slave_timer != NULL) { |
---|
1149 | g_timer_destroy (display->priv->slave_timer); |
---|
1150 | } |
---|
1151 | |
---|
1152 | G_OBJECT_CLASS (gdm_display_parent_class)->finalize (object); |
---|
1153 | } |
---|