summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEnno Boland (Gottox) <gottox@s01.de>2009-06-05 18:00:45 +0200
committerEnno Boland (Gottox) <gottox@s01.de>2009-06-05 18:00:45 +0200
commitbc5d280efefa23ebe0425a5f3de781194c2f94fc (patch)
tree2b13170e4e96e643e2941de7bd1f100b15a67245
parentda509312df9de31a0de5e90387884cbfc4ef42e7 (diff)
downloadsurf-bc5d280efefa23ebe0425a5f3de781194c2f94fc.tar.gz
surf-bc5d280efefa23ebe0425a5f3de781194c2f94fc.tar.bz2
surf-bc5d280efefa23ebe0425a5f3de781194c2f94fc.zip
removed unneeded event listeners and reworked file opener.
-rw-r--r--surf.c33
1 files changed, 13 insertions, 20 deletions
diff --git a/surf.c b/surf.c
index 67d64c5..cfc4d07 100644
--- a/surf.c
+++ b/surf.c
@@ -87,20 +87,24 @@ loadfile(gchar *f) {
GIOChannel *c = NULL;
GError *e = NULL;
GString *code = g_string_new("");
+ GString *uri = g_string_new(f);
gchar *line;
/* cannot use fileno in c99 - workaround*/
- if(strcmp(f, "-") == 0)
+ if(strcmp(f, "-") == 0) {
c = g_io_channel_unix_new(STDIN_FILENO);
- else
- c = g_io_channel_new_file(f, "r", NULL);
- if (c) {
- while(g_io_channel_read_line(c, &line, NULL, NULL, &e) == G_IO_STATUS_NORMAL) {
- g_string_append(code, line);
- g_free(line);
+ if (c) {
+ while(g_io_channel_read_line(c, &line, NULL, NULL, &e) == G_IO_STATUS_NORMAL) {
+ g_string_append(code, line);
+ g_free(line);
+ }
+ webkit_web_view_load_html_string(view, code->str, NULL);
+ g_io_channel_shutdown(c, FALSE, NULL);
}
- webkit_web_view_load_html_string(view, code->str, NULL);
- g_io_channel_shutdown(c, FALSE, NULL);
+ }
+ else {
+ g_string_prepend(uri, "file://");
+ loaduri(uri->str);
}
}
@@ -132,10 +136,6 @@ linkhover(WebKitWebView* page, const gchar* t, const gchar* l, gpointer d) {
}
void
-loadstart(WebKitWebView *view, WebKitWebFrame *f, gpointer d) {
-}
-
-void
loadcommit(WebKitWebView *view, WebKitWebFrame *f, gpointer d) {
gchar *uri;
@@ -148,11 +148,6 @@ loadcommit(WebKitWebView *view, WebKitWebFrame *f, gpointer d) {
}
void
-loadfinish(WebKitWebView *view, WebKitWebFrame *f, gpointer d) {
- /* ??? TODO */
-}
-
-void
progresschange(WebKitWebView* view, gint p, gpointer d) {
progress = p;
updatetitle();
@@ -208,8 +203,6 @@ void setup(void) {
g_signal_connect(G_OBJECT(view), "title-changed", G_CALLBACK(titlechange), view);
g_signal_connect(G_OBJECT(view), "load-progress-changed", G_CALLBACK(progresschange), view);
g_signal_connect(G_OBJECT(view), "load-committed", G_CALLBACK(loadcommit), view);
- g_signal_connect(G_OBJECT(view), "load-started", G_CALLBACK(loadstart), view);
- g_signal_connect(G_OBJECT(view), "load-finished", G_CALLBACK(loadfinish), view);
g_signal_connect(G_OBJECT(view), "hovering-over-link", G_CALLBACK(linkhover), view);
g_signal_connect(G_OBJECT(view), "new-window-policy-decision-requested", G_CALLBACK(newwindow), view);
g_signal_connect(G_OBJECT(view), "download-requested", G_CALLBACK(download), view);