[gtksourceview/wip/chergert/gsv-gtk4] gtype: move type initialization to static constructor



commit a03be8ce2610818abcc151a850edc332da30d09b
Author: Christian Hergert <chergert redhat com>
Date:   Mon Jan 27 11:14:01 2020 -0800

    gtype: move type initialization to static constructor
    
    We don't need this in class registration anymore, as we can rely on it to
    be registered up front from the library's static constructor.

 gtksourceview/gtksourcefileloader.c |  8 --------
 gtksourceview/gtksourcefilesaver.c  |  8 --------
 gtksourceview/gtksourceinit.c       | 24 +++++++++++++++++++++++-
 3 files changed, 23 insertions(+), 17 deletions(-)
---
diff --git a/gtksourceview/gtksourcefileloader.c b/gtksourceview/gtksourcefileloader.c
index 3c0e9c86..ead44011 100644
--- a/gtksourceview/gtksourcefileloader.c
+++ b/gtksourceview/gtksourcefileloader.c
@@ -452,14 +452,6 @@ gtk_source_file_loader_class_init (GtkSourceFileLoaderClass *klass)
                                                              G_PARAM_READWRITE |
                                                              G_PARAM_CONSTRUCT_ONLY |
                                                              G_PARAM_STATIC_STRINGS));
-
-       /* Due to potential deadlocks when registering types, we need to
-        * ensure the dependent private class GtkSourceBufferOutputStream
-        * has been registered up front.
-        *
-        * See https://bugzilla.gnome.org/show_bug.cgi?id=780216
-        */
-       g_type_ensure (GTK_SOURCE_TYPE_BUFFER_OUTPUT_STREAM);
 }
 
 static void
diff --git a/gtksourceview/gtksourcefilesaver.c b/gtksourceview/gtksourcefilesaver.c
index 8ee0e1a3..67670906 100644
--- a/gtksourceview/gtksourcefilesaver.c
+++ b/gtksourceview/gtksourcefilesaver.c
@@ -466,14 +466,6 @@ gtk_source_file_saver_class_init (GtkSourceFileSaverClass *klass)
                                     G_PARAM_STATIC_STRINGS));
 
        g_object_class_install_properties (object_class, N_PROPS, properties);
-
-       /* Due to potential deadlocks when registering types, we need to
-        * ensure the dependent private class GtkSourceBufferInputStream
-        * has been registered up front.
-        *
-        * See https://bugzilla.gnome.org/show_bug.cgi?id=780216
-        */
-       g_type_ensure (GTK_SOURCE_TYPE_BUFFER_INPUT_STREAM);
 }
 
 static void
diff --git a/gtksourceview/gtksourceinit.c b/gtksourceview/gtksourceinit.c
index 16198c80..0e10b047 100644
--- a/gtksourceview/gtksourceinit.c
+++ b/gtksourceview/gtksourceinit.c
@@ -21,14 +21,22 @@
 
 #include <glib/gi18n-lib.h>
 
-#include "gtksourceinit.h"
+#include "gtksourcebuffer.h"
+#include "gtksourcebufferinputstream-private.h"
+#include "gtksourcebufferoutputstream-private.h"
+#include "gtksourcefileloader.h"
+#include "gtksourcefilesaver.h"
+#include "gtksourcegutterrenderer.h"
 #include "gtksourcegutterrendererpixbuf.h"
 #include "gtksourcegutterrenderertext.h"
+#include "gtksourceinit.h"
 #include "gtksourcelanguagemanager-private.h"
 #include "gtksourcemap.h"
+#include "gtksourcestyleschemechooser.h"
 #include "gtksourcestyleschemechooserbutton.h"
 #include "gtksourcestyleschemechooserwidget.h"
 #include "gtksourcestyleschememanager-private.h"
+#include "gtksourcestyleschememanager-private.h"
 #include "gtksourceview.h"
 
 #ifdef G_OS_WIN32
@@ -161,9 +169,23 @@ gtk_source_init (void)
 
                bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
 
+               /* Due to potential deadlocks when registering types, we need to
+                * ensure the dependent private class GtkSourceBufferOutputStream
+                * and GtkSourceBufferInputStream have been registered up front.
+                *
+                * See https://bugzilla.gnome.org/show_bug.cgi?id=780216
+                */
+
+               g_type_ensure (GTK_SOURCE_TYPE_BUFFER);
+               g_type_ensure (GTK_SOURCE_TYPE_BUFFER_INPUT_STREAM);
+               g_type_ensure (GTK_SOURCE_TYPE_BUFFER_OUTPUT_STREAM);
+               g_type_ensure (GTK_SOURCE_TYPE_FILE_LOADER);
+               g_type_ensure (GTK_SOURCE_TYPE_FILE_SAVER);
+               g_type_ensure (GTK_SOURCE_TYPE_GUTTER_RENDERER);
                g_type_ensure (GTK_SOURCE_TYPE_GUTTER_RENDERER_TEXT);
                g_type_ensure (GTK_SOURCE_TYPE_GUTTER_RENDERER_PIXBUF);
                g_type_ensure (GTK_SOURCE_TYPE_MAP);
+               g_type_ensure (GTK_SOURCE_TYPE_STYLE_SCHEME_CHOOSER);
                g_type_ensure (GTK_SOURCE_TYPE_STYLE_SCHEME_CHOOSER_BUTTON);
                g_type_ensure (GTK_SOURCE_TYPE_STYLE_SCHEME_CHOOSER_WIDGET);
                g_type_ensure (GTK_SOURCE_TYPE_VIEW);


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