evolution-data-server r8535 - trunk/libedataserverui
- From: mbarnes svn gnome org
- To: svn-commits-list gnome org
- Subject: evolution-data-server r8535 - trunk/libedataserverui
- Date: Tue, 26 Feb 2008 14:06:52 +0000 (GMT)
Author: mbarnes
Date: Tue Feb 26 14:06:52 2008
New Revision: 8535
URL: http://svn.gnome.org/viewvc/evolution-data-server?rev=8535&view=rev
Log:
2008-02-26 Matthew Barnes <mbarnes redhat com>
** Fixes bug #513870
* libedataserverui/e-passwords.c (ep_clear_passwords_keyfile),
(ep_forget_passwords_keyfile), (ep_forget_password_keyfile),
(ep_get_password_keyfile):
Issue an informational message instead of a warning if the requested
group or key is not found in the key file. These are non-critical
events and should not halt the program when running with fatal
warnings, but it's still useful to leave a breadcrumb on the
terminal since our current password API leaves no way to report
status back to the caller.
Modified:
trunk/libedataserverui/ChangeLog
trunk/libedataserverui/e-passwords.c
Modified: trunk/libedataserverui/e-passwords.c
==============================================================================
--- trunk/libedataserverui/e-passwords.c (original)
+++ trunk/libedataserverui/e-passwords.c Tue Feb 26 14:06:52 2008
@@ -491,14 +491,19 @@
group = ep_key_file_get_group (msg->component);
- g_key_file_remove_group (key_file, group, &error);
- if (error == NULL)
+ if (g_key_file_remove_group (key_file, group, &error))
ep_key_file_save ();
- else {
- if (error) {
- g_warning ("%s", error->message);
- g_error_free (error);
- }
+
+ /* Not finding the requested group is acceptable, but we still
+ * want to leave an informational message on the terminal. */
+ else if (g_error_matches (error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_GROUP_NOT_FOUND)) {
+ g_message ("%s", error->message);
+ g_error_free (error);
+
+ /* Issue a warning if anything else goes wrong. */
+ } else if (error != NULL) {
+ g_warning ("%s", error->message);
+ g_error_free (error);
}
g_free (group);
@@ -543,9 +548,24 @@
groups = g_key_file_get_groups (key_file, &length);
for (ii = 0; ii < length; ii++) {
+ GError *error = NULL;
+
if (!g_str_has_prefix (groups[ii], KEY_FILE_GROUP_PREFIX))
continue;
- g_key_file_remove_group (key_file, groups[ii], NULL);
+
+ g_key_file_remove_group (key_file, groups[ii], &error);
+
+ /* Not finding the requested group is acceptable, but we still
+ * want to leave an informational message on the terminal. */
+ if (g_error_matches (error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_GROUP_NOT_FOUND)) {
+ g_message ("%s", error->message);
+ g_error_free (error);
+
+ /* Issue a warning if anything else goes wrong. */
+ } else if (error != NULL) {
+ g_warning ("%s", error->message);
+ g_error_free (error);
+ }
}
ep_key_file_save ();
g_strfreev (groups);
@@ -664,10 +684,22 @@
group = ep_key_file_get_group (msg->component);
key = ep_key_file_normalize_key (msg->key);
- g_key_file_remove_key (key_file, group, key, &error);
- if (error == NULL)
+ if (g_key_file_remove_key (key_file, group, key, &error))
ep_key_file_save ();
- else {
+
+ /* Not finding the requested key is acceptable, but we still
+ * want to leave an informational message on the terminal. */
+ else if (g_error_matches (error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_KEY_NOT_FOUND)) {
+ g_message ("%s", error->message);
+ g_error_free (error);
+
+ /* Not finding the requested group is also acceptable. */
+ } else if (g_error_matches (error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_GROUP_NOT_FOUND)) {
+ g_message ("%s", error->message);
+ g_error_free (error);
+
+ /* Issue a warning if anything else goes wrong. */
+ } else if (error != NULL) {
g_warning ("%s", error->message);
g_error_free (error);
}
@@ -740,6 +772,19 @@
if (password != NULL) {
msg->password = ep_password_decode (password);
g_free (password);
+
+ /* Not finding the requested key is acceptable, but we still
+ * want to leave an informational message on the terminal. */
+ } else if (g_error_matches (error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_KEY_NOT_FOUND)) {
+ g_message ("%s", error->message);
+ g_error_free (error);
+
+ /* Not finding the requested group is also acceptable. */
+ } else if (g_error_matches (error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_GROUP_NOT_FOUND)) {
+ g_message ("%s", error->message);
+ g_error_free (error);
+
+ /* Issue a warning if anything else goes wrong. */
} else if (error != NULL) {
g_warning ("%s", error->message);
g_error_free (error);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]