[gnome-shell/wip/nielsdg/cleanup-plugin-boilerplate: 12/13] plugin: use G_DECLARE_FINAL_TYPE



commit 94bb40a45bcac0ddb9a06d7be3ea83e25e18e2c1
Author: Niels De Graef <nielsdegraef gmail com>
Date:   Tue Dec 25 15:42:47 2018 +0100

    plugin: use G_DECLARE_FINAL_TYPE
    
    libmutter-4 added support for this, so we can also drop the boilerplate.

 src/gnome-shell-plugin.c | 20 ++++----------------
 1 file changed, 4 insertions(+), 16 deletions(-)
---
diff --git a/src/gnome-shell-plugin.c b/src/gnome-shell-plugin.c
index 198eba862..6a234001a 100644
--- a/src/gnome-shell-plugin.c
+++ b/src/gnome-shell-plugin.c
@@ -51,15 +51,10 @@
 #include "shell-perf-log.h"
 #include "shell-wm-private.h"
 
-#define GNOME_TYPE_SHELL_PLUGIN            (gnome_shell_plugin_get_type ())
-#define GNOME_SHELL_PLUGIN(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNOME_TYPE_SHELL_PLUGIN, 
GnomeShellPlugin))
-#define GNOME_SHELL_PLUGIN_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass),  GNOME_TYPE_SHELL_PLUGIN, 
GnomeShellPluginClass))
-#define GNOME_IS_SHELL_PLUGIN(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GNOME_SHELL_PLUGIN_TYPE))
-#define GNOME_IS_SHELL_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass),  GNOME_TYPE_SHELL_PLUGIN))
-#define GNOME_SHELL_PLUGIN_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj),  GNOME_TYPE_SHELL_PLUGIN, 
GnomeShellPluginClass))
-
-typedef struct _GnomeShellPlugin        GnomeShellPlugin;
-typedef struct _GnomeShellPluginClass   GnomeShellPluginClass;
+#define GNOME_TYPE_SHELL_PLUGIN (gnome_shell_plugin_get_type ())
+G_DECLARE_FINAL_TYPE (GnomeShellPlugin, gnome_shell_plugin,
+                      GNOME, SHELL_PLUGIN,
+                      MetaPlugin)
 
 struct _GnomeShellPlugin
 {
@@ -73,13 +68,6 @@ struct _GnomeShellPlugin
   ShellGlobal *global;
 };
 
-struct _GnomeShellPluginClass
-{
-  MetaPluginClass parent_class;
-};
-
-GType gnome_shell_plugin_get_type (void);
-
 G_DEFINE_TYPE (GnomeShellPlugin, gnome_shell_plugin, META_TYPE_PLUGIN)
 
 static gboolean


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