[gnome-software: 3/24] gs-plugin: Add list_apps_{async, finish}() vfuncs




commit 88f9a9092027acf9981048b23440f770cfbe4906
Author: Philip Withnall <pwithnall endlessos org>
Date:   Wed Apr 6 16:28:10 2022 +0100

    gs-plugin: Add list_apps_{async,finish}() vfuncs
    
    These will eventually replace multiple ways of querying for apps in
    plugins.
    
    Signed-off-by: Philip Withnall <pwithnall endlessos org>
    
    Helps: #1472

 lib/gs-plugin-types.h | 14 ++++++++++++++
 lib/gs-plugin.h       | 14 ++++++++++++++
 2 files changed, 28 insertions(+)
---
diff --git a/lib/gs-plugin-types.h b/lib/gs-plugin-types.h
index 5723dec72..032241ebf 100644
--- a/lib/gs-plugin-types.h
+++ b/lib/gs-plugin-types.h
@@ -170,6 +170,20 @@ typedef enum {
        GS_PLUGIN_REFINE_FLAGS_MASK                     = ~0,
 } GsPluginRefineFlags;
 
+/**
+ * GsPluginListAppsFlags:
+ * @GS_PLUGIN_LIST_APPS_FLAGS_NONE: No flags set.
+ * @GS_PLUGIN_LIST_APPS_FLAGS_INTERACTIVE: User initiated the job.
+ *
+ * Flags for an operation to list apps matching a given query.
+ *
+ * Since: 43
+ */
+typedef enum {
+       GS_PLUGIN_LIST_APPS_FLAGS_NONE = 0,
+       GS_PLUGIN_LIST_APPS_FLAGS_INTERACTIVE = 1 << 0,
+} GsPluginListAppsFlags;
+
 /**
  * GsPluginListInstalledAppsFlags:
  * @GS_PLUGIN_LIST_INSTALLED_APPS_FLAGS_NONE: No flags set.
diff --git a/lib/gs-plugin.h b/lib/gs-plugin.h
index f247e449b..973002c91 100644
--- a/lib/gs-plugin.h
+++ b/lib/gs-plugin.h
@@ -15,6 +15,7 @@
 
 #include "gs-app.h"
 #include "gs-app-list.h"
+#include "gs-app-query.h"
 #include "gs-category.h"
 #include "gs-plugin-event.h"
 #include "gs-plugin-types.h"
@@ -51,6 +52,9 @@ G_DECLARE_DERIVABLE_TYPE (GsPlugin, gs_plugin, GS, PLUGIN, GObject)
  *   batched by the plugin where possible.
  * @refine_finish: (nullable): Finish method for @refine_async. Must be
  *   implemented if @refine_async is implemented.
+ * @list_apps_async: (nullable): List apps matching a given query. (Since: 43)
+ * @list_apps_finish: (nullable): Finish method for @list_apps_async. Must be
+ *   implemented if @list_apps_async is implemented. (Since: 43)
  * @list_installed_apps_async: (nullable): Get the list of installed apps
  *   belonging to this plugin.
  * @list_installed_apps_finish: (nullable): Finish method for
@@ -120,6 +124,16 @@ struct _GsPluginClass
                                                         GAsyncResult           *result,
                                                         GError                 **error);
 
+       void                    (*list_apps_async)              (GsPlugin               *plugin,
+                                                                GsAppQuery             *query,
+                                                                GsPluginListAppsFlags   flags,
+                                                                GCancellable           *cancellable,
+                                                                GAsyncReadyCallback     callback,
+                                                                gpointer                user_data);
+       GsAppList *             (*list_apps_finish)             (GsPlugin               *plugin,
+                                                                GAsyncResult           *result,
+                                                                GError                 **error);
+
        void                    (*list_installed_apps_async)    (GsPlugin               *plugin,
                                                                 GsPluginListInstalledAppsFlags flags,
                                                                 GCancellable           *cancellable,


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