Build fix: Adapt WebKit api changes

This commit is contained in:
Christian Dywan 2007-12-19 22:37:00 +01:00
parent 6994580e28
commit 5928f8ad88
3 changed files with 29 additions and 27 deletions

View file

@ -682,7 +682,7 @@ gboolean on_location_key_down(GtkWidget* widget, GdkEventKey* event, CBrowser* b
{ {
GtkWidget* webView = get_nth_webView(-1, browser); GtkWidget* webView = get_nth_webView(-1, browser);
WebKitWebFrame* frame = webkit_web_view_get_main_frame(WEBKIT_WEB_VIEW(webView)); WebKitWebFrame* frame = webkit_web_view_get_main_frame(WEBKIT_WEB_VIEW(webView));
const gchar* uri = webkit_web_frame_get_location(frame); const gchar* uri = webkit_web_frame_get_uri(frame);
if(uri && *uri) if(uri && *uri)
gtk_entry_set_text(GTK_ENTRY(widget), uri); gtk_entry_set_text(GTK_ENTRY(widget), uri);
return TRUE; return TRUE;
@ -735,7 +735,7 @@ void on_action_openInPanel_activate(GtkAction* action, CBrowser* browser)
GtkWidget* webView = get_nth_webView(-1, browser); GtkWidget* webView = get_nth_webView(-1, browser);
g_free(config->panelPageholder); g_free(config->panelPageholder);
WebKitWebFrame* frame = webkit_web_view_get_main_frame(WEBKIT_WEB_VIEW(webView)); WebKitWebFrame* frame = webkit_web_view_get_main_frame(WEBKIT_WEB_VIEW(webView));
const gchar* uri = webkit_web_frame_get_location(frame); const gchar* uri = webkit_web_frame_get_uri(frame);
config->panelPageholder = g_strdup(uri); config->panelPageholder = g_strdup(uri);
GtkAction* action_pageholder = GtkAction* action_pageholder =
gtk_action_group_get_action(browser->actiongroup, "PanelPageholder"); gtk_action_group_get_action(browser->actiongroup, "PanelPageholder");
@ -1342,6 +1342,7 @@ CBrowser* browser_new(CBrowser* oldBrowser)
DOC_CONNECT ("title-changed" , on_webView_title_changed) DOC_CONNECT ("title-changed" , on_webView_title_changed)
DOC_CONNECT ("icon-loaded" , on_webView_icon_changed) DOC_CONNECT ("icon-loaded" , on_webView_icon_changed)
DOC_CONNECT ("load-started" , on_webView_load_started) DOC_CONNECT ("load-started" , on_webView_load_started)
DOC_CONNECT ("load-committed" , on_webView_load_committed)
DOC_CONNECT ("load-progress-changed" , on_webView_load_changed) DOC_CONNECT ("load-progress-changed" , on_webView_load_changed)
DOC_CONNECT ("load-finished" , on_webView_load_finished) DOC_CONNECT ("load-finished" , on_webView_load_finished)
DOC_CONNECT ("status-bar-text-changed" , on_webView_status_message) DOC_CONNECT ("status-bar-text-changed" , on_webView_status_message)

View file

@ -31,28 +31,14 @@ WebKitNavigationResponse on_webView_navigation_requested(GtkWidget* webView
return response; return response;
} }
void on_webView_location_changed(GtkWidget* webView, const gchar* uri void on_webView_title_changed(GtkWidget* webView, WebKitWebFrame* frame
, CBrowser* browser) , const gchar* title, CBrowser* browser)
{ {
gchar* newUri = g_strdup(uri ? uri : ""); const gchar* newTitle;
xbel_bookmark_set_href(browser->sessionItem, newUri); if(title)
if(webView == get_nth_webView(-1, browser)) newTitle = title;
{ else
gtk_entry_set_text(GTK_ENTRY(browser->location), newUri); newTitle = webkit_web_frame_get_uri(frame);
gtk_label_set_text(GTK_LABEL(browser->webView_name), newUri);
update_status_message(NULL, browser);
update_gui_state(browser);
}
}
void on_webView_title_changed(GtkWidget* webView, const gchar* title
, const gchar* uri, CBrowser* browser)
{
// TODO: We emulate location_changed here for now
// Shouldn't we have separated title_changed and location_changed signals?
on_webView_location_changed(webView, uri, browser);
gchar* newTitle;
newTitle = g_strdup(title ? title : uri);
xbel_item_set_title(browser->sessionItem, newTitle); xbel_item_set_title(browser->sessionItem, newTitle);
gtk_label_set_text(GTK_LABEL(browser->webView_name), newTitle); gtk_label_set_text(GTK_LABEL(browser->webView_name), newTitle);
sokoke_widget_set_tooltip_text(gtk_widget_get_parent( sokoke_widget_set_tooltip_text(gtk_widget_get_parent(
@ -101,6 +87,21 @@ void on_webView_load_started(GtkWidget* webView, WebKitWebFrame* widget
gtk_widget_show(browser->progress); gtk_widget_show(browser->progress);
} }
void on_webView_load_committed(GtkWidget* webView, WebKitWebFrame* frame
, CBrowser* browser)
{
const gchar* uri = webkit_web_frame_get_uri(frame);
gchar* newUri = g_strdup(uri ? uri : "");
xbel_bookmark_set_href(browser->sessionItem, newUri);
if(webView == get_nth_webView(-1, browser))
{
gtk_entry_set_text(GTK_ENTRY(browser->location), newUri);
gtk_label_set_text(GTK_LABEL(browser->webView_name), newUri);
update_status_message(NULL, browser);
update_gui_state(browser);
}
}
void on_webView_load_changed(GtkWidget* webView, gint progress, CBrowser* browser) void on_webView_load_changed(GtkWidget* webView, gint progress, CBrowser* browser)
{ {
browser->loadedBytes = progress; browser->loadedBytes = progress;

View file

@ -23,10 +23,7 @@ on_webView_navigation_requested(GtkWidget* webView, WebKitWebFrame* frame
, WebKitNetworkRequest* networkRequest); , WebKitNetworkRequest* networkRequest);
void void
on_webView_location_changed(GtkWidget*, const gchar*, CBrowser*); on_webView_title_changed(GtkWidget*, WebKitWebFrame*, const gchar*, CBrowser*);
void
on_webView_title_changed(GtkWidget*, const gchar*, const gchar*, CBrowser*);
void void
on_webView_icon_changed(GtkWidget*, WebKitWebFrame*, CBrowser*); on_webView_icon_changed(GtkWidget*, WebKitWebFrame*, CBrowser*);
@ -34,6 +31,9 @@ on_webView_icon_changed(GtkWidget*, WebKitWebFrame*, CBrowser*);
void void
on_webView_load_started(GtkWidget* , WebKitWebFrame*, CBrowser*); on_webView_load_started(GtkWidget* , WebKitWebFrame*, CBrowser*);
void
on_webView_load_committed(GtkWidget* , WebKitWebFrame*, CBrowser*);
void void
on_webView_load_changed(GtkWidget*, gint progress, CBrowser*); on_webView_load_changed(GtkWidget*, gint progress, CBrowser*);