aboutsummaryrefslogtreecommitdiff
path: root/callbacks.c
diff options
context:
space:
mode:
Diffstat (limited to 'callbacks.c')
-rw-r--r--callbacks.c44
1 files changed, 32 insertions, 12 deletions
diff --git a/callbacks.c b/callbacks.c
index 23c745b..b4cbd17 100644
--- a/callbacks.c
+++ b/callbacks.c
@@ -38,7 +38,7 @@ if ( (event->state & GDK_CONTROL_MASK) == GDK_CONTROL_MASK ) {
}
if (gtk_widget_has_focus(w.bar) && g == GDK_Escape) { gtk_widget_grab_focus(GTK_WIDGET(w.notebook)); return TRUE; }
-if (gtk_widget_has_focus(w.search)) {
+if (gtk_widget_has_focus(w.searchbar)) {
if (g == GDK_Escape) { show_search(FALSE); focus_view(); return TRUE; }
if ((g == GDK_Return) && (event->state & GDK_MOD1_MASK) == GDK_MOD1_MASK) { search(NULL, FALSE); }
}
@@ -67,6 +67,11 @@ w.hide = FALSE;
}
+/* link hovering callback */
+void cb_link_hover (WebKitWebView* page, const gchar* title, const gchar* link, gpointer data) {
+if(link != NULL) { gtk_statusbar_push(GTK_STATUSBAR(w.status), 0, link); }
+else { gtk_statusbar_push(GTK_STATUSBAR(w.status), 0, ""); }
+}
/* go forward or backwards, simple enough */
void cb_go(gboolean b) {
@@ -77,16 +82,32 @@ else { webkit_web_view_go_back(t->view); }
/* when the page load is commited, call this function */
-void cb_commit_load (WebKitWebView* page, WebKitWebFrame* frame, tab *t) {
-
-const gchar* uri = webkit_web_frame_get_uri(frame);
-
-if (gtk_notebook_get_current_page(w.notebook) == gtk_notebook_page_num(w.notebook, t->scroll)) {
-gtk_entry_set_text (GTK_ENTRY (w.bar), uri);
-}
-FILE *history = fopen(g_build_filename(g_get_home_dir(), DEFAULT_HISTORY_FILE, NULL), "a+");
-fprintf(history, "%s \n", uri);
-fclose(history);
+void cb_load_status (GObject* object, GParamSpec* pspec, tab *t) {
+
+ const gchar* uri = webkit_web_view_get_uri(t->view);
+ WebKitLoadStatus status = webkit_web_view_get_load_status(t->view);
+ switch(status) {
+ case WEBKIT_LOAD_PROVISIONAL:
+ break;
+ case WEBKIT_LOAD_COMMITTED:
+
+ if (gtk_notebook_get_current_page(w.notebook) == gtk_notebook_page_num(w.notebook, t->scroll)) {
+ gtk_entry_set_text (GTK_ENTRY (w.bar), uri);
+ }
+
+ FILE *history = fopen(g_build_filename(g_get_home_dir(), DEFAULT_HISTORY_FILE, NULL), "a+");
+ fprintf(history, "%s \n", uri);
+ fclose(history);
+
+ break;
+ case WEBKIT_LOAD_FIRST_VISUALLY_NON_EMPTY_LAYOUT:
+ break;
+ case WEBKIT_LOAD_FINISHED:
+ break;
+ default:
+ case WEBKIT_LOAD_FAILED:
+ break;
+ }
}
@@ -94,7 +115,6 @@ fclose(history);
/* title change callback */
void cb_title_changed(WebKitWebView *v, WebKitWebFrame *f, const char *title, tab *t) {
gchar *tabtitle;
-
if (gtk_notebook_get_current_page(w.notebook) == gtk_notebook_page_num(w.notebook, t->scroll)) {
gtk_window_set_title(GTK_WINDOW(w.win), g_strconcat(title, NULL));
}