[gnome-system-tools] Fix password label changing size



commit 8528a663bc936c3351e46016d96d5776c1e2be02
Author: Milan Bouchet-Valat <nalimilan club fr>
Date:   Mon May 24 11:31:22 2010 +0200

    Fix password label changing size
    
    Set the length of the password label in the main window on start, depending on the length of the strings that it will hold. This way, it will not change size, changing the users list's height, when a new user is selected.

 src/users/main.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/src/users/main.c b/src/users/main.c
index e9abca9..d182cd6 100644
--- a/src/users/main.c
+++ b/src/users/main.c
@@ -25,6 +25,7 @@
 
 
 #include <config.h>
+#include <glib/gi18n.h>
 #include "gst.h"
 
 #include <string.h>
@@ -56,6 +57,8 @@ static void
 main_window_prepare (GstUsersTool *tool)
 {
 	GtkWidget *uid_entry;
+	GtkWidget *passwd_label;
+	int width;
 
 	uid_entry = gst_dialog_get_widget (GST_TOOL (tool)->main_dialog, "user_settings_uid");
 	gtk_spin_button_set_range (GTK_SPIN_BUTTON (uid_entry), 0, OOBS_MAX_UID);
@@ -65,6 +68,12 @@ main_window_prepare (GstUsersTool *tool)
 	gtk_window_set_default_size (GTK_WINDOW (GST_TOOL (tool)->main_dialog),
 	                             650, 400);
 
+	/* Ensure dialog won't change size when selecting another user */
+	passwd_label = gst_dialog_get_widget (GST_TOOL (tool)->main_dialog,
+	                                        "user_settings_passwd");
+	width = MAX (strlen (_("Not asked on login")), strlen (_("Asked on login")));
+	gtk_label_set_width_chars (GTK_LABEL (passwd_label), width);
+
 	/* For random password generation. */
 	srand (time (NULL));
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]