[gnome-system-tools/users-ui-redesign] Don't commit changes when all user deletions have been canceled
- From: Milan Bouchet-Valat <milanbv src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gnome-system-tools/users-ui-redesign] Don't commit changes when all user deletions have been canceled
- Date: Mon, 30 Nov 2009 21:10:43 +0000 (UTC)
commit 4c995b6c31eee59cc5da9a7b30608729b400f1c3
Author: Milan Bouchet-Valat <nalimilan club fr>
Date: Sat Nov 28 16:12:16 2009 +0100
Don't commit changes when all user deletions have been canceled
We support deleting several selected users at the same time. But we need to check how many of them will finally be deleted, in case the user has chosen cancel for all of them. This is especially an issue now that PolicyKit authentication dialog may be shown when committing: if only one user was selected, and its deletion has been canceled, asking for authentication seems to indicate that the user will be removed anyway.
src/users/callbacks.c | 24 ------------------------
src/users/user-settings.c | 28 ++++++++++++++++++++++++++++
2 files changed, 28 insertions(+), 24 deletions(-)
---
diff --git a/src/users/callbacks.c b/src/users/callbacks.c
index 8761d4d..ecc2ed5 100644
--- a/src/users/callbacks.c
+++ b/src/users/callbacks.c
@@ -320,30 +320,6 @@ on_user_settings_clicked (GtkButton *button, gpointer user_data)
}
void
-on_user_delete_clicked (GtkButton *button, gpointer user_data)
-{
- GtkTreeModel *model;
- GtkTreePath *path;
- GtkTreeIter iter;
- GList *list, *elem;
-
- list = elem = table_get_row_references (TABLE_USERS, &model);
-
- while (elem) {
- path = gtk_tree_row_reference_get_path (elem->data);
- user_delete (model, path);
-
- gtk_tree_path_free (path);
- elem = elem->next;
- }
-
- g_list_foreach (list, (GFunc) gtk_tree_row_reference_free, NULL);
- g_list_free (list);
-
- gst_tool_commit (tool, GST_USERS_TOOL (tool)->users_config);
-}
-
-void
on_manage_groups_clicked (GtkWidget *widget, gpointer user_data)
{
GtkWidget *dialog;
diff --git a/src/users/user-settings.c b/src/users/user-settings.c
index d01831f..6c198f6 100644
--- a/src/users/user-settings.c
+++ b/src/users/user-settings.c
@@ -151,6 +151,34 @@ user_delete (GtkTreeModel *model, GtkTreePath *path)
return retval;
}
+void
+on_user_delete_clicked (GtkButton *button, gpointer user_data)
+{
+ GtkTreeModel *model;
+ GtkTreePath *path;
+ GtkTreeIter iter;
+ GList *list, *elem;
+ gboolean count;
+
+ list = elem = table_get_row_references (TABLE_USERS, &model);
+
+ count = 0;
+
+ while (elem) {
+ path = gtk_tree_row_reference_get_path (elem->data);
+ count += user_delete (model, path);
+
+ gtk_tree_path_free (path);
+ elem = elem->next;
+ }
+
+ g_list_foreach (list, (GFunc) gtk_tree_row_reference_free, NULL);
+ g_list_free (list);
+
+ if (count > 0)
+ gst_tool_commit (tool, GST_USERS_TOOL (tool)->users_config);
+}
+
static void
set_entry_text (GtkWidget *entry, const gchar *text)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]