[gnome-software/wip/async-plugin-repo-funcs: 12/40] gs-plugin: Add virtual functions for repository management




commit 18923610c981fb4e8fbadcf6f71e1cb69ee285c5
Author: Milan Crha <mcrha redhat com>
Date:   Mon Jun 13 18:41:05 2022 +0200

    gs-plugin: Add virtual functions for repository management

 lib/gs-plugin-types.h | 32 +++++++++++++++++++++++++++++++
 lib/gs-plugin.h       | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 85 insertions(+)
---
diff --git a/lib/gs-plugin-types.h b/lib/gs-plugin-types.h
index 81bcbcd00..14b1470dc 100644
--- a/lib/gs-plugin-types.h
+++ b/lib/gs-plugin-types.h
@@ -212,6 +212,38 @@ typedef enum {
        GS_PLUGIN_LIST_DISTRO_UPGRADES_FLAGS_INTERACTIVE = 1 << 0,
 } GsPluginListDistroUpgradesFlags;
 
+/**
+ * GsPluginManageRepositoryFlags:
+ * @GS_PLUGIN_MANAGE_REPOSITORY_FLAGS_NONE: No flags set.
+ * @GS_PLUGIN_MANAGE_REPOSITORY_FLAGS_INTERACTIVE: User initiated the job.
+ *
+ * Flags for an operation on a repository.
+ *
+ * Since: 43
+ */
+typedef enum {
+       GS_PLUGIN_MANAGE_REPOSITORY_FLAGS_NONE          = 0,
+       GS_PLUGIN_MANAGE_REPOSITORY_FLAGS_INTERACTIVE   = 1 << 0,
+} GsPluginManageRepositoryFlags;
+
+/**
+ * GsPluginManageRepositoryOperation:
+ * @GS_PLUGIN_MANAGE_REPOSITORY_OPERATION_INSTALL: Install the repository.
+ * @GS_PLUGIN_MANAGE_REPOSITORY_OPERATION_REMOVE: Remove the repository.
+ * @GS_PLUGIN_MANAGE_REPOSITORY_OPERATION_ENABLE: Enable the repository.
+ * @GS_PLUGIN_MANAGE_REPOSITORY_OPERATION_DISABLE: Disable the repository.
+ *
+ * The operation to run on a repository.
+ *
+ * Since: 43
+ */
+typedef enum {
+       GS_PLUGIN_MANAGE_REPOSITORY_OPERATION_INSTALL = 1,
+       GS_PLUGIN_MANAGE_REPOSITORY_OPERATION_REMOVE,
+       GS_PLUGIN_MANAGE_REPOSITORY_OPERATION_ENABLE,
+       GS_PLUGIN_MANAGE_REPOSITORY_OPERATION_DISABLE,
+} GsPluginManageRepositoryOperation;
+
 /**
  * GsPluginRule:
  * @GS_PLUGIN_RULE_CONFLICTS:          The plugin conflicts with another
diff --git a/lib/gs-plugin.h b/lib/gs-plugin.h
index 709819799..15bfa6194 100644
--- a/lib/gs-plugin.h
+++ b/lib/gs-plugin.h
@@ -63,6 +63,22 @@ G_DECLARE_DERIVABLE_TYPE (GsPlugin, gs_plugin, GS, PLUGIN, GObject)
  * @list_distro_upgrades_finish: (nullable): Finish method for
  *   @list_distro_upgrades_async. Must be implemented if
  *   @list_distro_upgrades_async is implemented.
+ * @install_repository_async: (nullable): Install repository.
+ * @install_repository_finish: (nullable): Finish method for
+ *   @install_repository_async. Must be implemented if
+ *   @install_repository_async is implemented.
+ * @remove_repository_async: (nullable): Remove repository.
+ * @remove_repository_finish: (nullable): Finish method for
+ *   @remove_repository_async. Must be implemented if
+ *   @remove_repository_async is implemented.
+ * @enable_repository_async: (nullable): Enable repository.
+ * @enable_repository_finish: (nullable): Finish method for
+ *   @enable_repository_async. Must be implemented if
+ *   @enable_repository_async is implemented.
+ * @disable_repository_async: (nullable): Disable repository.
+ * @disable_repository_finish: (nullable): Finish method for
+ *   @disable_repository_async. Must be implemented if
+ *   @disable_repository_async is implemented.
  *
  * The class structure for a #GsPlugin. Virtual methods here should be
  * implemented by plugin implementations derived from #GsPlugin to provide their
@@ -148,6 +164,43 @@ struct _GsPluginClass
                                                                 GAsyncResult           *result,
                                                                 GError                 **error);
 
+       void                    (*install_repository_async)     (GsPlugin               *plugin,
+                                                                GsApp                  *repository,
+                                                                GsPluginManageRepositoryFlags flags,
+                                                                GCancellable           *cancellable,
+                                                                GAsyncReadyCallback     callback,
+                                                                gpointer                user_data);
+       gboolean                (*install_repository_finish)    (GsPlugin               *plugin,
+                                                                GAsyncResult           *result,
+                                                                GError                 **error);
+       void                    (*remove_repository_async)      (GsPlugin               *plugin,
+                                                                GsApp                  *repository,
+                                                                GsPluginManageRepositoryFlags flags,
+                                                                GCancellable           *cancellable,
+                                                                GAsyncReadyCallback     callback,
+                                                                gpointer                user_data);
+       gboolean                (*remove_repository_finish)     (GsPlugin               *plugin,
+                                                                GAsyncResult           *result,
+                                                                GError                 **error);
+       void                    (*enable_repository_async)      (GsPlugin               *plugin,
+                                                                GsApp                  *repository,
+                                                                GsPluginManageRepositoryFlags flags,
+                                                                GCancellable           *cancellable,
+                                                                GAsyncReadyCallback     callback,
+                                                                gpointer                user_data);
+       gboolean                (*enable_repository_finish)     (GsPlugin               *plugin,
+                                                                GAsyncResult           *result,
+                                                                GError                 **error);
+       void                    (*disable_repository_async)     (GsPlugin               *plugin,
+                                                                GsApp                  *repository,
+                                                                GsPluginManageRepositoryFlags flags,
+                                                                GCancellable           *cancellable,
+                                                                GAsyncReadyCallback     callback,
+                                                                gpointer                user_data);
+       gboolean                (*disable_repository_finish)    (GsPlugin               *plugin,
+                                                                GAsyncResult           *result,
+                                                                GError                 **error);
+
        gpointer                 padding[23];
 };
 


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