summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorportix <none@none>2012-12-01 15:22:35 +0100
committerportix <none@none>2012-12-01 15:22:35 +0100
commit9bdd9b79794d00d2343c8132232dcc9d9490f1ed (patch)
treedb264b37c921e332a0e1e150eda83611d36f7306 /src
parent34b2c8c1f235ff0b1ae209a496115dde1730cdc6 (diff)
downloaddwb-9bdd9b79794d00d2343c8132232dcc9d9490f1ed.zip
Script access to tab widgets
Diffstat (limited to 'src')
-rw-r--r--src/scripts.c44
1 files changed, 43 insertions, 1 deletions
diff --git a/src/scripts.c b/src/scripts.c
index b77f2d4c..fb4d6239 100644
--- a/src/scripts.c
+++ b/src/scripts.c
@@ -118,11 +118,19 @@ static JSValueRef wv_get_main_frame(JSContextRef ctx, JSObjectRef object, JSStri
static JSValueRef wv_get_focused_frame(JSContextRef ctx, JSObjectRef object, JSStringRef js_name, JSValueRef* exception);
static JSValueRef wv_get_all_frames(JSContextRef ctx, JSObjectRef object, JSStringRef js_name, JSValueRef* exception);
static JSValueRef wv_get_number(JSContextRef ctx, JSObjectRef object, JSStringRef js_name, JSValueRef* exception);
+static JSValueRef wv_get_tab_widget(JSContextRef ctx, JSObjectRef object, JSStringRef js_name, JSValueRef* exception);
+static JSValueRef wv_get_tab_box(JSContextRef ctx, JSObjectRef object, JSStringRef js_name, JSValueRef* exception);
+static JSValueRef wv_get_tab_label(JSContextRef ctx, JSObjectRef object, JSStringRef js_name, JSValueRef* exception);
+static JSValueRef wv_get_tab_icon(JSContextRef ctx, JSObjectRef object, JSStringRef js_name, JSValueRef* exception);
static JSStaticValue wv_values[] = {
{ "mainFrame", wv_get_main_frame, NULL, kJSDefaultAttributes },
{ "focusedFrame", wv_get_focused_frame, NULL, kJSDefaultAttributes },
{ "allFrames", wv_get_all_frames, NULL, kJSDefaultAttributes },
{ "number", wv_get_number, NULL, kJSDefaultAttributes },
+ { "tabWidget", wv_get_tab_widget, NULL, kJSDefaultAttributes },
+ { "tabWidget", wv_get_tab_box, NULL, kJSDefaultAttributes },
+ { "tabLabel", wv_get_tab_label, NULL, kJSDefaultAttributes },
+ { "tabIcon", wv_get_tab_icon, NULL, kJSDefaultAttributes },
{ 0, 0, 0, 0 },
};
@@ -593,7 +601,8 @@ wv_get_all_frames(JSContextRef ctx, JSObjectRef object, JSStringRef js_name, JSV
/* wv_get_number {{{*/
static JSValueRef
-wv_get_number(JSContextRef ctx, JSObjectRef object, JSStringRef js_name, JSValueRef* exception) {
+wv_get_number(JSContextRef ctx, JSObjectRef object, JSStringRef js_name, JSValueRef* exception)
+{
GList *gl = dwb.state.views;
for (int i=0; gl; i++, gl=gl->next)
{
@@ -603,6 +612,39 @@ wv_get_number(JSContextRef ctx, JSObjectRef object, JSStringRef js_name, JSValue
return JSValueMakeNumber(ctx, -1);
}/*}}}*/
+static JSValueRef
+wv_get_tab_widget(JSContextRef ctx, JSObjectRef object, JSStringRef js_name, JSValueRef* exception)
+{
+ GList *gl = find_webview(object);
+ if (gl == NULL)
+ return JSValueMakeUndefined(ctx);
+ return make_object_for_class(ctx, m_default_class, G_OBJECT(VIEW(gl)->tabevent), false);
+}
+static JSValueRef
+wv_get_tab_box(JSContextRef ctx, JSObjectRef object, JSStringRef js_name, JSValueRef* exception)
+{
+ GList *gl = find_webview(object);
+ if (gl == NULL)
+ return JSValueMakeUndefined(ctx);
+ return make_object_for_class(ctx, m_default_class, G_OBJECT(VIEW(gl)->tabbox), false);
+}
+static JSValueRef
+wv_get_tab_label(JSContextRef ctx, JSObjectRef object, JSStringRef js_name, JSValueRef* exception)
+{
+ GList *gl = find_webview(object);
+ if (gl == NULL)
+ return JSValueMakeUndefined(ctx);
+ return make_object_for_class(ctx, m_default_class, G_OBJECT(VIEW(gl)->tablabel), false);
+}
+static JSValueRef
+wv_get_tab_icon(JSContextRef ctx, JSObjectRef object, JSStringRef js_name, JSValueRef* exception)
+{
+ GList *gl = find_webview(object);
+ if (gl == NULL)
+ return JSValueMakeUndefined(ctx);
+ return make_object_for_class(ctx, m_default_class, G_OBJECT(VIEW(gl)->tabicon), false);
+}
+
static JSValueRef
wv_set_title(JSContextRef ctx, JSObjectRef function, JSObjectRef this, size_t argc, const JSValueRef argv[], JSValueRef* exc)