[gnome-software: 12/29] gs-plugin-rewrite-resource: Port to the new GsPlugin lifecycle




commit bba0074039b41e3f39e20dd4c0850b4260548939
Author: Philip Withnall <pwithnall endlessos org>
Date:   Fri Oct 8 17:46:26 2021 +0100

    gs-plugin-rewrite-resource: Port to the new GsPlugin lifecycle
    
    Signed-off-by: Philip Withnall <pwithnall endlessos org>

 plugins/core/gs-plugin-rewrite-resource.c | 26 +++++++++++++++++++++++---
 plugins/core/gs-plugin-rewrite-resource.h | 22 ++++++++++++++++++++++
 2 files changed, 45 insertions(+), 3 deletions(-)
---
diff --git a/plugins/core/gs-plugin-rewrite-resource.c b/plugins/core/gs-plugin-rewrite-resource.c
index d17f6bd0b..5d3717134 100644
--- a/plugins/core/gs-plugin-rewrite-resource.c
+++ b/plugins/core/gs-plugin-rewrite-resource.c
@@ -11,11 +11,20 @@
 #include <glib/gi18n.h>
 #include <gnome-software.h>
 
-void
-gs_plugin_initialize (GsPlugin *plugin)
+#include "gs-plugin-rewrite-resource.h"
+
+struct _GsPluginRewriteResource
+{
+       GsPlugin        parent;
+};
+
+G_DEFINE_TYPE (GsPluginRewriteResource, gs_plugin_rewrite_resource, GS_TYPE_PLUGIN)
+
+static void
+gs_plugin_rewrite_resource_init (GsPluginRewriteResource *self)
 {
        /* let appstream add metadata first */
-       gs_plugin_add_rule (plugin, GS_PLUGIN_RULE_RUN_AFTER, "appstream");
+       gs_plugin_add_rule (GS_PLUGIN (self), GS_PLUGIN_RULE_RUN_AFTER, "appstream");
 }
 
 static gboolean
@@ -70,3 +79,14 @@ gs_plugin_refine (GsPlugin             *plugin,
 
        return TRUE;
 }
+
+static void
+gs_plugin_rewrite_resource_class_init (GsPluginRewriteResourceClass *klass)
+{
+}
+
+GType
+gs_plugin_query_type (void)
+{
+       return GS_TYPE_PLUGIN_REWRITE_RESOURCE;
+}
diff --git a/plugins/core/gs-plugin-rewrite-resource.h b/plugins/core/gs-plugin-rewrite-resource.h
new file mode 100644
index 000000000..0af8c8844
--- /dev/null
+++ b/plugins/core/gs-plugin-rewrite-resource.h
@@ -0,0 +1,22 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ * vi:set noexpandtab tabstop=8 shiftwidth=8:
+ *
+ * Copyright (C) 2021 Endless OS Foundation LLC
+ *
+ * Author: Philip Withnall <pwithnall endlessos org>
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+
+#pragma once
+
+#include <glib.h>
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define GS_TYPE_PLUGIN_REWRITE_RESOURCE (gs_plugin_rewrite_resource_get_type ())
+
+G_DECLARE_FINAL_TYPE (GsPluginRewriteResource, gs_plugin_rewrite_resource, GS, PLUGIN_REWRITE_RESOURCE, 
GsPlugin)
+
+G_END_DECLS


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