[gnome-packagekit] Only show the monitor icon when the task is no longer connected to the bus but running



commit 9883208d2ef296e181dc0f61b09cf1414810fca5
Author: Richard Hughes <richard hughsie com>
Date:   Tue May 26 18:36:59 2009 +0100

    Only show the monitor icon when the task is no longer connected to the bus but running
---
 src/gpk-check-update.c |    2 +-
 src/gpk-watch.c        |   16 ++++++++++++++--
 2 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/src/gpk-check-update.c b/src/gpk-check-update.c
index 236de20..9987910 100644
--- a/src/gpk-check-update.c
+++ b/src/gpk-check-update.c
@@ -856,7 +856,7 @@ gpk_check_update_process_updates (GpkCheckUpdate *cupdate, PkPackageList *list,
 	/* work out icon (cannot be NULL) */
 	icon = gpk_check_update_get_best_update_icon (cupdate, list);
 	gtk_status_icon_set_from_icon_name (cupdate->priv->status_icon, icon);
-	gtk_status_icon_set_visible (watch->priv->status_icon, TRUE);
+	gtk_status_icon_set_visible (cupdate->priv->status_icon, TRUE);
 
 	/* make tooltip */
 	if (status_security->len != 0)
diff --git a/src/gpk-watch.c b/src/gpk-watch.c
index 98e3328..42e2bc3 100644
--- a/src/gpk-watch.c
+++ b/src/gpk-watch.c
@@ -225,6 +225,8 @@ out:
 static PkBitfield
 gpk_watch_task_list_to_status_bitfield (GpkWatch *watch)
 {
+	gboolean ret;
+	gboolean active;
 	guint i;
 	guint length;
 	PkBitfield status = 0;
@@ -244,8 +246,18 @@ gpk_watch_task_list_to_status_bitfield (GpkWatch *watch)
 			egg_warning ("not found item %i", i);
 			break;
 		}
-		egg_debug ("%s %s", item->tid, pk_status_enum_to_text (item->status));
-		pk_bitfield_add (status, item->status);
+
+		/* only show an icon for this if the application isn't still on the bus */
+		ret = pk_client_is_caller_active (item->monitor, &active, NULL);
+
+		/* if we failed to get data, assume bad things happened */
+		if (!ret)
+			active = TRUE;
+
+		/* add to bitfield calculation */
+		egg_debug ("%s %s (active:%i)", item->tid, pk_status_enum_to_text (item->status), active);
+		if (!active)
+			pk_bitfield_add (status, item->status);
 	}
 out:
 	return status;



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