[gnome-system-tools] Only update Real name in case of success



commit d8dfce2ce5a11bf8481d2357ce6469bad90f7257
Author: Milan Bouchet-Valat <nalimilan club fr>
Date:   Sun Mar 14 16:19:24 2010 +0100

    Only update Real name in case of success
    
    Check that commit was successful before updating labels.

 src/users/user-settings.c |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)
---
diff --git a/src/users/user-settings.c b/src/users/user-settings.c
index 7845161..9c8a5f8 100644
--- a/src/users/user-settings.c
+++ b/src/users/user-settings.c
@@ -1053,6 +1053,7 @@ on_edit_user_name (GtkButton *button, gpointer user_data)
 	OobsUser *user;
 	const char *fullname;
 	gboolean is_self;
+	OobsResult result;
 
 	user = users_table_get_current ();
 
@@ -1090,12 +1091,14 @@ on_edit_user_name (GtkButton *button, gpointer user_data)
 		oobs_user_set_full_name (user, fullname);
 
 		if (is_self)
-			gst_tool_commit (tool, GST_USERS_TOOL (tool)->self_config);
+			result = gst_tool_commit (tool, GST_USERS_TOOL (tool)->self_config);
 		else
-			gst_tool_commit (tool, OOBS_OBJECT (user));
+			result = gst_tool_commit (tool, OOBS_OBJECT (user));
 
-		gtk_label_set_text (GTK_LABEL (user_settings_real_name), fullname);
-		users_table_update_current ();
+		if (result == OOBS_RESULT_OK) {
+			gtk_label_set_text (GTK_LABEL (user_settings_real_name), fullname);
+			users_table_update_current ();
+		}
 	}
 
 	g_object_unref (user);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]