gdm r5971 - in trunk: . daemon gui/simple-greeter
- From: halfline svn gnome org
- To: svn-commits-list gnome org
- Subject: gdm r5971 - in trunk: . daemon gui/simple-greeter
- Date: Sun, 9 Mar 2008 21:41:08 +0000 (GMT)
Author: halfline
Date: Sun Mar 9 21:41:08 2008
New Revision: 5971
URL: http://svn.gnome.org/viewvc/gdm?rev=5971&view=rev
Log:
2008-03-09 Ray Strode <rstrode redhat com>
Read timed login configuration from the daemon,
and pass along rather than reading it from the daemon
and greeter.
* daemon/gdm-simple-slave.c:
(get_timed_login_details):
(on_session_opened):
* daemon/gdm-greeter-server.[ch]:
(gdm_server_request_timed_login):
Read timed login configuration and forward to greeter
* gui/simple-greeter/gdm-greeter-client.[ch]:
(on_timed_login_requested), (client_dbus_handle_message),
(gdm_greeter_client_class_init):
* gui/simple-greeter/gdm-greeter-session.[ch]:
(on_timed_login_requested), (gdm_greeter_session_init):
Forward timed login requests from slave to login window
* gui/simple-greeter/gdm-greeter-login-window.[ch]:
(load_theme): don't show "automatic login" entry here
anymore
(gdm_greeter_login_window_request_timed_login):
show "automatic login" entry in face browser, start
timer
(read_configuration): drop function
(gdm_greeter_login_window_constructor): don't call
read_configuration anymore
(gdm_greeter_login_window_init): don't initialized
timed_login_delay here anymore since it's sent up from
slave now
Modified:
trunk/ChangeLog
trunk/daemon/gdm-greeter-server.c
trunk/daemon/gdm-greeter-server.h
trunk/daemon/gdm-simple-slave.c
trunk/gui/simple-greeter/gdm-greeter-client.c
trunk/gui/simple-greeter/gdm-greeter-client.h
trunk/gui/simple-greeter/gdm-greeter-login-window.c
trunk/gui/simple-greeter/gdm-greeter-login-window.h
trunk/gui/simple-greeter/gdm-greeter-session.c
Modified: trunk/daemon/gdm-greeter-server.c
==============================================================================
--- trunk/daemon/gdm-greeter-server.c (original)
+++ trunk/daemon/gdm-greeter-server.c Sun Mar 9 21:41:08 2008
@@ -272,6 +272,14 @@
send_dbus_string_signal (greeter_server, "DefaultSessionNameChanged", session_name);
}
+void
+gdm_greeter_server_request_timed_login (GdmGreeterServer *greeter_server,
+ const char *username,
+ int delay)
+{
+ send_dbus_string_and_int_signal (greeter_server, "TimedLoginRequested", username, delay);
+}
+
/* Note: Use abstract sockets like dbus does by default on Linux. Abstract
* sockets are only available on Linux.
*/
@@ -690,6 +698,10 @@
" <signal name=\"DefaultSessionNameChanged\">\n"
" <arg name=\"session_name\" type=\"s\"/>\n"
" </signal>\n"
+ " <signal name=\"TimedLoginRequested\">\n"
+ " <arg name=\"username\" type=\"s\"/>\n"
+ " <arg name=\"delay\" type=\"i\"/>\n"
+ " </signal>\n"
" <signal name=\"Ready\">\n"
" </signal>\n"
" <signal name=\"Reset\">\n"
Modified: trunk/daemon/gdm-greeter-server.h
==============================================================================
--- trunk/daemon/gdm-greeter-server.h (original)
+++ trunk/daemon/gdm-greeter-server.h Sun Mar 9 21:41:08 2008
@@ -91,6 +91,10 @@
void gdm_greeter_server_default_session_name_changed (GdmGreeterServer *greeter_server,
const char *text);
+void gdm_greeter_server_request_timed_login (GdmGreeterServer *greeter_server,
+ const char *username,
+ int delay);
+
G_END_DECLS
#endif /* __GDM_GREETER_SERVER_H */
Modified: trunk/daemon/gdm-simple-slave.c
==============================================================================
--- trunk/daemon/gdm-simple-slave.c (original)
+++ trunk/daemon/gdm-simple-slave.c Sun Mar 9 21:41:08 2008
@@ -362,17 +362,50 @@
gdm_greeter_server_secret_info_query (slave->priv->greeter_server, text);
}
+static gboolean
+get_timed_login_details (GdmSimpleSlave *slave,
+ char **username,
+ int *delay)
+{
+ gboolean enabled;
+ gboolean res;
+
+ enabled = FALSE;
+ res = gdm_settings_client_get_boolean (GDM_KEY_TIMED_LOGIN_ENABLE, &enabled);
+ if (! enabled) {
+ return FALSE;
+ }
+
+ *username = NULL;
+ res = gdm_settings_client_get_string (GDM_KEY_TIMED_LOGIN_USER, username);
+
+ if (username == NULL) {
+ return FALSE;
+ }
+
+ res = gdm_settings_client_get_int (GDM_KEY_TIMED_LOGIN_DELAY, delay);
+
+ return TRUE;
+}
+
static void
on_session_opened (GdmSession *session,
GdmSimpleSlave *slave)
{
gboolean res;
+ char *username;
+ int delay;
g_debug ("GdmSimpleSlave: session opened");
res = gdm_greeter_server_ready (slave->priv->greeter_server);
if (! res) {
g_warning ("Unable to send ready");
}
+
+ if (get_timed_login_details (slave, &username, &delay)) {
+ gdm_greeter_server_request_timed_login (slave->priv->greeter_server, username, delay);
+ g_free (username);
+ }
}
static void
Modified: trunk/gui/simple-greeter/gdm-greeter-client.c
==============================================================================
--- trunk/gui/simple-greeter/gdm-greeter-client.c (original)
+++ trunk/gui/simple-greeter/gdm-greeter-client.c Sun Mar 9 21:41:08 2008
@@ -34,6 +34,7 @@
#include <dbus/dbus-glib-lowlevel.h>
#include "gdm-greeter-client.h"
+#include "gdm-marshal.h"
#define GDM_GREETER_CLIENT_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GDM_TYPE_GREETER_CLIENT, GdmGreeterClientPrivate))
@@ -66,6 +67,7 @@
SELECTED_USER_CHANGED,
DEFAULT_LANGUAGE_NAME_CHANGED,
DEFAULT_SESSION_NAME_CHANGED,
+ TIMED_LOGIN_REQUESTED,
LAST_SIGNAL
};
@@ -178,6 +180,13 @@
}
static void
+on_timed_login_requested (GdmGreeterClient *client,
+ DBusMessage *message)
+{
+ emit_string_and_int_signal_for_message (client, "TimedLoginRequested", message, TIMED_LOGIN_REQUESTED);
+}
+
+static void
on_info_query (GdmGreeterClient *client,
DBusMessage *message)
{
@@ -608,6 +617,8 @@
on_default_language_name_changed (client, message);
} else if (dbus_message_is_signal (message, GREETER_SERVER_DBUS_INTERFACE, "DefaultSessionNameChanged")) {
on_default_session_name_changed (client, message);
+ } else if (dbus_message_is_signal (message, GREETER_SERVER_DBUS_INTERFACE, "TimedLoginRequested")) {
+ on_timed_login_requested (client, message);
} else {
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
}
@@ -870,6 +881,18 @@
g_cclosure_marshal_VOID__STRING,
G_TYPE_NONE,
1, G_TYPE_STRING);
+
+ gdm_greeter_client_signals[TIMED_LOGIN_REQUESTED] =
+ g_signal_new ("timed-login-requested",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (GdmGreeterClientClass, default_session_name_changed),
+ NULL,
+ NULL,
+ gdm_marshal_VOID__STRING_INT,
+ G_TYPE_NONE,
+ 2, G_TYPE_STRING, G_TYPE_INT);
+
}
static void
Modified: trunk/gui/simple-greeter/gdm-greeter-client.h
==============================================================================
--- trunk/gui/simple-greeter/gdm-greeter-client.h (original)
+++ trunk/gui/simple-greeter/gdm-greeter-client.h Sun Mar 9 21:41:08 2008
@@ -64,6 +64,9 @@
const char *session_name);
void (* default_language_name_changed) (GdmGreeterClient *client,
const char *language_name);
+ void (* timed_login_requested) (GdmGreeterClient *client,
+ const char *username,
+ int delay);
} GdmGreeterClientClass;
#define GDM_GREETER_CLIENT_ERROR (gdm_greeter_client_error_quark ())
Modified: trunk/gui/simple-greeter/gdm-greeter-login-window.c
==============================================================================
--- trunk/gui/simple-greeter/gdm-greeter-login-window.c (original)
+++ trunk/gui/simple-greeter/gdm-greeter-login-window.c Sun Mar 9 21:41:08 2008
@@ -93,8 +93,6 @@
#define KEY_BANNER_MESSAGE_TEXT KEY_GREETER_DIR "/banner_message_text"
#define KEY_LOGO KEY_GREETER_DIR "/logo_icon_name"
#define KEY_DISABLE_RESTART_BUTTONS KEY_GREETER_DIR "/disable_restart_buttons"
-#define TIMED_LOGIN_TIMEOUT_SEC 60
-
#define GDM_GREETER_LOGIN_WINDOW_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GDM_TYPE_GREETER_LOGIN_WINDOW, GdmGreeterLoginWindowPrivate))
enum {
@@ -124,6 +122,7 @@
gboolean timed_login_enabled;
guint timed_login_delay;
+ char *timed_login_username;
guint timed_login_timeout_id;
guint animation_timeout_id;
@@ -622,6 +621,25 @@
return TRUE;
}
+void
+gdm_greeter_login_window_request_timed_login (GdmGreeterLoginWindow *login_window,
+ const char *username,
+ int delay)
+{
+ g_return_if_fail (GDM_IS_GREETER_LOGIN_WINDOW (login_window));
+
+ g_debug ("GdmGreeterLoginWindow: requested automatic login for user '%s' in %d seconds", username, delay);
+
+ login_window->priv->timed_login_enabled = TRUE;
+ login_window->priv->timed_login_username = g_strdup (username);
+ login_window->priv->timed_login_delay = delay;
+
+ reset_dialog (login_window);
+ gdm_user_chooser_widget_set_show_auto_user (GDM_USER_CHOOSER_WIDGET (login_window->priv->user_chooser), TRUE);
+ gdm_user_chooser_widget_set_chosen_user_name (GDM_USER_CHOOSER_WIDGET (login_window->priv->user_chooser), GDM_USER_CHOOSER_USER_AUTO);
+ restart_timed_login_timeout (login_window);
+}
+
gboolean
gdm_greeter_login_window_info_query (GdmGreeterLoginWindow *login_window,
const char *text)
@@ -1246,10 +1264,6 @@
gdm_user_chooser_widget_set_show_only_chosen (GDM_USER_CHOOSER_WIDGET (login_window->priv->user_chooser), TRUE);
- if (login_window->priv->timed_login_enabled) {
- gdm_user_chooser_widget_set_show_auto_user (GDM_USER_CHOOSER_WIDGET (login_window->priv->user_chooser), TRUE);
- }
-
g_signal_connect (login_window->priv->user_chooser,
"activated",
G_CALLBACK (on_user_chosen),
@@ -1416,49 +1430,6 @@
}
static void
-read_configuration (GdmGreeterLoginWindow *login_window)
-{
- gboolean res;
- int delay;
- char *username;
-
- g_debug ("GdmGreeterLoginWindow: reading system configuration");
-
- res = gdm_settings_client_get_boolean (GDM_KEY_TIMED_LOGIN_ENABLE,
- &login_window->priv->timed_login_enabled);
- if (! res) {
- g_warning ("Unable to read configuration for %s", GDM_KEY_TIMED_LOGIN_ENABLE);
- }
- g_debug ("GdmGreeterLoginWindow: TimedLoginEnable=%s",
- login_window->priv->timed_login_enabled ? "true" : "false");
-
- /* treat failures here as disabling */
- username = NULL;
- res = gdm_settings_client_get_string (GDM_KEY_TIMED_LOGIN_USER, &username);
- if (! res) {
- g_warning ("Unable to read configuration for %s", GDM_KEY_TIMED_LOGIN_USER);
- login_window->priv->timed_login_enabled = FALSE;
- } else {
- if (username == NULL) {
- login_window->priv->timed_login_enabled = FALSE;
- }
- }
- g_debug ("GdmGreeterLoginWindow: TimedLogin=%s", username);
- g_free (username);
-
- delay = -1;
- res = gdm_settings_client_get_int (GDM_KEY_TIMED_LOGIN_DELAY, &delay);
- if (! res) {
- g_warning ("Unable to read configuration for %s", GDM_KEY_TIMED_LOGIN_DELAY);
- } else {
- if (delay >= 0) {
- login_window->priv->timed_login_delay = delay;
- }
- }
- g_debug ("GdmGreeterLoginWindow: TimedLoginDelay=%d", delay);
-}
-
-static void
update_banner_message (GdmGreeterLoginWindow *login_window)
{
GError *error;
@@ -1511,7 +1482,6 @@
construct_properties));
- read_configuration (login_window);
load_theme (login_window);
update_banner_message (login_window);
@@ -1663,7 +1633,6 @@
login_window->priv = GDM_GREETER_LOGIN_WINDOW_GET_PRIVATE (login_window);
login_window->priv->timed_login_enabled = FALSE;
- login_window->priv->timed_login_delay = TIMED_LOGIN_TIMEOUT_SEC;
gtk_window_set_title (GTK_WINDOW (login_window), _("Login Window"));
gtk_window_set_opacity (GTK_WINDOW (login_window), 0.85);
Modified: trunk/gui/simple-greeter/gdm-greeter-login-window.h
==============================================================================
--- trunk/gui/simple-greeter/gdm-greeter-login-window.h (original)
+++ trunk/gui/simple-greeter/gdm-greeter-login-window.h Sun Mar 9 21:41:08 2008
@@ -75,6 +75,10 @@
gboolean gdm_greeter_login_window_problem (GdmGreeterLoginWindow *login_window,
const char *text);
+void gdm_greeter_login_window_request_timed_login (GdmGreeterLoginWindow *login_window,
+ const char *username,
+ int delay);
+
G_END_DECLS
#endif /* __GDM_GREETER_LOGIN_WINDOW_H */
Modified: trunk/gui/simple-greeter/gdm-greeter-session.c
==============================================================================
--- trunk/gui/simple-greeter/gdm-greeter-session.c (original)
+++ trunk/gui/simple-greeter/gdm-greeter-session.c Sun Mar 9 21:41:08 2008
@@ -149,6 +149,16 @@
}
static void
+on_timed_login_requested (GdmGreeterClient *client,
+ const char *text,
+ int delay,
+ GdmGreeterSession *session)
+{
+ g_debug ("GdmGreeterSession: timed login requested for user %s (in %d seconds)", text, delay);
+ gdm_greeter_login_window_request_timed_login (GDM_GREETER_LOGIN_WINDOW (session->priv->login_window), text, delay);
+}
+
+static void
on_info_query (GdmGreeterClient *client,
const char *text,
GdmGreeterSession *session)
@@ -838,6 +848,11 @@
"default-session-name-changed",
G_CALLBACK (on_default_session_name_changed),
session);
+ g_signal_connect (session->priv->client,
+ "timed-login-requested",
+ G_CALLBACK (on_timed_login_requested),
+ session);
+
/* We want to listen for panel mnemonics even if the
* login window is focused, so we intercept them here.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]