|
0 |
From: Utopia Maintenance Team
|
|
1 |
<pkg-utopia-maintainers@lists.alioth.debian.org>
|
|
2 |
Date: Mon, 30 Apr 2018 17:56:52 +0000
|
|
3 |
Subject: Select the current user to authenticate with by default
|
|
4 |
|
|
5 |
Bug: http://bugzilla.gnome.org/show_bug.cgi?id=596188
|
|
6 |
Bug-Ubuntu: https://launchpad.net/bugs/435227
|
|
7 |
---
|
|
8 |
src/polkitgnomeauthenticationdialog.c | 23 ++++++++++++++---------
|
|
9 |
1 file changed, 14 insertions(+), 9 deletions(-)
|
|
10 |
|
|
11 |
diff --git a/src/polkitgnomeauthenticationdialog.c b/src/polkitgnomeauthenticationdialog.c
|
|
12 |
index 743cc96..d307516 100644
|
|
13 |
--- a/src/polkitgnomeauthenticationdialog.c
|
|
14 |
+++ b/src/polkitgnomeauthenticationdialog.c
|
|
15 |
@@ -138,7 +138,7 @@ user_combobox_changed (GtkComboBox *widget,
|
|
16 |
static void
|
|
17 |
create_user_combobox (PolkitGnomeAuthenticationDialog *dialog)
|
|
18 |
{
|
|
19 |
- int n;
|
|
20 |
+ int n, i, selected_index = 0;
|
|
21 |
GtkComboBox *combo;
|
|
22 |
GtkTreeIter iter;
|
|
23 |
GtkCellRenderer *renderer;
|
|
24 |
@@ -162,7 +162,7 @@ create_user_combobox (PolkitGnomeAuthenticationDialog *dialog)
|
|
25 |
|
|
26 |
|
|
27 |
/* For each user */
|
|
28 |
- for (n = 0; dialog->priv->users[n] != NULL; n++)
|
|
29 |
+ for (i = 0, n = 0; dialog->priv->users[n] != NULL; n++)
|
|
30 |
{
|
|
31 |
gchar *gecos;
|
|
32 |
gchar *real_name;
|
|
33 |
@@ -224,6 +224,14 @@ create_user_combobox (PolkitGnomeAuthenticationDialog *dialog)
|
|
34 |
USERNAME_COL, dialog->priv->users[n],
|
|
35 |
-1);
|
|
36 |
|
|
37 |
+ i++;
|
|
38 |
+ if (passwd->pw_uid == getuid ())
|
|
39 |
+ {
|
|
40 |
+ selected_index = i;
|
|
41 |
+ g_free (dialog->priv->selected_user);
|
|
42 |
+ dialog->priv->selected_user = g_strdup (dialog->priv->users[n]);
|
|
43 |
+ }
|
|
44 |
+
|
|
45 |
g_free (real_name);
|
|
46 |
g_object_unref (pixbuf);
|
|
47 |
}
|
|
48 |
@@ -252,8 +260,8 @@ create_user_combobox (PolkitGnomeAuthenticationDialog *dialog)
|
|
49 |
user_combobox_set_sensitive,
|
|
50 |
NULL, NULL);
|
|
51 |
|
|
52 |
- /* Initially select the "Select user..." ... */
|
|
53 |
- gtk_combo_box_set_active (GTK_COMBO_BOX (combo), 0);
|
|
54 |
+ /* Select the default user */
|
|
55 |
+ gtk_combo_box_set_active (GTK_COMBO_BOX (combo), selected_index);
|
|
56 |
|
|
57 |
/* Listen when a new user is selected */
|
|
58 |
g_signal_connect (GTK_WIDGET (combo),
|
|
59 |
@@ -719,16 +727,13 @@ polkit_gnome_authentication_dialog_constructed (GObject *object)
|
|
60 |
gtk_widget_set_tooltip_markup (label, s);
|
|
61 |
g_free (s);
|
|
62 |
|
|
63 |
- if (have_user_combobox)
|
|
64 |
+ /* Disable password entry and authenticate until have a user selected */
|
|
65 |
+ if (have_user_combobox && gtk_combo_box_get_active (GTK_COMBO_BOX (dialog->priv->user_combobox)) == 0)
|
|
66 |
{
|
|
67 |
- /* ... and make the password entry and "Authenticate" button insensitive */
|
|
68 |
gtk_widget_set_sensitive (dialog->priv->prompt_label, FALSE);
|
|
69 |
gtk_widget_set_sensitive (dialog->priv->password_entry, FALSE);
|
|
70 |
gtk_widget_set_sensitive (dialog->priv->auth_button, FALSE);
|
|
71 |
}
|
|
72 |
- else
|
|
73 |
- {
|
|
74 |
- }
|
|
75 |
|
|
76 |
gtk_widget_realize (GTK_WIDGET (dialog));
|
|
77 |
|