diff options
author | William Jon McCann <jmccann@redhat.com> | 2008-03-14 20:27:28 +0000 |
---|---|---|
committer | William Jon McCann <mccann@src.gnome.org> | 2008-03-14 20:27:28 +0000 |
commit | 6405c5b65566559bb22c47d5cac79dd44377bc8d (patch) | |
tree | 3290f047549926f0b0b3ab524be6b68a21964dc3 /daemon/gdm-product-slave.c | |
parent | fdeae4e0f9dc7730715978069b369987a9800787 (diff) | |
download | gdm-6405c5b65566559bb22c47d5cac79dd44377bc8d.tar.gz |
Refactor things a little. Rename renew to refresh. Add a pid to the
2008-03-14 William Jon McCann <jmccann@redhat.com>
* daemon/gdm-manager.c: (bus_name_owner_changed):
* daemon/gdm-product-slave.c: (send_dbus_string_method),
(send_dbus_void_method), (send_dbus_int_method),
(relay_session_started), (on_session_started),
(on_relay_refresh_credentials), (relay_dbus_handle_message):
* daemon/gdm-session-direct.c:
(gdm_session_direct_handle_session_started), (do_introspect),
(gdm_session_direct_accredit):
* daemon/gdm-session-private.h:
* daemon/gdm-session-relay.c: (gdm_session_relay_accredit),
(handle_secret_info_query), (handle_info), (handle_problem),
(handle_session_started), (do_introspect),
(gdm_session_iface_init):
* daemon/gdm-session-worker.c:
(gdm_session_worker_update_environment_from_passwd_info),
(_change_user), (_lookup_passwd_info),
(gdm_session_worker_accredit_user), (on_refresh_credentials),
(worker_dbus_handle_message):
* daemon/gdm-session.c: (gdm_session_class_init),
(_gdm_session_session_started):
* daemon/gdm-session.h:
* daemon/gdm-simple-slave.c: (on_session_started),
(gdm_simple_slave_accredit_when_ready), (on_greeter_connected):
* daemon/gdm-slave.c: (gdm_slave_get_primary_session_id_for_user),
(gdm_slave_switch_to_user_session):
* daemon/gdm-slave.h:
Refactor things a little. Rename renew to refresh. Add a pid to the
session started signal.
svn path=/trunk/; revision=6018
Diffstat (limited to 'daemon/gdm-product-slave.c')
-rw-r--r-- | daemon/gdm-product-slave.c | 75 |
1 files changed, 63 insertions, 12 deletions
diff --git a/daemon/gdm-product-slave.c b/daemon/gdm-product-slave.c index fbde8fe2..60711c49 100644 --- a/daemon/gdm-product-slave.c +++ b/daemon/gdm-product-slave.c @@ -109,7 +109,7 @@ send_dbus_string_method (DBusConnection *connection, str = ""; } - g_debug ("GdmGreeterClient: Calling %s", method); + g_debug ("GdmProductSlave: Calling %s", method); message = dbus_message_new_method_call (NULL, RELAY_SERVER_DBUS_PATH, RELAY_SERVER_DBUS_INTERFACE, @@ -155,7 +155,7 @@ send_dbus_void_method (DBusConnection *connection, DBusMessage *message; DBusMessage *reply; - g_debug ("GdmGreeterClient: Calling %s", method); + g_debug ("GdmProductSlave: Calling %s", method); message = dbus_message_new_method_call (NULL, RELAY_SERVER_DBUS_PATH, RELAY_SERVER_DBUS_INTERFACE, @@ -188,11 +188,61 @@ send_dbus_void_method (DBusConnection *connection, return TRUE; } + +static gboolean +send_dbus_int_method (DBusConnection *connection, + const char *method, + int payload) +{ + DBusError error; + DBusMessage *message; + DBusMessage *reply; + DBusMessageIter iter; + + g_debug ("GdmSessionWorker: Calling %s", method); + message = dbus_message_new_method_call (NULL, + RELAY_SERVER_DBUS_PATH, + RELAY_SERVER_DBUS_INTERFACE, + method); + if (message == NULL) { + g_warning ("Couldn't allocate the D-Bus message"); + return FALSE; + } + + dbus_message_iter_init_append (message, &iter); + dbus_message_iter_append_basic (&iter, + DBUS_TYPE_INT32, + &payload); + + dbus_error_init (&error); + reply = dbus_connection_send_with_reply_and_block (connection, + message, + -1, + &error); + dbus_message_unref (message); + if (reply != NULL) { + dbus_message_unref (reply); + } + dbus_connection_flush (connection); + + if (dbus_error_is_set (&error)) { + g_debug ("%s %s raised: %s\n", + method, + error.name, + error.message); + return FALSE; + } + + return TRUE; +} + static void -relay_session_started (GdmProductSlave *slave) +relay_session_started (GdmProductSlave *slave, + int pid) { - send_dbus_void_method (slave->priv->session_relay_connection, - "SessionStarted"); + send_dbus_int_method (slave->priv->session_relay_connection, + "SessionStarted", + pid); } static void @@ -222,11 +272,12 @@ disconnect_relay (GdmProductSlave *slave) static void on_session_started (GdmSession *session, + int pid, GdmProductSlave *slave) { g_debug ("GdmProductSlave: session started"); - relay_session_started (slave); + relay_session_started (slave, pid); disconnect_relay (slave); } @@ -629,12 +680,12 @@ on_relay_establish_credentials (GdmProductSlave *slave, } static void -on_relay_renew_credentials (GdmProductSlave *slave, - DBusMessage *message) +on_relay_refresh_credentials (GdmProductSlave *slave, + DBusMessage *message) { - g_debug ("GdmProductSlave: Relay RenewCredentials"); + g_debug ("GdmProductSlave: Relay RefreshCredentials"); - gdm_session_accredit (GDM_SESSION (slave->priv->session), GDM_SESSION_CRED_RENEW); + gdm_session_accredit (GDM_SESSION (slave->priv->session), GDM_SESSION_CRED_REFRESH); } static void @@ -904,8 +955,8 @@ relay_dbus_handle_message (DBusConnection *connection, on_relay_authorize (slave, message); } else if (dbus_message_is_signal (message, RELAY_SERVER_DBUS_INTERFACE, "EstablishCredentials")) { on_relay_establish_credentials (slave, message); - } else if (dbus_message_is_signal (message, RELAY_SERVER_DBUS_INTERFACE, "RenewCredentials")) { - on_relay_renew_credentials (slave, message); + } else if (dbus_message_is_signal (message, RELAY_SERVER_DBUS_INTERFACE, "RefreshCredentials")) { + on_relay_refresh_credentials (slave, message); } else if (dbus_message_is_signal (message, RELAY_SERVER_DBUS_INTERFACE, "AnswerQuery")) { on_relay_answer_query (slave, message); } else if (dbus_message_is_signal (message, RELAY_SERVER_DBUS_INTERFACE, "SessionSelected")) { |