[gnome-flashback] polkit: select the current user by default
- From: Alberts Muktupāvels <muktupavels src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-flashback] polkit: select the current user by default
- Date: Sun, 6 Sep 2015 20:59:00 +0000 (UTC)
commit a08041b2b5ab2e904e10ae908869cb1e06596ae7
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date: Sun Sep 6 21:46:46 2015 +0300
polkit: select the current user by default
Based on original policykit-gnome patch from Robert Ancell.
https://bugzilla.gnome.org/show_bug.cgi?id=596188
.../libpolkit/flashback-polkit-dialog.c | 16 +++++++++++++++-
1 files changed, 15 insertions(+), 1 deletions(-)
---
diff --git a/gnome-flashback/libpolkit/flashback-polkit-dialog.c
b/gnome-flashback/libpolkit/flashback-polkit-dialog.c
index 40042b7..9434b05 100644
--- a/gnome-flashback/libpolkit/flashback-polkit-dialog.c
+++ b/gnome-flashback/libpolkit/flashback-polkit-dialog.c
@@ -273,6 +273,8 @@ setup_users_store (FlashbackPolkitDialog *dialog)
{
GtkTreeIter iter;
gint i;
+ gint index;
+ gint selected_index;
GtkComboBox *combobox;
GtkCellRenderer *renderer;
@@ -289,6 +291,9 @@ setup_users_store (FlashbackPolkitDialog *dialog)
COLUMN_USERNAME, NULL,
-1);
+ index = 0;
+ selected_index = 0;
+
for (i = 0; dialog->users[i] != NULL; i++)
{
gchar *gecos;
@@ -354,6 +359,15 @@ setup_users_store (FlashbackPolkitDialog *dialog)
COLUMN_USERNAME, dialog->users[i],
-1);
+ index++;
+ if (passwd->pw_uid == getuid ())
+ {
+ selected_index = index;
+
+ g_free (dialog->selected_user);
+ dialog->selected_user = g_strdup (dialog->users[i]);
+ }
+
g_free (real_name);
g_object_unref (pixbuf);
}
@@ -377,7 +391,7 @@ setup_users_store (FlashbackPolkitDialog *dialog)
(GtkCellLayoutDataFunc) combobox_set_sensitive,
NULL, NULL);
- gtk_combo_box_set_active (GTK_COMBO_BOX (combobox), 0);
+ gtk_combo_box_set_active (GTK_COMBO_BOX (combobox), selected_index);
g_signal_connect (dialog->users_combobox, "changed",
G_CALLBACK (users_combobox_changed_cb), dialog);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]