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




commit 12bc9eef87633bc6bdc9a01b387b634d4f88f299
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 | 22 +++++++++++++++++++++
 lib/gs-plugin.h       | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 75 insertions(+)
---
diff --git a/lib/gs-plugin-types.h b/lib/gs-plugin-types.h
index 81bcbcd00..09f352a95 100644
--- a/lib/gs-plugin-types.h
+++ b/lib/gs-plugin-types.h
@@ -212,6 +212,28 @@ 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.
+ * @GS_PLUGIN_MANAGE_REPOSITORY_FLAGS_INSTALL: Install the repository.
+ * @GS_PLUGIN_MANAGE_REPOSITORY_FLAGS_REMOVE: Remove the repository.
+ * @GS_PLUGIN_MANAGE_REPOSITORY_FLAGS_ENABLE: Enable the repository.
+ * @GS_PLUGIN_MANAGE_REPOSITORY_FLAGS_DISABLE: Disable the repository.
+ *
+ * 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,
+       GS_PLUGIN_MANAGE_REPOSITORY_FLAGS_INSTALL       = 1 << 1,
+       GS_PLUGIN_MANAGE_REPOSITORY_FLAGS_REMOVE        = 1 << 2,
+       GS_PLUGIN_MANAGE_REPOSITORY_FLAGS_ENABLE        = 1 << 3,
+       GS_PLUGIN_MANAGE_REPOSITORY_FLAGS_DISABLE       = 1 << 4,
+} GsPluginManageRepositoryFlags;
+
 /**
  * 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]