diff --git a/debian/patches/0001-Select-the-current-user-to-authenticate-with-by-defa.patch b/debian/patches/0001-Select-the-current-user-to-authenticate-with-by-defa.patch new file mode 100644 index 0000000..91f67bb --- /dev/null +++ b/debian/patches/0001-Select-the-current-user-to-authenticate-with-by-defa.patch @@ -0,0 +1,78 @@ +From: Utopia Maintenance Team + +Date: Mon, 30 Apr 2018 17:56:52 +0000 +Subject: Select the current user to authenticate with by default + +Bug: http://bugzilla.gnome.org/show_bug.cgi?id=596188 +Bug-Ubuntu: https://launchpad.net/bugs/435227 +--- + src/polkitgnomeauthenticationdialog.c | 23 ++++++++++++++--------- + 1 file changed, 14 insertions(+), 9 deletions(-) + +diff --git a/src/polkitgnomeauthenticationdialog.c b/src/polkitgnomeauthenticationdialog.c +index 743cc96..d307516 100644 +--- a/src/polkitgnomeauthenticationdialog.c ++++ b/src/polkitgnomeauthenticationdialog.c +@@ -138,7 +138,7 @@ user_combobox_changed (GtkComboBox *widget, + static void + create_user_combobox (PolkitGnomeAuthenticationDialog *dialog) + { +- int n; ++ int n, i, selected_index = 0; + GtkComboBox *combo; + GtkTreeIter iter; + GtkCellRenderer *renderer; +@@ -162,7 +162,7 @@ create_user_combobox (PolkitGnomeAuthenticationDialog *dialog) + + + /* For each user */ +- for (n = 0; dialog->priv->users[n] != NULL; n++) ++ for (i = 0, n = 0; dialog->priv->users[n] != NULL; n++) + { + gchar *gecos; + gchar *real_name; +@@ -224,6 +224,14 @@ create_user_combobox (PolkitGnomeAuthenticationDialog *dialog) + USERNAME_COL, dialog->priv->users[n], + -1); + ++ i++; ++ if (passwd->pw_uid == getuid ()) ++ { ++ selected_index = i; ++ g_free (dialog->priv->selected_user); ++ dialog->priv->selected_user = g_strdup (dialog->priv->users[n]); ++ } ++ + g_free (real_name); + g_object_unref (pixbuf); + } +@@ -252,8 +260,8 @@ create_user_combobox (PolkitGnomeAuthenticationDialog *dialog) + user_combobox_set_sensitive, + NULL, NULL); + +- /* Initially select the "Select user..." ... */ +- gtk_combo_box_set_active (GTK_COMBO_BOX (combo), 0); ++ /* Select the default user */ ++ gtk_combo_box_set_active (GTK_COMBO_BOX (combo), selected_index); + + /* Listen when a new user is selected */ + g_signal_connect (GTK_WIDGET (combo), +@@ -719,16 +727,13 @@ polkit_gnome_authentication_dialog_constructed (GObject *object) + gtk_widget_set_tooltip_markup (label, s); + g_free (s); + +- if (have_user_combobox) ++ /* Disable password entry and authenticate until have a user selected */ ++ if (have_user_combobox && gtk_combo_box_get_active (GTK_COMBO_BOX (dialog->priv->user_combobox)) == 0) + { +- /* ... and make the password entry and "Authenticate" button insensitive */ + gtk_widget_set_sensitive (dialog->priv->prompt_label, FALSE); + gtk_widget_set_sensitive (dialog->priv->password_entry, FALSE); + gtk_widget_set_sensitive (dialog->priv->auth_button, FALSE); + } +- else +- { +- } + + gtk_widget_realize (GTK_WIDGET (dialog)); + diff --git a/debian/patches/02-select-default-user.patch b/debian/patches/02-select-default-user.patch deleted file mode 100644 index d19f87d..0000000 --- a/debian/patches/02-select-default-user.patch +++ /dev/null @@ -1,71 +0,0 @@ -# Description: Select the current user to authenticate with by default -# Ubuntu: https://launchpad.net/bugs/435227 -# Upstream: http://bugzilla.gnome.org/show_bug.cgi?id=596188 - -Index: policykit-1-gnome/src/polkitgnomeauthenticationdialog.c -=================================================================== ---- policykit-1-gnome.orig/src/polkitgnomeauthenticationdialog.c 2011-03-04 00:06:46.599981036 +0100 -+++ policykit-1-gnome/src/polkitgnomeauthenticationdialog.c 2011-03-04 00:07:11.211981036 +0100 -@@ -138,7 +138,7 @@ - static void - create_user_combobox (PolkitGnomeAuthenticationDialog *dialog) - { -- int n; -+ int n, i, selected_index = 0; - GtkComboBox *combo; - GtkTreeIter iter; - GtkCellRenderer *renderer; -@@ -162,7 +162,7 @@ - - - /* For each user */ -- for (n = 0; dialog->priv->users[n] != NULL; n++) -+ for (i = 0, n = 0; dialog->priv->users[n] != NULL; n++) - { - gchar *gecos; - gchar *real_name; -@@ -224,6 +224,14 @@ - USERNAME_COL, dialog->priv->users[n], - -1); - -+ i++; -+ if (passwd->pw_uid == getuid ()) -+ { -+ selected_index = i; -+ g_free (dialog->priv->selected_user); -+ dialog->priv->selected_user = g_strdup (dialog->priv->users[n]); -+ } -+ - g_free (real_name); - g_object_unref (pixbuf); - } -@@ -252,8 +260,8 @@ - user_combobox_set_sensitive, - NULL, NULL); - -- /* Initially select the "Select user..." ... */ -- gtk_combo_box_set_active (GTK_COMBO_BOX (combo), 0); -+ /* Select the default user */ -+ gtk_combo_box_set_active (GTK_COMBO_BOX (combo), selected_index); - - /* Listen when a new user is selected */ - g_signal_connect (GTK_WIDGET (combo), -@@ -719,16 +727,13 @@ - gtk_widget_set_tooltip_markup (label, s); - g_free (s); - -- if (have_user_combobox) -+ /* Disable password entry and authenticate until have a user selected */ -+ if (have_user_combobox && gtk_combo_box_get_active (GTK_COMBO_BOX (dialog->priv->user_combobox)) == 0) - { -- /* ... and make the password entry and "Authenticate" button insensitive */ - gtk_widget_set_sensitive (dialog->priv->prompt_label, FALSE); - gtk_widget_set_sensitive (dialog->priv->password_entry, FALSE); - gtk_widget_set_sensitive (dialog->priv->auth_button, FALSE); - } -- else -- { -- } - - gtk_widget_realize (GTK_WIDGET (dialog)); - diff --git a/debian/patches/series b/debian/patches/series index 91adbc7..a589347 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -1,2 +1 @@ -# Debian patches for policykit-1-gnome -02-select-default-user.patch +0001-Select-the-current-user-to-authenticate-with-by-defa.patch