[gnome-packagekit] if we're doing queries automatically for the user, don't spam them with locking failure messages. Fi
- From: Richard Hughes <rhughes src gnome org>
- To: svn-commits-list gnome org
- Subject: [gnome-packagekit] if we're doing queries automatically for the user, don't spam them with locking failure messages. Fi
- Date: Thu, 16 Jul 2009 14:24:35 +0000 (UTC)
commit 936539c3eb71ee6e0761d3b2145bc19a3933bebb
Author: Richard Hughes <richard hughsie com>
Date: Thu Jul 16 15:12:04 2009 +0100
if we're doing queries automatically for the user, don't spam them with locking failure messages. Fixes gnome#588698
src/gpk-check-update.c | 28 ++++++++++++++++++++++++++--
1 files changed, 26 insertions(+), 2 deletions(-)
---
diff --git a/src/gpk-check-update.c b/src/gpk-check-update.c
index a8f8ac0..427b7b2 100644
--- a/src/gpk-check-update.c
+++ b/src/gpk-check-update.c
@@ -1261,22 +1261,46 @@ gpk_cupdate_connection_changed_cb (EggDbusMonitor *monitor, gboolean connected,
static void
gpk_check_update_error_code_cb (PkClient *client, PkErrorCodeEnum code, const gchar *details, GpkCheckUpdate *cupdate)
{
+ PkRoleEnum role;
+ gboolean ret;
+ GError *error = NULL;
+
/* ignore some errors */
if (code == PK_ERROR_ENUM_PROCESS_KILL ||
code == PK_ERROR_ENUM_TRANSACTION_CANCELLED) {
egg_debug ("error ignored %s\n%s", pk_error_enum_to_text (code), details);
- return;
+ goto out;
}
/* ignore the ones we can handle */
if (pk_error_code_is_need_untrusted (code)) {
egg_debug ("error ignored as we're handling %s\n%s", pk_error_enum_to_text (code), details);
- return;
+ goto out;
+ }
+
+ /* get the role */
+ ret = pk_client_get_role (client, &role, NULL, &error);
+ if (!ret) {
+ egg_warning ("failed to get role: %s", error->message);
+ g_error_free (error);
+ goto out;
+ }
+
+ /* if we're doing queries automatically for the user, don't spam them
+ with locking failure messages */
+ if (code == PK_ERROR_ENUM_CANNOT_GET_LOCK) {
+ if (role == PK_ROLE_ENUM_GET_UPDATES ||
+ role == PK_ROLE_ENUM_GET_DISTRO_UPGRADES) {
+ egg_debug ("cannot get lock for automatic action, ignoring");
+ goto out;
+ }
}
/* not modal as we are a status icon */
gpk_error_dialog (gpk_error_enum_to_localised_text (code),
gpk_error_enum_to_localised_message (code), details);
+out:
+ return;
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]