summaryrefslogtreecommitdiff
path: root/src/scripts.c
diff options
context:
space:
mode:
authorportix <none@none>2012-12-04 13:12:08 +0100
committerportix <none@none>2012-12-04 13:12:08 +0100
commit0486ab5b0ccd5f0970ff85fd4a791c737dd637aa (patch)
tree74d8fce430b222b16d1e430c66d99499d6e69b03 /src/scripts.c
parent95c1859939e67a5c1c415afa36f4ea716239755e (diff)
downloaddwb-0486ab5b0ccd5f0970ff85fd4a791c737dd637aa.zip
Create constructor for objects derived from gobject, allows to use 'instanceof' for gobjects
Diffstat (limited to 'src/scripts.c')
-rw-r--r--src/scripts.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/scripts.c b/src/scripts.c
index e379ad92..5a6242b2 100644
--- a/src/scripts.c
+++ b/src/scripts.c
@@ -2545,12 +2545,14 @@ create_global_object()
/* Default gobject class */
cd = kJSClassDefinitionEmpty;
+ cd.className = "GObject";
cd.staticFunctions = default_functions;
cd.getProperty = get_property;
cd.setProperty = set_property;
-
m_default_class = JSClassCreate(&cd);
+ create_constructor(m_global_context, "GObject", m_webview_class, NULL, NULL);
+
/* Webview */
cd.className = "WebKitWebView";
cd.staticFunctions = wv_functions;
@@ -2558,19 +2560,26 @@ create_global_object()
cd.parentClass = m_default_class;
m_webview_class = JSClassCreate(&cd);
+ create_constructor(m_global_context, "WebKitWebView", m_webview_class, NULL, NULL);
+
/* Frame */
- cd.className = NULL;
+ cd.className = "WebKitWebFrame";
cd.staticFunctions = frame_functions;
cd.staticValues = frame_values;
cd.parentClass = m_default_class;
m_frame_class = JSClassCreate(&cd);
+ create_constructor(m_global_context, "WebKitWebFrame", m_frame_class, NULL, NULL);
+
/* SoupMessage */
+ cd.className = "SoupMessage";
cd.staticFunctions = default_functions;
cd.staticValues = message_values;
cd.parentClass = m_default_class;
m_message_class = JSClassCreate(&cd);
+ create_constructor(m_global_context, "SoupMessage", m_frame_class, NULL, NULL);
+
static JSStaticValue gui_values[] = {
{ "window", gui_get_window, NULL, kJSDefaultAttributes },
{ "mainBox", gui_get_main_box, NULL, kJSDefaultAttributes },
@@ -2599,6 +2608,8 @@ create_global_object()
cd.parentClass = m_default_class;
m_download_class = JSClassCreate(&cd);
+ create_constructor(m_global_context, "Download", m_download_class, download_constructor_cb, NULL);
+
JSStaticFunction scratchpad_functions[] = {
{ "show", sp_show, kJSDefaultAttributes },
{ "hide", sp_hide, kJSDefaultAttributes },
@@ -2615,8 +2626,6 @@ create_global_object()
JSObjectRef o = make_object_for_class(m_global_context, class, G_OBJECT(scratchpad_get()), true);
js_set_property(m_global_context, global_object, "scratchpad", o, kJSDefaultAttributes, NULL);
- create_constructor(m_global_context, "Download", m_download_class, download_constructor_cb, NULL);
- create_constructor(m_global_context, "WebKitWebView", m_webview_class, NULL, NULL);
}/*}}}*/
/*}}}*/