[gnome-software] Return installed and available sources from plugins
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] Return installed and available sources from plugins
- Date: Mon, 29 Aug 2016 20:45:19 +0000 (UTC)
commit cee9b9d607bf6ae1bc96eccc32cae0b91bc780a4
Author: Richard Hughes <richard hughsie com>
Date: Mon Aug 29 19:09:43 2016 +0100
Return installed and available sources from plugins
This allows us to do the filtering on the UI side.
src/gs-sources-dialog.c | 2 ++
src/plugins/gs-flatpak.c | 8 +++-----
src/plugins/gs-plugin-packagekit.c | 4 ++--
3 files changed, 7 insertions(+), 7 deletions(-)
---
diff --git a/src/gs-sources-dialog.c b/src/gs-sources-dialog.c
index bb4393f..e9c2496 100644
--- a/src/gs-sources-dialog.c
+++ b/src/gs-sources-dialog.c
@@ -197,6 +197,8 @@ get_sources_cb (GsPluginLoader *plugin_loader,
gtk_stack_set_visible_child_name (GTK_STACK (dialog->stack), "sources");
for (i = 0; i < gs_app_list_length (list); i++) {
app = gs_app_list_index (list, i);
+ if (gs_app_get_state (app) != AS_APP_STATE_INSTALLED)
+ continue;
add_source (GTK_LIST_BOX (dialog->listbox), app);
}
}
diff --git a/src/plugins/gs-flatpak.c b/src/plugins/gs-flatpak.c
index 62c238a..58374ca 100644
--- a/src/plugins/gs-flatpak.c
+++ b/src/plugins/gs-flatpak.c
@@ -471,14 +471,12 @@ gs_flatpak_add_sources (GsFlatpak *self, GsAppList *list,
if (flatpak_remote_get_noenumerate (xremote))
continue;
- /* not enabled */
- if (flatpak_remote_get_disabled (xremote))
- continue;
-
+ /* create both enabled and disabled and filter in the UI */
app = gs_app_new (flatpak_remote_get_name (xremote));
gs_app_set_management_plugin (app, gs_plugin_get_name (self->plugin));
gs_app_set_kind (app, AS_APP_KIND_SOURCE);
- gs_app_set_state (app, AS_APP_STATE_INSTALLED);
+ gs_app_set_state (app, flatpak_remote_get_disabled (xremote) ?
+ AS_APP_STATE_INSTALLED : AS_APP_STATE_AVAILABLE);
gs_app_add_quirk (app, AS_APP_QUIRK_NOT_LAUNCHABLE);
gs_app_set_name (app,
GS_APP_QUALITY_LOWEST,
diff --git a/src/plugins/gs-plugin-packagekit.c b/src/plugins/gs-plugin-packagekit.c
index 6ebf11b..55b4bfa 100644
--- a/src/plugins/gs-plugin-packagekit.c
+++ b/src/plugins/gs-plugin-packagekit.c
@@ -181,7 +181,6 @@ gs_plugin_add_sources (GsPlugin *plugin,
/* ask PK for the repo details */
filter = pk_bitfield_from_enums (PK_FILTER_ENUM_NOT_SOURCE,
PK_FILTER_ENUM_NOT_SUPPORTED,
- PK_FILTER_ENUM_INSTALLED,
-1);
results = pk_client_get_repo_list (PK_CLIENT(priv->task),
filter,
@@ -199,7 +198,8 @@ gs_plugin_add_sources (GsPlugin *plugin,
app = gs_app_new (id);
gs_app_set_management_plugin (app, gs_plugin_get_name (plugin));
gs_app_set_kind (app, AS_APP_KIND_SOURCE);
- gs_app_set_state (app, AS_APP_STATE_INSTALLED);
+ gs_app_set_state (app, pk_repo_detail_get_enabled (rd) ?
+ AS_APP_STATE_INSTALLED : AS_APP_STATE_AVAILABLE);
gs_app_set_name (app,
GS_APP_QUALITY_LOWEST,
pk_repo_detail_get_description (rd));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]