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




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

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

 plugins/dpkg/gs-plugin-dpkg.c | 26 ++++++++++++++++++++++++--
 plugins/dpkg/gs-plugin-dpkg.h | 22 ++++++++++++++++++++++
 2 files changed, 46 insertions(+), 2 deletions(-)
---
diff --git a/plugins/dpkg/gs-plugin-dpkg.c b/plugins/dpkg/gs-plugin-dpkg.c
index eb386a127..fe82c2aee 100644
--- a/plugins/dpkg/gs-plugin-dpkg.c
+++ b/plugins/dpkg/gs-plugin-dpkg.c
@@ -11,11 +11,22 @@
 #include <stdlib.h>
 #include <gnome-software.h>
 
+#include "gs-plugin-dpkg.h"
+
+struct _GsPluginDpkg
+{
+       GsPlugin        parent;
+};
+
+G_DEFINE_TYPE (GsPluginDpkg, gs_plugin_dpkg, GS_TYPE_PLUGIN)
+
 #define DPKG_DEB_BINARY                "/usr/bin/dpkg-deb"
 
-void
-gs_plugin_initialize (GsPlugin *plugin)
+static void
+gs_plugin_dpkg_init (GsPluginDpkg *self)
 {
+       GsPlugin *plugin = GS_PLUGIN (self);
+
        if (!g_file_test (DPKG_DEB_BINARY, G_FILE_TEST_EXISTS)) {
                g_debug ("disabling '%s' as no %s available",
                         gs_plugin_get_name (plugin), DPKG_DEB_BINARY);
@@ -109,3 +120,14 @@ gs_plugin_file_to_app (GsPlugin *plugin,
        gs_app_list_add (list, app);
        return TRUE;
 }
+
+static void
+gs_plugin_dpkg_class_init (GsPluginDpkgClass *klass)
+{
+}
+
+GType
+gs_plugin_query_type (void)
+{
+       return GS_TYPE_PLUGIN_DPKG;
+}
diff --git a/plugins/dpkg/gs-plugin-dpkg.h b/plugins/dpkg/gs-plugin-dpkg.h
new file mode 100644
index 000000000..df16fde8f
--- /dev/null
+++ b/plugins/dpkg/gs-plugin-dpkg.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_DPKG (gs_plugin_dpkg_get_type ())
+
+G_DECLARE_FINAL_TYPE (GsPluginDpkg, gs_plugin_dpkg, GS, PLUGIN_DPKG, GsPlugin)
+
+G_END_DECLS


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