[gdm/multi-stack: 1/17] Separate handling of non-users in user list from u
- From: Ray Strode <halfline src gnome org>
- To: svn-commits-list gnome org
- Subject: [gdm/multi-stack: 1/17] Separate handling of non-users in user list from u
- Date: Tue, 3 Mar 2009 13:31:30 -0500 (EST)
commit 710c060db918105f439923196523eb124b911b9b
Author: Ray Strode <rstrode redhat com>
Date: Tue Feb 24 15:12:35 2009 -0500
Separate handling of non-users in user list from users
Now get_chosen_user returns NULL if the activated item
wasn't a user. We also separate the handling of on item
activation in two functions depending on the item type.
This will be useful for adding custom handling for plugin
added items.
---
gui/simple-greeter/gdm-greeter-login-window.c | 47 ++++++++++++--------
gui/simple-greeter/gdm-user-chooser-widget.c | 19 ++++++++-
.../fingerprint/gdm-fingerprint-extension.c | 2 -
3 files changed, 47 insertions(+), 21 deletions(-)
diff --git a/gui/simple-greeter/gdm-greeter-login-window.c b/gui/simple-greeter/gdm-greeter-login-window.c
index 9f10cb3..f46ec78 100644
--- a/gui/simple-greeter/gdm-greeter-login-window.c
+++ b/gui/simple-greeter/gdm-greeter-login-window.c
@@ -1596,29 +1596,46 @@ begin_task_verification_for_selected_user (GdmTaskList *task_list,
}
static void
-on_user_chosen (GdmUserChooserWidget *user_chooser,
- GdmGreeterLoginWindow *login_window)
+on_user_chosen (GdmGreeterLoginWindow *login_window,
+ const char *user_name)
{
- char *user_name;
+ g_debug ("GdmGreeterLoginWindow: user chosen '%s'", user_name);
+
+ g_signal_emit (G_OBJECT (login_window), signals[USER_SELECTED],
+ 0, user_name);
+
+ gdm_task_list_foreach_task (GDM_TASK_LIST (login_window->priv->conversation_list),
+ (GdmTaskListForeachFunc)
+ begin_task_verification_for_selected_user,
+ login_window);
+
+ switch_mode (login_window, MODE_AUTHENTICATION);
+}
+
+static void
+on_user_chooser_activated (GdmUserChooserWidget *user_chooser,
+ GdmGreeterLoginWindow *login_window)
+{
+ char *item_id;
user_name = gdm_user_chooser_widget_get_chosen_user_name (GDM_USER_CHOOSER_WIDGET (login_window->priv->user_chooser));
g_debug ("GdmGreeterLoginWindow: user chosen '%s'", user_name);
- if (user_name == NULL) {
+ if (user_name != NULL) {
+ on_user_chosen (login_window, user_name);
+ g_free (user_name);
return;
}
- g_signal_emit (G_OBJECT (login_window), signals[USER_SELECTED],
- 0, user_name);
+ item_id = gdm_chooser_widget_get_active_item (GDM_CHOOSER_WIDGET (user_chooser));
- if (strcmp (user_name, GDM_USER_CHOOSER_USER_OTHER) == 0) {
+ if (strcmp (item_id, GDM_USER_CHOOSER_USER_OTHER) == 0) {
gdm_task_list_foreach_task (GDM_TASK_LIST (login_window->priv->conversation_list),
(GdmTaskListForeachFunc)
begin_task_verification,
login_window);
- } else if (strcmp (user_name, GDM_USER_CHOOSER_USER_GUEST) == 0) {
- /* FIXME: handle guest account stuff */
- } else if (strcmp (user_name, GDM_USER_CHOOSER_USER_AUTO) == 0) {
+ g_free (item_id);
+ } else if (strcmp (item_id, GDM_USER_CHOOSER_USER_AUTO) == 0) {
g_signal_emit (login_window, signals[BEGIN_AUTO_LOGIN], 0,
login_window->priv->timed_login_username);
@@ -1628,16 +1645,10 @@ on_user_chosen (GdmUserChooserWidget *user_chooser,
/* just wait for the user to select language and stuff */
set_log_in_button_mode (login_window, LOGIN_BUTTON_TIMED_LOGIN);
set_message (login_window, _("Select language and click Log In"));
- } else {
- gdm_task_list_foreach_task (GDM_TASK_LIST (login_window->priv->conversation_list),
- (GdmTaskListForeachFunc)
- begin_task_verification_for_selected_user,
- login_window);
+ g_free (item_id);
}
switch_mode (login_window, MODE_AUTHENTICATION);
-
- g_free (user_name);
}
static void
@@ -1926,7 +1937,7 @@ load_theme (GdmGreeterLoginWindow *login_window)
login_window);
g_signal_connect (login_window->priv->user_chooser,
"activated",
- G_CALLBACK (on_user_chosen),
+ G_CALLBACK (on_user_chooser_activated),
login_window);
g_signal_connect (login_window->priv->user_chooser,
"deactivated",
diff --git a/gui/simple-greeter/gdm-user-chooser-widget.c b/gui/simple-greeter/gdm-user-chooser-widget.c
index 08420b8..e569b7b 100644
--- a/gui/simple-greeter/gdm-user-chooser-widget.c
+++ b/gui/simple-greeter/gdm-user-chooser-widget.c
@@ -233,9 +233,26 @@ gdm_user_chooser_widget_set_show_user_auto (GdmUserChooserWidget *widget,
char *
gdm_user_chooser_widget_get_chosen_user_name (GdmUserChooserWidget *widget)
{
+ char *active_item_id;
+ gboolean isnt_user;
+
g_return_val_if_fail (GDM_IS_USER_CHOOSER_WIDGET (widget), NULL);
+ active_item_id = gdm_chooser_widget_get_active_item (GDM_CHOOSER_WIDGET (widget));
+
+ if (active_item_id == NULL) {
+ return NULL;
+ }
+
+ gdm_chooser_widget_lookup_item (GDM_CHOOSER_WIDGET (widget), active_item_id,
+ NULL, NULL, NULL, NULL, NULL,
+ &isnt_user);
+
+ if (isnt_user) {
+ g_free (active_item_id);
+ return NULL;
+ }
- return gdm_chooser_widget_get_active_item (GDM_CHOOSER_WIDGET (widget));
+ return active_item_id;
}
void
diff --git a/gui/simple-greeter/plugins/fingerprint/gdm-fingerprint-extension.c b/gui/simple-greeter/plugins/fingerprint/gdm-fingerprint-extension.c
index 7c74ecf..63f6ef3 100644
--- a/gui/simple-greeter/plugins/fingerprint/gdm-fingerprint-extension.c
+++ b/gui/simple-greeter/plugins/fingerprint/gdm-fingerprint-extension.c
@@ -287,8 +287,6 @@ create_page (GdmFingerprintExtension *extension)
static void
create_actions (GdmFingerprintExtension *extension)
{
- GtkAction *action;
-
extension->priv->actions = gtk_action_group_new ("gdm-fingerprint-extension");
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]