Commit 500d2c5f authored by Matthias Clasen's avatar Matthias Clasen

Add a keyboard chooser

svn path=/trunk/; revision=6212
parent 4404c50f
2008-05-05 Matthias Clasen <mclasen@redhat.com>
* gui/simple-greeter/gdm-layout*: Add keyboard layout chooser
widgetry, similar to what we have for sessions and languages.
* configure.in:
* gui/simple-greeter/Makefile.am: Build integration.
* gui/simple-greeter/gdm-greeter-panel.[hc]: Show a layout chooser.
* daemon/gdm-factory-slave.c:
* daemon/gdm-greeter-server.[ch]:
* daemon/gdm-product-slave.c:
* daemon/gdm-session-direct.c:
* daemon/gdm-session-private.h:
* daemon/gdm-session-relay.c:
* daemon/gdm-session-settings.[hc]:
* daemon/gdm-session-worker.c:
* daemon/gdm-session.[hc]:
* daemon/gdm-simple-slave.c:
* gui/simple-greeter/gdm-greeter-client.[hc]:
* gui/simple-greeter/gdm-greeter-session.c: Necessary plumbing
to get a layout setting all the way to and from .dmrc.
2008-05-02 William Jon McCann <jmccann@redhat.com>
* configure.ac: Post branch version bump
......
......@@ -48,6 +48,7 @@ SCROLLKEEPER_REQUIRED_VERSION=0.1.4
GCONF_REQUIRED_VERSION=2.6.1
POLICYKIT_REQUIRED_VERSION=0.7
GNOME_PANEL_REQUIRED_VERSION=2.0.0
LIBXKLAVIER_REQUIRED_VERSION=3.5
EXTRA_COMPILE_WARNINGS(yes)
......@@ -98,6 +99,7 @@ PKG_CHECK_MODULES(SIMPLE_GREETER,
gtk+-2.0 >= $GTK_REQUIRED_VERSION
libglade-2.0 >= $LIBGLADE_REQUIRED_VERSION
gconf-2.0 >= $GCONF_REQUIRED_VERSION
libxlavier >= $LIBXKLAVIER_REQUIRED_VERSION
)
AC_SUBST(SIMPLE_GREETER_CFLAGS)
AC_SUBST(SIMPLE_GREETER_LIBS)
......
......@@ -415,6 +415,14 @@ on_greeter_language_selected (GdmGreeterServer *greeter_server,
gdm_session_select_language (GDM_SESSION (slave->priv->session), text);
}
static void
on_greeter_layout_selected (GdmGreeterServer *greeter_server,
const char *text,
GdmFactorySlave *slave)
{
gdm_session_select_layout (GDM_SESSION (slave->priv->session), text);
}
static void
on_greeter_user_selected (GdmGreeterServer *greeter_server,
const char *text,
......@@ -504,6 +512,10 @@ run_greeter (GdmFactorySlave *slave)
"language-selected",
G_CALLBACK (on_greeter_language_selected),
slave);
g_signal_connect (slave->priv->greeter_server,
"layout-selected",
G_CALLBACK (on_greeter_layout_selected),
slave);
g_signal_connect (slave->priv->greeter_server,
"user-selected",
G_CALLBACK (on_greeter_user_selected),
......
......@@ -76,6 +76,7 @@ enum {
SESSION_SELECTED,
HOSTNAME_SELECTED,
LANGUAGE_SELECTED,
LAYOUT_SELECTED,
USER_SELECTED,
CANCELLED,
CONNECTED,
......@@ -265,6 +266,13 @@ gdm_greeter_server_default_language_name_changed (GdmGreeterServer *greeter_serv
send_dbus_string_signal (greeter_server, "DefaultLanguageNameChanged", language_name);
}
void
gdm_greeter_server_default_layout_name_changed (GdmGreeterServer *greeter_server,
const char *layout_name)
{
send_dbus_string_signal (greeter_server, "DefaultLayoutNameChanged", layout_name);
}
void
gdm_greeter_server_default_session_name_changed (GdmGreeterServer *greeter_server,
const char *session_name)
......@@ -495,6 +503,33 @@ handle_select_language (GdmGreeterServer *greeter_server,
return DBUS_HANDLER_RESULT_HANDLED;
}
static DBusHandlerResult
handle_select_layout (GdmGreeterServer *greeter_server,
DBusConnection *connection,
DBusMessage *message)
{
DBusMessage *reply;
DBusError error;
const char *text;
dbus_error_init (&error);
if (! dbus_message_get_args (message, &error,
DBUS_TYPE_STRING, &text,
DBUS_TYPE_INVALID)) {
g_warning ("ERROR: %s", error.message);
}
g_debug ("GreeterServer: SelectLayout: %s", text);
reply = dbus_message_new_method_return (message);
dbus_connection_send (connection, reply, NULL);
dbus_message_unref (reply);
g_signal_emit (greeter_server, signals [LAYOUT_SELECTED], 0, text);
return DBUS_HANDLER_RESULT_HANDLED;
}
static DBusHandlerResult
handle_select_user (GdmGreeterServer *greeter_server,
DBusConnection *connection,
......@@ -624,6 +659,8 @@ greeter_handle_child_message (DBusConnection *connection,
return handle_select_hostname (greeter_server, connection, message);
} else if (dbus_message_is_method_call (message, GDM_GREETER_SERVER_DBUS_INTERFACE, "SelectLanguage")) {
return handle_select_language (greeter_server, connection, message);
} else if (dbus_message_is_method_call (message, GDM_GREETER_SERVER_DBUS_INTERFACE, "SelectLayout")) {
return handle_select_layout (greeter_server, connection, message);
} else if (dbus_message_is_method_call (message, GDM_GREETER_SERVER_DBUS_INTERFACE, "SelectUser")) {
return handle_select_user (greeter_server, connection, message);
} else if (dbus_message_is_method_call (message, GDM_GREETER_SERVER_DBUS_INTERFACE, "Cancel")) {
......@@ -711,6 +748,10 @@ do_introspect (DBusConnection *connection,
" <signal name=\"DefaultLanguageNameChanged\">\n"
" <arg name=\"language_name\" type=\"s\"/>\n"
" </signal>\n"
" <signal name=\"DefaultLayoutNameChanged\">\n"
" <arg name=\"layout_name\" type=\"s\"/>\n"
" </signal>\n"
" <signal name=\"DefaultSessionNameChanged\">\n"
" <signal name=\"DefaultSessionNameChanged\">\n"
" <arg name=\"session_name\" type=\"s\"/>\n"
" </signal>\n"
......@@ -1157,6 +1198,17 @@ gdm_greeter_server_class_init (GdmGreeterServerClass *klass)
G_TYPE_NONE,
1,
G_TYPE_STRING);
signals [LAYOUT_SELECTED] =
g_signal_new ("layout-selected",
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GdmGreeterServerClass, layout_selected),
NULL,
NULL,
g_cclosure_marshal_VOID__STRING,
G_TYPE_NONE,
1,
G_TYPE_STRING);
signals [USER_SELECTED] =
g_signal_new ("user-selected",
G_OBJECT_CLASS_TYPE (object_class),
......
......@@ -57,6 +57,8 @@ typedef struct
const char *hostname);
void (* language_selected) (GdmGreeterServer *greeter_server,
const char *name);
void (* layout_selected) (GdmGreeterServer *greeter_server,
const char *name);
void (* user_selected) (GdmGreeterServer *greeter_server,
const char *name);
void (* cancelled) (GdmGreeterServer *greeter_server);
......@@ -88,6 +90,8 @@ void gdm_greeter_server_selected_user_changed (GdmGreeterServer *
const char *text);
void gdm_greeter_server_default_language_name_changed (GdmGreeterServer *greeter_server,
const char *text);
void gdm_greeter_server_default_layout_name_changed (GdmGreeterServer *greeter_server,
const char *text);
void gdm_greeter_server_default_session_name_changed (GdmGreeterServer *greeter_server,
const char *text);
......
......@@ -754,6 +754,28 @@ on_relay_language_selected (GdmProductSlave *slave,
}
}
static void
on_relay_layout_selected (GdmProductSlave *slave,
DBusMessage *message)
{
DBusError error;
const char *text;
dbus_bool_t res;
dbus_error_init (&error);
res = dbus_message_get_args (message,
&error,
DBUS_TYPE_STRING, &text,
DBUS_TYPE_INVALID);
if (res) {
g_debug ("GdmProductSlave: Layout selected %s", text);
gdm_session_select_layout (GDM_SESSION (slave->priv->session), text);
} else {
g_warning ("Unable to get arguments: %s", error.message);
dbus_error_free (&error);
}
}
static void
on_relay_user_selected (GdmProductSlave *slave,
DBusMessage *message)
......@@ -963,6 +985,8 @@ relay_dbus_handle_message (DBusConnection *connection,
on_relay_session_selected (slave, message);
} else if (dbus_message_is_signal (message, RELAY_SERVER_DBUS_INTERFACE, "LanguageSelected")) {
on_relay_language_selected (slave, message);
} else if (dbus_message_is_signal (message, RELAY_SERVER_DBUS_INTERFACE, "LayoutSelected")) {
on_relay_layout_selected (slave, message);
} else if (dbus_message_is_signal (message, RELAY_SERVER_DBUS_INTERFACE, "UserSelected")) {
on_relay_user_selected (slave, message);
} else if (dbus_message_is_signal (message, RELAY_SERVER_DBUS_INTERFACE, "StartSession")) {
......
......@@ -70,6 +70,8 @@ struct _GdmSessionDirectPrivate
char *saved_session;
char *selected_language;
char *saved_language;
char *selected_layout;
char *saved_layout;
char *selected_user;
char *user_x11_authority_file;
......@@ -596,6 +598,16 @@ get_default_language_name (GdmSessionDirect *session)
return setlocale (LC_MESSAGES, NULL);
}
static const char *
get_default_layout_name (GdmSessionDirect *session)
{
if (session->priv->saved_layout != NULL) {
return session->priv->saved_layout;
}
return "us";
}
static char *
get_fallback_session_name (void)
{
......@@ -661,6 +673,8 @@ gdm_session_direct_defaults_changed (GdmSessionDirect *session)
{
_gdm_session_default_language_name_changed (GDM_SESSION (session),
get_default_language_name (session));
_gdm_session_default_layout_name_changed (GDM_SESSION (session),
get_default_layout_name (session));
_gdm_session_default_session_name_changed (GDM_SESSION (session),
get_default_session_name (session));
}
......@@ -681,6 +695,9 @@ gdm_session_direct_select_user (GdmSession *session,
g_free (impl->priv->saved_language);
impl->priv->saved_language = NULL;
g_free (impl->priv->saved_layout);
impl->priv->saved_layout = NULL;
}
static DBusHandlerResult
......@@ -1034,6 +1051,39 @@ gdm_session_direct_handle_saved_language_name_read (GdmSessionDirect *session,
return DBUS_HANDLER_RESULT_HANDLED;
}
static DBusHandlerResult
gdm_session_direct_handle_saved_layout_name_read (GdmSessionDirect *session,
DBusConnection *connection,
DBusMessage *message)
{
DBusMessage *reply;
DBusError error;
const char *layout_name;
dbus_error_init (&error);
if (! dbus_message_get_args (message, &error,
DBUS_TYPE_STRING, &layout_name,
DBUS_TYPE_INVALID)) {
g_warning ("ERROR: %s", error.message);
}
reply = dbus_message_new_method_return (message);
dbus_connection_send (connection, reply, NULL);
dbus_message_unref (reply);
if (strcmp (layout_name,
get_default_layout_name (session)) != 0) {
g_free (session->priv->saved_layout);
session->priv->saved_layout = g_strdup (layout_name);
_gdm_session_default_layout_name_changed (GDM_SESSION (session),
layout_name);
}
return DBUS_HANDLER_RESULT_HANDLED;
}
static DBusHandlerResult
gdm_session_direct_handle_saved_session_name_read (GdmSessionDirect *session,
DBusConnection *connection,
......@@ -1135,6 +1185,8 @@ session_worker_message (DBusConnection *connection,
return gdm_session_direct_handle_session_died (session, connection, message);
} else if (dbus_message_is_method_call (message, GDM_SESSION_DBUS_INTERFACE, "SavedLanguageNameRead")) {
return gdm_session_direct_handle_saved_language_name_read (session, connection, message);
} else if (dbus_message_is_method_call (message, GDM_SESSION_DBUS_INTERFACE, "SavedLayoutNameRead")) {
return gdm_session_direct_handle_saved_layout_name_read (session, connection, message);
} else if (dbus_message_is_method_call (message, GDM_SESSION_DBUS_INTERFACE, "SavedSessionNameRead")) {
return gdm_session_direct_handle_saved_session_name_read (session, connection, message);
}
......@@ -1833,6 +1885,16 @@ get_language_name (GdmSessionDirect *session)
return get_default_language_name (session);
}
static const char *
get_layout_name (GdmSessionDirect *session)
{
if (session->priv->selected_layout != NULL) {
return session->priv->selected_layout;
}
return get_default_layout_name (session);
}
static const char *
get_session_name (GdmSessionDirect *session)
{
......@@ -1974,6 +2036,10 @@ setup_session_environment (GdmSessionDirect *session)
"GDM_LANG",
get_language_name (session));
gdm_session_direct_set_environment_variable (session,
"GDM_KEYBOARD_LAYOUT",
get_layout_name (session));
gdm_session_direct_set_environment_variable (session,
"DISPLAY",
session->priv->display_name);
......@@ -2063,6 +2129,12 @@ gdm_session_direct_close (GdmSession *session)
g_free (impl->priv->saved_language);
impl->priv->saved_language = NULL;
g_free (impl->priv->selected_layout);
impl->priv->selected_layout = NULL;
g_free (impl->priv->saved_layout);
impl->priv->saved_layout = NULL;
g_free (impl->priv->user_x11_authority_file);
impl->priv->user_x11_authority_file = NULL;
......@@ -2138,6 +2210,24 @@ gdm_session_direct_select_language (GdmSession *session,
get_language_name (impl));
}
static void
gdm_session_direct_select_layout (GdmSession *session,
const char *text)
{
GdmSessionDirect *impl = GDM_SESSION_DIRECT (session);
g_free (impl->priv->selected_layout);
if (strcmp (text, "__previous") == 0) {
impl->priv->selected_layout = NULL;
} else {
impl->priv->selected_layout = g_strdup (text);
}
send_dbus_string_signal (impl, "SetLayoutName",
get_layout_name (impl));
}
static void
_gdm_session_direct_set_display_id (GdmSessionDirect *session,
const char *id)
......@@ -2330,6 +2420,8 @@ gdm_session_direct_finalize (GObject *object)
g_free (session->priv->saved_session);
g_free (session->priv->selected_language);
g_free (session->priv->saved_language);
g_free (session->priv->selected_layout);
g_free (session->priv->saved_layout);
parent_class = G_OBJECT_CLASS (gdm_session_direct_parent_class);
......@@ -2405,6 +2497,7 @@ gdm_session_iface_init (GdmSessionIface *iface)
iface->answer_query = gdm_session_direct_answer_query;
iface->select_session = gdm_session_direct_select_session;
iface->select_language = gdm_session_direct_select_language;
iface->select_layout = gdm_session_direct_select_layout;
iface->select_user = gdm_session_direct_select_user;
}
......
......@@ -56,6 +56,8 @@ void _gdm_session_closed (GdmSession *sessio
/* user settings read from ~/.dmrc / system defaults */
void _gdm_session_default_language_name_changed (GdmSession *session,
const char *language_name);
void _gdm_session_default_layout_name_changed (GdmSession *session,
const char *layout_name);
void _gdm_session_default_session_name_changed (GdmSession *session,
const char *session_name);
/* user is selected/changed internally */
......
......@@ -266,6 +266,14 @@ gdm_session_relay_select_language (GdmSession *session,
send_dbus_string_signal (impl, "LanguageSelected", text);
}
static void
gdm_session_relay_select_layout (GdmSession *session,
const char *text)
{
GdmSessionRelay *impl = GDM_SESSION_RELAY (session);
send_dbus_string_signal (impl, "LayoutSelected", text);
}
static void
gdm_session_relay_select_user (GdmSession *session,
const char *text)
......@@ -814,6 +822,9 @@ do_introspect (DBusConnection *connection,
" <signal name=\"LanguageSelected\">\n"
" <arg name=\"language\" type=\"s\"/>\n"
" </signal>\n"
" <signal name=\"LayoutSelected\">\n"
" <arg name=\"layout\" type=\"s\"/>\n"
" </signal>\n"
" <signal name=\"SessionSelected\">\n"
" <arg name=\"session\" type=\"s\"/>\n"
" </signal>\n"
......@@ -1108,6 +1119,7 @@ gdm_session_iface_init (GdmSessionIface *iface)
iface->answer_query = gdm_session_relay_answer_query;
iface->select_session = gdm_session_relay_select_session;
iface->select_language = gdm_session_relay_select_language;
iface->select_layout = gdm_session_relay_select_layout;
iface->select_user = gdm_session_relay_select_user;
}
......
......@@ -36,6 +36,7 @@ struct _GdmSessionSettingsPrivate
{
char *session_name;
char *language_name;
char *layout_name;
};
static void gdm_session_settings_finalize (GObject *object);
......@@ -55,6 +56,7 @@ enum {
PROP_0 = 0,
PROP_SESSION_NAME,
PROP_LANGUAGE_NAME,
PROP_LAYOUT_NAME,
};
G_DEFINE_TYPE (GdmSessionSettings, gdm_session_settings, G_TYPE_OBJECT)
......@@ -93,6 +95,11 @@ gdm_session_settings_class_install_properties (GdmSessionSettingsClass *settings
NULL,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
g_object_class_install_property (object_class, PROP_LANGUAGE_NAME, param_spec);
param_spec = g_param_spec_string ("layout-name", "Keyboard Layout Name",
"The name of the keyboard layout",
NULL,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
g_object_class_install_property (object_class, PROP_LAYOUT_NAME, param_spec);
}
static void
......@@ -114,6 +121,7 @@ gdm_session_settings_finalize (GObject *object)
g_free (settings->priv->session_name);
g_free (settings->priv->language_name);
g_free (settings->priv->layout_name);
parent_class = G_OBJECT_CLASS (gdm_session_settings_parent_class);
......@@ -135,6 +143,19 @@ gdm_session_settings_set_language_name (GdmSessionSettings *settings,
}
}
void
gdm_session_settings_set_layout_name (GdmSessionSettings *settings,
const char *layout_name)
{
g_return_if_fail (GDM_IS_SESSION_SETTINGS (settings));
if (settings->priv->layout_name == NULL ||
strcmp (settings->priv->layout_name, layout_name) != 0) {
settings->priv->layout_name = g_strdup (layout_name);
g_object_notify (G_OBJECT (settings), "layout-name");
}
}
void
gdm_session_settings_set_session_name (GdmSessionSettings *settings,
const char *session_name)
......@@ -155,6 +176,13 @@ gdm_session_settings_get_language_name (GdmSessionSettings *settings)
return g_strdup (settings->priv->language_name);
}
char *
gdm_session_settings_get_layout_name (GdmSessionSettings *settings)
{
g_return_val_if_fail (GDM_IS_SESSION_SETTINGS (settings), NULL);
return g_strdup (settings->priv->layout_name);
}
char *
gdm_session_settings_get_session_name (GdmSessionSettings *settings)
{
......@@ -177,6 +205,10 @@ gdm_session_settings_set_property (GObject *object,
gdm_session_settings_set_language_name (settings, g_value_get_string (value));
break;
case PROP_LAYOUT_NAME:
gdm_session_settings_set_layout_name (settings, g_value_get_string (value));
break;
case PROP_SESSION_NAME:
gdm_session_settings_set_session_name (settings, g_value_get_string (value));
break;
......@@ -205,6 +237,10 @@ gdm_session_settings_get_property (GObject *object,
g_value_set_string (value, settings->priv->language_name);
break;
case PROP_LAYOUT_NAME:
g_value_set_string (value, settings->priv->layout_name);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
......@@ -225,7 +261,8 @@ gboolean
gdm_session_settings_is_loaded (GdmSessionSettings *settings)
{
return settings->priv->session_name != NULL ||
settings->priv->language_name != NULL;
settings->priv->language_name != NULL ||
settings->priv->layout_name != NULL;
}
gboolean
......@@ -238,6 +275,7 @@ gdm_session_settings_load (GdmSessionSettings *settings,
gboolean is_loaded;
char *session_name;
char *language_name;
char *layout_name;
char *filename;
g_return_val_if_fail (settings != NULL, FALSE);
......@@ -283,6 +321,20 @@ gdm_session_settings_load (GdmSessionSettings *settings,
goto out;
}
layout_name = g_key_file_get_string (key_file, "Desktop", "Layout",
&load_error);
if (layout_name != NULL) {
gdm_session_settings_set_layout_name (settings, layout_name);
g_free (layout_name);
} else if (g_error_matches (load_error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_KEY_NOT_FOUND)) {
g_error_free (load_error);
load_error = NULL;
} else {
g_propagate_error (error, load_error);
goto out;
}
is_loaded = TRUE;
out:
g_key_file_free (key_file);
......@@ -327,6 +379,11 @@ gdm_session_settings_save (GdmSessionSettings *settings,
settings->priv->language_name);
}
if (settings->priv->layout_name != NULL) {
g_key_file_set_string (key_file, "Desktop", "Layout",
settings->priv->layout_name);
}
contents = g_key_file_to_data (key_file, &length, &file_error);
if (contents == NULL) {
......
......@@ -61,9 +61,12 @@ gboolean gdm_session_settings_save (GdmSessionSettings
GError **error);
gboolean gdm_session_settings_is_loaded (GdmSessionSettings *settings);
char *gdm_session_settings_get_language_name (GdmSessionSettings *settings);
char *gdm_session_settings_get_layout_name (GdmSessionSettings *settings);
char *gdm_session_settings_get_session_name (GdmSessionSettings *settings);
void gdm_session_settings_set_language_name (GdmSessionSettings *settings,
const char *language_name);
void gdm_session_settings_set_layout_name (GdmSessionSettings *settings,
const char *layout_name);
void gdm_session_settings_set_session_name (GdmSessionSettings *settings,
const char *session_name);
......
......@@ -1784,6 +1784,14 @@ gdm_session_worker_set_language_name (GdmSessionWorker *worker,
language_name);
}
static void
gdm_session_worker_set_layout_name (GdmSessionWorker *worker,
const char *layout_name)
{
gdm_session_settings_set_layout_name (worker->priv->user_settings,
layout_name);
}
static void
on_set_language_name (GdmSessionWorker *worker,
DBusMessage *message)
......@@ -1806,6 +1814,28 @@ on_set_language_name (GdmSessionWorker *worker,
}
}
static void
on_set_layout_name (GdmSessionWorker *worker,
DBusMessage *message)
{
DBusError error;
const char *layout_name;
dbus_bool_t res;
dbus_error_init (&error);
res = dbus_message_get_args (message,
&error,
DBUS_TYPE_STRING, &layout_name,
DBUS_TYPE_INVALID);
if (res) {
g_debug ("GdmSessionWorker: layout name set to %s", layout_name);
gdm_session_worker_set_layout_name (worker, layout_name);
} else {
g_warning ("Unable to get arguments: %s", error.message);
dbus_error_free (&error);
}
}
static void
on_saved_language_name_read (GdmSessionWorker *worker)
{
......@@ -1818,6 +1848,18 @@ on_saved_language_name_read (GdmSessionWorker *worker)
g_free (language_name);
}
static void
on_saved_layout_name_read (GdmSessionWorker *worker)
{
char *layout_name;
layout_name = gdm_session_settings_get_layout_name (worker->priv->user_settings);
send_dbus_string_method (worker->priv->connection,
"SavedLayoutNameRead",
layout_name);
g_free (layout_name);
}
static void
on_saved_session_name_read (GdmSessionWorker *worker)
{
......@@ -1843,6 +1885,11 @@ do_setup (GdmSessionWorker *worker)
G_CALLBACK (on_saved_language_name_read),
worker);
g_signal_connect_swapped (worker->priv->user_settings,
"notify::layout-name",
G_CALLBACK (on_saved_layout_name_read),
worker);
g_signal_connect_swapped (worker->priv->user_settings,
"notify::session-name",
G_CALLBACK (on_saved_session_name_read),
......@@ -2300,6 +2347,8 @@ worker_dbus_handle_message (DBusConnection *connection,
on_set_environment_variable (worker, message);
} else if (dbus_message_is_signal (message, GDM_SESSION_DBUS_INTERFACE, "SetLanguageName")) {
on_set_language_name (worker, message);
} else if (dbus_message_is_signal (message, GDM_SESSION_DBUS_INTERFACE, "SetLayoutName")) {
on_set_layout_name (worker, message);
} else if (dbus_message_is_signal (message, GDM_SESSION_DBUS_INTERFACE, "SetSessionName")) {
on_set_session_name (worker, message);
} else {
......
......@@ -50,6 +50,7 @@ enum {
SESSION_DIED,
SELECTED_USER_CHANGED,
DEFAULT_LANGUAGE_NAME_CHANGED,
DEFAULT_LAYOUT_NAME_CHANGED,
DEFAULT_SESSION_NAME_CHANGED,
LAST_SIGNAL
};
......@@ -163,6 +164,15 @@ gdm_session_select_language (GdmSession *session,
GDM_SESSION_GET_IFACE (session)->select_language (session, text);
}
void
gdm_session_select_layout (GdmSession *session,
const char *text)
{
g_return_if_fail (GDM_IS_SESSION (session));
GDM_SESSION_GET_IFACE (session)->select_layout (session, text);
}
void
gdm_session_select_user (GdmSession *session,
const char *text)
......@@ -429,6 +439,17 @@ gdm_session_class_init (gpointer g_iface)
G_TYPE_NONE,
1,
G_TYPE_STRING);
signals [DEFAULT_LAYOUT_NAME_CHANGED] =
g_signal_new ("default-layout-name-changed",
iface_type,
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GdmSessionIface, default_layout_name_changed),
NULL,
NULL,
g_cclosure_marshal_VOID__STRING,
G_TYPE_NONE,
1,
G_TYPE_STRING);
signals [DEFAULT_SESSION_NAME_CHANGED] =
g_signal_new ("default-session-name-changed",
iface_type,
......@@ -609,6 +630,15 @@ _gdm_session_default_language_name_changed (GdmSession *session,
g_signal_emit (session, signals [DEFAULT_LANGUAGE_NAME_CHANGED], 0, language_name);
}
void
_gdm_session_default_layout_name_changed (GdmSession *session,
const char *layout_name)
{
g_return_if_fail (GDM_IS_SESSION (session));
g_signal_emit (session, signals [DEFAULT_LAYOUT_NAME_CHANGED], 0, layout_name);
}
void
_gdm_session_default_session_name_changed (GdmSession *session,
const char *session_name)
......
......@@ -60,6 +60,8 @@ struct _GdmSessionIface
const char *text);
void (* select_language) (GdmSession *session,
const char *text);
void (* select_layout) (GdmSession *session,
const char *text);
void (* select_session) (GdmSession *session,
const char *text);
void (* select_user) (GdmSession *session,
......@@ -108,6 +110,8 @@ struct _GdmSessionIface