[gnome-packagekit] Add a common function gpk_is_error_code_retry_trusted()



commit 1a4388c7aed41b69acaabb1626ea0b40dc8835cd
Author: Richard Hughes <richard hughsie com>
Date:   Wed Jun 17 13:05:05 2009 +0100

    Add a common function gpk_is_error_code_retry_trusted()

 src/gpk-common.c |   23 +++++++++++++++++++++++
 src/gpk-common.h |    1 +
 2 files changed, 24 insertions(+), 0 deletions(-)
---
diff --git a/src/gpk-common.c b/src/gpk-common.c
index e5561a9..5a511c8 100644
--- a/src/gpk-common.c
+++ b/src/gpk-common.c
@@ -45,6 +45,29 @@
 #define GNOME_SESSION_MANAGER_PATH		"/org/gnome/SessionManager"
 #define GNOME_SESSION_MANAGER_INTERFACE		"org.gnome.SessionManager"
 
+/**
+ * gpk_is_error_code_retry_trusted:
+ * @error_code: the transactions #PkErrorCodeEnum
+ *
+ * Return value: if the error code suggests to try with only_trusted %FALSE
+ **/
+gboolean
+gpk_is_error_code_retry_trusted (PkErrorCodeEnum error_code)
+{
+	gboolean ret = FALSE;
+	switch (error_code) {
+		case PK_ERROR_ENUM_GPG_FAILURE:
+		case PK_ERROR_ENUM_BAD_GPG_SIGNATURE:
+		case PK_ERROR_ENUM_MISSING_GPG_SIGNATURE:
+		case PK_ERROR_ENUM_CANNOT_INSTALL_REPO_UNSIGNED:
+		case PK_ERROR_ENUM_CANNOT_UPDATE_REPO_UNSIGNED:
+			ret = TRUE;
+			break;
+		default:
+			break;
+	}
+	return ret;
+}
 
 /**
  * gtk_text_buffer_insert_markup:
diff --git a/src/gpk-common.h b/src/gpk-common.h
index d250173..3e11acc 100644
--- a/src/gpk-common.h
+++ b/src/gpk-common.h
@@ -105,6 +105,7 @@ gboolean	 gpk_window_set_size_request		(GtkWindow	*window,
 							 guint		 width,
 							 guint		 height);
 gboolean	 gpk_ignore_session_error		(GError		*error);
+gboolean	 gpk_is_error_code_retry_trusted	(PkErrorCodeEnum error_code);
 
 G_END_DECLS
 



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