Commit b68366e5 authored by Kalev Lember's avatar Kalev Lember

extras: Fix button handling for apps in UNAVAILABLE state

When we have an app in UNAVAILABLE state, it can mean two things:

 a) it's a "not found" app created in the extras page; in this case we
    need to handle the "Visit website" button

 b) it's an app that's from enabled=0 enabled_metadata=1 repo; in this
    case we are handing "Install..." button and first ask for
    confirmation whether to enable the repo as well

Fixes: GNOME/gnome-software#587
parent 425c76e5
......@@ -262,16 +262,22 @@ static void
app_row_button_clicked_cb (GsAppRow *app_row,
GsExtrasPage *self)
{
GsApp *app;
app = gs_app_row_get_app (app_row);
if (gs_app_get_state (app) == AS_APP_STATE_AVAILABLE ||
gs_app_get_state (app) == AS_APP_STATE_AVAILABLE_LOCAL)
GsApp *app = gs_app_row_get_app (app_row);
if (gs_app_get_state (app) == AS_APP_STATE_UNAVAILABLE &&
gs_app_get_url (app, AS_URL_KIND_MISSING) != NULL) {
gs_shell_show_uri (self->shell,
gs_app_get_url (app, AS_URL_KIND_MISSING));
} else if (gs_app_get_state (app) == AS_APP_STATE_AVAILABLE ||
gs_app_get_state (app) == AS_APP_STATE_AVAILABLE_LOCAL ||
gs_app_get_state (app) == AS_APP_STATE_UNAVAILABLE) {
gs_page_install_app (GS_PAGE (self), app, GS_SHELL_INTERACTION_FULL,
self->search_cancellable);
else if (gs_app_get_state (app) == AS_APP_STATE_INSTALLED)
} else if (gs_app_get_state (app) == AS_APP_STATE_INSTALLED) {
gs_page_remove_app (GS_PAGE (self), app, self->search_cancellable);
else
} else {
g_critical ("extras: app in unexpected state %u", gs_app_get_state (app));
}
}
static void
......
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