Back to index

lightdm  1.3.2
Classes | Defines | Functions
layout.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.

Classes

struct  LightDMLayout
struct  LightDMLayoutClass

Defines

#define LIGHTDM_TYPE_LAYOUT   (lightdm_layout_get_type())
#define LIGHTDM_LAYOUT(obj)   (G_TYPE_CHECK_INSTANCE_CAST ((obj), LIGHTDM_TYPE_LAYOUT, LightDMLayout));
#define LIGHTDM_LAYOUT_CLASS(klass)   (G_TYPE_CHECK_CLASS_CAST ((klass), LIGHTDM_TYPE_LAYOUT, LightDMLayoutClass))
#define LIGHTDM_IS_LAYOUT(obj)   (G_TYPE_CHECK_INSTANCE_TYPE ((obj), LIGHTDM_TYPE_LAYOUT))
#define LIGHTDM_IS_LAYOUT_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), LIGHTDM_TYPE_LAYOUT))
#define LIGHTDM_LAYOUT_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS ((obj), LIGHTDM_TYPE_LAYOUT, LightDMLayoutClass))

Functions

GType lightdm_layout_get_type (void)
GList * lightdm_get_layouts (void)
 lightdm_get_layouts:
void lightdm_set_layout (LightDMLayout *layout)
 lightdm_set_layout: : The layout to use
LightDMLayoutlightdm_get_layout (void)
 lightdm_get_layout:
const gchar * lightdm_layout_get_name (LightDMLayout *layout)
 lightdm_layout_get_name: : A LightDMLayout
const gchar * lightdm_layout_get_short_description (LightDMLayout *layout)
 lightdm_layout_get_short_description: : A LightDMLayout
const gchar * lightdm_layout_get_description (LightDMLayout *layout)
 lightdm_layout_get_description: : A LightDMLayout

Class Documentation

struct LightDMLayout

Definition at line 26 of file layout.h.

Class Members
GObject parent_instance

Define Documentation

#define LIGHTDM_IS_LAYOUT (   obj)    (G_TYPE_CHECK_INSTANCE_TYPE ((obj), LIGHTDM_TYPE_LAYOUT))

Definition at line 22 of file layout.h.

#define LIGHTDM_IS_LAYOUT_CLASS (   klass)    (G_TYPE_CHECK_CLASS_TYPE ((klass), LIGHTDM_TYPE_LAYOUT))

Definition at line 23 of file layout.h.

#define LIGHTDM_LAYOUT (   obj)    (G_TYPE_CHECK_INSTANCE_CAST ((obj), LIGHTDM_TYPE_LAYOUT, LightDMLayout));

Definition at line 20 of file layout.h.

#define LIGHTDM_LAYOUT_CLASS (   klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), LIGHTDM_TYPE_LAYOUT, LightDMLayoutClass))

Definition at line 21 of file layout.h.

#define LIGHTDM_LAYOUT_GET_CLASS (   obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), LIGHTDM_TYPE_LAYOUT, LightDMLayoutClass))

Definition at line 24 of file layout.h.

Definition at line 19 of file layout.h.


Function Documentation

lightdm_get_layout:

Get the current keyboard layout.

Return value: (transfer none): The currently active layout for this user.

Definition at line 173 of file layout.c.

{
    lightdm_get_layouts ();

    if (layouts && xkl_config && !default_layout)
    {
        gchar *full_name;
        GList *item;

        full_name = make_layout_string (xkl_config->layouts ? xkl_config->layouts[0] : NULL,
                                        xkl_config->variants ? xkl_config->variants[0] : NULL);

        for (item = layouts; item; item = item->next)
        {
            LightDMLayout *iter_layout = (LightDMLayout *) item->data;
            if (g_strcmp0 (lightdm_layout_get_name (iter_layout), full_name) == 0)
            {
                default_layout = iter_layout;
                break;
            }
        }

        g_free (full_name);
    }

    return default_layout;
}

Here is the call graph for this function:

Here is the caller graph for this function:

GList* lightdm_get_layouts ( void  )

lightdm_get_layouts:

Get a list of keyboard layouts to present to the user.

Return value: (element-type LightDMLayout) (transfer none): A list of LightDMLayout that should be presented to the user.

Definition at line 111 of file layout.c.

{
    XklConfigRegistry *registry;

    if (have_layouts)
        return layouts;

    display = XOpenDisplay (NULL);
    xkl_engine = xkl_engine_get_instance (display);
    xkl_config = xkl_config_rec_new ();
    if (!xkl_config_rec_get_from_server (xkl_config, xkl_engine))
        g_warning ("Failed to get Xkl configuration from server");

    registry = xkl_config_registry_get_instance (xkl_engine);
    xkl_config_registry_load (registry, FALSE);
    xkl_config_registry_foreach_layout (registry, layout_cb, NULL);
    g_object_unref (registry);

    have_layouts = TRUE;

    return layouts;
}

Here is the call graph for this function:

Here is the caller graph for this function:

const gchar* lightdm_layout_get_description ( LightDMLayout layout)

lightdm_layout_get_description: : A LightDMLayout

Get the long description of a layout.

Return value: A long description of the layout

Definition at line 240 of file layout.c.

{
    g_return_val_if_fail (LIGHTDM_IS_LAYOUT (layout), NULL);
    return GET_PRIVATE (layout)->description;
}

Here is the caller graph for this function:

const gchar* lightdm_layout_get_name ( LightDMLayout layout)

lightdm_layout_get_name: : A LightDMLayout

Get the name of a layout.

Return value: The name of the layout

Definition at line 210 of file layout.c.

{
    g_return_val_if_fail (LIGHTDM_IS_LAYOUT (layout), NULL);
    return GET_PRIVATE (layout)->name;
}

Here is the caller graph for this function:

lightdm_layout_get_short_description: : A LightDMLayout

Get the short description of a layout.

Return value: A short description of the layout

Definition at line 225 of file layout.c.

{
    g_return_val_if_fail (LIGHTDM_IS_LAYOUT (layout), NULL);
    return GET_PRIVATE (layout)->short_description;
}

Here is the caller graph for this function:

GType lightdm_layout_get_type ( void  )
void lightdm_set_layout ( LightDMLayout dmlayout)

lightdm_set_layout: : The layout to use

Set the layout for this session.

Definition at line 141 of file layout.c.

{
    XklConfigRec *config;
    gchar *layout, *variant;

    g_return_if_fail (dmlayout != NULL);

    g_debug ("Setting keyboard layout to '%s'", lightdm_layout_get_name (dmlayout));

    parse_layout_string (lightdm_layout_get_name (dmlayout), &layout, &variant);

    config = xkl_config_rec_new ();
    config->layouts = g_malloc (sizeof (gchar *) * 2);
    config->variants = g_malloc (sizeof (gchar *) * 2);
    config->model = g_strdup (xkl_config->model);
    config->layouts[0] = layout;
    config->layouts[1] = NULL;
    config->variants[0] = variant;
    config->variants[1] = NULL;
    if (!xkl_config_rec_activate (config, xkl_engine))
        g_warning ("Failed to activate XKL config");
    g_object_unref (config);
}

Here is the call graph for this function: