[gnome-software] Update the last installed timestamp after successful offline updates
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] Update the last installed timestamp after successful offline updates
- Date: Thu, 20 Mar 2014 00:45:01 +0000 (UTC)
commit 0e0fe278e78eb8877f5798c01eee94b48d52cb7e
Author: Kalev Lember <kalevlember gmail com>
Date: Wed Mar 19 18:17:48 2014 +0100
Update the last installed timestamp after successful offline updates
This makes sure our internal timestamp is up to date after an external
app (e.g. gnome-shell) has triggered offline updates.
https://bugzilla.gnome.org/show_bug.cgi?id=726645
src/gs-offline-updates.c | 24 ++++++++++++++++++++++++
src/gs-offline-updates.h | 1 +
src/gs-update-monitor.c | 7 +++++++
3 files changed, 32 insertions(+), 0 deletions(-)
---
diff --git a/src/gs-offline-updates.c b/src/gs-offline-updates.c
index 416e674..0a196fc 100644
--- a/src/gs-offline-updates.c
+++ b/src/gs-offline-updates.c
@@ -118,6 +118,30 @@ gs_offline_updates_results_available (void)
}
gboolean
+gs_offline_updates_get_time_completed (guint64 *time_completed)
+{
+ GFile *file;
+ GFileInfo *info;
+ gboolean result = FALSE;
+
+ file = g_file_new_for_path (PK_OFFLINE_UPDATE_RESULTS_FILENAME);
+ info = g_file_query_info (file,
+ G_FILE_ATTRIBUTE_TIME_MODIFIED,
+ G_FILE_QUERY_INFO_NONE,
+ NULL,
+ NULL);
+ if (info != NULL) {
+ *time_completed = g_file_info_get_attribute_uint64 (info, G_FILE_ATTRIBUTE_TIME_MODIFIED);
+ result = TRUE;
+ }
+
+ g_object_unref (file);
+ g_object_unref (info);
+
+ return result;
+}
+
+gboolean
gs_offline_updates_get_status (gboolean *success,
guint *num_packages,
gchar **error_code,
diff --git a/src/gs-offline-updates.h b/src/gs-offline-updates.h
index 8b146e3..9d6c82f 100644
--- a/src/gs-offline-updates.h
+++ b/src/gs-offline-updates.h
@@ -30,6 +30,7 @@ void gs_offline_updates_trigger (void);
void gs_offline_updates_cancel (void);
void gs_offline_updates_clear_status (void);
gboolean gs_offline_updates_results_available (void);
+gboolean gs_offline_updates_get_time_completed (guint64 *time_completed);
gboolean gs_offline_updates_get_status (gboolean *success,
guint *num_packages,
gchar **error_code,
diff --git a/src/gs-update-monitor.c b/src/gs-update-monitor.c
index 059d712..e0ef43c 100644
--- a/src/gs-update-monitor.c
+++ b/src/gs-update-monitor.c
@@ -146,6 +146,13 @@ check_offline_update_cb (gpointer user_data)
goto out;
if (success) {
+ guint64 time_completed;
+
+ if (gs_offline_updates_get_time_completed (&time_completed)) {
+ g_settings_set (monitor->settings,
+ "install-timestamp", "x", time_completed);
+ }
+
title = ngettext ("Software Update Installed",
"Software Updates Installed",
num_packages);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]