do_setup (GdmSessionWorker *worker)
{
        GError  *error;
        gboolean res;

        worker->priv->user_settings = gdm_session_settings_new ();

        g_signal_connect_swapped (worker->priv->user_settings,
                                  "notify::language-name",
                                  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),
                                  worker);

        /* In some setups the user can read ~/.dmrc at this point.
         * In some other setups the user can only read ~/.dmrc after completing
         * the pam conversation.
         *
         * The user experience is better if we can read .dmrc now since we can
         * prefill in the language and session combo boxes in the greeter with
         * the right values.
         *
         * We'll try now, and if it doesn't work out, try later.
         */
        if (worker->priv->username != NULL) {
                attempt_to_load_user_settings (worker,
                                               worker->priv->username);
        }

        error = NULL;
        res = gdm_session_worker_initialize_pam (worker,
                                                 worker->priv->service,
                                                 worker->priv->username,
                                                 worker->priv->hostname,
                                                 worker->priv->x11_display_name,
                                                 worker->priv->x11_authority_file,
                                                 worker->priv->display_device,
                                                 &error);
        if (! res) {
                send_dbus_string_method (worker->priv->connection,
                                         "SetupFailed",
                                         error->message);
                g_error_free (error);
                return;
        }

        send_dbus_void_method (worker->priv->connection, "SetupComplete");
}
do_setup (GdmSessionWorker *worker)
{
        GError  *error;
        gboolean res;

        worker->priv->user_settings = gdm_session_settings_new ();

        g_signal_connect_swapped (worker->priv->user_settings,
                                  "notify::language-name",
                                  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),
                                  worker);

         
        if (worker->priv->username != NULL) {
                attempt_to_load_user_settings (worker,
                                               worker->priv->username);
        }

        error = NULL;
        res = gdm_session_worker_initialize_pam (worker,
                                                 worker->priv->service,
                                                 worker->priv->username,
                                                 worker->priv->hostname,
                                                 worker->priv->x11_display_name,
                                                 worker->priv->x11_authority_file,
                                                 worker->priv->display_device,
                                                 &error);
        if (! res) {
                send_dbus_string_method (worker->priv->connection,
                                         "SetupFailed",
                                         error->message);
                g_error_free (error);
                return;
        }

        send_dbus_void_method (worker->priv->connection, "SetupComplete");
}