[gnome-software/wip/async-plugin-repo-funcs: 8/32] gs-repo-row: Change how checks whether plugin supports repository operation




commit dcccf70edfce26bc855b16e603ec5157161e17a2
Author: Milan Crha <mcrha redhat com>
Date:   Tue Jun 14 15:20:20 2022 +0200

    gs-repo-row: Change how checks whether plugin supports repository operation
    
    Use the async methods existence to check whether plugin supports
    certain repository operation, instead of using the obsolete plugin
    actions, which require function definitions.

 src/gs-repo-row.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/src/gs-repo-row.c b/src/gs-repo-row.c
index 9f871eb04..0a3a3b9cb 100644
--- a/src/gs-repo-row.c
+++ b/src/gs-repo-row.c
@@ -207,10 +207,16 @@ gs_repo_row_set_repo (GsRepoRow *self, GsApp *repo)
                                 self, 0);
 
        plugin = gs_app_dup_management_plugin (repo);
-       priv->supports_remove = plugin != NULL && gs_plugin_get_action_supported (plugin, 
GS_PLUGIN_ACTION_REMOVE_REPO);
-       priv->supports_enable_disable = plugin != NULL &&
-               gs_plugin_get_action_supported (plugin, GS_PLUGIN_ACTION_ENABLE_REPO) &&
-               gs_plugin_get_action_supported (plugin, GS_PLUGIN_ACTION_DISABLE_REPO);
+       if (plugin) {
+               GsPluginClass *plugin_class = GS_PLUGIN_GET_CLASS (plugin);
+               priv->supports_remove = plugin_class != NULL && plugin_class->remove_repository_async != NULL;
+               priv->supports_enable_disable = plugin_class != NULL &&
+                       plugin_class->enable_repository_async != NULL &&
+                       plugin_class->disable_repository_async != NULL;
+       } else {
+               priv->supports_remove = FALSE;
+               priv->supports_enable_disable = FALSE;
+       }
 
        gtk_label_set_label (GTK_LABEL (priv->name_label), gs_app_get_name (repo));
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]