diff options
author | William Jon McCann <mccann@jhu.edu> | 2007-10-29 21:06:50 +0000 |
---|---|---|
committer | William Jon McCann <mccann@src.gnome.org> | 2007-10-29 21:06:50 +0000 |
commit | 613d29b63282b97e0a7a35514e1989a854e8566f (patch) | |
tree | 5e3adf337ec2922336d56bbd74cff41af26261ce | |
parent | 327b2e24e6711e1717676900458a9885c4d4c686 (diff) | |
download | gdm-613d29b63282b97e0a7a35514e1989a854e8566f.tar.gz |
Rename GdmSession to GdmSessionDirect in preparation for adding a
2007-10-29 William Jon McCann <mccann@jhu.edu>
* daemon/Makefile.am:
* daemon/gdm-product-slave.c: (on_session_opened),
(on_session_started), (on_session_exited), (on_session_died),
(slave_open_ck_session), (setup_session_environment),
(setup_session), (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_relay_begin_verification),
(on_relay_begin_verification_for_user), (on_relay_answer),
(reset_session), (on_relay_open), (create_new_session),
(on_relay_cancelled), (gdm_product_slave_stop):
* daemon/gdm-session-direct.c: (gdm_session_direct_error_quark),
(send_dbus_string_signal),
(gdm_session_direct_user_verification_error_handler),
(gdm_session_direct_started_handler),
(gdm_session_direct_startup_error_handler),
(gdm_session_direct_exited_handler),
(gdm_session_direct_class_install_signals),
(gdm_session_direct_finalize), (gdm_session_direct_class_init),
(gdm_session_direct_handle_verified),
(gdm_session_direct_handle_verification_failed),
(gdm_session_direct_handle_username_changed),
(cancel_pending_query), (answer_pending_query),
(set_pending_query), (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), (session_worker_message),
(handle_connection), (setup_server), (gdm_session_direct_init),
(gdm_session_direct_new), (worker_stopped), (worker_started),
(worker_exited), (worker_died), (start_worker),
(gdm_session_direct_open), (send_begin_verification),
(send_begin_verification_for_user),
(gdm_session_direct_begin_verification),
(send_environment_variable), (send_environment),
(gdm_session_direct_start_program), (gdm_session_direct_close),
(gdm_session_direct_is_running),
(gdm_session_direct_set_environment_variable),
(gdm_session_direct_answer_query),
(gdm_session_direct_get_username):
* daemon/gdm-session-direct.h:
* daemon/gdm-session-relay.h:
* daemon/gdm-session.c:
* daemon/gdm-session.h:
* daemon/gdm-simple-slave.c: (on_session_started),
(on_session_exited), (on_session_died), (add_user_authorization),
(slave_open_ck_session), (setup_session_environment),
(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),
(create_new_session), (on_greeter_begin_verification),
(on_greeter_begin_verification_for_user), (on_greeter_answer),
(on_greeter_cancel), (on_greeter_connected),
(gdm_simple_slave_stop):
* daemon/gdm-slave.c:
* 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):
Rename GdmSession to GdmSessionDirect in preparation for adding
a GdmSession interface. Naming is hard.
svn path=/trunk/; revision=5451
-rw-r--r-- | ChangeLog | 67 | ||||
-rw-r--r-- | daemon/Makefile.am | 12 | ||||
-rw-r--r-- | daemon/gdm-product-slave.c | 64 | ||||
-rw-r--r-- | daemon/gdm-session-direct.c (renamed from daemon/gdm-session.c) | 318 | ||||
-rw-r--r-- | daemon/gdm-session-direct.h | 127 | ||||
-rw-r--r-- | daemon/gdm-session-relay.h | 4 | ||||
-rw-r--r-- | daemon/gdm-session.h | 127 | ||||
-rw-r--r-- | daemon/gdm-simple-slave.c | 70 | ||||
-rw-r--r-- | daemon/gdm-slave.c | 1 | ||||
-rw-r--r-- | daemon/test-session.c | 70 |
10 files changed, 463 insertions, 397 deletions
@@ -1,5 +1,72 @@ 2007-10-29 William Jon McCann <mccann@jhu.edu> + * daemon/Makefile.am: + * daemon/gdm-product-slave.c: (on_session_opened), + (on_session_started), (on_session_exited), (on_session_died), + (slave_open_ck_session), (setup_session_environment), + (setup_session), (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_relay_begin_verification), + (on_relay_begin_verification_for_user), (on_relay_answer), + (reset_session), (on_relay_open), (create_new_session), + (on_relay_cancelled), (gdm_product_slave_stop): + * daemon/gdm-session-direct.c: (gdm_session_direct_error_quark), + (send_dbus_string_signal), + (gdm_session_direct_user_verification_error_handler), + (gdm_session_direct_started_handler), + (gdm_session_direct_startup_error_handler), + (gdm_session_direct_exited_handler), + (gdm_session_direct_class_install_signals), + (gdm_session_direct_finalize), (gdm_session_direct_class_init), + (gdm_session_direct_handle_verified), + (gdm_session_direct_handle_verification_failed), + (gdm_session_direct_handle_username_changed), + (cancel_pending_query), (answer_pending_query), + (set_pending_query), (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), (session_worker_message), + (handle_connection), (setup_server), (gdm_session_direct_init), + (gdm_session_direct_new), (worker_stopped), (worker_started), + (worker_exited), (worker_died), (start_worker), + (gdm_session_direct_open), (send_begin_verification), + (send_begin_verification_for_user), + (gdm_session_direct_begin_verification), + (send_environment_variable), (send_environment), + (gdm_session_direct_start_program), (gdm_session_direct_close), + (gdm_session_direct_is_running), + (gdm_session_direct_set_environment_variable), + (gdm_session_direct_answer_query), + (gdm_session_direct_get_username): + * daemon/gdm-session-direct.h: + * daemon/gdm-session-relay.h: + * daemon/gdm-session.c: + * daemon/gdm-session.h: + * daemon/gdm-simple-slave.c: (on_session_started), + (on_session_exited), (on_session_died), (add_user_authorization), + (slave_open_ck_session), (setup_session_environment), + (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), + (create_new_session), (on_greeter_begin_verification), + (on_greeter_begin_verification_for_user), (on_greeter_answer), + (on_greeter_cancel), (on_greeter_connected), + (gdm_simple_slave_stop): + * daemon/gdm-slave.c: + * 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): + Rename GdmSession to GdmSessionDirect in preparation for adding + a GdmSession interface. Naming is hard. + +2007-10-29 William Jon McCann <mccann@jhu.edu> + * daemon/gdm-factory-slave.c: (setup_server), (run_greeter), (idle_connect_to_display): * daemon/gdm-product-slave.c: (setup_server): diff --git a/daemon/Makefile.am b/daemon/Makefile.am index af56e8c2..d3fa98dd 100644 --- a/daemon/Makefile.am +++ b/daemon/Makefile.am @@ -66,8 +66,8 @@ noinst_PROGRAMS = \ test_session_SOURCES = \ test-session.c \ - gdm-session.c \ - gdm-session.h \ + gdm-session-direct.c \ + gdm-session-direct.h \ gdm-session-record.c \ gdm-session-record.h \ gdm-session-worker-job.c\ @@ -96,8 +96,8 @@ gdm_simple_slave_SOURCES = \ ck-connector.c \ gdm-server.c \ gdm-server.h \ - gdm-session.c \ - gdm-session.h \ + gdm-session-direct.c \ + gdm-session-direct.h \ gdm-session-record.c \ gdm-session-record.h \ gdm-session-worker-job.c \ @@ -153,8 +153,8 @@ gdm_product_slave_SOURCES = \ gdm-server.h \ ck-connector.h \ ck-connector.c \ - gdm-session.c \ - gdm-session.h \ + gdm-session-direct.c \ + gdm-session-direct.h \ gdm-session-record.c \ gdm-session-record.h \ gdm-session-worker-job.c \ diff --git a/daemon/gdm-product-slave.c b/daemon/gdm-product-slave.c index 1417984f..56957127 100644 --- a/daemon/gdm-product-slave.c +++ b/daemon/gdm-product-slave.c @@ -48,7 +48,7 @@ #include "gdm-product-slave-glue.h" #include "gdm-server.h" -#include "gdm-session.h" +#include "gdm-session-direct.h" #include "ck-connector.h" @@ -84,7 +84,7 @@ struct GdmProductSlavePrivate CkConnector *ckc; GdmServer *server; - GdmSession *session; + GdmSessionDirect *session; DBusGProxy *session_relay_proxy; DBusGConnection *session_relay_connection; DBusGProxy *product_display_proxy; @@ -139,7 +139,7 @@ relay_session_opened (GdmProductSlave *slave) } static void -on_session_opened (GdmSession *session, +on_session_opened (GdmSessionDirect *session, GdmProductSlave *slave) { g_debug ("session opened"); @@ -158,7 +158,7 @@ disconnect_relay (GdmProductSlave *slave) } static void -on_session_started (GdmSession *session, +on_session_started (GdmSessionDirect *session, GPid pid, GdmProductSlave *slave) { @@ -170,7 +170,7 @@ on_session_started (GdmSession *session, } static void -on_session_exited (GdmSession *session, +on_session_exited (GdmSessionDirect *session, int exit_code, GdmProductSlave *slave) { @@ -180,7 +180,7 @@ on_session_exited (GdmSession *session, } static void -on_session_died (GdmSession *session, +on_session_died (GdmSessionDirect *session, int signal_number, GdmProductSlave *slave) { @@ -313,7 +313,7 @@ slave_open_ck_session (GdmProductSlave *slave, g_return_val_if_fail (GDM_IS_SLAVE (slave), FALSE); - username = gdm_session_get_username (slave->priv->session); + username = gdm_session_direct_get_username (slave->priv->session); x11_display_device = NULL; @@ -403,28 +403,28 @@ setup_session_environment (GdmProductSlave *slave) "display-x11-authority-file", &auth_file, NULL); - gdm_session_set_environment_variable (slave->priv->session, + gdm_session_direct_set_environment_variable (slave->priv->session, "GDMSESSION", slave->priv->selected_session); - gdm_session_set_environment_variable (slave->priv->session, + gdm_session_direct_set_environment_variable (slave->priv->session, "DESKTOP_SESSION", slave->priv->selected_session); - gdm_session_set_environment_variable (slave->priv->session, + gdm_session_direct_set_environment_variable (slave->priv->session, "LANG", slave->priv->selected_language); - gdm_session_set_environment_variable (slave->priv->session, + gdm_session_direct_set_environment_variable (slave->priv->session, "GDM_LANG", slave->priv->selected_language); - gdm_session_set_environment_variable (slave->priv->session, + gdm_session_direct_set_environment_variable (slave->priv->session, "DISPLAY", display_name); - gdm_session_set_environment_variable (slave->priv->session, + gdm_session_direct_set_environment_variable (slave->priv->session, "XAUTHORITY", auth_file); - gdm_session_set_environment_variable (slave->priv->session, + gdm_session_direct_set_environment_variable (slave->priv->session, "PATH", "/bin:/usr/bin:" BINDIR); @@ -447,7 +447,7 @@ setup_session (GdmProductSlave *slave) char *filename; gboolean res; - username = gdm_session_get_username (slave->priv->session); + username = gdm_session_direct_get_username (slave->priv->session); g_debug ("%s%ssuccessfully authenticated\n", username ? username : "", @@ -468,7 +468,7 @@ setup_session (GdmProductSlave *slave) return FALSE; } - gdm_session_start_program (slave->priv->session, command); + gdm_session_direct_start_program (slave->priv->session, command); g_free (filename); g_free (command); @@ -553,7 +553,7 @@ gdm_product_slave_create_server (GdmProductSlave *slave) } static void -on_session_user_verified (GdmSession *session, +on_session_user_verified (GdmSessionDirect *session, GdmProductSlave *slave) { GError *error; @@ -576,7 +576,7 @@ on_session_user_verified (GdmSession *session, } static void -on_session_user_verification_error (GdmSession *session, +on_session_user_verification_error (GdmSessionDirect *session, GError *error, GdmProductSlave *slave) { @@ -584,7 +584,7 @@ on_session_user_verification_error (GdmSession *session, GError *local_error; gboolean res; - username = gdm_session_get_username (session); + username = gdm_session_direct_get_username (session); g_debug ("%s%scould not be successfully authenticated: %s\n", username ? username : "", @@ -607,7 +607,7 @@ on_session_user_verification_error (GdmSession *session, } static void -on_session_info (GdmSession *session, +on_session_info (GdmSessionDirect *session, const char *text, GdmProductSlave *slave) { @@ -630,7 +630,7 @@ on_session_info (GdmSession *session, } static void -on_session_problem (GdmSession *session, +on_session_problem (GdmSessionDirect *session, const char *text, GdmProductSlave *slave) { @@ -654,7 +654,7 @@ on_session_problem (GdmSession *session, } static void -on_session_info_query (GdmSession *session, +on_session_info_query (GdmSessionDirect *session, const char *text, GdmProductSlave *slave) { @@ -677,7 +677,7 @@ on_session_info_query (GdmSession *session, } static void -on_session_secret_info_query (GdmSession *session, +on_session_secret_info_query (GdmSessionDirect *session, const char *text, GdmProductSlave *slave) { @@ -711,7 +711,7 @@ on_relay_begin_verification (DBusGProxy *proxy, g_debug ("Relay BeginVerification"); error = NULL; - res = gdm_session_begin_verification (slave->priv->session, + res = gdm_session_direct_begin_verification (slave->priv->session, NULL, &error); if (! res) { @@ -732,7 +732,7 @@ on_relay_begin_verification_for_user (DBusGProxy *proxy, g_debug ("Relay BeginVerificationForUser"); error = NULL; - res = gdm_session_begin_verification (slave->priv->session, + res = gdm_session_direct_begin_verification (slave->priv->session, username, &error); if (! res) { @@ -750,7 +750,7 @@ on_relay_answer (DBusGProxy *proxy, g_debug ("Relay Answer"); - gdm_session_answer_query (slave->priv->session, text); + gdm_session_direct_answer_query (slave->priv->session, text); } static void @@ -790,8 +790,8 @@ reset_session (GdmProductSlave *slave) "display-name", &display_name, NULL); - gdm_session_close (slave->priv->session); - res = gdm_session_open (slave->priv->session, + gdm_session_direct_close (slave->priv->session); + res = gdm_session_direct_open (slave->priv->session, "gdm", "", display_name, @@ -838,7 +838,7 @@ on_relay_open (DBusGProxy *proxy, NULL); error = NULL; - res = gdm_session_open (slave->priv->session, + res = gdm_session_direct_open (slave->priv->session, "gdm", "", display_name, @@ -855,7 +855,7 @@ on_relay_open (DBusGProxy *proxy, static void create_new_session (GdmProductSlave *slave) { - slave->priv->session = gdm_session_new (); + slave->priv->session = gdm_session_direct_new (); g_signal_connect (slave->priv->session, "opened", @@ -915,7 +915,7 @@ on_relay_cancelled (DBusGProxy *proxy, g_debug ("Relay cancelled"); if (slave->priv->session != NULL) { - gdm_session_close (slave->priv->session); + gdm_session_direct_close (slave->priv->session); g_object_unref (slave->priv->session); } @@ -1133,7 +1133,7 @@ gdm_product_slave_stop (GdmSlave *slave) res = GDM_SLAVE_CLASS (gdm_product_slave_parent_class)->stop (slave); if (GDM_PRODUCT_SLAVE (slave)->priv->session != NULL) { - gdm_session_close (GDM_PRODUCT_SLAVE (slave)->priv->session); + gdm_session_direct_close (GDM_PRODUCT_SLAVE (slave)->priv->session); g_object_unref (GDM_PRODUCT_SLAVE (slave)->priv->session); GDM_PRODUCT_SLAVE (slave)->priv->session = NULL; } diff --git a/daemon/gdm-session.c b/daemon/gdm-session-direct.c index 3bda4838..5cf948d9 100644 --- a/daemon/gdm-session.c +++ b/daemon/gdm-session-direct.c @@ -45,7 +45,7 @@ #include <dbus/dbus-glib.h> #include <dbus/dbus-glib-lowlevel.h> -#include "gdm-session.h" +#include "gdm-session-direct.h" #include "gdm-session-record.h" #include "gdm-session-worker-job.h" @@ -53,7 +53,7 @@ #define GDM_SESSION_DBUS_INTERFACE "org.gnome.DisplayManager.Session" #define GDM_SESSION_DBUS_ERROR_CANCEL "org.gnome.DisplayManager.Session.Error.Cancel" -struct _GdmSessionPrivate +struct _GdmSessionDirectPrivate { GdmSessionWorkerJob *job; GPid session_pid; @@ -92,17 +92,17 @@ enum { LAST_SIGNAL }; -static guint gdm_session_signals [LAST_SIGNAL]; +static guint gdm_session_direct_signals [LAST_SIGNAL]; -G_DEFINE_TYPE (GdmSession, gdm_session, G_TYPE_OBJECT); +G_DEFINE_TYPE (GdmSessionDirect, gdm_session_direct, G_TYPE_OBJECT); GQuark -gdm_session_error_quark (void) +gdm_session_direct_error_quark (void) { static GQuark error_quark = 0; if (error_quark == 0) - error_quark = g_quark_from_static_string ("gdm-session"); + error_quark = g_quark_from_static_string ("gdm-session-direct"); return error_quark; } @@ -133,7 +133,7 @@ send_dbus_message (DBusConnection *connection, } static void -send_dbus_string_signal (GdmSession *session, +send_dbus_string_signal (GdmSessionDirect *session, const char *name, const char *text) { @@ -157,8 +157,8 @@ send_dbus_string_signal (GdmSession *session, } static void -gdm_session_user_verification_error_handler (GdmSession *session, - GError *error) +gdm_session_direct_user_verification_error_handler (GdmSessionDirect *session, + GError *error) { gdm_session_record_failed (session->priv->session_pid, session->priv->username, @@ -168,8 +168,8 @@ gdm_session_user_verification_error_handler (GdmSession *session, } static void -gdm_session_started_handler (GdmSession *session, - GPid pid) +gdm_session_direct_started_handler (GdmSessionDirect *session, + GPid pid) { gdm_session_record_login (session->priv->session_pid, @@ -180,8 +180,8 @@ gdm_session_started_handler (GdmSession *session, } static void -gdm_session_startup_error_handler (GdmSession *session, - GError *error) +gdm_session_direct_startup_error_handler (GdmSessionDirect *session, + GError *error) { gdm_session_record_login (session->priv->session_pid, session->priv->username, @@ -191,8 +191,8 @@ gdm_session_startup_error_handler (GdmSession *session, } static void -gdm_session_exited_handler (GdmSession *session, - int exit_code) +gdm_session_direct_exited_handler (GdmSessionDirect *session, + int exit_code) { gdm_session_record_logout (session->priv->session_pid, session->priv->username, @@ -202,38 +202,38 @@ gdm_session_exited_handler (GdmSession *session, } static void -gdm_session_class_install_signals (GdmSessionClass *session_class) +gdm_session_direct_class_install_signals (GdmSessionDirectClass *session_class) { GObjectClass *object_class; object_class = G_OBJECT_CLASS (session_class); - gdm_session_signals[OPENED] = + gdm_session_direct_signals[OPENED] = g_signal_new ("opened", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (GdmSessionClass, opened), + G_STRUCT_OFFSET (GdmSessionDirectClass, opened), NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); - gdm_session_signals[CLOSED] = + gdm_session_direct_signals[CLOSED] = g_signal_new ("closed", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (GdmSessionClass, closed), + G_STRUCT_OFFSET (GdmSessionDirectClass, closed), NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); session_class->user_verified = NULL; - gdm_session_signals[USER_VERIFIED] = + gdm_session_direct_signals[USER_VERIFIED] = g_signal_new ("user-verified", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (GdmSessionClass, user_verified), + G_STRUCT_OFFSET (GdmSessionDirectClass, user_verified), NULL, NULL, g_cclosure_marshal_VOID__VOID, @@ -241,24 +241,24 @@ gdm_session_class_install_signals (GdmSessionClass *session_class) 0); session_class->user_verified = NULL; - gdm_session_signals[USER_VERIFICATION_ERROR] = + gdm_session_direct_signals[USER_VERIFICATION_ERROR] = g_signal_new ("user-verification-error", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (GdmSessionClass, user_verification_error), + G_STRUCT_OFFSET (GdmSessionDirectClass, user_verification_error), NULL, NULL, g_cclosure_marshal_VOID__POINTER, G_TYPE_NONE, 1, G_TYPE_POINTER); - session_class->user_verification_error = gdm_session_user_verification_error_handler; + session_class->user_verification_error = gdm_session_direct_user_verification_error_handler; - gdm_session_signals[INFO_QUERY] = + gdm_session_direct_signals[INFO_QUERY] = g_signal_new ("info-query", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (GdmSessionClass, info_query), + G_STRUCT_OFFSET (GdmSessionDirectClass, info_query), NULL, NULL, g_cclosure_marshal_VOID__STRING, @@ -267,11 +267,11 @@ gdm_session_class_install_signals (GdmSessionClass *session_class) G_TYPE_STRING); session_class->info_query = NULL; - gdm_session_signals[SECRET_INFO_QUERY] = + gdm_session_direct_signals[SECRET_INFO_QUERY] = g_signal_new ("secret-info-query", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (GdmSessionClass, secret_info_query), + G_STRUCT_OFFSET (GdmSessionDirectClass, secret_info_query), NULL, NULL, g_cclosure_marshal_VOID__STRING, @@ -280,11 +280,11 @@ gdm_session_class_install_signals (GdmSessionClass *session_class) G_TYPE_STRING); session_class->secret_info_query = NULL; - gdm_session_signals[INFO] = + gdm_session_direct_signals[INFO] = g_signal_new ("info", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (GdmSessionClass, info), + G_STRUCT_OFFSET (GdmSessionDirectClass, info), NULL, NULL, g_cclosure_marshal_VOID__STRING, @@ -293,11 +293,11 @@ gdm_session_class_install_signals (GdmSessionClass *session_class) G_TYPE_STRING); session_class->info = NULL; - gdm_session_signals[PROBLEM] = + gdm_session_direct_signals[PROBLEM] = g_signal_new ("problem", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (GdmSessionClass, problem), + G_STRUCT_OFFSET (GdmSessionDirectClass, problem), NULL, NULL, g_cclosure_marshal_VOID__STRING, @@ -306,50 +306,50 @@ gdm_session_class_install_signals (GdmSessionClass *session_class) G_TYPE_STRING); session_class->problem = NULL; - gdm_session_signals[SESSION_STARTED] = + gdm_session_direct_signals[SESSION_STARTED] = g_signal_new ("session-started", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (GdmSessionClass, session_started), + G_STRUCT_OFFSET (GdmSessionDirectClass, session_started), NULL, NULL, g_cclosure_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT); - session_class->session_started = gdm_session_started_handler; + session_class->session_started = gdm_session_direct_started_handler; - gdm_session_signals[SESSION_STARTUP_ERROR] = + gdm_session_direct_signals[SESSION_STARTUP_ERROR] = g_signal_new ("session-startup-error", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (GdmSessionClass, session_startup_error), + G_STRUCT_OFFSET (GdmSessionDirectClass, session_startup_error), NULL, NULL, g_cclosure_marshal_VOID__POINTER, G_TYPE_NONE, 1, G_TYPE_POINTER); - session_class->session_startup_error = gdm_session_startup_error_handler; + session_class->session_startup_error = gdm_session_direct_startup_error_handler; - gdm_session_signals[SESSION_EXITED] = + gdm_session_direct_signals[SESSION_EXITED] = g_signal_new ("session-exited", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (GdmSessionClass, session_exited), + G_STRUCT_OFFSET (GdmSessionDirectClass, session_exited), NULL, NULL, g_cclosure_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT); - session_class->session_exited = gdm_session_exited_handler; + session_class->session_exited = gdm_session_direct_exited_handler; - gdm_session_signals[SESSION_DIED] = + gdm_session_direct_signals[SESSION_DIED] = g_signal_new ("session-died", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (GdmSessionClass, session_died), + G_STRUCT_OFFSET (GdmSessionDirectClass, session_died), NULL, NULL, g_cclosure_marshal_VOID__INT, @@ -360,16 +360,16 @@ gdm_session_class_install_signals (GdmSessionClass *session_class) } static void -gdm_session_finalize (GObject *object) +gdm_session_direct_finalize (GObject *object) { - GdmSession *session; + GdmSessionDirect *session; GObjectClass *parent_class; - session = GDM_SESSION (object); + session = GDM_SESSION_DIRECT (object); g_free (session->priv->username); - parent_class = G_OBJECT_CLASS (gdm_session_parent_class); + parent_class = G_OBJECT_CLASS (gdm_session_direct_parent_class); if (session->priv->environment != NULL) { g_hash_table_destroy (session->priv->environment); @@ -381,24 +381,24 @@ gdm_session_finalize (GObject *object) } static void -gdm_session_class_init (GdmSessionClass *session_class) +gdm_session_direct_class_init (GdmSessionDirectClass *session_class) { GObjectClass *object_class; object_class = G_OBJECT_CLASS (session_class); - object_class->finalize = gdm_session_finalize; + object_class->finalize = gdm_session_direct_finalize; - gdm_session_class_install_signals (session_class); + gdm_session_direct_class_install_signals (session_class); g_type_class_add_private (session_class, - sizeof (GdmSessionPrivate)); + sizeof (GdmSessionDirectPrivate)); } static DBusHandlerResult -gdm_session_handle_verified (GdmSession *session, - DBusConnection *connection, - DBusMessage *message) +gdm_session_direct_handle_verified (GdmSessionDirect *session, + DBusConnection *connection, + DBusMessage *message) { DBusMessage *reply; @@ -410,16 +410,16 @@ gdm_session_handle_verified (GdmSession *session, session->priv->is_verified = TRUE; g_signal_emit (session, - gdm_session_signals[USER_VERIFIED], + gdm_session_direct_signals[USER_VERIFIED], 0); return DBUS_HANDLER_RESULT_HANDLED; } static DBusHandlerResult -gdm_session_handle_verification_failed (GdmSession *session, - DBusConnection *connection, - DBusMessage *message) +gdm_session_direct_handle_verification_failed (GdmSessionDirect *session, + DBusConnection *connection, + DBusMessage *message) { DBusMessage *reply; DBusError error; @@ -439,13 +439,13 @@ gdm_session_handle_verification_failed (GdmSession *session, g_debug ("Emitting 'verification-failed' signal"); - gerror = g_error_new (GDM_SESSION_ERROR, - GDM_SESSION_ERROR_AUTHENTICATING, + gerror = g_error_new (GDM_SESSION_DIRECT_ERROR, + GDM_SESSION_DIRECT_ERROR_AUTHENTICATING, "%s", text); g_signal_emit (session, - gdm_session_signals[USER_VERIFICATION_ERROR], + gdm_session_direct_signals[USER_VERIFICATION_ERROR], 0, gerror); g_error_free (gerror); @@ -453,9 +453,9 @@ gdm_session_handle_verification_failed (GdmSession *session, } static DBusHandlerResult -gdm_session_handle_username_changed (GdmSession *session, - DBusConnection *connection, - DBusMessage *message) +gdm_session_direct_handle_username_changed (GdmSessionDirect *session, + DBusConnection *connection, + DBusMessage *message) { DBusMessage *reply; DBusError error; @@ -483,7 +483,7 @@ gdm_session_handle_username_changed (GdmSession *session, } static void -cancel_pending_query (GdmSession *session) +cancel_pending_query (GdmSessionDirect *session) { DBusMessage *reply; @@ -505,7 +505,7 @@ cancel_pending_query (GdmSession *session) } static void -answer_pending_query (GdmSession *session, +answer_pending_query (GdmSessionDirect *session, const char *answer) { DBusMessage *reply; @@ -525,7 +525,7 @@ answer_pending_query (GdmSession *session, } static void -set_pending_query (GdmSession *session, +set_pending_query (GdmSessionDirect *session, DBusMessage *message) { g_assert (session->priv->message_pending_reply == NULL); @@ -534,9 +534,9 @@ set_pending_query (GdmSession *session, } static DBusHandlerResult -gdm_session_handle_info_query (GdmSession *session, - DBusConnection *connection, - DBusMessage *message) +gdm_session_direct_handle_info_query (GdmSessionDirect *session, + DBusConnection *connection, + DBusMessage *message) { DBusError error; const char *text; @@ -552,16 +552,16 @@ gdm_session_handle_info_query (GdmSession *session, g_debug ("Emitting 'info-query' signal"); g_signal_emit (session, - gdm_session_signals[INFO_QUERY], + gdm_session_direct_signals[INFO_QUERY], 0, text); return DBUS_HANDLER_RESULT_HANDLED; } static DBusHandlerResult -gdm_session_handle_secret_info_query (GdmSession *session, - DBusConnection *connection, - DBusMessage *message) +gdm_session_direct_handle_secret_info_query (GdmSessionDirect *session, + DBusConnection *connection, + DBusMessage *message) { DBusError error; const char *text; @@ -578,16 +578,16 @@ gdm_session_handle_secret_info_query (GdmSession *session, g_debug ("Emitting 'secret-info-query' signal"); g_signal_emit (session, - gdm_session_signals[SECRET_INFO_QUERY], + gdm_session_direct_signals[SECRET_INFO_QUERY], 0, text); return DBUS_HANDLER_RESULT_HANDLED; } static DBusHandlerResult -gdm_session_handle_info (GdmSession *session, - DBusConnection *connection, - DBusMessage *message) +gdm_session_direct_handle_info (GdmSessionDirect *session, + DBusConnection *connection, + DBusMessage *message) { DBusMessage *reply; DBusError error; @@ -606,16 +606,16 @@ gdm_session_handle_info (GdmSession *session, g_debug ("Emitting 'info' signal"); g_signal_emit (session, - gdm_session_signals[INFO], + gdm_session_direct_signals[INFO], 0, text); return DBUS_HANDLER_RESULT_HANDLED; } static DBusHandlerResult -gdm_session_handle_problem (GdmSession *session, - DBusConnection *connection, - DBusMessage *message) +gdm_session_direct_handle_problem (GdmSessionDirect *session, + DBusConnection *connection, + DBusMessage *message) { DBusMessage *reply; DBusError error; @@ -634,15 +634,15 @@ gdm_session_handle_problem (GdmSession *session, g_debug ("Emitting 'problem' signal"); g_signal_emit (session, - gdm_session_signals[PROBLEM], + gdm_session_direct_signals[PROBLEM], 0, text); return DBUS_HANDLER_RESULT_HANDLED; } static DBusHandlerResult -gdm_session_handle_session_started (GdmSession *session, - DBusConnection *connection, - DBusMessage *message) +gdm_session_direct_handle_session_started (GdmSessionDirect *session, + DBusConnection *connection, + DBusMessage *message) { DBusMessage *reply; DBusError error; @@ -666,16 +666,16 @@ gdm_session_handle_session_started (GdmSession *session, session->priv->is_running = TRUE; g_signal_emit (session, - gdm_session_signals[SESSION_STARTED], + gdm_session_direct_signals[SESSION_STARTED], 0, pid); return DBUS_HANDLER_RESULT_HANDLED; } static DBusHandlerResult -gdm_session_handle_startup_failed (GdmSession *session, - DBusConnection *connection, - DBusMessage *message) +gdm_session_direct_handle_startup_failed (GdmSessionDirect *session, + DBusConnection *connection, + DBusMessage *message) { DBusMessage *reply; DBusError error; @@ -695,16 +695,16 @@ gdm_session_handle_startup_failed (GdmSession *session, g_debug ("Emitting 'session-startup-error' signal"); g_signal_emit (session, - gdm_session_signals[SESSION_STARTUP_ERROR], + gdm_session_direct_signals[SESSION_STARTUP_ERROR], 0, text); return DBUS_HANDLER_RESULT_HANDLED; } static DBusHandlerResult -gdm_session_handle_session_exited (GdmSession *session, - DBusConnection *connection, - DBusMessage *message) +gdm_session_direct_handle_session_exited (GdmSessionDirect *session, + DBusConnection *connection, + DBusMessage *message) { DBusMessage *reply; DBusError error; @@ -726,16 +726,16 @@ gdm_session_handle_session_exited (GdmSession *session, session->priv->is_running = FALSE; g_signal_emit (session, - gdm_session_signals[SESSION_EXITED], + gdm_session_direct_signals[SESSION_EXITED], 0, code); return DBUS_HANDLER_RESULT_HANDLED; } static DBusHandlerResult -gdm_session_handle_session_died (GdmSession *session, - DBusConnection *connection, - DBusMessage *message) +gdm_session_direct_handle_session_died (GdmSessionDirect *session, + DBusConnection *connection, + DBusMessage *message) { DBusMessage *reply; DBusError error; @@ -757,7 +757,7 @@ gdm_session_handle_session_died (GdmSession *session, session->priv->is_running = FALSE; g_signal_emit (session, - gdm_session_signals[SESSION_DIED], + gdm_session_direct_signals[SESSION_DIED], 0, code); return DBUS_HANDLER_RESULT_HANDLED; } @@ -767,30 +767,30 @@ session_worker_message (DBusConnection *connection, DBusMessage *message, void *user_data) { - GdmSession *session = GDM_SESSION (user_data); + GdmSessionDirect *session = GDM_SESSION_DIRECT (user_data); if (dbus_message_is_method_call (message, GDM_SESSION_DBUS_INTERFACE, "Verified")) { - return gdm_session_handle_verified (session, connection, message); + return gdm_session_direct_handle_verified (session, connection, message); } else if (dbus_message_is_method_call (message, GDM_SESSION_DBUS_INTERFACE, "VerificationFailed")) { - return gdm_session_handle_verification_failed (session, connection, message); + return gdm_session_direct_handle_verification_failed (session, connection, message); } else if (dbus_message_is_method_call (message, GDM_SESSION_DBUS_INTERFACE, "UsernameChanged")) { - return gdm_session_handle_username_changed (session, connection, message); + return gdm_session_direct_handle_username_changed (session, connection, message); } else if (dbus_message_is_method_call (message, GDM_SESSION_DBUS_INTERFACE, "InfoQuery")) { - return gdm_session_handle_info_query (session, connection, message); + return gdm_session_direct_handle_info_query (session, connection, message); } else if (dbus_message_is_method_call (message, GDM_SESSION_DBUS_INTERFACE, "SecretInfoQuery")) { - return gdm_session_handle_secret_info_query (session, connection, message); + return gdm_session_direct_handle_secret_info_query (session, connection, message); } else if (dbus_message_is_method_call (message, GDM_SESSION_DBUS_INTERFACE, "Info")) { - return gdm_session_handle_info (session, connection, message); + return gdm_session_direct_handle_info (session, connection, message); } else if (dbus_message_is_method_call (message, GDM_SESSION_DBUS_INTERFACE, "Problem")) { - return gdm_session_handle_problem (session, connection, message); + return gdm_session_direct_handle_problem (session, connection, message); } else if (dbus_message_is_method_call (message, GDM_SESSION_DBUS_INTERFACE, "SessionStarted")) { - return gdm_session_handle_session_started (session, connection, message); + return gdm_session_direct_handle_session_started (session, connection, message); } else if (dbus_message_is_method_call (message, GDM_SESSION_DBUS_INTERFACE, "StartupFailed")) { - return gdm_session_handle_startup_failed (session, connection, message); + return gdm_session_direct_handle_startup_failed (session, connection, message); } else if (dbus_message_is_method_call (message, GDM_SESSION_DBUS_INTERFACE, "SessionExited")) { - return gdm_session_handle_session_exited (session, connection, message); + return gdm_session_direct_handle_session_exited (session, connection, message); } else if (dbus_message_is_method_call (message, GDM_SESSION_DBUS_INTERFACE, "SessionDied")) { - return gdm_session_handle_session_died (session, connection, message); + return gdm_session_direct_handle_session_died (session, connection, message); } return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; @@ -1004,7 +1004,7 @@ handle_connection (DBusServer *server, DBusConnection *new_connection, void *user_data) { - GdmSession *session = GDM_SESSION (user_data); + GdmSessionDirect *session = GDM_SESSION_DIRECT (user_data); g_debug ("Handing new connection"); @@ -1032,12 +1032,12 @@ handle_connection (DBusServer *server, session); g_debug ("Emitting opened signal"); - g_signal_emit (session, gdm_session_signals [OPENED], 0); + g_signal_emit (session, gdm_session_direct_signals [OPENED], 0); } } static gboolean -setup_server (GdmSession *session) +setup_server (GdmSessionDirect *session) { DBusError error; gboolean ret; @@ -1079,11 +1079,11 @@ setup_server (GdmSession *session) } static void -gdm_session_init (GdmSession *session) +gdm_session_direct_init (GdmSessionDirect *session) { session->priv = G_TYPE_INSTANCE_GET_PRIVATE (session, - GDM_TYPE_SESSION, - GdmSessionPrivate); + GDM_TYPE_SESSION_DIRECT, + GdmSessionDirectPrivate); session->priv->environment = g_hash_table_new_full (g_str_hash, g_str_equal, @@ -1093,26 +1093,26 @@ gdm_session_init (GdmSession *session) setup_server (session); } -GdmSession * -gdm_session_new (void) +GdmSessionDirect * +gdm_session_direct_new (void) { - GdmSession *session; + GdmSessionDirect *session; - session = g_object_new (GDM_TYPE_SESSION, NULL); + session = g_object_new (GDM_TYPE_SESSION_DIRECT, NULL); return session; } static void worker_stopped (GdmSessionWorkerJob *job, - GdmSession *session) + GdmSessionDirect *session) { g_debug ("Worker job stopped"); } static void worker_started (GdmSessionWorkerJob *job, - GdmSession *session) + GdmSessionDirect *session) { g_debug ("Worker job started"); } @@ -1120,25 +1120,25 @@ worker_started (GdmSessionWorkerJob *job, static void worker_exited (GdmSessionWorkerJob *job, int code, - GdmSession *session) + GdmSessionDirect *session) { g_debug ("Worker job exited: %d", code); if (!session->priv->is_verified) { GError *error; - error = g_error_new (GDM_SESSION_ERROR, - GDM_SESSION_ERROR_WORKER_DIED, + error = g_error_new (GDM_SESSION_DIRECT_ERROR, + GDM_SESSION_DIRECT_ERROR_WORKER_DIED, _("worker exited with status %d"), code); g_signal_emit (session, - gdm_session_signals [USER_VERIFICATION_ERROR], + gdm_session_direct_signals [USER_VERIFICATION_ERROR], 0, error); g_error_free (error); } else if (session->priv->is_running) { g_signal_emit (session, - gdm_session_signals [SESSION_EXITED], + gdm_session_direct_signals [SESSION_EXITED], 0, code); } } @@ -1146,29 +1146,29 @@ worker_exited (GdmSessionWorkerJob *job, static void worker_died (GdmSessionWorkerJob *job, int signum, - GdmSession *session) + GdmSessionDirect *session) { g_debug ("Worker job died: %d", signum); if (!session->priv->is_verified) { GError *error; - error = g_error_new (GDM_SESSION_ERROR, - GDM_SESSION_ERROR_WORKER_DIED, + error = g_error_new (GDM_SESSION_DIRECT_ERROR, + GDM_SESSION_DIRECT_ERROR_WORKER_DIED, _("worker got signal '%s' and was subsequently killed"), g_strsignal (signum)); g_signal_emit (session, - gdm_session_signals[USER_VERIFICATION_ERROR], + gdm_session_direct_signals[USER_VERIFICATION_ERROR], 0, error); g_error_free (error); } else if (session->priv->is_running) { g_signal_emit (session, - gdm_session_signals[SESSION_EXITED], + gdm_session_direct_signals[SESSION_EXITED], 0, signum); } } static gboolean -start_worker (GdmSession *session) +start_worker (GdmSessionDirect *session) { gboolean res; @@ -1197,12 +1197,12 @@ start_worker (GdmSession *session) } gboolean -gdm_session_open (GdmSession *session, - const char *service_name, - const char *hostname, - const char *x11_display_name, - const char *display_device, - GError **error) +gdm_session_direct_open (GdmSessionDirect *session, + const char *service_name, + const char *hostname, + const char *x11_display_name, + const char *display_device, + GError **error) { gboolean res; @@ -1225,7 +1225,7 @@ gdm_session_open (GdmSession *session, } static void -send_begin_verification (GdmSession *session) +send_begin_verification (GdmSessionDirect *session) { DBusMessage *message; DBusMessageIter iter; @@ -1250,7 +1250,7 @@ send_begin_verification (GdmSession *session) } static void -send_begin_verification_for_user (GdmSession *session) +send_begin_verification_for_user (GdmSessionDirect *session) { DBusMessage *message; DBusMessageIter iter; @@ -1276,9 +1276,9 @@ send_begin_verification_for_user (GdmSession *session) } gboolean -gdm_session_begin_verification (GdmSession *session, - const char *username, - GError **error) +gdm_session_direct_begin_verification (GdmSessionDirect *session, + const char *username, + GError **error) { g_return_val_if_fail (session != NULL, FALSE); g_return_val_if_fail (dbus_connection_get_is_connected (session->priv->worker_connection), FALSE); @@ -1297,7 +1297,7 @@ gdm_session_begin_verification (GdmSession *session, static void send_environment_variable (const char *key, const char *value, - GdmSession *session) + GdmSessionDirect *session) { DBusMessage *message; DBusMessageIter iter; @@ -1318,7 +1318,7 @@ send_environment_variable (const char *key, } static void -send_environment (GdmSession *session) +send_environment (GdmSessionDirect *session) { g_hash_table_foreach (session->priv->environment, @@ -1327,12 +1327,12 @@ send_environment (GdmSession *session) } void -gdm_session_start_program (GdmSession *session, - const char *command) +gdm_session_direct_start_program (GdmSessionDirect *session, + const char *command) { g_return_if_fail (session != NULL); g_return_if_fail (session != NULL); - g_return_if_fail (gdm_session_is_running (session) == FALSE); + g_return_if_fail (gdm_session_direct_is_running (session) == FALSE); g_return_if_fail (command != NULL); send_environment (session); @@ -1341,7 +1341,7 @@ gdm_session_start_program (GdmSession *session, } void -gdm_session_close (GdmSession *session) +gdm_session_direct_close (GdmSessionDirect *session) { g_return_if_fail (session != NULL); @@ -1386,7 +1386,7 @@ gdm_session_close (GdmSession *session) } gboolean -gdm_session_is_running (GdmSession *session) +gdm_session_direct_is_running (GdmSessionDirect *session) { g_return_val_if_fail (session != NULL, FALSE); @@ -1394,9 +1394,9 @@ gdm_session_is_running (GdmSession *session) } void -gdm_session_set_environment_variable (GdmSession *session, - const char *key, - const char *value) +gdm_session_direct_set_environment_variable (GdmSessionDirect *session, + const char *key, + const char *value) { g_return_if_fail (session != NULL); g_return_if_fail (session != NULL); @@ -1409,8 +1409,8 @@ gdm_session_set_environment_variable (GdmSession *session, } void -gdm_session_answer_query (GdmSession *session, - const char *answer) +gdm_session_direct_answer_query (GdmSessionDirect *session, + const char *answer) { g_return_if_fail (session != NULL); @@ -1418,7 +1418,7 @@ gdm_session_answer_query (GdmSession *session, } char * -gdm_session_get_username (GdmSession *session) +gdm_session_direct_get_username (GdmSessionDirect *session) { g_return_val_if_fail (session != NULL, NULL); diff --git a/daemon/gdm-session-direct.h b/daemon/gdm-session-direct.h new file mode 100644 index 00000000..d4eea4c4 --- /dev/null +++ b/daemon/gdm-session-direct.h @@ -0,0 +1,127 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2006 Ray Strode <rstrode@redhat.com> + * + * 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, 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_DIRECT_H +#define __GDM_SESSION_DIRECT_H + +#include <glib-object.h> + +G_BEGIN_DECLS + +#define GDM_TYPE_SESSION_DIRECT (gdm_session_direct_get_type ()) +#define GDM_SESSION_DIRECT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GDM_TYPE_SESSION_DIRECT, GdmSessionDirect)) +#define GDM_SESSION_DIRECT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDM_TYPE_SESSION_DIRECT, GdmSessionDirectClass)) +#define GDM_IS_SESSION_DIRECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GDM_TYPE_SESSION_DIRECT)) +#define GDM_IS_SESSION_DIRECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDM_TYPE_SESSION_DIRECT)) +#define GDM_SESSION_DIRECT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GDM_TYPE_SESSION_DIRECT, GdmSessionDirectClass)) +#define GDM_SESSION_DIRECT_ERROR (gdm_session_direct_error_quark ()) + +typedef struct _GdmSessionDirectPrivate GdmSessionDirectPrivate; + +typedef struct +{ + GObject parent; + + /*< private > */ + 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 { + GDM_SESSION_DIRECT_ERROR_GENERIC = 0, + GDM_SESSION_DIRECT_ERROR_WITH_SESSION_DIRECT_COMMAND, + GDM_SESSION_DIRECT_ERROR_FORKING, + GDM_SESSION_DIRECT_ERROR_COMMUNICATING, + GDM_SESSION_DIRECT_ERROR_WORKER_DIED, + GDM_SESSION_DIRECT_ERROR_AUTHENTICATING, + GDM_SESSION_DIRECT_ERROR_AUTHORIZING, + GDM_SESSION_DIRECT_ERROR_OPENING_LOG_FILE, + GDM_SESSION_DIRECT_ERROR_OPENING_SESSION_DIRECT, + GDM_SESSION_DIRECT_ERROR_GIVING_CREDENTIALS +} 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); + +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 */ diff --git a/daemon/gdm-session-relay.h b/daemon/gdm-session-relay.h index fe0b3d18..a1d664e7 100644 --- a/daemon/gdm-session-relay.h +++ b/daemon/gdm-session-relay.h @@ -19,8 +19,8 @@ */ -#ifndef __GDM_SESSION_SERVER_H -#define __GDM_SESSION_SERVER_H +#ifndef __GDM_SESSION_RELAY_H +#define __GDM_SESSION_RELAY_H #include <glib-object.h> diff --git a/daemon/gdm-session.h b/daemon/gdm-session.h deleted file mode 100644 index fc6d183d..00000000 --- a/daemon/gdm-session.h +++ /dev/null @@ -1,127 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- - * - * Copyright (C) 2006 Ray Strode <rstrode@redhat.com> - * - * 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, 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(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GDM_TYPE_SESSION, GdmSession)) -#define GDM_SESSION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDM_TYPE_SESSION, GdmSessionClass)) -#define GDM_IS_SESSION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GDM_TYPE_SESSION)) -#define GDM_IS_SESSION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDM_TYPE_SESSION)) -#define GDM_SESSION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GDM_TYPE_SESSION, GdmSessionClass)) -#define GDM_SESSION_ERROR (gdm_session_error_quark ()) - -typedef struct _GdmSessionPrivate GdmSessionPrivate; - -typedef struct -{ - GObject parent; - - /*< private > */ - GdmSessionPrivate *priv; -} GdmSession; - -typedef struct -{ - GObjectClass parent_class; - - /* signals */ - void (* opened) (GdmSession *session); - void (* closed) (GdmSession *session); - - void (* user_verified) (GdmSession *session); - - void (* user_verification_error) (GdmSession *session, - GError *error); - - 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, - GPid pid); - - void (* session_startup_error) (GdmSession *session, - GError *error); - - void (* session_exited) (GdmSession *session, - int exit_code); - - void (* session_died) (GdmSession *session, - int signal_number); -} GdmSessionClass; - -typedef enum _GdmSessionError { - GDM_SESSION_ERROR_GENERIC = 0, - GDM_SESSION_ERROR_WITH_SESSION_COMMAND, - GDM_SESSION_ERROR_FORKING, - GDM_SESSION_ERROR_COMMUNICATING, - GDM_SESSION_ERROR_WORKER_DIED, - GDM_SESSION_ERROR_AUTHENTICATING, - GDM_SESSION_ERROR_AUTHORIZING, - GDM_SESSION_ERROR_OPENING_LOG_FILE, - GDM_SESSION_ERROR_OPENING_SESSION, - GDM_SESSION_ERROR_GIVING_CREDENTIALS -} GdmSessionError; - -GType gdm_session_get_type (void); -GQuark gdm_session_error_quark (void); - -GdmSession * gdm_session_new (void) G_GNUC_MALLOC; - -gboolean gdm_session_open (GdmSession *session, - const char *service_name, - const char *hostname, - const char *x11_display_name, - const char *console_name, - GError **error); -void gdm_session_close (GdmSession *session); -gboolean gdm_session_begin_verification (GdmSession *session, - const char *username, - GError **error); -void gdm_session_start_program (GdmSession *session, - const char *command); -void gdm_session_set_environment_variable (GdmSession *session, - const char *key, - const char *value); - -void gdm_session_answer_query (GdmSession *session, - const char *answer); - -char * gdm_session_get_username (GdmSession *session); - -gboolean gdm_session_is_running (GdmSession *session); - -G_END_DECLS - -#endif /* GDM_SESSION_H */ diff --git a/daemon/gdm-simple-slave.c b/daemon/gdm-simple-slave.c index 3a545aeb..ea82be34 100644 --- a/daemon/gdm-simple-slave.c +++ b/daemon/gdm-simple-slave.c @@ -48,7 +48,7 @@ #include "gdm-simple-slave-glue.h" #include "gdm-server.h" -#include "gdm-session.h" +#include "gdm-session-direct.h" #include "gdm-greeter-server.h" #include "gdm-greeter-session.h" @@ -84,7 +84,7 @@ struct GdmSimpleSlavePrivate GdmServer *server; GdmGreeterServer *greeter_server; GdmGreeterSession *greeter; - GdmSession *session; + GdmSessionDirect *session; DBusGConnection *connection; }; @@ -99,9 +99,9 @@ static void gdm_simple_slave_finalize (GObject *object); G_DEFINE_TYPE (GdmSimpleSlave, gdm_simple_slave, GDM_TYPE_SLAVE) static void -on_session_started (GdmSession *session, - GPid pid, - GdmSimpleSlave *slave) +on_session_started (GdmSessionDirect *session, + GPid pid, + GdmSimpleSlave *slave) { g_debug ("session started on pid %d\n", (int) pid); @@ -109,7 +109,7 @@ on_session_started (GdmSession *session, } static void -on_session_exited (GdmSession *session, +on_session_exited (GdmSessionDirect *session, int exit_code, GdmSimpleSlave *slave) { @@ -119,7 +119,7 @@ on_session_exited (GdmSession *session, } static void -on_session_died (GdmSession *session, +on_session_died (GdmSessionDirect *session, int signal_number, GdmSimpleSlave *slave) { @@ -244,7 +244,7 @@ add_user_authorization (GdmSimpleSlave *slave, char *username; gboolean ret; - username = gdm_session_get_username (slave->priv->session); + username = gdm_session_direct_get_username (slave->priv->session); ret = gdm_slave_add_user_authorization (GDM_SLAVE (slave), username, filename); @@ -268,7 +268,7 @@ slave_open_ck_session (GdmSimpleSlave *slave, g_return_val_if_fail (GDM_IS_SLAVE (slave), FALSE); - username = gdm_session_get_username (slave->priv->session); + username = gdm_session_direct_get_username (slave->priv->session); x11_display_device = NULL; @@ -354,33 +354,33 @@ setup_session_environment (GdmSimpleSlave *slave) session_cookie = ck_connector_get_cookie (slave->priv->ckc); } - gdm_session_set_environment_variable (slave->priv->session, + gdm_session_direct_set_environment_variable (slave->priv->session, "GDMSESSION", slave->priv->selected_session); - gdm_session_set_environment_variable (slave->priv->session, + gdm_session_direct_set_environment_variable (slave->priv->session, "DESKTOP_SESSION", slave->priv->selected_session); - gdm_session_set_environment_variable (slave->priv->session, + gdm_session_direct_set_environment_variable (slave->priv->session, "LANG", slave->priv->selected_language); - gdm_session_set_environment_variable (slave->priv->session, + gdm_session_direct_set_environment_variable (slave->priv->session, "GDM_LANG", slave->priv->selected_language); - gdm_session_set_environment_variable (slave->priv->session, + gdm_session_direct_set_environment_variable (slave->priv->session, "DISPLAY", display_name); - gdm_session_set_environment_variable (slave->priv->session, + gdm_session_direct_set_environment_variable (slave->priv->session, "XAUTHORITY", auth_file); if (session_cookie != NULL) { - gdm_session_set_environment_variable (slave->priv->session, + gdm_session_direct_set_environment_variable (slave->priv->session, "XDG_SESSION_COOKIE", session_cookie); } - gdm_session_set_environment_variable (slave->priv->session, + gdm_session_direct_set_environment_variable (slave->priv->session, "PATH", "/bin:/usr/bin:" BINDIR); @@ -391,7 +391,7 @@ setup_session_environment (GdmSimpleSlave *slave) } static void -on_session_user_verified (GdmSession *session, +on_session_user_verified (GdmSessionDirect *session, GdmSimpleSlave *slave) { char *username; @@ -402,7 +402,7 @@ on_session_user_verified (GdmSession *session, gdm_greeter_session_stop (slave->priv->greeter); gdm_greeter_server_stop (slave->priv->greeter_server); - username = gdm_session_get_username (session); + username = gdm_session_direct_get_username (session); g_debug ("%s%ssuccessfully authenticated\n", username ? username : "", @@ -423,7 +423,7 @@ on_session_user_verified (GdmSession *session, return; } - gdm_session_start_program (session, command); + gdm_session_direct_start_program (session, command); g_free (filename); g_free (command); @@ -448,13 +448,13 @@ queue_greeter_reset (GdmSimpleSlave *slave) } static void -on_session_user_verification_error (GdmSession *session, +on_session_user_verification_error (GdmSessionDirect *session, GError *error, GdmSimpleSlave *slave) { char *username; - username = gdm_session_get_username (session); + username = gdm_session_direct_get_username (session); g_debug ("could not successfully authenticate user '%s': %s", username, @@ -468,7 +468,7 @@ on_session_user_verification_error (GdmSession *session, } static void -on_session_info (GdmSession *session, +on_session_info (GdmSessionDirect *session, const char *text, GdmSimpleSlave *slave) { @@ -477,7 +477,7 @@ on_session_info (GdmSession *session, } static void -on_session_problem (GdmSession *session, +on_session_problem (GdmSessionDirect *session, const char *text, GdmSimpleSlave *slave) { @@ -486,7 +486,7 @@ on_session_problem (GdmSession *session, } static void -on_session_info_query (GdmSession *session, +on_session_info_query (GdmSessionDirect *session, const char *text, GdmSimpleSlave *slave) { @@ -496,7 +496,7 @@ on_session_info_query (GdmSession *session, } static void -on_session_secret_info_query (GdmSession *session, +on_session_secret_info_query (GdmSessionDirect *session, const char *text, GdmSimpleSlave *slave) { @@ -505,7 +505,7 @@ on_session_secret_info_query (GdmSession *session, } static void -on_session_opened (GdmSession *session, +on_session_opened (GdmSessionDirect *session, GdmSimpleSlave *slave) { gboolean res; @@ -522,7 +522,7 @@ create_new_session (GdmSimpleSlave *slave) { g_debug ("Creating new session"); - slave->priv->session = gdm_session_new (); + slave->priv->session = gdm_session_direct_new (); g_signal_connect (slave->priv->session, "opened", @@ -596,7 +596,7 @@ on_greeter_begin_verification (GdmGreeterServer *greeter_server, g_debug ("begin verification"); error = NULL; - res = gdm_session_begin_verification (slave->priv->session, + res = gdm_session_direct_begin_verification (slave->priv->session, NULL, &error); if (! res) { @@ -615,7 +615,7 @@ on_greeter_begin_verification_for_user (GdmGreeterServer *greeter_server, g_debug ("begin verification"); error = NULL; - res = gdm_session_begin_verification (slave->priv->session, + res = gdm_session_direct_begin_verification (slave->priv->session, username, &error); if (! res) { @@ -629,7 +629,7 @@ on_greeter_answer (GdmGreeterServer *greeter_server, const char *text, GdmSimpleSlave *slave) { - gdm_session_answer_query (slave->priv->session, text); + gdm_session_direct_answer_query (slave->priv->session, text); } static void @@ -674,7 +674,7 @@ on_greeter_cancel (GdmGreeterServer *greeter_server, NULL); if (slave->priv->session != NULL) { - gdm_session_close (slave->priv->session); + gdm_session_direct_close (slave->priv->session); g_object_unref (slave->priv->session); } @@ -686,7 +686,7 @@ on_greeter_cancel (GdmGreeterServer *greeter_server, display_device = g_strdup (""); } - gdm_session_open (slave->priv->session, + gdm_session_direct_open (slave->priv->session, "gdm", "" /* hostname */, display_name, @@ -718,7 +718,7 @@ on_greeter_connected (GdmGreeterServer *greeter_server, display_device = g_strdup (""); } - gdm_session_open (slave->priv->session, + gdm_session_direct_open (slave->priv->session, "gdm", "" /* hostname */, display_name, @@ -954,7 +954,7 @@ gdm_simple_slave_stop (GdmSlave *slave) } if (GDM_SIMPLE_SLAVE (slave)->priv->session != NULL) { - gdm_session_close (GDM_SIMPLE_SLAVE (slave)->priv->session); + gdm_session_direct_close (GDM_SIMPLE_SLAVE (slave)->priv->session); g_object_unref (GDM_SIMPLE_SLAVE (slave)->priv->session); GDM_SIMPLE_SLAVE (slave)->priv->session = NULL; } diff --git a/daemon/gdm-slave.c b/daemon/gdm-slave.c index e1485a06..063be872 100644 --- a/daemon/gdm-slave.c +++ b/daemon/gdm-slave.c @@ -50,7 +50,6 @@ #include "gdm-slave-glue.h" #include "gdm-server.h" -#include "gdm-session.h" #define GDM_SLAVE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GDM_TYPE_SLAVE, GdmSlavePrivate)) diff --git a/daemon/test-session.c b/daemon/test-session.c index 9d13361c..7bbdd5e4 100644 --- a/daemon/test-session.c +++ b/daemon/test-session.c @@ -28,12 +28,12 @@ #include <glib.h> -#include "gdm-session.h" +#include "gdm-session-direct.h" static GMainLoop *loop; static void -on_open (GdmSession *session, +on_open (GdmSessionDirect *session, const char *username) { GError *error; @@ -42,9 +42,9 @@ on_open (GdmSession *session, g_debug ("Got opened: begin auth for %s", username ? username : "(null)"); error = NULL; - res = gdm_session_begin_verification (session, - username, - &error); + res = gdm_session_direct_begin_verification (session, + username, + &error); if (! res) { g_warning ("Unable to begin verification: %s", error->message); g_error_free (error); @@ -52,14 +52,14 @@ on_open (GdmSession *session, } static void -on_session_started (GdmSession *session, +on_session_started (GdmSessionDirect *session, GPid pid) { g_print ("session started on pid %d\n", (int) pid); } static void -on_session_exited (GdmSession *session, +on_session_exited (GdmSessionDirect *session, int exit_code) { g_print ("session exited with code %d\n", exit_code); @@ -67,7 +67,7 @@ on_session_exited (GdmSession *session, } static void -on_session_died (GdmSession *session, +on_session_died (GdmSessionDirect *session, int signal_number) { g_print ("session died with signal %d, (%s)", @@ -77,27 +77,27 @@ on_session_died (GdmSession *session, } static void -on_user_verified (GdmSession *session) +on_user_verified (GdmSessionDirect *session) { char *username; const char *command = "/usr/bin/gedit /tmp/foo.log"; - username = gdm_session_get_username (session); + username = gdm_session_direct_get_username (session); g_print ("%s%ssuccessfully authenticated\n", username ? username : "", username ? " " : ""); g_free (username); - gdm_session_start_program (session, command); + gdm_session_direct_start_program (session, command); } static void -on_user_verification_error (GdmSession *session, +on_user_verification_error (GdmSessionDirect *session, GError *error) { char *username; - username = gdm_session_get_username (session); + username = gdm_session_direct_get_username (session); g_print ("%s%scould not be successfully authenticated: %s\n", username ? username : "", username ? " " : "", @@ -108,7 +108,7 @@ on_user_verification_error (GdmSession *session, } static void -on_info_query (GdmSession *session, +on_info_query (GdmSessionDirect *session, const char *query_text) { char answer[1024]; @@ -119,29 +119,29 @@ on_info_query (GdmSession *session, answer[strlen(answer) - 1] = '\0'; if (answer[0] == '\0') { - gdm_session_close (session); + gdm_session_direct_close (session); g_main_loop_quit (loop); } else { - gdm_session_answer_query (session, answer); + gdm_session_direct_answer_query (session, answer); } } static void -on_info (GdmSession *session, +on_info (GdmSessionDirect *session, const char *info) { g_print ("\n** NOTE: %s\n", info); } static void -on_problem (GdmSession *session, +on_problem (GdmSessionDirect *session, const char *problem) { g_print ("\n** WARNING: %s\n", problem); } static void -on_secret_info_query (GdmSession *session, +on_secret_info_query (GdmSessionDirect *session, const char *query_text) { char answer[1024]; @@ -166,30 +166,30 @@ on_secret_info_query (GdmSession *session, g_print ("\n"); - gdm_session_answer_query (session, answer); + gdm_session_direct_answer_query (session, answer); } static void -import_environment (GdmSession *session) +import_environment (GdmSessionDirect *session) { if (g_getenv ("PATH") != NULL) - gdm_session_set_environment_variable (session, "PATH", - g_getenv ("PATH")); + gdm_session_direct_set_environment_variable (session, "PATH", + g_getenv ("PATH")); if (g_getenv ("DISPLAY") != NULL) - gdm_session_set_environment_variable (session, "DISPLAY", - g_getenv ("DISPLAY")); + gdm_session_direct_set_environment_variable (session, "DISPLAY", + g_getenv ("DISPLAY")); if (g_getenv ("XAUTHORITY") != NULL) - gdm_session_set_environment_variable (session, "XAUTHORITY", - g_getenv ("XAUTHORITY")); + gdm_session_direct_set_environment_variable (session, "XAUTHORITY", + g_getenv ("XAUTHORITY")); } int main (int argc, char *argv[]) { - GdmSession *session; + GdmSessionDirect *session; char *username; int exit_code; @@ -201,7 +201,7 @@ main (int argc, do { g_message ("creating instance of 'user session' object..."); - session = gdm_session_new (); + session = gdm_session_direct_new (); g_message ("'user session' object created successfully"); if (argc <= 1) { @@ -210,12 +210,12 @@ main (int argc, username = argv[1]; } - gdm_session_open (session, - "gdm", - "", - ":0", - ttyname (STDIN_FILENO), - NULL); + gdm_session_direct_open (session, + "gdm", + "", + ":0", + ttyname (STDIN_FILENO), + NULL); g_signal_connect (session, "opened", G_CALLBACK (on_open), |