[gnome-software: 3/72] gs-plugin: Add a refine vfunc to GsPlugin




commit ef6f301fe180953574798fa8239d0a34e0380b17
Author: Philip Withnall <pwithnall endlessos org>
Date:   Wed Nov 24 16:25:03 2021 +0000

    gs-plugin: Add a refine vfunc to GsPlugin
    
    Eventually, all the plugins will be ported from the `gs_plugin_refine()`
    plugin function to providing `refine_async()` and `refine_finish()`
    vfuncs in their class.
    
    This will happen over the following commits.
    
    Signed-off-by: Philip Withnall <pwithnall endlessos org>
    
    Helps: #1472

 lib/gs-plugin.h | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
---
diff --git a/lib/gs-plugin.h b/lib/gs-plugin.h
index 48e7c12ff..077a1d74a 100644
--- a/lib/gs-plugin.h
+++ b/lib/gs-plugin.h
@@ -43,6 +43,14 @@ G_DECLARE_DERIVABLE_TYPE (GsPlugin, gs_plugin, GS, PLUGIN, GObject)
  *   doesn’t need to be explicitly shut down.
  * @shutdown_finish: (nullable): Finish method for @shutdown_async. Must be
  *   implemented if @shutdown_async is implemented.
+ * @refine_async: (nullable): Refining looks up and adds data to #GsApps. The
+ *   apps to refine are provided in a list, and the flags specify what data to
+ *   look up and add. Refining certain kinds of data can be very expensive (for
+ *   example, requiring network requests), which is why it’s not all loaded by
+ *   default. By refining multiple applications at once, data requests can be
+ *   batched by the plugin where possible.
+ * @refine_finish: (nullable): Finish method for @refine_async. Must be
+ *   implemented if @refine_async is implemented.
  *
  * The class structure for a #GsPlugin. Virtual methods here should be
  * implemented by plugin implementations derived from #GsPlugin to provide their
@@ -89,6 +97,16 @@ struct _GsPluginClass
                                                         GAsyncResult           *result,
                                                         GError                 **error);
 
+       void                    (*refine_async)         (GsPlugin               *plugin,
+                                                        GsAppList              *list,
+                                                        GsPluginRefineFlags     flags,
+                                                        GCancellable           *cancellable,
+                                                        GAsyncReadyCallback     callback,
+                                                        gpointer                user_data);
+       gboolean                (*refine_finish)        (GsPlugin               *plugin,
+                                                        GAsyncResult           *result,
+                                                        GError                 **error);
+
        gpointer                 padding[23];
 };
 


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