Commit 63b20bf1 authored by Richard Hughes's avatar Richard Hughes

Add support for updates that can be done live, i.e. without a reboot

parent 3d78cfc4
......@@ -91,6 +91,7 @@ gs_app_addon_row_refresh (GsAppAddonRow *row)
gtk_label_set_label (GTK_LABEL (row->label), _("Pending"));
break;
case AS_APP_STATE_UPDATABLE:
case AS_APP_STATE_UPDATABLE_LIVE:
case AS_APP_STATE_INSTALLED:
gtk_widget_set_visible (row->label, TRUE);
gtk_label_set_label (GTK_LABEL (row->label), _("Installed"));
......
......@@ -83,7 +83,8 @@ gs_app_row_get_description (GsAppRow *app_row)
/* convert the markdown update description into PangoMarkup */
if (priv->show_update &&
gs_app_get_state (priv->app) == AS_APP_STATE_UPDATABLE) {
(gs_app_get_state (priv->app) == AS_APP_STATE_UPDATABLE ||
gs_app_get_state (priv->app) == AS_APP_STATE_UPDATABLE_LIVE)) {
tmp = gs_app_get_update_details (priv->app);
if (tmp != NULL && tmp[0] != '\0') {
g_autoptr(GsMarkdown) markdown = NULL;
......@@ -144,7 +145,8 @@ gs_app_row_refresh (GsAppRow *app_row)
gtk_label_set_label (GTK_LABEL (priv->name_label),
gs_app_get_name (priv->app));
if (priv->show_update &&
gs_app_get_state (priv->app) == AS_APP_STATE_UPDATABLE) {
(gs_app_get_state (priv->app) == AS_APP_STATE_UPDATABLE ||
gs_app_get_state (priv->app) == AS_APP_STATE_UPDATABLE_LIVE)) {
gtk_widget_show (priv->version_label);
gtk_widget_hide (priv->star);
gtk_label_set_label (GTK_LABEL (priv->version_label),
......@@ -232,6 +234,12 @@ gs_app_row_refresh (GsAppRow *app_row)
* allows the application to be easily installed */
gtk_button_set_label (GTK_BUTTON (priv->button), _("Install"));
break;
case AS_APP_STATE_UPDATABLE_LIVE:
gtk_widget_set_visible (priv->button, TRUE);
/* TRANSLATORS: this is a button next to the search results that
* allows the firmware to be easily updated */
gtk_button_set_label (GTK_BUTTON (priv->button), _("Install"));
break;
case AS_APP_STATE_UPDATABLE:
case AS_APP_STATE_INSTALLED:
if (gs_app_get_kind (priv->app) != GS_APP_KIND_SYSTEM)
......@@ -262,7 +270,16 @@ gs_app_row_refresh (GsAppRow *app_row)
break;
}
gtk_widget_set_visible (priv->button_box, !priv->show_update);
/* hide buttons in the update list, unless the app is live updatable */
switch (gs_app_get_state (priv->app)) {
case AS_APP_STATE_UPDATABLE_LIVE:
case AS_APP_STATE_INSTALLING:
gtk_widget_set_visible (priv->button_box, TRUE);
break;
default:
gtk_widget_set_visible (priv->button_box, !priv->show_update);
break;
}
if (priv->selectable) {
if (gs_app_get_id_kind (priv->app) == AS_ID_KIND_DESKTOP ||
......
......@@ -66,6 +66,7 @@ app_state_changed_idle (gpointer user_data)
switch (gs_app_get_state (tile->app)) {
case AS_APP_STATE_INSTALLED:
case AS_APP_STATE_UPDATABLE:
case AS_APP_STATE_UPDATABLE_LIVE:
installed = TRUE;
name = g_strdup_printf ("%s (%s)",
gs_app_get_name (tile->app),
......
......@@ -422,6 +422,7 @@ gs_app_set_state_internal (GsApp *app, AsAppState state)
state == AS_APP_STATE_AVAILABLE ||
state == AS_APP_STATE_AVAILABLE_LOCAL ||
state == AS_APP_STATE_UPDATABLE ||
state == AS_APP_STATE_UPDATABLE_LIVE ||
state == AS_APP_STATE_UNAVAILABLE)
state_change_ok = TRUE;
break;
......@@ -464,6 +465,12 @@ gs_app_set_state_internal (GsApp *app, AsAppState state)
state == AS_APP_STATE_REMOVING)
state_change_ok = TRUE;
break;
case AS_APP_STATE_UPDATABLE_LIVE:
/* updatable-live has to go into an action state */
if (state == AS_APP_STATE_UNKNOWN ||
state == AS_APP_STATE_INSTALLING)
state_change_ok = TRUE;
break;
case AS_APP_STATE_UNAVAILABLE:
/* updatable has to go into an action state */
if (state == AS_APP_STATE_UNKNOWN ||
......
......@@ -62,6 +62,7 @@ app_state_changed_idle (gpointer user_data)
case AS_APP_STATE_INSTALLING:
case AS_APP_STATE_REMOVING:
case AS_APP_STATE_UPDATABLE:
case AS_APP_STATE_UPDATABLE_LIVE:
name = g_strdup_printf ("%s (%s)",
gs_app_get_name (tile->app),
_("Installed"));
......
......@@ -89,6 +89,7 @@ gs_history_dialog_set_app (GsHistoryDialog *dialog, GsApp *app)
tmp = C_("app status", "Installed");
break;
case AS_APP_STATE_UPDATABLE:
case AS_APP_STATE_UPDATABLE_LIVE:
/* TRANSLATORS: this is the status in the history UI,
* where we are showing the application was updated */
tmp = C_("app status", "Updated");
......
......@@ -607,6 +607,8 @@ gs_plugin_loader_app_is_non_installed (GsApp *app, gpointer user_data)
return FALSE;
if (gs_app_get_state (app) == AS_APP_STATE_UPDATABLE)
return FALSE;
if (gs_app_get_state (app) == AS_APP_STATE_UPDATABLE_LIVE)
return FALSE;
return TRUE;
}
......@@ -2790,6 +2792,7 @@ gs_plugin_loader_updates_changed_delay_cb (gpointer user_data)
switch (gs_app_get_state (app)) {
case AS_APP_STATE_INSTALLED:
case AS_APP_STATE_UPDATABLE:
case AS_APP_STATE_UPDATABLE_LIVE:
gs_app_set_state (app, AS_APP_STATE_UNKNOWN);
break;
default:
......
......@@ -67,6 +67,7 @@ app_state_changed_idle (gpointer user_data)
case AS_APP_STATE_INSTALLING:
case AS_APP_STATE_REMOVING:
case AS_APP_STATE_UPDATABLE:
case AS_APP_STATE_UPDATABLE_LIVE:
installed = TRUE;
name = g_strdup_printf ("%s (%s)",
gs_app_get_name (tile->app),
......
......@@ -216,6 +216,7 @@ gs_shell_details_switch_to (GsShellDetails *self)
switch (gs_app_get_state (self->app)) {
case AS_APP_STATE_INSTALLED:
case AS_APP_STATE_UPDATABLE:
case AS_APP_STATE_UPDATABLE_LIVE:
if (gs_app_get_id_kind (self->app) == AS_ID_KIND_DESKTOP ||
gs_app_get_id_kind (self->app) == AS_ID_KIND_WEB_APP) {
gtk_widget_set_visible (self->button_details_launch, TRUE);
......@@ -239,6 +240,7 @@ gs_shell_details_switch_to (GsShellDetails *self)
switch (state) {
case AS_APP_STATE_INSTALLED:
case AS_APP_STATE_UPDATABLE:
case AS_APP_STATE_UPDATABLE_LIVE:
gtk_widget_set_visible (self->button_remove, TRUE);
gtk_widget_set_sensitive (self->button_remove, TRUE);
/* Mark the button as destructive only if Launch is not visible */
......@@ -297,6 +299,7 @@ gs_shell_details_switch_to (GsShellDetails *self)
case AS_APP_STATE_AVAILABLE:
case AS_APP_STATE_QUEUED_FOR_INSTALL:
case AS_APP_STATE_UPDATABLE:
case AS_APP_STATE_UPDATABLE_LIVE:
case AS_APP_STATE_UNAVAILABLE:
case AS_APP_STATE_AVAILABLE_LOCAL:
case AS_APP_STATE_INSTALLING:
......@@ -807,6 +810,7 @@ gs_shell_details_refresh_all (GsShellDetails *self)
switch (gs_app_get_state (self->app)) {
case AS_APP_STATE_INSTALLED:
case AS_APP_STATE_UPDATABLE:
case AS_APP_STATE_UPDATABLE_LIVE:
gtk_widget_set_visible (self->label_addons_uninstalled_app, FALSE);
break;
default:
......@@ -1127,6 +1131,7 @@ gs_shell_details_addon_selected_cb (GsAppAddonRow *row,
switch (gs_app_get_state (self->app)) {
case AS_APP_STATE_INSTALLED:
case AS_APP_STATE_UPDATABLE:
case AS_APP_STATE_UPDATABLE_LIVE:
if (gs_app_addon_row_get_selected (row)) {
gs_page_install_app (GS_PAGE (self), addon);
} else {
......
......@@ -396,9 +396,15 @@ gs_plugin_add_update_app (GsPlugin *plugin,
return FALSE;
}
/* can be done live */
if (flags & FU_DEVICE_FLAG_ALLOW_ONLINE) {
gs_app_set_state (app, AS_APP_STATE_UPDATABLE_LIVE);
} else {
gs_app_set_state (app, AS_APP_STATE_UPDATABLE);
}
/* actually add the application */
gs_app_set_management_plugin (app, "fwupd");
gs_app_set_state (app, AS_APP_STATE_UPDATABLE);
gs_app_set_id_kind (app, AS_ID_KIND_FIRMWARE);
gs_app_add_source_id (app, filename_cache);
gs_app_add_category (app, "System");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment