[gjs] context: Do other one-time init stuff in class_init



commit 5745453f546058eabc88ca36717f834dceb3bd69
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Wed Feb 27 18:32:36 2013 -0500

    context: Do other one-time init stuff in class_init
    
    https://bugzilla.gnome.org/show_bug.cgi?id=694828

 gjs/context.c |   18 ++++++++----------
 1 files changed, 8 insertions(+), 10 deletions(-)
---
diff --git a/gjs/context.c b/gjs/context.c
index 627921a..890510b 100644
--- a/gjs/context.c
+++ b/gjs/context.c
@@ -345,8 +345,16 @@ gjs_context_class_init(GjsContextClass *klass)
 
     JS_SetCStringsAreUTF8();
 
+    /* For GjsPrivate */
+    {
+        char *priv_typelib_dir = g_build_filename (PKGLIBDIR, "girepository-1.0", NULL);
+        g_irepository_prepend_search_path(priv_typelib_dir);
+        g_free (priv_typelib_dir);
+    }
+
     gjs_register_native_module("byteArray", gjs_define_byte_array_stuff, 0);
     gjs_register_native_module("_gi", gjs_define_private_gi_stuff, 0);
+    gjs_register_native_module("gi", gjs_define_gi_stuff, GJS_NATIVE_SUPPLIES_MODULE_OBJ);
 }
 
 static void
@@ -652,16 +660,6 @@ gjs_context_constructor (GType                  type,
 
     js_context->profiler = gjs_profiler_new(js_context->runtime);
 
-    if (!gjs_is_registered_native_module(js_context->context, NULL, "gi"))
-        gjs_register_native_module("gi", gjs_define_gi_stuff, GJS_NATIVE_SUPPLIES_MODULE_OBJ);
-
-    /* For GjsDBus */
-    {
-        char *priv_typelib_dir = g_build_filename (PKGLIBDIR, "girepository-1.0", NULL);
-        g_irepository_prepend_search_path(priv_typelib_dir);
-        g_free (priv_typelib_dir);
-    }
-
     if (js_context->gc_notifications_enabled)
         JS_SetGCCallback(js_context->context, gjs_on_context_gc);
 


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