[gnome-software/wip/hughsie/non-free: 5/6] Return installed and available sources from plugins



commit b725b4b0b6359ce7f0e7c853dc6b63e75538c966
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]