[gjs] Gtk: fix enabling and disabling the C override helper



commit 3bcd6bac79b6b58e9d684c5f5e701ad8649b5efd
Author: Giovanni Campagna <scampa giovanni gmail com>
Date:   Thu Apr 10 19:33:06 2014 +0200

    Gtk: fix enabling and disabling the C override helper
    
    We need to include "config.h" in the introspected header, so that
    it knows whether to expose the function or not, and we cannot use
    a constant because the introspection scanner is too limited to
    recognize conditional constants. So we just check for the function
    directly.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=727394

 libgjs-private/gjs-gtk-util.h |    8 ++------
 modules/overrides/Gtk.js      |   11 +++++------
 2 files changed, 7 insertions(+), 12 deletions(-)
---
diff --git a/libgjs-private/gjs-gtk-util.h b/libgjs-private/gjs-gtk-util.h
index 987d589..7ea2a15 100644
--- a/libgjs-private/gjs-gtk-util.h
+++ b/libgjs-private/gjs-gtk-util.h
@@ -23,14 +23,14 @@
 #ifndef __GJS_PRIVATE_GTK_UTIL_H__
 #define __GJS_PRIVATE_GTK_UTIL_H__
 
+#include "config.h"
+
 #ifdef ENABLE_GTK
 
 #include <gtk/gtk.h>
 
 G_BEGIN_DECLS
 
-#define GJS_ENABLE_GTK 1
-
 void gjs_gtk_container_child_set_property (GtkContainer *container,
                                            GtkWidget    *child,
                                            const gchar  *property,
@@ -38,10 +38,6 @@ void gjs_gtk_container_child_set_property (GtkContainer *container,
 
 G_END_DECLS
 
-#else
-
-#define GJS_ENABLE_GTK 0
-
 #endif
 
 #endif /* __GJS_PRIVATE_GTK_UTIL_H__ */
diff --git a/modules/overrides/Gtk.js b/modules/overrides/Gtk.js
index 45c10db..16fac20 100644
--- a/modules/overrides/Gtk.js
+++ b/modules/overrides/Gtk.js
@@ -4,10 +4,9 @@ var Gtk;
 function _init() {
     Gtk = this;
 
-    if (!GjsPrivate.ENABLE_GTK)
-       return;
-
-    Gtk.Container.prototype.child_set_property = function(child, property, value) {
-        GjsPrivate.gtk_container_child_set_property(this, child, property, value);
-    };
+    if (GjsPrivate.gtk_container_child_set_property) {
+        Gtk.Container.prototype.child_set_property = function(child, property, value) {
+            GjsPrivate.gtk_container_child_set_property(this, child, property, value);
+        };
+    }
 }


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