--- rbwebkitgtk.c.old 2009-09-25 15:37:05.000000000 +0200 +++ rbwebkitgtk.c 2009-09-25 15:11:13.000000000 +0200 @@ -30,10 +30,12 @@ #include "webkit/webkit.h" #include "webkit/webkitwebview.h" +#include "webkit/webkitwebframe.h" #include "rbwebkitgtkversion.h" #define _WEBVIEW_SELF(s) (WEBKIT_WEB_VIEW(RVAL2GOBJ(s))) +#define _WEBFRAME_SELF(s) (WEBKIT_WEB_FRAME(RVAL2GOBJ(s))) /* #define _HISTITEM_SELF(s) (WEBKIT_WEB_HISTORY_ITEM(RVAL2GOBJ(s))) */ /* #define _BFLIST_SELF(s) (WEBKIT_WEB_BACK_FORWARD_LIST(RVAL2GOBJ(s))) */ @@ -699,6 +701,38 @@ /* return CSTR2RVAL(uri); */ /* } */ + +/* + * Method: get_main_frame + * + * Returns: the main frame of view. + * + */ +static VALUE +wk_webkit_web_view_get_main_frame(self) + VALUE self; +{ + WebKitWebFrame* main_frame; + main_frame = (WebKitWebFrame *) webkit_web_view_get_main_frame(_WEBVIEW_SELF(self)); + return GOBJ2RVAL(main_frame); +} + + +/* + * Method: get_title + * + * Returns: the title value. + * + */ +static VALUE +wk_webkit_web_frame_get_title(self) + VALUE self; +{ + gchar* title; + title = (gchar *) webkit_web_frame_get_title(_WEBFRAME_SELF(self)); + return CSTR2RVAL(title); +} + /* * Method: get_last_visited_time_in_seconds * @@ -1032,9 +1066,16 @@ /* rb_define_method(rb_cWebView, "get_paste_target_list", wk_webview_get_paste_target_list, 0); */ /* rb_define_method(rb_cWebView, "get_transparent", wk_webview_get_transparent, 0); */ /* rb_define_method(rb_cWebView, "set_transparent", wk_webview_set_transparent, 1); */ + rb_define_method(rb_cWebView, "get_main_frame", wk_webkit_web_view_get_main_frame, 0); G_DEF_SETTERS(rb_cWebView); + VALUE rb_cWebFrame = G_DEF_CLASS(WEBKIT_TYPE_WEB_FRAME, "WebFrame", rb_mWebKit); + + rb_define_method(rb_cWebFrame, "get_title", wk_webkit_web_frame_get_title, 0); + + G_DEF_SETTERS(rb_cWebFrame); + /* VALUE rb_cWebHistoryItem = G_DEF_CLASS(WEBKIT_TYPE_WEB_HISTORY_ITEM, "WebHistoryItem", rb_mWebKit); */ /* rb_define_method(rb_cWebHistoryItem, "initialize", wk_histitem_initialize, 2); */ /* rb_define_method(rb_cWebHistoryItem, "get_title", wk_histitem_get_title, 0); */