Package list policykit-1-gnome / 7d872a3
Convert patches to git-buildpackage pq Martin Pitt 3 years ago
3 changed file(s) with 79 addition(s) and 73 deletion(s). Raw diff Collapse all Expand all
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
+0
-71
debian/patches/02-select-default-user.patch less more
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/src/polkitgnomeauthenticationdialog.c
5 ===================================================================
6 --- policykit-1-gnome.orig/src/polkitgnomeauthenticationdialog.c 2011-03-04 00:06:46.599981036 +0100
7 +++ policykit-1-gnome/src/polkitgnomeauthenticationdialog.c 2011-03-04 00:07:11.211981036 +0100
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 @@ -719,16 +727,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
0 # Debian patches for policykit-1-gnome
1 02-select-default-user.patch
0 0001-Select-the-current-user-to-authenticate-with-by-defa.patch