diff options
author | mutantturkey <crazycal00@gmail.com> | 2010-05-08 09:37:50 -0400 |
---|---|---|
committer | mutantturkey <crazycal00@gmail.com> | 2010-05-08 09:37:50 -0400 |
commit | c7fc46833b69228f926497b4e6ed713effe4b708 (patch) | |
tree | a4bdd067ff518eeeb4ecf2ce30a9aea402b9271a | |
parent | 153071ed896fe8323c6aed815fdfe4f04905e524 (diff) |
added a reload callback CTRL+R
-rw-r--r-- | sb.c | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -28,6 +28,7 @@ static void tab_close(); static void tab_focus(GtkNotebook *notebook, GtkNotebookPage *page, guint page_num, gpointer user_data); static void download(WebKitWebView *web_view, GObject *download, gpointer user_data); static void config(); +static void reload(); gboolean key_press_cb(GtkWidget *widget, GdkEventKey *event); static void activate_uri_entry_cb (GtkWidget* entry, gpointer data) { @@ -37,6 +38,11 @@ static void activate_uri_entry_cb (GtkWidget* entry, gpointer data) { gtk_widget_grab_focus(GTK_WIDGET(t->view)); } +static void reload() { + struct tab *t = get_tab(NULL, gtk_notebook_get_current_page(GTK_NOTEBOOK(w.notebook))); + webkit_web_view_reload(t->view); + +} static void tab_close() { struct tab *t = get_tab(NULL, gtk_notebook_get_current_page(GTK_NOTEBOOK(w.notebook))); gtk_notebook_remove_page(GTK_NOTEBOOK(w.notebook), gtk_notebook_get_current_page(GTK_NOTEBOOK(w.notebook))); @@ -50,6 +56,7 @@ static void download(WebKitWebView *web_view, GObject *d, gpointer user_data) { gchar *command = g_strconcat(defaultdownload, g_strdup(c), NULL); puts(command); g_spawn_command_line_async(command, NULL); + g_free(command); } static void link_hover_cb (WebKitWebView* page, const gchar* title, const gchar* link, gpointer data) { /* gchar *linkhover; @@ -198,6 +205,8 @@ if (event->state == GDK_CONTROL_MASK) { if (gdk_keyval_to_lower(event->keyval) == GDK_w) { tab_close(); return TRUE; } if (gdk_keyval_to_lower(event->keyval) == GDK_bracketright) { tab_zoom(TRUE); return TRUE; } if (gdk_keyval_to_lower(event->keyval) == GDK_bracketleft) { tab_zoom(FALSE); return TRUE; } + if (gdk_keyval_to_lower(event->keyval) == GDK_r) { reload(); return TRUE; } + if (gtk_widget_has_focus(w.bar) && gdk_keyval_to_lower(event->keyval) == GDK_Return) { load_uri(g_strconcat(defaultsearchengine, gtk_entry_get_text(GTK_ENTRY(w.bar)), NULL)); return TRUE; } else { return FALSE; } } |