[polari] lib: Use new G_DECLARE_FINAL_TYPE() macro



commit 5d118ec7fe8591ea6b4f5ca3b6aada03e783b0ee
Author: Florian Müllner <fmuellner gnome org>
Date:   Tue Jan 27 21:10:29 2015 +0100

    lib: Use new G_DECLARE_FINAL_TYPE() macro
    
    Use the newly introduced macros to cut down on GObject boilerplate.

 configure.ac                      |    2 +-
 src/lib/polari-fixed-size-frame.c |    8 ++++++++
 src/lib/polari-fixed-size-frame.h |   22 +---------------------
 src/lib/polari-room.c             |    8 ++++++++
 src/lib/polari-room.h             |   22 +---------------------
 5 files changed, 19 insertions(+), 43 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 0f63806..ffadc5a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -22,7 +22,7 @@ LT_INIT([disable-static])
 GLIB_GSETTINGS
 
 PKG_CHECK_MODULES(POLARI,
-                  gio-2.0 >= 2.41.0
+                  gio-2.0 >= 2.43.4
                   gobject-introspection-1.0
                   gtk+-3.0 >= 3.13.4
                   telepathy-glib);
diff --git a/src/lib/polari-fixed-size-frame.c b/src/lib/polari-fixed-size-frame.c
index 089f38f..de6f2db 100644
--- a/src/lib/polari-fixed-size-frame.c
+++ b/src/lib/polari-fixed-size-frame.c
@@ -18,6 +18,14 @@
 
 #include "polari-fixed-size-frame.h"
 
+typedef struct _PolariFixedSizeFramePrivate PolariFixedSizeFramePrivate;
+
+struct _PolariFixedSizeFrame {
+  GtkFrame parent_instance;
+
+  PolariFixedSizeFramePrivate *priv;
+};
+
 struct _PolariFixedSizeFramePrivate {
   int width;
   int height;
diff --git a/src/lib/polari-fixed-size-frame.h b/src/lib/polari-fixed-size-frame.h
index 6926eec..0d697ad 100644
--- a/src/lib/polari-fixed-size-frame.h
+++ b/src/lib/polari-fixed-size-frame.h
@@ -23,28 +23,8 @@
 
 G_BEGIN_DECLS
 
-typedef struct _PolariFixedSizeFrame        PolariFixedSizeFrame;
-typedef struct _PolariFixedSizeFrameClass   PolariFixedSizeFrameClass;
-typedef struct _PolariFixedSizeFramePrivate PolariFixedSizeFramePrivate;
-
 #define POLARI_TYPE_FIXED_SIZE_FRAME            (polari_fixed_size_frame_get_type())
-#define POLARI_FIXED_SIZE_FRAME(o)              (G_TYPE_CHECK_INSTANCE_CAST ((o), 
POLARI_TYPE_FIXED_SIZE_FRAME, PolariFixedSizeFrame))
-#define POLARI_IS_FIXED_SIZE_FRAME(o)           (G_TYPE_CHECK_INSTANCE_TYPE ((o), 
POLARI_TYPE_FIXED_SIZE_FRAME))
-#define POLARI_FIXED_SIZE_FRAME_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), 
POLARI_TYPE_FIXED_SIZE_FRAME, PolariFixedSizeFrameClass))
-#define POLARI_IS_FIXED_SIZE_FRAME_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), 
POLARI_TYPE_FIXED_SIZE_FRAME))
-#define POLARI_FIXED_SIZE_FRAME_GET_CLASS(o)    (G_TYPE_INSTANCE_GET_CLASS ((o), 
POLARI_TYPE_FIXED_SIZE_FRAME, PolariFixedSizeFrameClass))
-
-struct _PolariFixedSizeFrame {
-  GtkFrame parent_instance;
-
-  PolariFixedSizeFramePrivate *priv;
-};
-
-struct _PolariFixedSizeFrameClass {
-  GtkFrameClass parent_class;
-};
-
-GType polari_fixed_size_frame_get_type (void) G_GNUC_CONST;
+G_DECLARE_FINAL_TYPE(PolariFixedSizeFrame, polari_fixed_size_frame, POLARI, FIXED_SIZE_FRAME, GtkFrame)
 
 G_END_DECLS
 
diff --git a/src/lib/polari-room.c b/src/lib/polari-room.c
index 2ee1744..0da348d 100644
--- a/src/lib/polari-room.c
+++ b/src/lib/polari-room.c
@@ -20,6 +20,14 @@
 
 #include "polari-room.h"
 
+typedef struct _PolariRoomPrivate PolariRoomPrivate;
+
+struct _PolariRoom {
+    GObject parent_instance;
+
+    PolariRoomPrivate *priv;
+};
+
 struct _PolariRoomPrivate {
   TpAccount *account;
   TpChannel *channel;
diff --git a/src/lib/polari-room.h b/src/lib/polari-room.h
index 9906ad2..61b7556 100644
--- a/src/lib/polari-room.h
+++ b/src/lib/polari-room.h
@@ -25,28 +25,8 @@
 
 G_BEGIN_DECLS
 
-typedef struct _PolariRoom        PolariRoom;
-typedef struct _PolariRoomClass   PolariRoomClass;
-typedef struct _PolariRoomPrivate PolariRoomPrivate;
-
 #define POLARI_TYPE_ROOM            (polari_room_get_type())
-#define POLARI_ROOM(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), POLARI_TYPE_ROOM, PolariRoom))
-#define POLARI_ROOM_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), POLARI_TYPE_ROOM, PolariRoomClass))
-#define POLARI_IS_ROOM(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), POLARI_TYPE_ROOM))
-#define POLARI_IS_ROOM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), POLARI_TYPE_ROOM))
-#define POLARI_ROOM_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), POLARI_TYPE_ROOM, PolariRoomClass))
-
-struct _PolariRoom {
-    GObject parent_instance;
-
-    PolariRoomPrivate *priv;
-};
-
-struct _PolariRoomClass {
-    GObjectClass parent_class;
-};
-
-GType polari_room_get_type (void) G_GNUC_CONST;
+G_DECLARE_FINAL_TYPE (PolariRoom, polari_room, POLARI, ROOM, GObject)
 
 gboolean polari_room_should_highlight_message (PolariRoom *room,
                                                TpMessage *message);


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