Adding nibbles patch

This commit is contained in:
Enno Boland (tox) 2010-09-09 11:15:02 +02:00
parent a1db4e9bf5
commit f1299dcfc1
1 changed files with 14 additions and 16 deletions

12
surf.c
View File

@ -87,7 +87,7 @@ static void linkhover(WebKitWebView *v, const char* t, const char* l, Client *c)
static void loadstatuschange(WebKitWebView *view, GParamSpec *pspec, Client *c); static void loadstatuschange(WebKitWebView *view, GParamSpec *pspec, Client *c);
static void loaduri(Client *c, const Arg *arg); static void loaduri(Client *c, const Arg *arg);
static void navigate(Client *c, const Arg *arg); static void navigate(Client *c, const Arg *arg);
static Client *newclient(gboolean view); static Client *newclient(void);
static void newwindow(Client *c, const Arg *arg); static void newwindow(Client *c, const Arg *arg);
static void newrequest(SoupSession *s, SoupMessage *msg, gpointer v); static void newrequest(SoupSession *s, SoupMessage *msg, gpointer v);
static void pasteuri(GtkClipboard *clipboard, const char *text, gpointer d); static void pasteuri(GtkClipboard *clipboard, const char *text, gpointer d);
@ -181,7 +181,7 @@ copystr(char **str, const char *src) {
WebKitWebView * WebKitWebView *
createwindow(WebKitWebView *v, WebKitWebFrame *f, Client *c) { createwindow(WebKitWebView *v, WebKitWebFrame *f, Client *c) {
Client *n = newclient(TRUE); Client *n = newclient();
return n->view; return n->view;
} }
@ -211,6 +211,7 @@ void
destroyclient(Client *c) { destroyclient(Client *c) {
Client *p; Client *p;
webkit_web_view_stop_loading(c->view);
gtk_widget_destroy(c->indicator); gtk_widget_destroy(c->indicator);
gtk_widget_destroy(GTK_WIDGET(c->view)); gtk_widget_destroy(GTK_WIDGET(c->view));
gtk_widget_destroy(c->scroll); gtk_widget_destroy(c->scroll);
@ -410,7 +411,7 @@ navigate(Client *c, const Arg *arg) {
} }
Client * Client *
newclient(gboolean newview) { newclient(void) {
Client *c; Client *c;
WebKitWebSettings *settings; WebKitWebSettings *settings;
WebKitWebFrame *frame; WebKitWebFrame *frame;
@ -454,8 +455,6 @@ newclient(gboolean newview) {
/* Webview */ /* Webview */
c->view = WEBKIT_WEB_VIEW(webkit_web_view_new()); c->view = WEBKIT_WEB_VIEW(webkit_web_view_new());
/* The widget to which the widget is added will handle the signals. */
if (!newview){
g_signal_connect(G_OBJECT(c->view), "title-changed", G_CALLBACK(titlechange), c); g_signal_connect(G_OBJECT(c->view), "title-changed", G_CALLBACK(titlechange), c);
g_signal_connect(G_OBJECT(c->view), "hovering-over-link", G_CALLBACK(linkhover), c); g_signal_connect(G_OBJECT(c->view), "hovering-over-link", G_CALLBACK(linkhover), c);
g_signal_connect(G_OBJECT(c->view), "create-web-view", G_CALLBACK(createwindow), c); g_signal_connect(G_OBJECT(c->view), "create-web-view", G_CALLBACK(createwindow), c);
@ -465,7 +464,6 @@ newclient(gboolean newview) {
g_signal_connect(G_OBJECT(c->view), "notify::load-status", G_CALLBACK(loadstatuschange), c); g_signal_connect(G_OBJECT(c->view), "notify::load-status", G_CALLBACK(loadstatuschange), c);
g_signal_connect(G_OBJECT(c->view), "notify::progress", G_CALLBACK(progresschange), c); g_signal_connect(G_OBJECT(c->view), "notify::progress", G_CALLBACK(progresschange), c);
g_signal_connect(G_OBJECT(c->view), "download-requested", G_CALLBACK(initdownload), c); g_signal_connect(G_OBJECT(c->view), "download-requested", G_CALLBACK(initdownload), c);
}
/* Indicator */ /* Indicator */
c->indicator = gtk_drawing_area_new(); c->indicator = gtk_drawing_area_new();
@ -839,7 +837,7 @@ main(int argc, char *argv[]) {
if(i < argc) if(i < argc)
arg.v = argv[i]; arg.v = argv[i];
setup(); setup();
newclient(FALSE); newclient();
if(arg.v) if(arg.v)
loaduri(clients, &arg); loaduri(clients, &arg);
gtk_main(); gtk_main();