Commit becfcf5d authored by William Jon McCann's avatar William Jon McCann Committed by William Jon McCann

Make SessionRelay and SessionDirect (was Session) implement a common

2007-10-29  William Jon McCann  <mccann@jhu.edu>

	* daemon/Makefile.am:
	* daemon/gdm-factory-slave.c: (on_session_info),
	(on_session_problem), (on_session_info_query),
	(on_session_secret_info_query), (on_session_opened),
	(on_session_user_verified), (on_session_user_verification_error),
	(on_session_session_started), (create_product_display),
	(on_session_relay_disconnected), (on_session_relay_connected),
	(on_greeter_begin_verification),
	(on_greeter_begin_verification_for_user), (on_greeter_answer),
	(on_greeter_session_selected), (on_greeter_language_selected),
	(on_greeter_user_selected), (on_greeter_cancel),
	(gdm_factory_slave_start), (gdm_factory_slave_stop):
	* daemon/gdm-product-slave.c: (setup_server),
	(add_user_authorization), (setup_session),
	(on_session_user_verified), (on_relay_start_session),
	(on_relay_begin_verification),
	(on_relay_begin_verification_for_user), (on_relay_answer),
	(reset_session), (on_relay_open), (create_new_session),
	(on_relay_cancelled), (connect_to_session_relay),
	(gdm_product_slave_stop):
	* daemon/gdm-session-direct.c: (on_user_verification_error),
	(on_session_started), (on_session_startup_error),
	(on_session_exited), (gdm_session_direct_handle_verified),
	(gdm_session_direct_handle_verification_failed),
	(gdm_session_direct_handle_username_changed),
	(gdm_session_direct_handle_info_query),
	(gdm_session_direct_handle_secret_info_query),
	(gdm_session_direct_handle_info),
	(gdm_session_direct_handle_problem),
	(gdm_session_direct_handle_session_started),
	(gdm_session_direct_handle_startup_failed),
	(gdm_session_direct_handle_session_exited),
	(gdm_session_direct_handle_session_died), (handle_connection),
	(gdm_session_direct_init), (worker_exited), (worker_died),
	(gdm_session_direct_open), (send_begin_verification),
	(send_begin_verification_for_user),
	(gdm_session_direct_begin_verification),
	(gdm_session_direct_begin_verification_for_user),
	(is_prog_in_path), (get_session_command_for_file),
	(get_session_command), (open_ck_session),
	(setup_session_environment), (gdm_session_direct_start_session),
	(gdm_session_direct_close), (gdm_session_direct_answer_query),
	(gdm_session_direct_cancel), (gdm_session_direct_get_username),
	(gdm_session_direct_select_session),
	(gdm_session_direct_select_language),
	(gdm_session_direct_select_user),
	(_gdm_session_direct_set_display_name),
	(_gdm_session_direct_set_display_hostname),
	(_gdm_session_direct_set_display_device),
	(_gdm_session_direct_set_user_x11_authority_file),
	(_gdm_session_direct_set_display_is_local),
	(gdm_session_direct_set_property),
	(gdm_session_direct_get_property), (gdm_session_direct_dispose),
	(gdm_session_direct_finalize), (gdm_session_iface_init),
	(gdm_session_direct_class_init), (gdm_session_direct_new):
	* daemon/gdm-session-direct.h:
	* daemon/gdm-session-private.h:
	* daemon/gdm-session-relay.c: (gdm_session_relay_open),
	(gdm_session_relay_close), (gdm_session_relay_begin_verification),
	(gdm_session_relay_begin_verification_for_user),
	(gdm_session_relay_answer_query),
	(gdm_session_relay_select_session),
	(gdm_session_relay_select_language),
	(gdm_session_relay_select_user), (gdm_session_relay_cancel),
	(gdm_session_relay_start_session), (handle_info_query),
	(handle_secret_info_query), (handle_info), (handle_problem),
	(handle_user_verified), (handle_user_verification_error),
	(handle_session_started), (handle_session_stopped),
	(handle_opened), (handle_reset), (do_introspect),
	(handle_connection), (gdm_session_iface_init),
	(gdm_session_relay_class_init):
	* daemon/gdm-session-relay.h:
	* daemon/gdm-session.c: (gdm_session_get_type), (gdm_session_open),
	(gdm_session_close), (gdm_session_begin_verification),
	(gdm_session_begin_verification_for_user),
	(gdm_session_answer_query), (gdm_session_select_session),
	(gdm_session_select_language), (gdm_session_select_user),
	(gdm_session_cancel), (gdm_session_start_session),
	(gdm_session_class_init), (_gdm_session_user_verified),
	(_gdm_session_user_verification_error), (_gdm_session_info_query),
	(_gdm_session_secret_info_query), (_gdm_session_info),
	(_gdm_session_problem), (_gdm_session_session_started),
	(_gdm_session_session_startup_error),
	(_gdm_session_session_exited), (_gdm_session_session_died),
	(_gdm_session_opened), (_gdm_session_closed),
	(_gdm_session_selected_user_changed):
	* daemon/gdm-session.h:
	* daemon/gdm-simple-slave.c: (on_session_started),
	(on_session_exited), (on_session_died), (on_session_user_verified),
	(on_session_user_verification_error), (on_session_info),
	(on_session_problem), (on_session_info_query),
	(on_session_secret_info_query), (on_session_opened),
	(on_session_selected_user_changed), (create_new_session),
	(on_greeter_begin_verification),
	(on_greeter_begin_verification_for_user), (on_greeter_answer),
	(on_greeter_session_selected), (on_greeter_language_selected),
	(on_greeter_cancel), (on_greeter_connected),
	(gdm_simple_slave_stop), (gdm_simple_slave_init):
	* daemon/test-session.c: (on_open), (on_session_started),
	(on_session_exited), (on_session_died), (on_user_verified),
	(on_user_verification_error), (on_info_query), (on_info),
	(on_problem), (on_secret_info_query), (import_environment), (main):
	Make SessionRelay and SessionDirect (was Session) implement a common
	interface GdmSession.  Push some code that lived in the simple and product
	slaves into the SessionDirect class.  Using an interface has a few
	advantages besides ensuring consistency: makes it easier to do some
	abstraction in the slave classes, makes it possible to more easily
	implement other non-pam backends.

	Add a stub for a selected-user-changed signal from the session interface.
	This will be used to update the user selection in the greeter when the
	user is set from the backend.


svn path=/trunk/; revision=5452
parent 613d29b6
2007-10-29 William Jon McCann <mccann@jhu.edu>
* daemon/Makefile.am:
* daemon/gdm-factory-slave.c: (on_session_info),
(on_session_problem), (on_session_info_query),
(on_session_secret_info_query), (on_session_opened),
(on_session_user_verified), (on_session_user_verification_error),
(on_session_session_started), (create_product_display),
(on_session_relay_disconnected), (on_session_relay_connected),
(on_greeter_begin_verification),
(on_greeter_begin_verification_for_user), (on_greeter_answer),
(on_greeter_session_selected), (on_greeter_language_selected),
(on_greeter_user_selected), (on_greeter_cancel),
(gdm_factory_slave_start), (gdm_factory_slave_stop):
* daemon/gdm-product-slave.c: (setup_server),
(add_user_authorization), (setup_session),
(on_session_user_verified), (on_relay_start_session),
(on_relay_begin_verification),
(on_relay_begin_verification_for_user), (on_relay_answer),
(reset_session), (on_relay_open), (create_new_session),
(on_relay_cancelled), (connect_to_session_relay),
(gdm_product_slave_stop):
* daemon/gdm-session-direct.c: (on_user_verification_error),
(on_session_started), (on_session_startup_error),
(on_session_exited), (gdm_session_direct_handle_verified),
(gdm_session_direct_handle_verification_failed),
(gdm_session_direct_handle_username_changed),
(gdm_session_direct_handle_info_query),
(gdm_session_direct_handle_secret_info_query),
(gdm_session_direct_handle_info),
(gdm_session_direct_handle_problem),
(gdm_session_direct_handle_session_started),
(gdm_session_direct_handle_startup_failed),
(gdm_session_direct_handle_session_exited),
(gdm_session_direct_handle_session_died), (handle_connection),
(gdm_session_direct_init), (worker_exited), (worker_died),
(gdm_session_direct_open), (send_begin_verification),
(send_begin_verification_for_user),
(gdm_session_direct_begin_verification),
(gdm_session_direct_begin_verification_for_user),
(is_prog_in_path), (get_session_command_for_file),
(get_session_command), (open_ck_session),
(setup_session_environment), (gdm_session_direct_start_session),
(gdm_session_direct_close), (gdm_session_direct_answer_query),
(gdm_session_direct_cancel), (gdm_session_direct_get_username),
(gdm_session_direct_select_session),
(gdm_session_direct_select_language),
(gdm_session_direct_select_user),
(_gdm_session_direct_set_display_name),
(_gdm_session_direct_set_display_hostname),
(_gdm_session_direct_set_display_device),
(_gdm_session_direct_set_user_x11_authority_file),
(_gdm_session_direct_set_display_is_local),
(gdm_session_direct_set_property),
(gdm_session_direct_get_property), (gdm_session_direct_dispose),
(gdm_session_direct_finalize), (gdm_session_iface_init),
(gdm_session_direct_class_init), (gdm_session_direct_new):
* daemon/gdm-session-direct.h:
* daemon/gdm-session-private.h:
* daemon/gdm-session-relay.c: (gdm_session_relay_open),
(gdm_session_relay_close), (gdm_session_relay_begin_verification),
(gdm_session_relay_begin_verification_for_user),
(gdm_session_relay_answer_query),
(gdm_session_relay_select_session),
(gdm_session_relay_select_language),
(gdm_session_relay_select_user), (gdm_session_relay_cancel),
(gdm_session_relay_start_session), (handle_info_query),
(handle_secret_info_query), (handle_info), (handle_problem),
(handle_user_verified), (handle_user_verification_error),
(handle_session_started), (handle_session_stopped),
(handle_opened), (handle_reset), (do_introspect),
(handle_connection), (gdm_session_iface_init),
(gdm_session_relay_class_init):
* daemon/gdm-session-relay.h:
* daemon/gdm-session.c: (gdm_session_get_type), (gdm_session_open),
(gdm_session_close), (gdm_session_begin_verification),
(gdm_session_begin_verification_for_user),
(gdm_session_answer_query), (gdm_session_select_session),
(gdm_session_select_language), (gdm_session_select_user),
(gdm_session_cancel), (gdm_session_start_session),
(gdm_session_class_init), (_gdm_session_user_verified),
(_gdm_session_user_verification_error), (_gdm_session_info_query),
(_gdm_session_secret_info_query), (_gdm_session_info),
(_gdm_session_problem), (_gdm_session_session_started),
(_gdm_session_session_startup_error),
(_gdm_session_session_exited), (_gdm_session_session_died),
(_gdm_session_opened), (_gdm_session_closed),
(_gdm_session_selected_user_changed):
* daemon/gdm-session.h:
* daemon/gdm-simple-slave.c: (on_session_started),
(on_session_exited), (on_session_died), (on_session_user_verified),
(on_session_user_verification_error), (on_session_info),
(on_session_problem), (on_session_info_query),
(on_session_secret_info_query), (on_session_opened),
(on_session_selected_user_changed), (create_new_session),
(on_greeter_begin_verification),
(on_greeter_begin_verification_for_user), (on_greeter_answer),
(on_greeter_session_selected), (on_greeter_language_selected),
(on_greeter_cancel), (on_greeter_connected),
(gdm_simple_slave_stop), (gdm_simple_slave_init):
* daemon/test-session.c: (on_open), (on_session_started),
(on_session_exited), (on_session_died), (on_user_verified),
(on_user_verification_error), (on_info_query), (on_info),
(on_problem), (on_secret_info_query), (import_environment), (main):
Make SessionRelay and SessionDirect (was Session) implement a common
interface GdmSession. Push some code that lived in the simple and product
slaves into the SessionDirect class. Using an interface has a few
advantages besides ensuring consistency: makes it easier to do some
abstraction in the slave classes, makes it possible to more easily
implement other non-pam backends.
Add a stub for a selected-user-changed signal from the session interface.
This will be used to update the user selection in the greeter when the
user is set from the backend.
2007-10-29 William Jon McCann <mccann@jhu.edu>
* daemon/Makefile.am:
......
......@@ -66,6 +66,11 @@ noinst_PROGRAMS = \
test_session_SOURCES = \
test-session.c \
ck-connector.h \
ck-connector.c \
gdm-session.c \
gdm-session.h \
gdm-session-private.h \
gdm-session-direct.c \
gdm-session-direct.h \
gdm-session-record.c \
......@@ -96,6 +101,9 @@ gdm_simple_slave_SOURCES = \
ck-connector.c \
gdm-server.c \
gdm-server.h \
gdm-session.c \
gdm-session.h \
gdm-session-private.h \
gdm-session-direct.c \
gdm-session-direct.h \
gdm-session-record.c \
......@@ -130,6 +138,9 @@ gdm_factory_slave_SOURCES = \
ck-connector.c \
gdm-server.c \
gdm-server.h \
gdm-session.c \
gdm-session.h \
gdm-session-private.h \
gdm-session-relay.c \
gdm-session-relay.h \
gdm-slave.c \
......@@ -153,6 +164,9 @@ gdm_product_slave_SOURCES = \
gdm-server.h \
ck-connector.h \
ck-connector.c \
gdm-session.c \
gdm-session.h \
gdm-session-private.h \
gdm-session-direct.c \
gdm-session-direct.h \
gdm-session-record.c \
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -22,6 +22,7 @@
#define __GDM_SESSION_DIRECT_H
#include <glib-object.h>
#include "gdm-session.h"
G_BEGIN_DECLS
......@@ -37,48 +38,13 @@ typedef struct _GdmSessionDirectPrivate GdmSessionDirectPrivate;
typedef struct
{
GObject parent;
/*< private > */
GObject parent;
GdmSessionDirectPrivate *priv;
} GdmSessionDirect;
typedef struct
{
GObjectClass parent_class;
/* signals */
void (* opened) (GdmSessionDirect *session_direct);
void (* closed) (GdmSessionDirect *session_direct);
void (* user_verified) (GdmSessionDirect *session_direct);
void (* user_verification_error) (GdmSessionDirect *session_direct,
GError *error);
void (* info_query) (GdmSessionDirect *session_direct,
const char *query_text);
void (* secret_info_query) (GdmSessionDirect *session_direct,
const char *query_text);
void (* info) (GdmSessionDirect *session_direct,
const char *info);
void (* problem) (GdmSessionDirect *session_direct,
const char *problem);
void (* session_started) (GdmSessionDirect *session_direct,
GPid pid);
void (* session_startup_error) (GdmSessionDirect *session_direct,
GError *error);
void (* session_exited) (GdmSessionDirect *session_direct,
int exit_code);
void (* session_died) (GdmSessionDirect *session_direct,
int signal_number);
} GdmSessionDirectClass;
typedef enum _GdmSessionDirectError {
......@@ -97,31 +63,13 @@ typedef enum _GdmSessionDirectError {
GType gdm_session_direct_get_type (void);
GQuark gdm_session_direct_error_quark (void);
GdmSessionDirect * gdm_session_direct_new (void) G_GNUC_MALLOC;
gboolean gdm_session_direct_open (GdmSessionDirect *session_direct,
const char *service_name,
const char *hostname,
const char *x11_display_name,
const char *console_name,
GError **error);
void gdm_session_direct_close (GdmSessionDirect *session_direct);
gboolean gdm_session_direct_begin_verification (GdmSessionDirect *session_direct,
const char *username,
GError **error);
void gdm_session_direct_start_program (GdmSessionDirect *session_direct,
const char *command);
void gdm_session_direct_set_environment_variable (GdmSessionDirect *session_direct,
const char *key,
const char *value);
void gdm_session_direct_answer_query (GdmSessionDirect *session_direct,
const char *answer);
GdmSessionDirect * gdm_session_direct_new (const char *display_name,
const char *display_hostname,
const char *display_device,
gboolean display_is_local) G_GNUC_MALLOC;
char * gdm_session_direct_get_username (GdmSessionDirect *session_direct);
gboolean gdm_session_direct_is_running (GdmSessionDirect *session_direct);
G_END_DECLS
#endif /* GDM_SESSION_DIRECT_H */
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
*
* Copyright (C) 2007 William Jon McCann <mccann@jhu.edu>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
#ifndef __GDM_SESSION_PRIVATE_H
#define __GDM_SESSION_PRIVATE_H
#include <glib-object.h>
#include "gdm-session.h"
G_BEGIN_DECLS
void _gdm_session_user_verified (GdmSession *session);
void _gdm_session_user_verification_error (GdmSession *session,
const char *text);
void _gdm_session_info_query (GdmSession *session,
const char *text);
void _gdm_session_secret_info_query (GdmSession *session,
const char *text);
void _gdm_session_info (GdmSession *session,
const char *text);
void _gdm_session_problem (GdmSession *session,
const char *text);
void _gdm_session_session_started (GdmSession *session);
void _gdm_session_session_startup_error (GdmSession *session,
const char *message);
void _gdm_session_session_exited (GdmSession *session,
int exit_code);
void _gdm_session_session_died (GdmSession *session,
int signal_number);
void _gdm_session_opened (GdmSession *session);
void _gdm_session_closed (GdmSession *session);
void _gdm_session_selected_user_changed (GdmSession *session,
const char *text);
G_END_DECLS
#endif /* __GDM_SESSION_PRIVATE_H */
This diff is collapsed.
......@@ -24,6 +24,8 @@
#include <glib-object.h>
#include "gdm-session.h"
G_BEGIN_DECLS
#define GDM_TYPE_SESSION_RELAY (gdm_session_relay_get_type ())
......@@ -45,59 +47,14 @@ typedef struct
{
GObjectClass parent_class;
void (* user_verified) (GdmSessionRelay *session_relay);
void (* user_verification_error) (GdmSessionRelay *session_relay,
GError *error);
void (* info_query) (GdmSessionRelay *session_relay,
const char *query_text);
void (* secret_info_query) (GdmSessionRelay *session_relay,
const char *query_text);
void (* info) (GdmSessionRelay *session_relay,
const char *info);
void (* problem) (GdmSessionRelay *session_relay,
const char *problem);
void (* session_started) (GdmSessionRelay *session_relay,
GPid pid);
void (* session_startup_error) (GdmSessionRelay *session_relay,
GError *error);
void (* session_exited) (GdmSessionRelay *session_relay,
int exit_code);
void (* session_died) (GdmSessionRelay *session_relay,
int signal_number);
void (* opened) (GdmSessionRelay *session_relay);
/* Signals */
void (* connected) (GdmSessionRelay *session_relay);
void (* disconnected) (GdmSessionRelay *session_relay);
} GdmSessionRelayClass;
GType gdm_session_relay_get_type (void);
GdmSessionRelay * gdm_session_relay_new (void);
void gdm_session_relay_begin_verification (GdmSessionRelay *session_relay);
void gdm_session_relay_begin_verification_for_user (GdmSessionRelay *session_relay,
const char *username);
void gdm_session_relay_answer_query (GdmSessionRelay *session_relay,
const char *text);
void gdm_session_relay_open (GdmSessionRelay *session_relay);
void gdm_session_relay_select_session (GdmSessionRelay *session_relay,
const char *session);
void gdm_session_relay_select_language (GdmSessionRelay *session_relay,
const char *language);
void gdm_session_relay_select_user (GdmSessionRelay *session_relay,
const char *user);
void gdm_session_relay_cancel (GdmSessionRelay *session_relay);
gboolean gdm_session_relay_start (GdmSessionRelay *session_relay);
gboolean gdm_session_relay_stop (GdmSessionRelay *session_relay);
char * gdm_session_relay_get_address (GdmSessionRelay *session_relay);
......
This diff is collapsed.
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
*
* Copyright (C) 2007 William Jon McCann <mccann@jhu.edu>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
#ifndef __GDM_SESSION_H
#define __GDM_SESSION_H
#include <glib-object.h>
G_BEGIN_DECLS
#define GDM_TYPE_SESSION (gdm_session_get_type ())
#define GDM_SESSION(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GDM_TYPE_SESSION, GdmSession))
#define GDM_SESSION_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GDM_TYPE_SESSION, GdmSessionClass))
#define GDM_IS_SESSION(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GDM_TYPE_SESSION))
#define GDM_SESSION_GET_IFACE(o) (G_TYPE_INSTANCE_GET_INTERFACE ((o), GDM_TYPE_SESSION, GdmSessionIface))
typedef struct _GdmSession GdmSession; /* Dummy typedef */
typedef struct _GdmSessionIface GdmSessionIface;
struct _GdmSessionIface
{
GTypeInterface base_iface;
/* Methods */
void (* begin_verification) (GdmSession *session);
void (* begin_verification_for_user) (GdmSession *session,
const char *username);
void (* answer_query) (GdmSession *session,
const char *text);
void (* select_language) (GdmSession *session,
const char *text);
void (* select_session) (GdmSession *session,
const char *text);
void (* select_user) (GdmSession *session,
const char *text);
void (* open) (GdmSession *session);
void (* close) (GdmSession *session);
void (* cancel) (GdmSession *session);
void (* start_session) (GdmSession *session);
/* Signals */
void (* user_verified) (GdmSession *session);
void (* user_verification_error) (GdmSession *session,
const char *message);
void (* info_query) (GdmSession *session,
const char *query_text);
void (* secret_info_query) (GdmSession *session,
const char *query_text);
void (* info) (GdmSession *session,
const char *info);
void (* problem) (GdmSession *session,
const char *problem);
void (* session_started) (GdmSession *session);
void (* session_startup_error) (GdmSession *session,
const char *message);
void (* session_exited) (GdmSession *session,
int exit_code);
void (* session_died) (GdmSession *session,
int signal_number);
void (* opened) (GdmSession *session);
void (* closed) (GdmSession *session);
void (* selected_user_changed) (GdmSession *session,
const char *text);
};
GType gdm_session_get_type (void) G_GNUC_CONST;
void gdm_session_begin_verification (GdmSession *session);
void gdm_session_begin_verification_for_user (GdmSession *session,
const char *username);
void gdm_session_answer_query (GdmSession *session,
const char *text);
void gdm_session_select_session (GdmSession *session,
const char *session_name);
void gdm_session_select_language (GdmSession *session,
const char *language);
void gdm_session_select_user (GdmSession *session,
const char *username);
void gdm_session_open (GdmSession *session);
void gdm_session_close (GdmSession *session);
void gdm_session_cancel (GdmSession *session);
void gdm_session_start_session (GdmSession *session);
G_END_DECLS
#endif /* __GDM_SESSION_H */
This diff is collapsed.
......@@ -33,33 +33,22 @@
static GMainLoop *loop;
static void
on_open (GdmSessionDirect *session,
on_open (GdmSession *session,
const char *username)
{
GError *error;
gboolean res;
g_debug ("Got opened: begin auth for %s", username ? username : "(null)");
error = NULL;
res = gdm_session_direct_begin_verification (session,
username,
&error);
if (! res) {
g_warning ("Unable to begin verification: %s", error->message);
g_error_free (error);
}
gdm_session_begin_verification (session);
}
static void
on_session_started (GdmSessionDirect *session,
GPid pid)
on_session_started (GdmSession *session)
{
g_print ("session started on pid %d\n", (int) pid);
g_print ("session started");
}
static void
on_session_exited (GdmSessionDirect *session,
on_session_exited (GdmSession *session,
int exit_code)
{
g_print ("session exited with code %d\n", exit_code);
......@@ -67,7 +56,7 @@ on_session_exited (GdmSessionDirect *session,
}
static void
on_session_died (GdmSessionDirect *session,
on_session_died (GdmSession *session,
int signal_number)
{
g_print ("session died with signal %d, (%s)",
......@@ -77,38 +66,36 @@ on_session_died (GdmSessionDirect *session,
}
static void
on_user_verified (GdmSessionDirect *session)
on_user_verified (GdmSession *session)
{
char *username;
const char *command = "/usr/bin/gedit /tmp/foo.log";
username = gdm_session_direct_get_username (session);
username = gdm_session_direct_get_username (GDM_SESSION_DIRECT (session));
g_print ("%s%ssuccessfully authenticated\n",
username ? username : "", username ? " " : "");
g_free (username);
gdm_session_direct_start_program (session, command);
gdm_session_start_session (session);
}
static void
on_user_verification_error (GdmSessionDirect *session,
GError *error)
on_user_verification_error (GdmSession *session,
const char *message)
{
char *username;
username = gdm_session_direct_get_username (session);
username = gdm_session_direct_get_username (GDM_SESSION_DIRECT (session));
g_print ("%s%scould not be successfully authenticated: %s\n",
username ? username : "", username ? " " : "",
error->message);
message);
g_free (username);
exit (1);
}
static void
on_info_query (GdmSessionDirect *session,
on_info_query (GdmSession *session,
const char *query_text)
{
char answer[1024];
......@@ -119,29 +106,29 @@ on_info_query (GdmSessionDirect *session,
answer[strlen(answer) - 1] = '\0';
if (answer[0] == '\0') {
gdm_session_direct_close (session);
gdm_session_close (session);
g_main_loop_quit (loop);
} else {
gdm_session_direct_answer_query (session, answer);
gdm_session_answer_query (session, answer);
}
}
static void
on_info (GdmSessionDirect *session,
on_info (GdmSession *session,
const char *info)
{
g_print ("\n** NOTE: %s\n", info);
}
static void
on_problem (GdmSessionDirect *session,
on_problem (GdmSession *session,
const char *problem)
{
g_print ("\n** WARNING: %s\n", problem);
}
static void
on_secret_info_query (GdmSessionDirect *session,
on_secret_info_query (GdmSession *session,
const char *query_text)
{
char answer[1024];
......@@ -166,23 +153,12 @@ on_secret_info_query (GdmSessionDirect *session,
g_print ("\n");
gdm_session_direct_answer_query (session, answer);
gdm_session_answer_query (session, answer);
}
static void
import_environment (GdmSessionDirect *session)
{
if (g_getenv ("PATH") != NULL)
gdm_session_direct_set_environment_variable (session, "PATH",
g_getenv ("PATH"));
if (g_getenv ("DISPLAY") != NULL)
gdm_session_direct_set_environment_variable (session, "DISPLAY",
g_getenv ("DISPLAY"));
if (g_getenv ("XAUTHORITY") != NULL)
gdm_session_direct_set_environment_variable (session, "XAUTHORITY",
g_getenv ("XAUTHORITY"));
}
int
......@@ -190,8 +166,8 @@ main (int argc,
char *argv[])
{
GdmSessionDirect *session;
char *username;
int exit_code;
char *username;
int exit_code;
exit_code = 0;
......@@ -200,9 +176,12 @@ main (int argc,
g_type_init ();
do {
g_message ("creating instance of 'user session' object...");
session = gdm_session_direct_new ();
g_message ("'user session' object created successfully");
g_debug ("creating instance of GdmSessionDirect object...");
session = gdm_session_direct_new (":0",
g_get_host_name (),
ttyname (STDIN_FILENO),
TRUE);
g_debug ("GdmSessionDirect object created successfully");
if (argc <= 1) {
username = NULL;
......@@ -210,12 +189,7 @@ main (int argc,
username = argv[1];
}
gdm_session_direct_open (session,
"gdm",
"",
":0",
ttyname (STDIN_FILENO),
NULL);
gdm_session_open (GDM_SESSION (session));
g_signal_connect (session, "opened",
G_CALLBACK (on_open),
......@@ -263,9 +237,9 @@ main (int argc,
g_main_loop_run (loop);
g_main_loop_unref (loop);
g_message ("destroying previously created 'user session' object...");
g_message ("destroying previously created GdmSessionDirect object...");
g_object_unref (session);
g_message ("'user session' object destroyed successfully");
g_message ("GdmSessionDirect object destroyed successfully");
} while (1);
return exit_code;
......
2007-10-29 William Jon McCann <mccann@jhu.edu>
reviewed by: <delete if not using a buddy>
* POTFILES.in:
2007-10-29 Kjartan Maraas <kmaraas@gnome.org>
* nb.po: Updated Norwegian bokmål translation.
......
......@@ -28,6 +28,7 @@ daemon/gdm-product-slave.c
daemon/gdm-server.c
daemon/gdm-session.c
daemon/gdm-session-relay.c
daemon/gdm-session-direct.c
daemon/gdm-session-worker.c
daemon/gdm-session-worker-job.c
daemon/gdm-simple-slave.c
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment