[gtksourceview/wip/chergert/snippets: 63/119] style: use G_DECLARE_FINAL_TYPE()



commit d489e28b46ce00cb28aba6e18caeabbdc45e9c6b
Author: Christian Hergert <chergert redhat com>
Date:   Thu Jan 9 15:05:48 2020 -0800

    style: use G_DECLARE_FINAL_TYPE()
    
    The GtkSourceStyle class was already effectively final.

 gtksourceview/gtksourcestyle.c | 38 ++++++++++++++++----------------------
 gtksourceview/gtksourcestyle.h | 18 +++++-------------
 2 files changed, 21 insertions(+), 35 deletions(-)
---
diff --git a/gtksourceview/gtksourcestyle.c b/gtksourceview/gtksourcestyle.c
index e35dbca7..65048c84 100644
--- a/gtksourceview/gtksourcestyle.c
+++ b/gtksourceview/gtksourcestyle.c
@@ -33,20 +33,14 @@
  * which are set when given style is used.
  */
 
-static void    gtk_source_style_set_property   (GObject      *object,
-                                                guint         prop_id,
-                                                const GValue *value,
-                                                GParamSpec   *pspec);
-
-static void    gtk_source_style_get_property   (GObject      *object,
-                                                guint         prop_id,
-                                                GValue       *value,
-                                                GParamSpec   *pspec);
-
-struct _GtkSourceStyleClass
-{
-       GObjectClass parent_class;
-};
+static void gtk_source_style_set_property (GObject      *object,
+                                           guint         prop_id,
+                                           const GValue *value,
+                                           GParamSpec   *pspec);
+static void gtk_source_style_get_property (GObject      *object,
+                                           guint         prop_id,
+                                           GValue       *value,
+                                           GParamSpec   *pspec);
 
 G_DEFINE_TYPE (GtkSourceStyle, gtk_source_style, G_TYPE_OBJECT)
 
@@ -255,9 +249,9 @@ G_STMT_START {                                      \
 
 static void
 gtk_source_style_set_property (GObject      *object,
-                              guint         prop_id,
-                              const GValue *value,
-                              GParamSpec   *pspec)
+                               guint         prop_id,
+                               const GValue *value,
+                               GParamSpec   *pspec)
 {
        GtkSourceStyle *style = GTK_SOURCE_STYLE (object);
        const gchar *string;
@@ -397,10 +391,10 @@ gtk_source_style_set_property (GObject      *object,
 }
 
 static void
-gtk_source_style_get_property (GObject      *object,
-                              guint         prop_id,
-                              GValue       *value,
-                              GParamSpec   *pspec)
+gtk_source_style_get_property (GObject    *object,
+                               guint       prop_id,
+                               GValue     *value,
+                               GParamSpec *pspec)
 {
        GtkSourceStyle *style = GTK_SOURCE_STYLE (object);
 
@@ -536,7 +530,7 @@ gtk_source_style_copy (const GtkSourceStyle *style)
  */
 void
 gtk_source_style_apply (const GtkSourceStyle *style,
-                       GtkTextTag           *tag)
+                        GtkTextTag           *tag)
 {
        g_return_if_fail (GTK_IS_TEXT_TAG (tag));
 
diff --git a/gtksourceview/gtksourcestyle.h b/gtksourceview/gtksourcestyle.h
index 6e8ece45..3ae95dc8 100644
--- a/gtksourceview/gtksourcestyle.h
+++ b/gtksourceview/gtksourcestyle.h
@@ -30,23 +30,15 @@
 
 G_BEGIN_DECLS
 
-#define GTK_SOURCE_TYPE_STYLE             (gtk_source_style_get_type ())
-#define GTK_SOURCE_STYLE(obj)             (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_SOURCE_TYPE_STYLE, 
GtkSourceStyle))
-#define GTK_SOURCE_IS_STYLE(obj)          (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_SOURCE_TYPE_STYLE))
-#define GTK_SOURCE_STYLE_CLASS(klass)     (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_SOURCE_TYPE_STYLE, 
GtkSourceStyleClass))
-#define GTK_SOURCE_IS_STYLE_CLASS(klass)  (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_SOURCE_TYPE_STYLE))
-#define GTK_SOURCE_STYLE_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_SOURCE_TYPE_STYLE, 
GtkSourceStyleClass))
-
-typedef struct _GtkSourceStyleClass GtkSourceStyleClass;
+#define GTK_SOURCE_TYPE_STYLE (gtk_source_style_get_type ())
 
 GTK_SOURCE_AVAILABLE_IN_ALL
-GType           gtk_source_style_get_type      (void) G_GNUC_CONST;
+G_DECLARE_FINAL_TYPE (GtkSourceStyle, gtk_source_style, GTK_SOURCE, STYLE, GObject)
 
 GTK_SOURCE_AVAILABLE_IN_ALL
-GtkSourceStyle *gtk_source_style_copy          (const GtkSourceStyle *style);
-
+GtkSourceStyle *gtk_source_style_copy  (const GtkSourceStyle *style);
 GTK_SOURCE_AVAILABLE_IN_3_22
-void            gtk_source_style_apply         (const GtkSourceStyle *style,
-                                                GtkTextTag           *tag);
+void            gtk_source_style_apply (const GtkSourceStyle *style,
+                                        GtkTextTag           *tag);
 
 G_END_DECLS


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