Back to index

lightdm  1.3.2
Typedefs | Functions
status.h File Reference
#include <glib-object.h>
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.


typedef void(* StatusRequestFunc )(const gchar *message)


void status_connect (StatusRequestFunc message_cb)
void status_notify (const gchar *format,...)

Typedef Documentation

typedef void(* StatusRequestFunc)(const gchar *message)

Definition at line 10 of file status.h.

Function Documentation

void status_connect ( StatusRequestFunc  message_cb)

Definition at line 39 of file status.c.

    gchar *path;
    GSocketAddress *address;
    gboolean result;
    GSource *source;
    GError *error = NULL;

    request_func = request_cb;

    status_socket = g_socket_new (G_SOCKET_FAMILY_UNIX, G_SOCKET_TYPE_STREAM, G_SOCKET_PROTOCOL_DEFAULT, &error);
    if (error)
        g_printerr ("Unable to open socket for status: %s\n", error->message);
    g_clear_error (&error);
    if (!status_socket)

    path = g_build_filename (g_getenv ("LIGHTDM_TEST_ROOT"), ".status-socket", NULL);
    address = g_unix_socket_address_new (path);
    result = g_socket_connect (status_socket, address, NULL, &error);
    g_object_unref (address);
    if (error)
        g_printerr ("Failed to connect to status socket %s: %s\n", path, error->message);
    g_clear_error (&error);
    g_free (path);
    if (!result)

    source = g_socket_create_source (status_socket, G_IO_IN, NULL);
    g_source_set_callback (source, (GSourceFunc) status_request_cb, NULL, NULL);
    g_source_attach (source, NULL);   

Here is the call graph for this function:

Here is the caller graph for this function:

void status_notify ( const gchar *  format,

Definition at line 73 of file status.c.

    gchar status[1024];
    va_list ap;

    va_start (ap, format);
    vsnprintf (status, 1024, format, ap);
    va_end (ap);

    if (status_socket)
        GError *error = NULL;
        int length;

        length = strlen (status);
        g_socket_send (status_socket, (gchar *) &length, sizeof (length), NULL, &error);
        g_socket_send (status_socket, status, strlen (status), NULL, &error);
        if (error)
            g_printerr ("Failed to write to status socket: %s\n", error->message);
        g_clear_error (&error);
        g_printerr ("%s\n", status);

Here is the caller graph for this function: