[gnome-software: 9/29] gs-plugin-hardcoded-popular: Port to the new GsPlugin lifecycle




commit f8d2ee9954a2183d5a13258dac3e8d376eb86ce0
Author: Philip Withnall <pwithnall endlessos org>
Date:   Fri Oct 8 17:45:37 2021 +0100

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

 plugins/core/gs-plugin-hardcoded-popular.c | 26 +++++++++++++++++++++++---
 plugins/core/gs-plugin-hardcoded-popular.h | 22 ++++++++++++++++++++++
 2 files changed, 45 insertions(+), 3 deletions(-)
---
diff --git a/plugins/core/gs-plugin-hardcoded-popular.c b/plugins/core/gs-plugin-hardcoded-popular.c
index 243127450..e55759f51 100644
--- a/plugins/core/gs-plugin-hardcoded-popular.c
+++ b/plugins/core/gs-plugin-hardcoded-popular.c
@@ -10,11 +10,20 @@
 
 #include <gnome-software.h>
 
-void
-gs_plugin_initialize (GsPlugin *plugin)
+#include "gs-plugin-hardcoded-popular.h"
+
+struct _GsPluginHardcodedPopular
+{
+       GsPlugin        parent;
+};
+
+G_DEFINE_TYPE (GsPluginHardcodedPopular, gs_plugin_hardcoded_popular, GS_TYPE_PLUGIN)
+
+static void
+gs_plugin_hardcoded_popular_init (GsPluginHardcodedPopular *self)
 {
        /* let appstream add applications 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");
 }
 
 gboolean
@@ -64,3 +73,14 @@ gs_plugin_add_popular (GsPlugin *plugin,
        }
        return TRUE;
 }
+
+static void
+gs_plugin_hardcoded_popular_class_init (GsPluginHardcodedPopularClass *klass)
+{
+}
+
+GType
+gs_plugin_query_type (void)
+{
+       return GS_TYPE_PLUGIN_HARDCODED_POPULAR;
+}
diff --git a/plugins/core/gs-plugin-hardcoded-popular.h b/plugins/core/gs-plugin-hardcoded-popular.h
new file mode 100644
index 000000000..f17ec82db
--- /dev/null
+++ b/plugins/core/gs-plugin-hardcoded-popular.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_HARDCODED_POPULAR (gs_plugin_hardcoded_popular_get_type ())
+
+G_DECLARE_FINAL_TYPE (GsPluginHardcodedPopular, gs_plugin_hardcoded_popular, GS, PLUGIN_HARDCODED_POPULAR, 
GsPlugin)
+
+G_END_DECLS


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