[accounts-dialog] Pay attention to PolicyKit changes
- From: Matthias Clasen <matthiasc src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [accounts-dialog] Pay attention to PolicyKit changes
- Date: Wed, 20 Jan 2010 19:19:25 +0000 (UTC)
commit b407743a2092b26b1f7c2795f0ef91b27e7e4bbc
Author: Matthias Clasen <mclasen redhat com>
Date: Wed Jan 20 13:30:39 2010 -0500
Pay attention to PolicyKit changes
...and update widget sensitivity/visibility.
src/main.c | 30 ++++++++++++++++++++++++------
1 files changed, 24 insertions(+), 6 deletions(-)
---
diff --git a/src/main.c b/src/main.c
index 43db271..668b508 100644
--- a/src/main.c
+++ b/src/main.c
@@ -608,14 +608,15 @@ update_add_button (GObject *source,
g_object_unref (result);
}
- if (!is_authorized) {
- gtk_widget_set_sensitive (get_widget (d, "add-user-button"), FALSE);
- }
+ gtk_widget_set_sensitive (get_widget (d, "add-user-button"), is_authorized);
if (!gtk_widget_is_sensitive (get_widget (d, "add-user-button")) &&
!gtk_widget_is_sensitive (get_widget (d, "delete-user-button"))) {
gtk_widget_hide (get_widget (d, "add-delete-buttonbox"));
}
+ else {
+ gtk_widget_show (get_widget (d, "add-delete-buttonbox"));
+ }
}
static void
@@ -647,14 +648,15 @@ update_delete_button (GObject *source,
g_object_unref (result);
}
- if (!is_authorized) {
- gtk_widget_set_sensitive (get_widget (d, "delete-user-button"), FALSE);
- }
+ gtk_widget_set_sensitive (get_widget (d, "delete-user-button"), is_authorized);
if (!gtk_widget_is_sensitive (get_widget (d, "add-user-button")) &&
!gtk_widget_is_sensitive (get_widget (d, "delete-user-button"))) {
gtk_widget_hide (get_widget (d, "add-delete-buttonbox"));
}
+ else {
+ gtk_widget_show (get_widget (d, "add-delete-buttonbox"));
+ }
}
static void
@@ -685,6 +687,20 @@ update_create_buttons (UserAccountDialog *d)
}
static void
+authorizations_changed (PolkitAuthority *authority,
+ gpointer data)
+{
+ UserAccountDialog *d = data;
+ UmUser *user;
+
+ update_create_buttons (d);
+ user = get_selected_user (d);
+ if (user) {
+ update_change_buttons (d, user);
+ }
+}
+
+static void
selected_user_changed (GtkTreeSelection *selection, UserAccountDialog *d)
{
GtkWidget *widget;
@@ -1129,6 +1145,8 @@ main (int argc, char *argv[])
}
d->authority = polkit_authority_get ();
+ g_signal_connect (d->authority, "changed",
+ G_CALLBACK (authorizations_changed), d);
setup_main_window (d);
d->login_options = um_login_options_new (d->builder);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]