Back to index

lightdm  1.3.2
Classes | Enumerations | Functions | Variables
display-manager.c File Reference
#include <config.h>
#include <stdlib.h>
#include <string.h>
#include <sys/wait.h>
#include "display-manager.h"
#include "configuration.h"
#include "display.h"
#include "seat-xlocal.h"
#include "seat-xremote.h"
#include "plymouth.h"

Go to the source code of this file.

Classes

struct  DisplayManagerPrivate

Enumerations

enum  { SEAT_ADDED, SEAT_REMOVED, STOPPED, LAST_SIGNAL }

Functions

 G_DEFINE_TYPE (DisplayManager, display_manager, G_TYPE_OBJECT)
DisplayManagerdisplay_manager_new (void)
GList * display_manager_get_seats (DisplayManager *manager)
static void check_stopped (DisplayManager *manager)
static void seat_stopped_cb (Seat *seat, DisplayManager *manager)
gboolean display_manager_add_seat (DisplayManager *manager, Seat *seat)
void display_manager_start (DisplayManager *manager)
void display_manager_stop (DisplayManager *manager)
static void display_manager_init (DisplayManager *manager)
static void display_manager_finalize (GObject *object)
static void display_manager_class_init (DisplayManagerClass *klass)

Variables

static guint signals [LAST_SIGNAL] = { 0 }

Class Documentation

struct DisplayManagerPrivate

Definition at line 33 of file display-manager.c.

Class Members
GList * seats
gboolean stopped
gboolean stopping

Enumeration Type Documentation

anonymous enum
Enumerator:
SEAT_ADDED 
SEAT_REMOVED 
STOPPED 
LAST_SIGNAL 

Definition at line 25 of file display-manager.c.


Function Documentation

static void check_stopped ( DisplayManager manager) [static]

Definition at line 60 of file display-manager.c.

{
    if (manager->priv->stopping &&
        !manager->priv->stopped &&
        g_list_length (manager->priv->seats) == 0)
    {
        manager->priv->stopped = TRUE;
        g_debug ("Display manager stopped");
        g_signal_emit (manager, signals[STOPPED], 0);
    }
}

Here is the caller graph for this function:

gboolean display_manager_add_seat ( DisplayManager manager,
Seat seat 
)

Definition at line 87 of file display-manager.c.

{
    gboolean result;

    g_return_val_if_fail (!manager->priv->stopping, FALSE);

    result = seat_start (SEAT (seat));
    if (!result)
        return FALSE;

    manager->priv->seats = g_list_append (manager->priv->seats, g_object_ref (seat));
    g_signal_connect (seat, "stopped", G_CALLBACK (seat_stopped_cb), manager);
    g_signal_emit (manager, signals[SEAT_ADDED], 0, seat);

    return TRUE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void display_manager_class_init ( DisplayManagerClass klass) [static]

Definition at line 169 of file display-manager.c.

{
    GObjectClass *object_class = G_OBJECT_CLASS (klass);

    object_class->finalize = display_manager_finalize;

    g_type_class_add_private (klass, sizeof (DisplayManagerPrivate));

    signals[SEAT_ADDED] =
        g_signal_new ("seat-added",
                      G_TYPE_FROM_CLASS (klass),
                      G_SIGNAL_RUN_LAST,
                      G_STRUCT_OFFSET (DisplayManagerClass, seat_added),
                      NULL, NULL,
                      g_cclosure_marshal_VOID__OBJECT,
                      G_TYPE_NONE, 1, SEAT_TYPE);
    signals[SEAT_REMOVED] =
        g_signal_new ("seat-removed",
                      G_TYPE_FROM_CLASS (klass),
                      G_SIGNAL_RUN_LAST,
                      G_STRUCT_OFFSET (DisplayManagerClass, seat_removed),
                      NULL, NULL,
                      g_cclosure_marshal_VOID__OBJECT,
                      G_TYPE_NONE, 1, SEAT_TYPE);
    signals[STOPPED] =
        g_signal_new ("stopped",
                      G_TYPE_FROM_CLASS (klass),
                      G_SIGNAL_RUN_LAST,
                      G_STRUCT_OFFSET (DisplayManagerClass, stopped),
                      NULL, NULL,
                      g_cclosure_marshal_VOID__VOID,
                      G_TYPE_NONE, 0);
}

Here is the call graph for this function:

static void display_manager_finalize ( GObject *  object) [static]

Definition at line 151 of file display-manager.c.

{
    DisplayManager *self;
    GList *link;

    self = DISPLAY_MANAGER (object);

    for (link = self->priv->seats; link; link = link->next)
    {
        Seat *seat = link->data;
        g_signal_handlers_disconnect_matched (seat, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, self);
    }
    g_list_free_full (self->priv->seats, g_object_unref);

    G_OBJECT_CLASS (display_manager_parent_class)->finalize (object);
}

Here is the caller graph for this function:

Definition at line 54 of file display-manager.c.

{
    return manager->priv->seats;
}

Here is the caller graph for this function:

static void display_manager_init ( DisplayManager manager) [static]

Definition at line 141 of file display-manager.c.

{
    manager->priv = G_TYPE_INSTANCE_GET_PRIVATE (manager, DISPLAY_MANAGER_TYPE, DisplayManagerPrivate);

    /* Load the seat modules */
    seat_register_module ("xlocal", SEAT_XLOCAL_TYPE);
    seat_register_module ("xremote", SEAT_XREMOTE_TYPE);
}

Here is the call graph for this function:

Definition at line 48 of file display-manager.c.

{
    return g_object_new (DISPLAY_MANAGER_TYPE, NULL);
}

Here is the caller graph for this function:

Definition at line 105 of file display-manager.c.

{
    g_return_if_fail (manager != NULL);

    /* Disable Plymouth if no X servers are replacing it */
    if (plymouth_get_is_active ())
    {
        g_debug ("Stopping Plymouth, no displays replace it");      
        plymouth_quit (FALSE);
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void display_manager_stop ( DisplayManager manager)

Definition at line 118 of file display-manager.c.

{
    GList *link;

    g_return_if_fail (manager != NULL);

    if (manager->priv->stopping)
        return;

    g_debug ("Stopping display manager");

    manager->priv->stopping = TRUE;

    for (link = manager->priv->seats; link; link = link->next)
    {
        Seat *seat = link->data;
        seat_stop (seat);
    }

    check_stopped (manager);
}

Here is the call graph for this function:

Here is the caller graph for this function:

G_DEFINE_TYPE ( DisplayManager  ,
display_manager  ,
G_TYPE_OBJECT   
)
static void seat_stopped_cb ( Seat seat,
DisplayManager manager 
) [static]

Definition at line 73 of file display-manager.c.

{
    manager->priv->seats = g_list_remove (manager->priv->seats, seat);
    g_signal_handlers_disconnect_matched (seat, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, manager);

    if (!manager->priv->stopping)
        g_signal_emit (manager, signals[SEAT_REMOVED], 0, seat);

    g_object_unref (seat);

    check_stopped (manager);
}

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

guint signals[LAST_SIGNAL] = { 0 } [static]

Definition at line 31 of file display-manager.c.