[gnome-software/wip/hughsie/fwupd] Only trigger an offline update for packages
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/wip/hughsie/fwupd] Only trigger an offline update for packages
- Date: Mon, 16 Mar 2015 09:33:29 +0000 (UTC)
commit cbb863566357430c27dafb352dfa8efe88ea44be
Author: Richard Hughes <richard hughsie com>
Date: Thu Mar 12 13:39:43 2015 +0000
Only trigger an offline update for packages
Other providers such as fwupd handle this differently.
src/gs-shell-updates.c | 16 +++++-----------
src/plugins/gs-plugin-systemd-updates.c | 18 ++++++++++++++++++
2 files changed, 23 insertions(+), 11 deletions(-)
---
diff --git a/src/gs-shell-updates.c b/src/gs-shell-updates.c
index 314dee6..e7b6429 100644
--- a/src/gs-shell-updates.c
+++ b/src/gs-shell-updates.c
@@ -850,8 +850,11 @@ gs_shell_updates_upgrade_cb (GsPluginLoader *plugin_loader,
_cleanup_error_free_ GError *error = NULL;
/* get the results */
- if (!gs_plugin_loader_app_action_finish (plugin_loader, res, &error))
+ if (!gs_plugin_loader_app_action_finish (plugin_loader, res, &error)) {
g_warning ("Failed to upgrade: %s", error->message);
+ return;
+ }
+ gs_reboot (gs_offline_updates_cancel);
}
static void
@@ -864,12 +867,10 @@ gs_shell_updates_button_update_all_cb (GtkButton *button,
_cleanup_error_free_ GError *error = NULL;
_cleanup_ptrarray_unref_ GPtrArray *apps = NULL;
- /* any firmware updates? */
+ /* do the upgrade action? */
apps = gs_update_list_get_apps (GS_UPDATE_LIST (priv->list_box_updates));
for (i = 0; i < apps->len; i++) {
app = g_ptr_array_index (apps, i);
- if (gs_app_get_id_kind (app) != AS_ID_KIND_FIRMWARE)
- continue;
gs_plugin_loader_app_action_async (priv->plugin_loader,
app,
GS_PLUGIN_LOADER_ACTION_UPGRADE,
@@ -877,13 +878,6 @@ gs_shell_updates_button_update_all_cb (GtkButton *button,
(GAsyncReadyCallback) gs_shell_updates_upgrade_cb,
shell_updates);
}
-
- /* normal packages */
- if (!pk_offline_trigger (PK_OFFLINE_ACTION_REBOOT, NULL, &error)) {
- g_warning ("failed to trigger an offline update: %s", error->message);
- return;
- }
- gs_reboot (gs_offline_updates_cancel);
}
/**
diff --git a/src/plugins/gs-plugin-systemd-updates.c b/src/plugins/gs-plugin-systemd-updates.c
index 449fe5b..e6a47ef 100644
--- a/src/plugins/gs-plugin-systemd-updates.c
+++ b/src/plugins/gs-plugin-systemd-updates.c
@@ -31,6 +31,7 @@
struct GsPluginPrivate {
GFileMonitor *monitor;
gsize done_init;
+ gboolean is_triggered;
};
/**
@@ -143,3 +144,20 @@ gs_plugin_add_updates (GsPlugin *plugin,
}
return TRUE;
}
+
+/**
+ * gs_plugin_app_upgrade:
+ */
+gboolean
+gs_plugin_app_upgrade (GsPlugin *plugin,
+ GsApp *app,
+ GCancellable *cancellable,
+ GError **error)
+{
+ if (plugin->priv->is_triggered)
+ return TRUE;
+ if (!pk_offline_trigger (PK_OFFLINE_ACTION_REBOOT, NULL, error))
+ return FALSE;
+ plugin->priv->is_triggered = TRUE;
+ return TRUE;
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]