[epiphany/wip/modern_gobject: 10/15] EphyAboutHandler: Use G_DECLARE_FINAL_TYPE



commit 9b108d35a27b6c318d90c9456580c0c1f0ca0eed
Author: Michael Catanzaro <mcatanzaro igalia com>
Date:   Sun Sep 13 19:21:09 2015 -0500

    EphyAboutHandler: Use G_DECLARE_FINAL_TYPE

 embed/ephy-about-handler.c |   15 ++++++++-------
 embed/ephy-about-handler.h |   25 +++----------------------
 2 files changed, 11 insertions(+), 29 deletions(-)
---
diff --git a/embed/ephy-about-handler.c b/embed/ephy-about-handler.c
index f658c3c..01da4fe 100644
--- a/embed/ephy-about-handler.c
+++ b/embed/ephy-about-handler.c
@@ -36,7 +36,10 @@
 #include <gtk/gtk.h>
 #include <glib/gi18n.h>
 
-struct _EphyAboutHandlerPrivate {
+struct _EphyAboutHandler
+{
+  GObject parent_instance;
+
   EphySMaps *smaps;
 };
 
@@ -50,7 +53,7 @@ ephy_about_handler_finalize (GObject *object)
 {
   EphyAboutHandler *handler = EPHY_ABOUT_HANDLER (object);
 
-  g_clear_object (&handler->priv->smaps);
+  g_clear_object (&handler->smaps);
 
   G_OBJECT_CLASS (ephy_about_handler_parent_class)->finalize (object);
 }
@@ -58,7 +61,6 @@ ephy_about_handler_finalize (GObject *object)
 static void
 ephy_about_handler_init (EphyAboutHandler *handler)
 {
-  handler->priv = G_TYPE_INSTANCE_GET_PRIVATE (handler, EPHY_TYPE_ABOUT_HANDLER, EphyAboutHandlerPrivate);
 }
 
 static void
@@ -67,16 +69,15 @@ ephy_about_handler_class_init (EphyAboutHandlerClass *klass)
   GObjectClass *object_class = G_OBJECT_CLASS (klass);
 
   object_class->finalize = ephy_about_handler_finalize;
-  g_type_class_add_private (object_class, sizeof (EphyAboutHandlerPrivate));
 }
 
 static EphySMaps *
 ephy_about_handler_get_smaps (EphyAboutHandler *handler)
 {
-  if (!handler->priv->smaps)
-    handler->priv->smaps = ephy_smaps_new ();
+  if (!handler->smaps)
+    handler->smaps = ephy_smaps_new ();
 
-  return handler->priv->smaps;
+  return handler->smaps;
 }
 
 static void
diff --git a/embed/ephy-about-handler.h b/embed/ephy-about-handler.h
index bcc6158..9c5799b 100644
--- a/embed/ephy-about-handler.h
+++ b/embed/ephy-about-handler.h
@@ -25,33 +25,14 @@
 
 G_BEGIN_DECLS
 
-#define EPHY_TYPE_ABOUT_HANDLER         (ephy_about_handler_get_type ())
-#define EPHY_ABOUT_HANDLER(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), EPHY_TYPE_ABOUT_HANDLER, 
EphyAboutHandler))
-#define EPHY_ABOUT_HANDLER_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST((k), EPHY_TYPE_ABOUT_HANDLER, 
EphyAboutHandlerClass))
-#define EPHY_IS_ABOUT_HANDLER(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), EPHY_TYPE_ABOUT_HANDLER))
-#define EPHY_IS_ABOUT_HANDLER_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE ((k), EPHY_TYPE_ABOUT_HANDLER))
-#define EPHY_ABOUT_HANDLER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), EPHY_TYPE_ABOUT_HANDLER, 
EphyAboutHandlerClass))
+#define EPHY_TYPE_ABOUT_HANDLER (ephy_about_handler_get_type ())
+
+G_DECLARE_FINAL_TYPE (EphyAboutHandler, ephy_about_handler, EPHY, ABOUT_HANDLER, GObject)
 
 #define EPHY_ABOUT_SCHEME "ephy-about"
 #define EPHY_ABOUT_SCHEME_LEN 10
 #define EPHY_ABOUT_OVERVIEW_MAX_ITEMS 10
 
-typedef struct _EphyAboutHandlerClass   EphyAboutHandlerClass;
-typedef struct _EphyAboutHandler        EphyAboutHandler;
-typedef struct _EphyAboutHandlerPrivate EphyAboutHandlerPrivate;
-
-struct _EphyAboutHandler
-{
-  GObject parent;
-
-  EphyAboutHandlerPrivate *priv;
-};
-
-struct _EphyAboutHandlerClass
-{
-  GObjectClass parent_class;
-};
-
 GType             ephy_about_handler_get_type       (void);
 
 EphyAboutHandler *ephy_about_handler_new            (void);


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