[gnome-software] Fix the logic for stale notification removal at startup
- From: Kalev Lember <klember src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] Fix the logic for stale notification removal at startup
- Date: Tue, 23 Jun 2015 14:14:05 +0000 (UTC)
commit 710147c46d3dbc817987a4635419fa334e5595b1
Author: Kalev Lember <klember redhat com>
Date: Tue Jun 23 13:32:00 2015 +0200
Fix the logic for stale notification removal at startup
The code that was supposed to remove stale notifications from previous
gnome-software execution never actually worked due to a glib bug. Now
that glib commit c612fca fixed up g_application_withdraw_notification(),
several issues with the code have came up.
This commit makes the stale notification removal more careful, so that
we only withdraw the "Updates Available" notification when the prepared
update is gone; and likewise only remove the "Updates Completed"
notification when we have no update results to show.
src/gs-update-monitor.c | 11 +++++++----
1 files changed, 7 insertions(+), 4 deletions(-)
---
diff --git a/src/gs-update-monitor.c b/src/gs-update-monitor.c
index bc11605..dc09ea9 100644
--- a/src/gs-update-monitor.c
+++ b/src/gs-update-monitor.c
@@ -119,7 +119,6 @@ offline_update_monitor_cb (GFileMonitor *file_monitor,
static void
start_monitoring_offline_updates (GsUpdateMonitor *monitor)
{
- monitor->offline_update_file = g_file_new_for_path ("/var/lib/PackageKit/prepared-update");
monitor->offline_update_monitor = g_file_monitor_file (monitor->offline_update_file, 0, NULL, NULL);
g_signal_connect (monitor->offline_update_monitor, "changed",
@@ -502,6 +501,7 @@ gs_update_monitor_init (GsUpdateMonitor *monitor)
{
gint64 tmp;
+ monitor->offline_update_file = g_file_new_for_path ("/var/lib/PackageKit/prepared-update");
monitor->check_offline_update_id =
g_timeout_add_seconds (15, check_offline_update_cb, monitor);
@@ -589,11 +589,14 @@ gs_update_monitor_class_init (GsUpdateMonitorClass *klass)
static void
remove_stale_notifications (GsUpdateMonitor *monitor)
{
- if (pk_offline_get_results_mtime (NULL) > 0) {
- g_debug ("Withdrawing stale notifications");
-
+ if (!g_file_query_exists (monitor->offline_update_file, NULL)) {
+ g_debug ("Withdrawing stale updates-available notification");
g_application_withdraw_notification (monitor->application,
"updates-available");
+ }
+
+ if (pk_offline_get_results_mtime (NULL) == 0) {
+ g_debug ("Withdrawing stale offline-updates notification");
g_application_withdraw_notification (monitor->application,
"offline-updates");
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]