1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
|
/*
* Copyright (C) 2010-2011 Robert Ancell.
* Author: Robert Ancell <robert.ancell@canonical.com>
*
* 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 the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version. See http://www.gnu.org/copyleft/gpl.html the full text of the
* license.
*/
#include <config.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <sys/stat.h>
#include <xcb/xcb.h>
#include <pwd.h>
#include <fcntl.h>
#include <glib/gstdio.h>
#include <sys/ioctl.h>
#ifdef __linux__
#include <linux/vt.h>
#endif
#include "display-manager.h"
#include "guest-manager.h"
#include "xdmcp-server.h"
#include "xserver.h"
#include "theme.h"
enum {
DISPLAY_ADDED,
LAST_SIGNAL
};
static guint signals[LAST_SIGNAL] = { 0 };
struct DisplayManagerPrivate
{
/* Configuration */
GKeyFile *config;
/* Directory to store authorization files */
gchar *auth_dir;
/* Counter to generate unique authorization file names */
guint auth_counter;
/* Directory to write log files to */
gchar *log_dir;
/* TRUE if running in test mode (i.e. as non-root for testing) */
gboolean test_mode;
/* Guest account manager */
GuestManager *guest_manager;
/* The displays being managed */
GList *displays;
/* XDMCP server */
XDMCPServer *xdmcp_server;
};
G_DEFINE_TYPE (DisplayManager, display_manager, G_TYPE_OBJECT);
DisplayManager *
display_manager_new (GKeyFile *config)
{
DisplayManager *self = g_object_new (DISPLAY_MANAGER_TYPE, NULL);
self->priv->config = config;
self->priv->test_mode = g_key_file_get_boolean (self->priv->config, "LightDM", "test-mode", NULL);
self->priv->auth_dir = g_key_file_get_string (self->priv->config, "LightDM", "authorization-directory", NULL);
if (!self->priv->auth_dir)
self->priv->auth_dir = g_strdup (XAUTH_DIR);
self->priv->log_dir = g_key_file_get_string (self->priv->config, "LightDM", "log-directory", NULL);
if (!self->priv->log_dir)
self->priv->log_dir = g_strdup (LOG_DIR);
self->priv->guest_manager = guest_manager_new (self->priv->config);
return self;
}
static gboolean
display_number_used (DisplayManager *manager, guint display_number)
{
GList *link;
for (link = manager->priv->displays; link; link = link->next)
{
Display *display = link->data;
XServer *xserver = display_get_xserver (display);
if (xserver && xserver_get_hostname (xserver) == NULL && xserver_get_display_number (xserver) == display_number)
return TRUE;
}
/* In test mode there is probably another display manager running so see if the server exists */
if (manager->priv->test_mode)
{
xcb_connection_t *connection;
gchar *address;
gboolean is_used;
address = g_strdup_printf (":%d", display_number);
connection = xcb_connect_to_display_with_auth_info (address, NULL, NULL);
g_free (address);
is_used = !xcb_connection_has_error (connection);
xcb_disconnect (connection);
return is_used;
}
return FALSE;
}
static guint
get_free_display_number (DisplayManager *manager)
{
guint display_number = 0;
while (display_number_used (manager, display_number))
display_number++;
return display_number;
}
static gchar *
get_authorization_path (DisplayManager *manager)
{
gchar *path;
path = g_strdup_printf ("%s/%d", manager->priv->auth_dir, manager->priv->auth_counter);
manager->priv->auth_counter++;
return path;
}
static void
start_session (Display *display, Session *session, gboolean is_greeter, DisplayManager *manager)
{
gchar *log_filename = NULL;
XAuthorization *authorization;
/* Connect using the session bus */
if (manager->priv->test_mode)
{
child_process_set_env (CHILD_PROCESS (session), "DBUS_SESSION_BUS_ADDRESS", getenv ("DBUS_SESSION_BUS_ADDRESS"));
child_process_set_env (CHILD_PROCESS (session), "XDG_SESSION_COOKIE", getenv ("XDG_SESSION_COOKIE"));
child_process_set_env (CHILD_PROCESS (session), "LDM_BUS", "SESSION");
}
authorization = xserver_get_authorization (display_get_xserver (display));
if (authorization)
{
gchar *path;
path = get_authorization_path (manager);
session_set_authorization (session, authorization, path);
g_free (path);
}
if (is_greeter)
{
gchar *filename;
filename = g_strdup_printf ("%s-greeter.log", xserver_get_address (display_get_xserver (display)));
log_filename = g_build_filename (manager->priv->log_dir, filename, NULL);
g_free (filename);
}
else
{
// FIXME: Copy old error file
if (manager->priv->test_mode)
log_filename = g_strdup (".xsession-errors");
else
{
struct passwd *user_info = getpwnam (session_get_username (session));
if (user_info)
log_filename = g_build_filename (user_info->pw_dir, ".xsession-errors", NULL);
else
g_warning ("Failed to get user info for user '%s'", session_get_username (session));
}
}
if (log_filename)
{
g_debug ("Logging to %s", log_filename);
child_process_set_log_file (CHILD_PROCESS (session), log_filename);
g_free (log_filename);
}
}
static void
start_greeter_cb (Display *display, Session *session, DisplayManager *manager)
{
start_session (display, session, TRUE, manager);
}
static void
start_session_cb (Display *display, Session *session, DisplayManager *manager)
{
start_session (display, session, FALSE, manager);
}
static void
end_session_cb (Display *display, Session *session, DisplayManager *manager)
{
XServer *xserver;
/* Change authorization for next session */
xserver = display_get_xserver (display);
if (xserver_get_server_type (xserver) == XSERVER_TYPE_LOCAL)
{
XAuthorization *authorization;
g_debug ("Generating new authorization cookie for %s", xserver_get_address (xserver));
authorization = xauth_new_cookie ();
xserver_set_authorization (xserver, authorization, NULL);
g_object_unref (authorization);
}
}
static guchar
atox (char c)
{
if (c >= '0' && c <= '9')
return c - '0';
if (c >= 'a' && c <= 'f')
return c - 'a' + 10;
if (c >= 'A' && c <= 'F')
return c - 'A' + 10;
return 0;
}
static void
string_to_xdm_auth_key (const gchar *key, guchar *data)
{
gint i;
memset (data, 0, sizeof (data));
if (strncmp (key, "0x", 2) == 0 || strncmp (key, "0X", 2) == 0)
{
for (i = 0; i < 8; i++)
{
if (key[i*2] == '\0')
break;
data[i] |= atox (key[i*2]) << 8;
if (key[i*2+1] == '\0')
break;
data[i] |= atox (key[i*2+1]);
}
}
else
{
for (i = 1; i < 8 && key[i-1]; i++)
data[i] = key[i-1];
}
}
static gint
get_vt (DisplayManager *manager, gchar *config_section)
{
gchar *vt;
gboolean use_active = FALSE;
#ifdef __linux__
gint console_fd;
#endif
int number = -1;
if (manager->priv->test_mode)
return -1;
vt = g_key_file_get_string (manager->priv->config, config_section, "vt", NULL);
if (vt)
{
if (strcmp (vt, "active") == 0)
use_active = TRUE;
else
number = atoi (vt);
g_free (vt);
if (number >= 0)
return number;
}
#ifdef __linux__
console_fd = g_open ("/dev/console", O_RDONLY | O_NOCTTY);
if (console_fd < 0)
{
g_warning ("Error opening /dev/console: %s", strerror (errno));
return -1;
}
if (use_active)
{
struct vt_stat console_state = { 0 };
if (ioctl (console_fd, VT_GETSTATE, &console_state) < 0)
g_warning ("Error using VT_GETSTATE on /dev/console: %s", strerror (errno));
else
number = console_state.v_active;
}
else
{
if (ioctl (console_fd, VT_OPENQRY, &number) < 0)
g_warning ("Error using VT_OPENQRY on /dev/console: %s", strerror (errno));
}
close (console_fd);
#else
number = -1;
#endif
return number;
}
static XServer *
make_xserver (DisplayManager *manager, gchar *config_section)
{
gint display_number, vt;
XServer *xserver;
XAuthorization *authorization = NULL;
gchar *xdmcp_manager, *filename, *path, *xserver_command;
if (config_section && g_key_file_has_key (manager->priv->config, config_section, "display-number", NULL))
display_number = g_key_file_get_integer (manager->priv->config, config_section, "display-number", NULL);
else
display_number = get_free_display_number (manager);
xdmcp_manager = config_section ? g_key_file_get_string (manager->priv->config, config_section, "xdmcp-manager", NULL) : NULL;
if (xdmcp_manager)
{
gint port;
gchar *key;
xserver = xserver_new (XSERVER_TYPE_LOCAL_TERMINAL, xdmcp_manager, display_number);
port = g_key_file_get_integer (manager->priv->config, config_section, "xdmcp-port", NULL);
if (port > 0)
xserver_set_port (xserver, port);
key = g_key_file_get_string (manager->priv->config, config_section, "key", NULL);
if (key)
{
guchar data[8];
string_to_xdm_auth_key (key, data);
xserver_set_authentication (xserver, "XDM-AUTHENTICATION-1", data, 8);
authorization = xauth_new ("XDM-AUTHORIZATION-1", data, 8);
}
}
else
{
xserver = xserver_new (XSERVER_TYPE_LOCAL, NULL, display_number);
authorization = xauth_new_cookie ();
}
g_free (xdmcp_manager);
path = get_authorization_path (manager);
xserver_set_authorization (xserver, authorization, path);
g_object_unref (authorization);
g_free (path);
filename = g_strdup_printf ("%s.log", xserver_get_address (xserver));
path = g_build_filename (manager->priv->log_dir, filename, NULL);
g_debug ("Logging to %s", path);
child_process_set_log_file (CHILD_PROCESS (xserver), path);
g_free (filename);
g_free (path);
vt = get_vt (manager, config_section);
if (vt >= 0)
{
g_debug ("Starting on /dev/tty%d", vt);
xserver_set_vt (xserver, vt);
}
xserver_command = g_key_file_get_string (manager->priv->config, "LightDM", "xserver", NULL);
if (xserver_command)
xserver_set_command (xserver, xserver_command);
g_free (xserver_command);
if (manager->priv->test_mode)
xserver_set_command (xserver, "Xephyr");
return xserver;
}
static Display *
add_display (DisplayManager *manager)
{
Display *display;
gchar *value;
display = display_new (g_list_length (manager->priv->displays));
g_signal_connect (display, "start-greeter", G_CALLBACK (start_greeter_cb), manager);
g_signal_connect (display, "start-session", G_CALLBACK (start_session_cb), manager);
g_signal_connect (display, "end-session", G_CALLBACK (end_session_cb), manager);
value = g_key_file_get_string (manager->priv->config, "LightDM", "session-wrapper", NULL);
if (value)
display_set_session_wrapper (display, value);
g_free (value);
if (manager->priv->test_mode)
display_set_greeter_user (display, NULL);
manager->priv->displays = g_list_append (manager->priv->displays, display);
g_signal_emit (manager, signals[DISPLAY_ADDED], 0, display);
return display;
}
Display *
display_manager_add_display (DisplayManager *manager)
{
Display *display;
XServer *xserver;
g_debug ("Starting new display");
display = add_display (manager);
xserver = make_xserver (manager, NULL);
display_set_xserver (display, xserver);
display_start (display);
g_object_unref (xserver);
return display;
}
void
display_manager_switch_to_user (DisplayManager *manager, char *username)
{
GList *link;
Display *display;
XServer *xserver;
for (link = manager->priv->displays; link; link = link->next)
{
display = link->data;
const gchar *session_user;
session_user = display_get_session_user (display);
if (session_user && strcmp (session_user, username) == 0)
{
g_debug ("Switching to user %s session on display %s", username, xserver_get_address (display_get_xserver (display)));
//display_focus (display);
return;
}
}
g_debug ("Starting new display for user %s", username);
display = add_display (manager);
xserver = make_xserver (manager, NULL);
display_set_xserver (display, xserver);
display_start (display);
g_object_unref (xserver);
}
void
display_manager_switch_to_guest (DisplayManager *manager)
{
// fixme
}
static gboolean
xdmcp_session_cb (XDMCPServer *server, XDMCPSession *session, DisplayManager *manager)
{
Display *display;
gchar *address;
XServer *xserver;
gboolean result;
// FIXME: Try IPv6 then fallback to IPv4
display = add_display (manager);
address = g_inet_address_to_string (G_INET_ADDRESS (xdmcp_session_get_address (session)));
xserver = xserver_new (XSERVER_TYPE_REMOTE, address, xdmcp_session_get_display_number (session));
if (strcmp (xdmcp_session_get_authorization_name (session), "") != 0)
{
XAuthorization *authorization = NULL;
gchar *path;
authorization = xauth_new (xdmcp_session_get_authorization_name (session),
xdmcp_session_get_authorization_data (session),
xdmcp_session_get_authorization_data_length (session));
path = get_authorization_path (manager);
xserver_set_authorization (xserver, authorization, path);
g_object_unref (authorization);
g_free (path);
}
display_set_xserver (display, xserver);
result = display_start (display);
g_object_unref (xserver);
g_free (address);
if (!result)
g_object_unref (display);
return result;
}
static void
setup_auth_dir (DisplayManager *manager)
{
GDir *dir;
GError *error = NULL;
g_mkdir_with_parents (manager->priv->auth_dir, S_IRWXU | S_IXGRP | S_IXOTH);
dir = g_dir_open (manager->priv->auth_dir, 0, &error);
if (!dir)
{
g_warning ("Authorization dir not created: %s", error->message);
g_clear_error (&error);
return;
}
/* Clear out the directory */
while (TRUE)
{
const gchar *filename;
gchar *path;
GFile *file;
filename = g_dir_read_name (dir);
if (!filename)
break;
path = g_build_filename (manager->priv->auth_dir, filename, NULL);
file = g_file_new_for_path (filename);
g_file_delete (file, NULL, NULL);
g_free (path);
g_object_unref (file);
}
g_dir_close (dir);
}
static gboolean
plymouth_run_command (const gchar *command, gint *exit_status)
{
gchar *command_line;
gboolean result;
GError *error = NULL;
command_line = g_strdup_printf ("/bin/plymouth %s", command);
result = g_spawn_command_line_sync (command_line, NULL, NULL, exit_status, &error);
g_free (command_line);
if (!result)
g_debug ("Could not run %s: %s", command_line, error->message);
g_clear_error (&error);
return result;
}
static gboolean
plymouth_command_returns_true (gchar *command)
{
gint exit_status;
if (!plymouth_run_command (command, &exit_status))
return FALSE;
return WIFEXITED (exit_status) && WEXITSTATUS (exit_status) == 0;
}
static void
stop_plymouth_cb (XServer *xserver, DisplayManager *manager)
{
g_debug ("Stopping Plymouth, display replacing it has started");
plymouth_run_command ("quit --retain-splash", NULL);
}
static void
stop_plymouth_due_to_failure_cb (XServer *xserver, int status_of_signum, DisplayManager *manager)
{
/* Check if Plymouth is even running (we may have already transitioned to it */
if (!plymouth_command_returns_true ("--ping"))
return;
g_debug ("Stopping Plymouth, error starting display");
plymouth_run_command ("quit", NULL);
}
void
display_manager_start (DisplayManager *manager)
{
gchar *displays;
gchar **tokens, **i;
gboolean plymouth_is_running, plymouth_on_active_vt = FALSE, plymouth_being_replaced = FALSE;
/* Make an empty authorization directory */
setup_auth_dir (manager);
/* Load the static display entries */
displays = g_key_file_get_string (manager->priv->config, "LightDM", "displays", NULL);
if (!displays)
displays = g_strdup ("");
tokens = g_strsplit (displays, " ", -1);
g_free (displays);
/* Check if Plymouth is running and start to deactivate it */
plymouth_is_running = plymouth_command_returns_true ("--ping");
if (plymouth_is_running)
{
/* Check if running on the active VT */
plymouth_on_active_vt = plymouth_command_returns_true ("--has-active-vt");
/* Deactivate stops Plymouth from drawing, as we are about to start an X server to replace it */
plymouth_run_command ("deactivate", NULL);
}
/* Start each static display */
for (i = tokens; *i; i++)
{
Display *display;
gchar *value, *default_user, *display_name;
gint user_timeout;
XServer *xserver;
gboolean replaces_plymouth = FALSE;
display_name = *i;
g_debug ("Loading display %s", display_name);
display = add_display (manager);
/* If this is starting on the active VT, then this display will replace Plymouth */
if (plymouth_on_active_vt && !plymouth_being_replaced)
{
gchar *vt;
vt = g_key_file_get_string (manager->priv->config, display_name, "vt", NULL);
if (vt && strcmp (vt, "active") == 0)
{
plymouth_being_replaced = TRUE;
replaces_plymouth = TRUE;
}
g_free (vt);
}
value = g_key_file_get_string (manager->priv->config, display_name, "session", NULL);
if (value)
display_set_default_session (display, value);
g_free (value);
value = g_key_file_get_string (manager->priv->config, display_name, "greeter-user", NULL);
if (value)
display_set_greeter_user (display, value);
g_free (value);
value = g_key_file_get_string (manager->priv->config, display_name, "greeter-theme", NULL);
if (value)
display_set_greeter_theme (display, value);
g_free (value);
value = g_key_file_get_string (manager->priv->config, display_name, "pam-service", NULL);
if (value)
display_set_pam_service (display, value);
g_free (value);
/* Automatically log in or start a greeter session */
default_user = g_key_file_get_string (manager->priv->config, display_name, "default-user", NULL);
user_timeout = g_key_file_get_integer (manager->priv->config, display_name, "default-user-timeout", NULL);
if (user_timeout < 0)
user_timeout = 0;
if (default_user)
{
display_set_default_user (display, default_user);
display_set_default_user_timeout (display, user_timeout);
if (user_timeout == 0)
g_debug ("Starting session for user %s", default_user);
else
g_debug ("Starting session for user %s in %d seconds", default_user, user_timeout);
}
xserver = make_xserver (manager, display_name);
display_set_xserver (display, xserver);
/* Stop Plymouth when the X server starts/fails */
if (replaces_plymouth)
{
g_debug ("Display %s will replace Plymouth", display_name);
xserver_set_no_root (xserver, TRUE);
g_signal_connect (xserver, "ready", G_CALLBACK (stop_plymouth_cb), manager);
g_signal_connect (xserver, "exited", G_CALLBACK (stop_plymouth_due_to_failure_cb), manager);
g_signal_connect (xserver, "terminated", G_CALLBACK (stop_plymouth_due_to_failure_cb), manager);
}
/* Start it up! */
if (!display_start (display))
{
g_warning ("Failed to start static display %s", display_name);
if (replaces_plymouth)
{
g_debug ("Stopping Plymouth, display failed to start");
plymouth_run_command ("quit", NULL);
}
}
g_object_unref (xserver);
g_free (default_user);
}
g_strfreev (tokens);
/* Stop Plymouth if we're not expecting an X server to replace it */
if (plymouth_is_running && !plymouth_being_replaced)
{
g_debug ("Stopping Plymouth, no displays replace it");
plymouth_run_command ("quit", NULL);
}
if (g_key_file_get_boolean (manager->priv->config, "xdmcp", "enabled", NULL))
{
gchar *key;
manager->priv->xdmcp_server = xdmcp_server_new ();
if (g_key_file_has_key (manager->priv->config, "xdmcp", "port", NULL))
{
gint port;
port = g_key_file_get_integer (manager->priv->config, "xdmcp", "port", NULL);
if (port > 0)
xdmcp_server_set_port (manager->priv->xdmcp_server, port);
}
g_signal_connect (manager->priv->xdmcp_server, "new-session", G_CALLBACK (xdmcp_session_cb), manager);
key = g_key_file_get_string (manager->priv->config, "xdmcp", "key", NULL);
if (key)
{
guchar data[8];
string_to_xdm_auth_key (key, data);
xdmcp_server_set_authentication (manager->priv->xdmcp_server, "XDM-AUTHENTICATION-1", data, 8);
xdmcp_server_set_authorization (manager->priv->xdmcp_server, "XDM-AUTHORIZATION-1", data, 8);
g_free (key);
}
else
xdmcp_server_set_authorization (manager->priv->xdmcp_server, "MIT-MAGIC-COOKIE-1", NULL, 0);
g_debug ("Starting XDMCP server on UDP/IP port %d", xdmcp_server_get_port (manager->priv->xdmcp_server));
xdmcp_server_start (manager->priv->xdmcp_server);
}
}
static void
display_manager_init (DisplayManager *manager)
{
manager->priv = G_TYPE_INSTANCE_GET_PRIVATE (manager, DISPLAY_MANAGER_TYPE, DisplayManagerPrivate);
}
static void
display_manager_finalize (GObject *object)
{
DisplayManager *self;
GList *link;
self = DISPLAY_MANAGER (object);
if (self->priv->xdmcp_server)
g_object_unref (self->priv->xdmcp_server);
for (link = self->priv->displays; link; link = link->next)
g_object_unref (link->data);
g_list_free (self->priv->displays);
G_OBJECT_CLASS (display_manager_parent_class)->finalize (object);
}
static void
display_manager_class_init (DisplayManagerClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->finalize = display_manager_finalize;
g_type_class_add_private (klass, sizeof (DisplayManagerPrivate));
signals[DISPLAY_ADDED] =
g_signal_new ("display-added",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (DisplayManagerClass, display_added),
NULL, NULL,
g_cclosure_marshal_VOID__OBJECT,
G_TYPE_NONE, 1, DISPLAY_TYPE);
}
|