summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiovanni Campagna <scampa.giovanni@gmail.com>2014-04-10 19:33:06 +0200
committerGiovanni Campagna <scampa.giovanni@gmail.com>2014-04-10 19:56:06 +0200
commit3bcd6bac79b6b58e9d684c5f5e701ad8649b5efd (patch)
tree3947b2be015dcb78ff09b294a1c821b36754ac4e
parent570fef74a9e57a12c828bff76fe827da1655319c (diff)
downloadgjs-3bcd6bac79b6b58e9d684c5f5e701ad8649b5efd.tar.gz
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
-rw-r--r--libgjs-private/gjs-gtk-util.h8
-rw-r--r--modules/overrides/Gtk.js11
2 files changed, 7 insertions, 12 deletions
diff --git a/libgjs-private/gjs-gtk-util.h b/libgjs-private/gjs-gtk-util.h
index 987d5895..7ea2a158 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 45c10dbf..16fac204 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);
+ };
+ }
}