Re: [gdm-list] [PATCH] some pam related improvements
- From: Ludwig Nussel <ludwig nussel suse de>
- To: gdm-list gnome org
- Subject: Re: [gdm-list] [PATCH] some pam related improvements
- Date: Wed, 7 Feb 2007 12:42:39 +0100
Brian Cameron wrote:
> Right, but "Start Again" could remain insensitive until at least on
> field has a value.
Patch attached that disables "start again" for the first prompt. Both gdmlogin
and gdmgreeter behave correctly with this patch AFAICT.
cu
Ludwig
--
(o_ Ludwig Nussel
//\ SUSE LINUX Products GmbH, Development
V_/_ http://www.suse.de/
Index: gdm2/gui/greeter/greeter.c
===================================================================
--- gdm2.orig/gui/greeter/greeter.c
+++ gdm2/gui/greeter/greeter.c
@@ -85,6 +85,7 @@ extern GtkButton *gtk_ok_button;
extern GtkButton *gtk_start_again_button;
gboolean greeter_probably_login_prompt = FALSE;
+static gboolean first_prompt = TRUE;
static void process_operation (guchar opcode, const gchar *args);
@@ -197,16 +198,15 @@ process_operation (guchar op_code,
gdm_config_get_string (GDM_KEY_SOUND_ON_LOGIN_FILE),
gdm_config_get_bool (GDM_KEY_SOUND_ON_LOGIN));
greeter_probably_login_prompt = TRUE;
- if (gtk_start_again_button != NULL)
- gtk_widget_set_sensitive (GTK_WIDGET (gtk_start_again_button), FALSE);
- } else {
- greeter_probably_login_prompt = FALSE;
- if (gtk_start_again_button != NULL)
- gtk_widget_set_sensitive (GTK_WIDGET (gtk_start_again_button), TRUE);
}
if (gtk_ok_button != NULL)
gtk_widget_set_sensitive (GTK_WIDGET (gtk_ok_button), FALSE);
+ if (gtk_start_again_button != NULL)
+ gtk_widget_set_sensitive (GTK_WIDGET (gtk_start_again_button), !first_prompt);
+
+ first_prompt = FALSE;
+
greeter_ignore_buttons (FALSE);
greeter_item_pam_prompt (tmp, PW_ENTRY_SIZE, TRUE);
@@ -216,17 +216,16 @@ process_operation (guchar op_code,
case GDM_NOECHO:
tmp = ve_locale_to_utf8 (args);
- if (tmp != NULL && strcmp (tmp, _("Password:")) == 0) {
- if (gtk_start_again_button != NULL)
- gtk_widget_set_sensitive (GTK_WIDGET (gtk_start_again_button), TRUE);
- greeter_probably_login_prompt = FALSE;
- } else {
- if (gtk_start_again_button != NULL)
- gtk_widget_set_sensitive (GTK_WIDGET (gtk_start_again_button), FALSE);
- }
+ greeter_probably_login_prompt = FALSE;
+
if (gtk_ok_button != NULL)
gtk_widget_set_sensitive (GTK_WIDGET (gtk_ok_button), FALSE);
+ if (gtk_start_again_button != NULL)
+ gtk_widget_set_sensitive (GTK_WIDGET (gtk_start_again_button), !first_prompt);
+
+ first_prompt = FALSE;
+
greeter_ignore_buttons (FALSE);
greeter_item_pam_prompt (tmp, PW_ENTRY_SIZE, FALSE);
g_free (tmp);
@@ -379,6 +378,8 @@ process_operation (guchar op_code,
if (gtk_start_again_button != NULL)
gtk_widget_set_sensitive (GTK_WIDGET (gtk_start_again_button), FALSE);
+ first_prompt = TRUE;
+
conversation_info = greeter_lookup_id ("pam-conversation");
if (conversation_info)
Index: gdm2/gui/gdmlogin.c
===================================================================
--- gdm2.orig/gui/gdmlogin.c
+++ gdm2/gui/gdmlogin.c
@@ -162,6 +162,8 @@ extern const gchar *current_session;
extern gboolean session_dir_whacked_out;
extern gint gdm_timed_delay;
+static gboolean first_prompt = TRUE;
+
static void login_window_resize (gboolean force);
/* Background program logic */
@@ -1532,7 +1534,6 @@ process_operation (guchar op_code,
GtkWidget *dlg;
static gboolean replace_msg = TRUE;
static gboolean messages_to_give = FALSE;
- gboolean greeter_probably_login_prompt = FALSE;
gint lookup_status = SESSION_LOOKUP_SUCCESS;
gchar *firstmsg = NULL;
gchar *secondmsg = NULL;
@@ -1558,15 +1559,15 @@ process_operation (guchar op_code,
gdm_config_get_string (GDM_KEY_SOUND_ON_LOGIN_FILE),
gdm_config_get_bool (GDM_KEY_SOUND_ON_LOGIN));
gtk_label_set_text_with_mnemonic (GTK_LABEL (label), _("_Username:"));
- greeter_probably_login_prompt = TRUE;
- gtk_widget_set_sensitive (start_again_button, FALSE);
} else {
- gtk_widget_set_sensitive (start_again_button, TRUE);
if (tmp != NULL)
gtk_label_set_text (GTK_LABEL (label), tmp);
}
g_free (tmp);
+ gtk_widget_set_sensitive (GTK_WIDGET (start_again_button), !first_prompt);
+ first_prompt = FALSE;
+
gtk_widget_show (GTK_WIDGET (label));
gtk_entry_set_text (GTK_ENTRY (entry), "");
gtk_entry_set_max_length (GTK_ENTRY (entry), PW_ENTRY_SIZE);
@@ -1589,15 +1590,16 @@ process_operation (guchar op_code,
case GDM_NOECHO:
tmp = ve_locale_to_utf8 (args);
if (tmp != NULL && strcmp (tmp, _("Password:")) == 0) {
- gtk_widget_set_sensitive (start_again_button, TRUE);
gtk_label_set_text_with_mnemonic (GTK_LABEL (label), _("_Password:"));
} else {
- gtk_widget_set_sensitive (start_again_button, FALSE);
if (tmp != NULL)
gtk_label_set_text (GTK_LABEL (label), tmp);
}
g_free (tmp);
+ gtk_widget_set_sensitive (GTK_WIDGET (start_again_button), !first_prompt);
+ first_prompt = FALSE;
+
gtk_widget_show (GTK_WIDGET (label));
gtk_entry_set_text (GTK_ENTRY (entry), "");
gtk_entry_set_max_length (GTK_ENTRY (entry), PW_ENTRY_SIZE);
@@ -1818,6 +1820,8 @@ process_operation (guchar op_code,
curuser = NULL;
}
+ first_prompt = TRUE;
+
gtk_widget_set_sensitive (entry, TRUE);
gtk_widget_set_sensitive (ok_button, FALSE);
gtk_widget_set_sensitive (start_again_button, FALSE);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]