|
0 |
# Description: Select the current user to authenticate with by default
|
|
1 |
# Ubuntu: https://launchpad.net/bugs/435227
|
|
2 |
# Upstream: http://bugzilla.gnome.org/show_bug.cgi?id=596188
|
|
3 |
|
|
4 |
Index: policykit-1-gnome-0.94/src/polkitgnomeauthenticationdialog.c
|
|
5 |
===================================================================
|
|
6 |
--- policykit-1-gnome-0.94.orig/src/polkitgnomeauthenticationdialog.c 2009-10-02 13:43:42.000000000 +1000
|
|
7 |
+++ policykit-1-gnome-0.94/src/polkitgnomeauthenticationdialog.c 2009-10-02 18:03:03.000000000 +1000
|
|
8 |
@@ -138,7 +138,7 @@
|
|
9 |
static void
|
|
10 |
create_user_combobox (PolkitGnomeAuthenticationDialog *dialog)
|
|
11 |
{
|
|
12 |
- int n;
|
|
13 |
+ int n, i, selected_index = 0;
|
|
14 |
GtkComboBox *combo;
|
|
15 |
GtkTreeIter iter;
|
|
16 |
GtkCellRenderer *renderer;
|
|
17 |
@@ -162,7 +162,7 @@
|
|
18 |
|
|
19 |
|
|
20 |
/* For each user */
|
|
21 |
- for (n = 0; dialog->priv->users[n] != NULL; n++)
|
|
22 |
+ for (i = 0, n = 0; dialog->priv->users[n] != NULL; n++)
|
|
23 |
{
|
|
24 |
gchar *gecos;
|
|
25 |
gchar *real_name;
|
|
26 |
@@ -224,6 +224,14 @@
|
|
27 |
USERNAME_COL, dialog->priv->users[n],
|
|
28 |
-1);
|
|
29 |
|
|
30 |
+ i++;
|
|
31 |
+ if (passwd->pw_uid == getuid ())
|
|
32 |
+ {
|
|
33 |
+ selected_index = i;
|
|
34 |
+ g_free (dialog->priv->selected_user);
|
|
35 |
+ dialog->priv->selected_user = g_strdup (dialog->priv->users[n]);
|
|
36 |
+ }
|
|
37 |
+
|
|
38 |
g_free (real_name);
|
|
39 |
g_object_unref (pixbuf);
|
|
40 |
}
|
|
41 |
@@ -252,8 +260,8 @@
|
|
42 |
user_combobox_set_sensitive,
|
|
43 |
NULL, NULL);
|
|
44 |
|
|
45 |
- /* Initially select the "Select user..." ... */
|
|
46 |
- gtk_combo_box_set_active (GTK_COMBO_BOX (combo), 0);
|
|
47 |
+ /* Select the default user */
|
|
48 |
+ gtk_combo_box_set_active (GTK_COMBO_BOX (combo), selected_index);
|
|
49 |
|
|
50 |
/* Listen when a new user is selected */
|
|
51 |
g_signal_connect (GTK_WIDGET (combo),
|
|
52 |
@@ -706,16 +714,13 @@
|
|
53 |
gtk_widget_set_tooltip_markup (label, s);
|
|
54 |
g_free (s);
|
|
55 |
|
|
56 |
- if (have_user_combobox)
|
|
57 |
+ /* Disable password entry and authenticate until have a user selected */
|
|
58 |
+ if (have_user_combobox && gtk_combo_box_get_active (GTK_COMBO_BOX (dialog->priv->user_combobox)) == 0)
|
|
59 |
{
|
|
60 |
- /* ... and make the password entry and "Authenticate" button insensitive */
|
|
61 |
gtk_widget_set_sensitive (dialog->priv->prompt_label, FALSE);
|
|
62 |
gtk_widget_set_sensitive (dialog->priv->password_entry, FALSE);
|
|
63 |
gtk_widget_set_sensitive (dialog->priv->auth_button, FALSE);
|
|
64 |
}
|
|
65 |
- else
|
|
66 |
- {
|
|
67 |
- }
|
|
68 |
|
|
69 |
gtk_widget_realize (GTK_WIDGET (dialog));
|
|
70 |
|