I've been meaning to send this one for a while now. It adds some bindings to the urlbar and searchbar (c-h, c-w, c-u for deleting, c-b, c-e for home/end). Not sure how it should be changed now that there's a config.h
rz
diff -r bb36803abc1f surf.c --- a/surf.c Mon Jul 13 09:35:41 2009 +0200 +++ b/surf.c Sun Sep 06 10:41:37 2009 -0700 @@ -36,6 +36,7 @@ extern char *optarg; extern int optind; +static void addglobalbindings(void); static void cleanup(void); static void destroyclient(Client *c); static void destroywin(GtkWidget* w, Client *c); @@ -65,6 +66,28 @@ static void updatetitle(Client *c, const gchar *title); void +addglobalbindings(void) { + GtkBindingSet *bindingset; + GtkWidget *widget; + gchar *str; + + widget = gtk_entry_new(); + bindingset = gtk_binding_set_by_class(>K_OBJECT_TYPE(widget)); + gtk_widget_destroy(widget); + + str = g_strdup("delete-from-cursor"); + gtk_binding_entry_add_signal(bindingset, GDK_h, GDK_CONTROL_MASK, str, 2, G_TYPE_ENUM, GTK_DELETE_CHARS, G_TYPE_INT, -1); + gtk_binding_entry_add_signal(bindingset, GDK_w, GDK_CONTROL_MASK, str, 2, G_TYPE_ENUM, GTK_DELETE_WORD_ENDS, G_TYPE_INT, -1); + gtk_binding_entry_add_signal(bindingset, GDK_u, GDK_CONTROL_MASK, str, 2, G_TYPE_ENUM, GTK_DELETE_PARAGRAPH_ENDS, G_TYPE_INT, -1); + g_free(str); + + str = g_strdup("move-cursor"); + gtk_binding_entry_add_signal(bindingset, GDK_b, GDK_CONTROL_MASK, str, 3, G_TYPE_ENUM, GTK_MOVEMENT_PARAGRAPH_ENDS, G_TYPE_INT, -1, G_TYPE_BOOLEAN, FALSE); + gtk_binding_entry_add_signal(bindingset, GDK_e, GDK_CONTROL_MASK, str, 3, G_TYPE_ENUM, GTK_MOVEMENT_PARAGRAPH_ENDS, G_TYPE_INT, 1, G_TYPE_BOOLEAN, FALSE); + g_free(str); +} + +void cleanup(void) { while(clients) destroyclient(clients); @@ -212,8 +235,6 @@ else webkit_web_view_reload(c->view); return TRUE; - case GDK_b: - return TRUE; case GDK_g: showurl(c); return TRUE; @@ -556,6 +577,8 @@ cookiejar = soup_cookie_jar_text_new(filename, FALSE); soup_session_add_feature(s, SOUP_SESSION_FEATURE(cookiejar)); + addglobalbindings(); + gtk_main(); cleanup(); return EXIT_SUCCESS;