[metacity] frames: use G_DECLARE_FINAL_TYPE



commit dc2280b81889f04fa2de534765f907b3d9b6c698
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Fri Jun 3 13:58:27 2016 +0300

    frames: use G_DECLARE_FINAL_TYPE

 src/ui/frames.c |   28 +++++++++++++++++++++++-----
 src/ui/frames.h |   37 ++-----------------------------------
 2 files changed, 25 insertions(+), 40 deletions(-)
---
diff --git a/src/ui/frames.c b/src/ui/frames.c
index ed84e6e..039b371 100644
--- a/src/ui/frames.c
+++ b/src/ui/frames.c
@@ -98,18 +98,36 @@ static void invalidate_all_caches (MetaFrames *frames);
 static void invalidate_whole_window (MetaFrames *frames,
                                      MetaUIFrame *frame);
 
+struct _MetaFrames
+{
+  GtkWindow    parent;
+
+  GHashTable  *text_heights;
+
+  GHashTable  *frames;
+
+  guint        tooltip_timeout;
+  MetaUIFrame *last_motion_frame;
+
+  gint         expose_delay_count;
+
+  gint         invalidate_cache_timeout_id;
+  GList       *invalidate_frames;
+  GHashTable  *cache;
+};
+
 G_DEFINE_TYPE (MetaFrames, meta_frames, GTK_TYPE_WINDOW)
 
 static void
-meta_frames_class_init (MetaFramesClass *class)
+meta_frames_class_init (MetaFramesClass *frames_class)
 {
-  GObjectClass   *gobject_class;
+  GObjectClass *object_class;
   GtkWidgetClass *widget_class;
 
-  gobject_class = G_OBJECT_CLASS (class);
-  widget_class = (GtkWidgetClass*) class;
+  object_class = G_OBJECT_CLASS (frames_class);
+  widget_class = GTK_WIDGET_CLASS (frames_class);
 
-  gobject_class->finalize = meta_frames_finalize;
+  object_class->finalize = meta_frames_finalize;
 
   widget_class->destroy = meta_frames_destroy;
   widget_class->style_updated = meta_frames_style_updated;
diff --git a/src/ui/frames.h b/src/ui/frames.h
index 2396b02..30cb623 100644
--- a/src/ui/frames.h
+++ b/src/ui/frames.h
@@ -58,15 +58,8 @@ typedef enum
  * as subwindows.
  */
 
-#define META_TYPE_FRAMES            (meta_frames_get_type ())
-#define META_FRAMES(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), META_TYPE_FRAMES, MetaFrames))
-#define META_FRAMES_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), META_TYPE_FRAMES, MetaFramesClass))
-#define META_IS_FRAMES(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), META_TYPE_FRAMES))
-#define META_IS_FRAMES_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), META_TYPE_FRAMES))
-#define META_FRAMES_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), META_TYPE_FRAMES, MetaFramesClass))
-
-typedef struct _MetaFrames        MetaFrames;
-typedef struct _MetaFramesClass   MetaFramesClass;
+#define META_TYPE_FRAMES meta_frames_get_type ()
+G_DECLARE_FINAL_TYPE (MetaFrames, meta_frames, META, FRAMES, GtkWindow)
 
 typedef struct _MetaUIFrame         MetaUIFrame;
 
@@ -86,32 +79,6 @@ struct _MetaUIFrame
   MetaFrameControl prelit_control;
 };
 
-struct _MetaFrames
-{
-  GtkWindow parent_instance;
-
-  GHashTable *text_heights;
-
-  GHashTable *frames;
-
-  guint tooltip_timeout;
-  MetaUIFrame *last_motion_frame;
-
-  int expose_delay_count;
-
-  int invalidate_cache_timeout_id;
-  GList *invalidate_frames;
-  GHashTable *cache;
-};
-
-struct _MetaFramesClass
-{
-  GtkWindowClass parent_class;
-
-};
-
-GType        meta_frames_get_type               (void) G_GNUC_CONST;
-
 MetaFrames *meta_frames_new (int screen_number);
 
 void meta_frames_manage_window (MetaFrames *frames,


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