[gnome-software: 1/38] gs-plugin: Add refresh_metadata_{async, finish}() vfuncs




commit 8cc22bb6f64932e59ae1179dfc3ebb1b045284cb
Author: Philip Withnall <pwithnall endlessos org>
Date:   Tue Jan 25 18:17:39 2022 +0000

    gs-plugin: Add refresh_metadata_{async,finish}() vfuncs
    
    These will eventually replace the `gs_plugin_refresh()` function.
    
    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 9b1f31c93..ae8f0a903 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;
 
+/**
+ * GsPluginRefreshMetadataFlags:
+ * @GS_PLUGIN_REFRESH_METADATA_FLAGS_NONE: No flags set.
+ * @GS_PLUGIN_REFRESH_METADATA_FLAGS_INTERACTIVE: User initiated the job.
+ *
+ * Flags for an operation to refresh metadata.
+ *
+ * Since: 42
+ */
+typedef enum {
+       GS_PLUGIN_REFRESH_METADATA_FLAGS_NONE = 0,
+       GS_PLUGIN_REFRESH_METADATA_FLAGS_INTERACTIVE = 1 << 0,
+} GsPluginRefreshMetadataFlags;
+
 /**
  * GsPluginRule:
  * @GS_PLUGIN_RULE_CONFLICTS:          The plugin conflicts with another
diff --git a/lib/gs-plugin.h b/lib/gs-plugin.h
index 4eadb8ee6..260696e7b 100644
--- a/lib/gs-plugin.h
+++ b/lib/gs-plugin.h
@@ -57,6 +57,10 @@ G_DECLARE_DERIVABLE_TYPE (GsPlugin, gs_plugin, GS, PLUGIN, GObject)
  * @list_installed_apps_finish: (nullable): Finish method for
  *   @list_installed_apps_async. Must be implemented if
  *   @list_installed_apps_async is implemented.
+ * @refresh_metadata_async: (nullable): Refresh plugin metadata.
+ * @refresh_metadata_finish: (nullable): Finish method for
+ *   @refresh_metadata_async. Must be implemented if @refresh_metadata_async is
+ *   implemented.
  *
  * The class structure for a #GsPlugin. Virtual methods here should be
  * implemented by plugin implementations derived from #GsPlugin to provide their
@@ -121,6 +125,16 @@ struct _GsPluginClass
                                                                 GAsyncResult           *result,
                                                                 GError                 **error);
 
+       void                    (*refresh_metadata_async)       (GsPlugin               *plugin,
+                                                                guint64                 cache_age_secs,
+                                                                GsPluginRefreshMetadataFlags flags,
+                                                                GCancellable           *cancellable,
+                                                                GAsyncReadyCallback     callback,
+                                                                gpointer                user_data);
+       gboolean                (*refresh_metadata_finish)      (GsPlugin               *plugin,
+                                                                GAsyncResult           *result,
+                                                                GError                 **error);
+
        gpointer                 padding[23];
 };
 


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