diff --git a/capplets/about-me/ChangeLog b/capplets/about-me/ChangeLog index 04a1da8fc..34b43c0af 100644 --- a/capplets/about-me/ChangeLog +++ b/capplets/about-me/ChangeLog @@ -1,3 +1,9 @@ +2007-11-03 Jens Granseuer + + * gnome-about-me-password.c: (io_watch_stdout): add another string to + the list of recognized error returns from passwd ("must choose a longer + password") + 2007-08-21 Jens Granseuer * gnome-about-me.c: (about_me_setup_email): fix the last commit to use diff --git a/capplets/about-me/gnome-about-me-password.c b/capplets/about-me/gnome-about-me-password.c index 85651ac0d..640d75049 100644 --- a/capplets/about-me/gnome-about-me-password.c +++ b/capplets/about-me/gnome-about-me-password.c @@ -63,25 +63,25 @@ typedef struct { GtkEntry *retyped_password; GtkImage *dialog_image; GtkLabel *status_label; - + /* Whether we have authenticated */ gboolean authenticated; - + /* Communication with the passwd program */ GPid backend_pid; - + GIOChannel *backend_stdin; GIOChannel *backend_stdout; - + GQueue *backend_stdin_queue; /* Write queue to backend_stdin */ - + /* GMainLoop IDs */ guint backend_child_watch_id; /* g_child_watch_add (PID) */ guint backend_stdout_watch_id; /* g_io_add_watch (stdout) */ - + /* State of the passwd program */ PasswdState backend_state; - + } PasswordDialog; /* Buffer size for backend output */ @@ -95,7 +95,7 @@ typedef struct { GQuark gnome_about_me_password_error_quark(void) { static GQuark q = 0; - + if (q == 0) { q = g_quark_from_static_string("gnome_about_me_password_error"); } @@ -162,7 +162,7 @@ child_watch_cb (GPid pid, gint status, PasswordDialog *pdialog) g_warning (_("Child exited unexpectedly")); } } - + free_passwd_resources (pdialog); } @@ -174,19 +174,19 @@ spawn_passwd (PasswordDialog *pdialog, GError **error) gchar *argv[2]; gchar *envp[1]; gint my_stdin, my_stdout, my_stderr; - + argv[0] = "/usr/bin/passwd"; /* Is it safe to rely on a hard-coded path? */ argv[1] = NULL; - + envp[0] = NULL; /* If we pass an empty array as the environment, * will the childs environment be empty, and the * locales set to the C default? From the manual: * "If envp is NULL, the child inherits its * parent'senvironment." - * If I'm wrong here, we somehow have to set + * If I'm wrong here, we somehow have to set * the locales here. */ - + if (!g_spawn_async_with_pipes (NULL, /* Working directory */ argv, /* Argument vector */ envp, /* Environment */ @@ -198,57 +198,57 @@ spawn_passwd (PasswordDialog *pdialog, GError **error) &my_stdout, /* Stdout */ &my_stderr, /* Stderr */ error)) { /* GError */ - + /* An error occured */ free_passwd_resources (pdialog); - + return FALSE; } - + /* 2>&1 */ if (dup2 (my_stderr, my_stdout) == -1) { /* Failed! */ g_set_error (error, - PASSDLG_ERROR, + PASSDLG_ERROR, PASSDLG_ERROR_BACKEND, strerror (errno)); - + /* Clean up */ stop_passwd (pdialog); - + return FALSE; } - + /* Open IO Channels */ pdialog->backend_stdin = g_io_channel_unix_new (my_stdin); pdialog->backend_stdout = g_io_channel_unix_new (my_stdout); - + /* Set raw encoding */ /* Set nonblocking mode */ if (g_io_channel_set_encoding (pdialog->backend_stdin, NULL, error) != G_IO_STATUS_NORMAL || g_io_channel_set_encoding (pdialog->backend_stdout, NULL, error) != G_IO_STATUS_NORMAL || g_io_channel_set_flags (pdialog->backend_stdin, G_IO_FLAG_NONBLOCK, error) != G_IO_STATUS_NORMAL || g_io_channel_set_flags (pdialog->backend_stdout, G_IO_FLAG_NONBLOCK, error) != G_IO_STATUS_NORMAL ) { - + /* Clean up */ stop_passwd (pdialog); return FALSE; } - + /* Turn off buffering */ g_io_channel_set_buffered (pdialog->backend_stdin, FALSE); g_io_channel_set_buffered (pdialog->backend_stdout, FALSE); - + /* Add IO Channel watcher */ pdialog->backend_stdout_watch_id = g_io_add_watch (pdialog->backend_stdout, G_IO_IN | G_IO_PRI, (GIOFunc) io_watch_stdout, pdialog); - + /* Add child watcher */ pdialog->backend_child_watch_id = g_child_watch_add (pdialog->backend_pid, (GChildWatchFunc) child_watch_cb, pdialog); - + /* Success! */ - + return TRUE; } @@ -256,19 +256,19 @@ spawn_passwd (PasswordDialog *pdialog, GError **error) static void stop_passwd (PasswordDialog *pdialog) { - /* This is the standard way of returning from the dialog with passwd. + /* This is the standard way of returning from the dialog with passwd. * If we return this way we can safely kill passwd as it has completed * its task. */ - + if (pdialog->backend_pid != -1) { kill (pdialog->backend_pid, 9); } - + /* We must run free_passwd_resources here and not let our child * watcher do it, since it will access invalid memory after the * dialog has been closed and cleaned up. - * + * * If we had more than a single thread we'd need to remove * the child watch before trying to kill the child. */ @@ -280,59 +280,59 @@ static void free_passwd_resources (PasswordDialog *pdialog) { GError *error = NULL; - + /* Remove the child watcher */ if (pdialog->backend_child_watch_id != 0) { - + g_source_remove (pdialog->backend_child_watch_id); pdialog->backend_child_watch_id = 0; } - + /* Close IO channels (internal file descriptors are automatically closed) */ if (pdialog->backend_stdin != NULL) { - + if (g_io_channel_shutdown (pdialog->backend_stdin, TRUE, &error) != G_IO_STATUS_NORMAL) { g_warning (_("Could not shutdown backend_stdin IO channel: %s"), error->message); g_error_free (error); error = NULL; } - + g_io_channel_unref (pdialog->backend_stdin); - + pdialog->backend_stdin = NULL; } - + if (pdialog->backend_stdout != NULL) { - + if (g_io_channel_shutdown (pdialog->backend_stdout, TRUE, &error) != G_IO_STATUS_NORMAL) { g_warning (_("Could not shutdown backend_stdout IO channel: %s"), error->message); g_error_free (error); error = NULL; } - + g_io_channel_unref (pdialog->backend_stdout); - + pdialog->backend_stdout = NULL; } - + /* Remove IO watcher */ if (pdialog->backend_stdout_watch_id != 0) { - + g_source_remove (pdialog->backend_stdout_watch_id); - + pdialog->backend_stdout_watch_id = 0; } - + /* Close PID */ if (pdialog->backend_pid != -1) { - + g_spawn_close_pid (pdialog->backend_pid); - + pdialog->backend_pid = -1; } - + /* Clear backend state */ pdialog->backend_state = PASSWD_STATE_NONE; } @@ -352,16 +352,16 @@ io_queue_pop (GQueue *queue, GIOChannel *channel) gchar *buf; gsize bytes_written; GError *error = NULL; - + buf = g_queue_pop_head (queue); - + if (buf != NULL) { - + if (g_io_channel_write_chars (channel, buf, -1, &bytes_written, &error) != G_IO_STATUS_NORMAL) { g_warning ("Could not write queue element \"%s\" to channel: %s", buf, error->message); g_error_free (error); } - + g_free (buf); } } @@ -373,26 +373,26 @@ is_string_complete (gchar *str, ...) { va_list ap; gchar *arg; - + if (strlen (str) == 0) { return FALSE; } - + va_start (ap, str); - + while ((arg = va_arg (ap, char *)) != NULL) { if (g_strrstr (str, arg) != NULL) { va_end (ap); return TRUE; } } - + va_end (ap); - + return FALSE; } -/* +/* * IO watcher for stdout, called whenever there is data to read from the backend. * This is where most of the actual IO handling happens. */ @@ -400,101 +400,102 @@ static gboolean io_watch_stdout (GIOChannel *source, GIOCondition condition, PasswordDialog *pdialog) { static GString *str = NULL; /* Persistent buffer */ - + gchar buf[BUFSIZE]; /* Temporary buffer */ gsize bytes_read; GError *error = NULL; - + gchar *msg = NULL; /* Status error message */ GladeXML *dialog; - + gboolean reinit = FALSE; - + /* Initialize buffer */ if (str == NULL) { str = g_string_new (""); } - + dialog = pdialog->xml; - + if (g_io_channel_read_chars (source, buf, BUFSIZE, &bytes_read, &error) != G_IO_STATUS_NORMAL) { g_warning ("IO Channel read error: %s", error->message); g_error_free (error); - + return TRUE; } - + str = g_string_append_len (str, buf, bytes_read); - + /* In which state is the backend? */ switch (pdialog->backend_state) { case PASSWD_STATE_AUTH: /* Passwd is asking for our current password */ - + if (is_string_complete (str->str, "assword: ", "failure", "wrong", NULL)) { /* Which response did we get? */ passdlg_set_busy (pdialog, FALSE); - + if (g_strrstr (str->str, "assword: ") != NULL) { /* Authentication successfull */ - + pdialog->backend_state = PASSWD_STATE_NEW; - + if (pdialog->authenticated) { /* This is a re-authentication * It succeeded, so pop our new password from the queue */ io_queue_pop (pdialog->backend_stdin_queue, pdialog->backend_stdin); } - + /* Update UI state */ passdlg_set_auth_state (pdialog, TRUE); passdlg_set_status (pdialog, _("Authenticated!")); - + /* Check to see if the passwords are valid * (They might be non-empty if the user had to re-authenticate, * and thus we need to enable the change-password-button) */ passdlg_refresh_password_state (pdialog); - + } else { /* Authentication failed */ - + if (pdialog->authenticated) { /* This is a re-auth, and it failed. * The password must have been changed in the meantime! * Ask the user to re-authenticate */ - + /* Update status message and auth state */ passdlg_set_status (pdialog, _("Your password has been changed since you initially authenticated! Please re-authenticate.")); } else { passdlg_set_status (pdialog, _("That password was incorrect.")); } - + /* Focus current password */ gtk_widget_grab_focus (GTK_WIDGET (pdialog->current_password)); } - + reinit = TRUE; } break; case PASSWD_STATE_NEW: /* Passwd is asking for our new password */ - + if (is_string_complete (str->str, "assword: ", NULL)) { /* Advance to next state */ pdialog->backend_state = PASSWD_STATE_RETYPE; - + /* Pop retyped password from queue and into IO channel */ io_queue_pop (pdialog->backend_stdin_queue, pdialog->backend_stdin); - + reinit = TRUE; } break; case PASSWD_STATE_RETYPE: /* Passwd is asking for our retyped new password */ - + if (is_string_complete (str->str, "successfully", "short", + "longer", "panlindrome", "simple", "similar", @@ -505,72 +506,74 @@ io_watch_stdout (GIOChannel *source, GIOCondition condition, PasswordDialog *pdi "1 numeric or special", "failure", NULL)) { - + /* What response did we get? */ passdlg_set_busy (pdialog, FALSE); - + if (g_strrstr (str->str, "successfully") != NULL) { /* Hooray! */ - + passdlg_clear (pdialog); passdlg_set_status (pdialog, _("Your password has been changed.")); } else { /* Ohnoes! */ - + /* Focus new password */ gtk_widget_grab_focus (GTK_WIDGET (pdialog->new_password)); - + if (g_strrstr (str->str, "recovered") != NULL) { /* What does this indicate? * "Authentication information cannot be recovered?" from libpam? */ msg = g_strdup_printf (_("System error: %s."), str->str); - } else if (g_strrstr (str->str, "short") != NULL) { + } else if (g_strrstr (str->str, "short") != NULL || + g_strrstr (str->str, "longer") != NULL) { msg = g_strdup (_("The password is too short.")); - } else if (g_strrstr (str->str, "panlindrome") != NULL) { + } else if (g_strrstr (str->str, "panlindrome") != NULL || + g_strrstr (str->str, "simple") != NULL) { msg = g_strdup (_("The password is too simple.")); - } else if (g_strrstr (str->str, "simple") != NULL) { - msg = g_strdup (_("The password is too simple.")); - } else if ((g_strrstr (str->str, "similar") != NULL) || (g_strrstr (str->str, "wrapped") != NULL)) { + } else if (g_strrstr (str->str, "similar") != NULL || + g_strrstr (str->str, "wrapped") != NULL) { msg = g_strdup (_("The old and new passwords are too similar.")); } else if (g_strrstr (str->str, "1 numeric or special") != NULL) { msg = g_strdup (_("The new password must contain numeric or special character(s).")); - } else if ((g_strrstr (str->str, "unchanged") != NULL) || (g_strrstr (str->str, "match") != NULL)) { + } else if (g_strrstr (str->str, "unchanged") != NULL || + g_strrstr (str->str, "match") != NULL) { msg = g_strdup (_("The old and new passwords are the same.")); } else if (g_strrstr (str->str, "failure") != NULL) { /* Authentication failure */ msg = g_strdup (_("Your password has been changed since you initially authenticated! Please re-authenticate.")); - + passdlg_set_auth_state (pdialog, FALSE); } } - + reinit = TRUE; - + if (msg != NULL) { /* An error occured! */ passdlg_set_status (pdialog, msg); g_free (msg); - + /* At this point, passwd might have exited, in which case * child_watch_cb should clean up for us and remove this watcher. * On some error conditions though, passwd just re-prompts us * for our new password. */ - + pdialog->backend_state = PASSWD_STATE_ERR; } - + /* child_watch_cb should clean up for us now */ } break; case PASSWD_STATE_NONE: /* Passwd is not asking for anything yet */ if (is_string_complete (str->str, "assword: ", NULL)) { - + pdialog->backend_state = PASSWD_STATE_AUTH; - + /* Pop the IO queue, i.e. send current password */ io_queue_pop (pdialog->backend_stdin_queue, pdialog->backend_stdin); - + reinit = TRUE; } break; @@ -579,12 +582,12 @@ io_watch_stdout (GIOChannel *source, GIOCondition condition, PasswordDialog *pdi reinit = TRUE; break; } - + if (reinit) { g_string_free (str, TRUE); str = NULL; } - + /* Continue calling us */ return TRUE; } @@ -598,9 +601,9 @@ static void authenticate (PasswordDialog *pdialog) { gchar *s; - + s = g_strdup_printf ("%s\n", gtk_entry_get_text (pdialog->current_password)); - + g_queue_push_tail (pdialog->backend_stdin_queue, s); } @@ -609,9 +612,9 @@ static void update_password (PasswordDialog *pdialog) { gchar *s; - + s = g_strdup_printf ("%s\n", gtk_entry_get_text (pdialog->new_password)); - + g_queue_push_tail (pdialog->backend_stdin_queue, s); /* We need to allocate new space because io_queue_pop() g_free()s * every element of the queue after it's done */ @@ -619,13 +622,13 @@ update_password (PasswordDialog *pdialog) } /* Sets dialog busy state according to busy - * + * * When busy: * Sets the cursor to busy * Disables the interface to prevent that the user interferes * Reverts all this when non-busy - * - * Note that this function takes into account the + * + * Note that this function takes into account the * authentication state of the dialog. So setting the * dialog to busy and then back to normal should leave * the dialog unchanged. @@ -639,37 +642,37 @@ passdlg_set_busy (PasswordDialog *pdialog, gboolean busy) GdkDisplay *display; dialog = pdialog->xml; - + /* Set cursor */ toplevel = WID ("change-password"); display = gtk_widget_get_display (toplevel); if (busy) { cursor = gdk_cursor_new_for_display (display, GDK_WATCH); } - + gdk_window_set_cursor (toplevel->window, cursor); gdk_display_flush (display); if (busy) { gdk_cursor_unref (cursor); } - + /* Disable/Enable UI */ if (pdialog->authenticated) { /* Authenticated state */ - + /* Enable/disable new password section */ g_object_set (pdialog->new_password, "sensitive", !busy, NULL); g_object_set (pdialog->retyped_password, "sensitive", !busy, NULL); g_object_set (WID ("new-password-label"), "sensitive", !busy, NULL); g_object_set (WID ("retyped-password-label"), "sensitive", !busy, NULL); - + /* Enable/disable change password button */ g_object_set (WID ("change-password-button"), "sensitive", !busy, NULL); - + } else { /* Not-authenticated state */ - + /* Enable/disable auth section state */ g_object_set (pdialog->current_password, "sensitive", !busy, NULL); g_object_set (WID ("authenticate-button"), "sensitive", !busy, NULL); @@ -682,24 +685,24 @@ static void passdlg_error_dialog (const gchar *title, const gchar *msg, const gchar *details) { GtkWidget *dialog; - + dialog = eel_alert_dialog_new (NULL, 0, - GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, + GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, msg, NULL, title); - + if (details != NULL) { eel_alert_dialog_set_details_label (EEL_ALERT_DIALOG (dialog), details); } - + g_signal_connect (G_OBJECT (dialog), "response", G_CALLBACK (gtk_widget_destroy), NULL); - + gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE); gtk_widget_show (dialog); } /* Set authenticated state of dialog according to state - * + * * When in authenticated state: * Disables authentication-part of interface * Enables new-password-part of interface @@ -712,41 +715,41 @@ static void passdlg_set_auth_state (PasswordDialog *pdialog, gboolean state) { GladeXML *dialog; - + dialog = pdialog->xml; - + /* Widgets which require a not-authenticated state to be accessible */ g_object_set (pdialog->current_password, "sensitive", !state, NULL); g_object_set (WID ("current-password-label"), "sensitive", !state, NULL); g_object_set (WID ("authenticate-button"), "sensitive", !state, NULL); - + /* Widgets which require authentication to be accessible */ g_object_set (pdialog->new_password, "sensitive", state, NULL); g_object_set (pdialog->retyped_password, "sensitive", state, NULL); g_object_set (WID ("new-password-label"), "sensitive", state, NULL); g_object_set (WID ("retyped-password-label"), "sensitive", state, NULL); - + if (!state) { /* Disable change-password-button when in not-authenticated state */ g_object_set (WID ("change-password-button"), "sensitive", FALSE, NULL); } - + pdialog->authenticated = state; - + if (state) { /* Authenticated state */ - + /* Focus new password */ gtk_widget_grab_focus (GTK_WIDGET (pdialog->new_password)); - + /* Set open lock image */ gtk_image_set_from_file (GTK_IMAGE (pdialog->dialog_image), GNOMECC_PIXMAP_DIR "/gnome-about-me-lock-open.png"); } else { /* Not authenticated state */ - + /* Focus current password */ gtk_widget_grab_focus (GTK_WIDGET (pdialog->current_password)); - + /* Set closed lock image */ gtk_image_set_from_file (GTK_IMAGE (pdialog->dialog_image), GNOMECC_PIXMAP_DIR "/gnome-about-me-lock.png"); } @@ -765,7 +768,7 @@ passdlg_clear (PasswordDialog *pdialog) { /* Set non-authenticated state */ passdlg_set_auth_state (pdialog, FALSE); - + /* Clear password entries */ gtk_entry_set_text (pdialog->current_password, ""); gtk_entry_set_text (pdialog->new_password, ""); @@ -780,25 +783,25 @@ passdlg_spawn_passwd (PasswordDialog *pdialog) { GError *error = NULL; gchar *details; - + /* If backend is running, stop it */ stop_passwd (pdialog); - + /* Spawn backend */ if (!spawn_passwd (pdialog, &error)) { details = g_strdup_printf (_("Unable to launch %s: %s"), "/usr/bin/passwd", error->message); - + passdlg_error_dialog (_("Unable to launch backend"), _("A system error has occurred"), details); - + g_free (details); g_error_free (error); - + return FALSE; } - + return TRUE; } @@ -808,22 +811,22 @@ passdlg_authenticate (GtkButton *button, PasswordDialog *pdialog) { /* Set busy as this can be a long process */ passdlg_set_busy (pdialog, TRUE); - + /* Update status message */ passdlg_set_status (pdialog, _("Checking password...")); - + /* Spawn backend */ if (!passdlg_spawn_passwd (pdialog)) { return; } - + authenticate (pdialog); - + /* Our IO watcher should now handle the rest */ } /* Validate passwords - * Returns: + * Returns: * PASSDLG_ERROR_NONE (0) if passwords are valid * PASSDLG_ERROR_NEW_PASSWORD_EMPTY * PASSDLG_ERROR_RETYPED_PASSWORD_EMPTY @@ -835,30 +838,30 @@ passdlg_validate_passwords (PasswordDialog *pdialog) GladeXML *dialog; const gchar *new_password, *retyped_password; glong nlen, rlen; - + dialog = pdialog->xml; - + new_password = gtk_entry_get_text (pdialog->new_password); retyped_password = gtk_entry_get_text (pdialog->retyped_password); - + nlen = g_utf8_strlen (new_password, -1); rlen = g_utf8_strlen (retyped_password, -1); - + if (nlen == 0) { /* New password empty */ return PASSDLG_ERROR_NEW_PASSWORD_EMPTY; } - + if (rlen == 0) { /* Retyped password empty */ return PASSDLG_ERROR_RETYPED_PASSWORD_EMPTY; } - + if (nlen != rlen || strncmp (new_password, retyped_password, nlen) != 0) { /* Passwords not equal */ return PASSDLG_ERROR_PASSWORDS_NOT_EQUAL; } - + /* Success */ return PASSDLG_ERROR_NONE; } @@ -872,28 +875,28 @@ passdlg_refresh_password_state (PasswordDialog *pdialog) GladeXML *dialog; guint ret; gboolean valid = FALSE; - + dialog = pdialog->xml; - + ret = passdlg_validate_passwords (pdialog); - + if (ret == PASSDLG_ERROR_NONE) { valid = TRUE; } - + g_object_set (WID ("change-password-button"), "sensitive", valid, NULL); - + return ret; } /* Called whenever any of the new password fields have changed */ -static void +static void passdlg_check_password (GtkEntry *entry, PasswordDialog *pdialog) { guint ret; - + ret = passdlg_refresh_password_state (pdialog); - + switch (ret) { case PASSDLG_ERROR_NONE: passdlg_set_status (pdialog, _("Click Change password to change your password.")); @@ -916,47 +919,47 @@ passdlg_check_password (GtkEntry *entry, PasswordDialog *pdialog) /* Called when the "Change password" dialog-button is clicked * Returns: TRUE if we want to keep the dialog running, FALSE otherwise */ static gboolean -passdlg_process_response (PasswordDialog *pdialog, gint response_id) +passdlg_process_response (PasswordDialog *pdialog, gint response_id) { - + if (response_id == GTK_RESPONSE_OK) { /* Set busy as this can be a long process */ passdlg_set_busy (pdialog, TRUE); - + /* Stop passwd if an error occured and it is still running */ if (pdialog->backend_state == PASSWD_STATE_ERR) { - + /* Stop passwd, free resources */ stop_passwd (pdialog); } - + /* Check that the backend is still running, or that an error * hass occured but it has not yet exited */ if (pdialog->backend_pid == -1) { /* If it is not, re-run authentication */ - + /* Spawn backend */ if (!passdlg_spawn_passwd (pdialog)) { return TRUE; } - + /* Add current and new passwords to queue */ authenticate (pdialog); update_password (pdialog); } else { /* Only add new passwords to queue */ update_password (pdialog); - + /* Pop new password through the backend */ io_queue_pop (pdialog->backend_stdin_queue, pdialog->backend_stdin); } - + /* Our IO watcher should now handle the rest */ - + /* Keep the dialog running */ return TRUE; } - + return FALSE; } @@ -978,83 +981,83 @@ passdlg_init (PasswordDialog *pdialog, GtkWindow *parent) GladeXML *dialog; GtkWidget *wpassdlg; GtkAccelGroup *group; - + /* Initialize dialog */ dialog = glade_xml_new (GNOMECC_GLADE_DIR "/gnome-about-me.glade", "change-password", NULL); pdialog->xml = dialog; - + wpassdlg = WID ("change-password"); capplet_set_icon (wpassdlg, "user-info"); - + group = gtk_accel_group_new (); - + /* * Initialize backend */ - + /* Initialize backend_pid. -1 means the backend is not running */ pdialog->backend_pid = -1; - + /* Initialize IO Channels */ pdialog->backend_stdin = NULL; pdialog->backend_stdout = NULL; - + /* Initialize write queue */ pdialog->backend_stdin_queue = g_queue_new (); - + /* Initialize watchers */ pdialog->backend_child_watch_id = 0; pdialog->backend_stdout_watch_id = 0; - + /* Initialize backend state */ pdialog->backend_state = PASSWD_STATE_NONE; - + /* * Initialize UI */ - + /* Initialize pdialog widgets */ pdialog->current_password = GTK_ENTRY (WID ("current-password")); pdialog->new_password = GTK_ENTRY (WID ("new-password")); pdialog->retyped_password = GTK_ENTRY (WID ("retyped-password")); pdialog->dialog_image = GTK_IMAGE (WID ("dialog-image")); pdialog->status_label = GTK_LABEL (WID ("status-label")); - + /* Initialize accelerators */ gtk_widget_add_accelerator (GTK_WIDGET (pdialog->current_password), "activate", group, GDK_Return, 0, 0); - + gtk_widget_add_accelerator (GTK_WIDGET (pdialog->new_password), "activate", group, GDK_Return, 0, 0); - + /* Activate authenticate-button when enter is pressed in current-password */ g_signal_connect (G_OBJECT (pdialog->current_password), "activate", G_CALLBACK (passdlg_activate), WID ("authenticate-button")); - + /* Activate retyped-password when enter is pressed in new-password */ g_signal_connect (G_OBJECT (pdialog->new_password), "activate", G_CALLBACK (passdlg_activate), pdialog->retyped_password); - + /* Clear status message */ passdlg_set_status (pdialog, ""); - + /* Set non-authenticated state */ passdlg_set_auth_state (pdialog, FALSE); - + /* Connect signal handlers */ g_signal_connect (G_OBJECT (WID ("authenticate-button")), "clicked", G_CALLBACK (passdlg_authenticate), pdialog); - + /* Verify new passwords on-the-fly */ - g_signal_connect (G_OBJECT (WID ("new-password")), "changed", + g_signal_connect (G_OBJECT (WID ("new-password")), "changed", G_CALLBACK (passdlg_check_password), pdialog); - g_signal_connect (G_OBJECT (WID ("retyped-password")), "changed", + g_signal_connect (G_OBJECT (WID ("retyped-password")), "changed", G_CALLBACK (passdlg_check_password), pdialog); - + /* Set misc dialog properties */ gtk_window_set_resizable (GTK_WINDOW (wpassdlg), FALSE); gtk_window_set_transient_for (GTK_WINDOW (wpassdlg), GTK_WINDOW (parent)); @@ -1067,25 +1070,25 @@ gnome_about_me_password (GtkWindow *parent) PasswordDialog *pdialog; GladeXML *dialog; GtkWidget *wpassdlg; - + gint result; gboolean response; - + /* Initialize dialog */ pdialog = g_new0 (PasswordDialog, 1); passdlg_init (pdialog, parent); - + dialog = pdialog->xml; wpassdlg = WID ("change-password"); - + /* Go! */ gtk_widget_show_all (wpassdlg); - + do { result = gtk_dialog_run (GTK_DIALOG (wpassdlg)); response = passdlg_process_response (pdialog, result); } while (response); - + /* Clean up */ stop_passwd (pdialog); gtk_widget_destroy (wpassdlg);