[gnome-software: 10/29] gs-plugin-icons: Port to the new GsPlugin lifecycle




commit 92e28809b19019036455241e3d1ba2245f35946a
Author: Philip Withnall <pwithnall endlessos org>
Date:   Fri Oct 8 17:45:53 2021 +0100

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

 plugins/core/gs-plugin-icons.c | 30 ++++++++++++++++++++++--------
 plugins/core/gs-plugin-icons.h | 22 ++++++++++++++++++++++
 2 files changed, 44 insertions(+), 8 deletions(-)
---
diff --git a/plugins/core/gs-plugin-icons.c b/plugins/core/gs-plugin-icons.c
index 918c7d1e9..2daf9df42 100644
--- a/plugins/core/gs-plugin-icons.c
+++ b/plugins/core/gs-plugin-icons.c
@@ -13,6 +13,8 @@
 
 #include <gnome-software.h>
 
+#include "gs-plugin-icons.h"
+
 /*
  * SECTION:
  * Loads remote icons and converts them into local cached ones.
@@ -25,17 +27,18 @@
  * icons happens in a worker thread.
  */
 
-void
-gs_plugin_initialize (GsPlugin *plugin)
+struct _GsPluginIcons
 {
-       /* needs remote icons downloaded */
-       gs_plugin_add_rule (plugin, GS_PLUGIN_RULE_RUN_AFTER, "appstream");
-}
+       GsPlugin        parent;
+};
 
-void
-gs_plugin_destroy (GsPlugin *plugin)
+G_DEFINE_TYPE (GsPluginIcons, gs_plugin_icons, GS_TYPE_PLUGIN)
+
+static void
+gs_plugin_icons_init (GsPluginIcons *self)
 {
-       /* Nothing to do here */
+       /* needs remote icons downloaded */
+       gs_plugin_add_rule (GS_PLUGIN (self), GS_PLUGIN_RULE_RUN_AFTER, "appstream");
 }
 
 static gboolean
@@ -81,3 +84,14 @@ gs_plugin_refine (GsPlugin             *plugin,
 
        return TRUE;
 }
+
+static void
+gs_plugin_icons_class_init (GsPluginIconsClass *klass)
+{
+}
+
+GType
+gs_plugin_query_type (void)
+{
+       return GS_TYPE_PLUGIN_ICONS;
+}
diff --git a/plugins/core/gs-plugin-icons.h b/plugins/core/gs-plugin-icons.h
new file mode 100644
index 000000000..e092d0d2e
--- /dev/null
+++ b/plugins/core/gs-plugin-icons.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_ICONS (gs_plugin_icons_get_type ())
+
+G_DECLARE_FINAL_TYPE (GsPluginIcons, gs_plugin_icons, GS, PLUGIN_ICONS, GsPlugin)
+
+G_END_DECLS


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