Last but also least is this tiny history patch that attempts to improve
the current one in two aspects:

1) log every page you surf, not only the ones explicitly opened from the
cli or c-g (which in my case are very few ones).

2) more informative log entries %title - %url.

It naturally hooks on titlechange.

Best regards
--
Carlos
diff -N -up surf-0.4.1/config.def.h surf-0.4.1-history//config.def.h
--- surf-0.4.1/config.def.h     2010-06-08 04:06:41.000000000 -0300
+++ surf-0.4.1-history//config.def.h    2010-07-09 18:31:40.000000000 -0300
@@ -5,6 +5,7 @@ static char *progress_trust = "#00FF00";
 static char *stylefile      = ".surf/style.css";
 static char *scriptfile     = ".surf/script.js";
 static char *cookiefile     = ".surf/cookies.txt";
+static char *historyfile    = ".surf/history";
 static time_t sessiontime   = 3600;
 #define NOBACKGROUND 0
 
diff -N -up surf-0.4.1/surf.c surf-0.4.1-history//surf.c
--- surf-0.4.1/surf.c   2010-06-08 04:06:42.000000000 -0300
+++ surf-0.4.1-history//surf.c  2010-07-09 18:31:13.000000000 -0300
@@ -140,6 +140,7 @@ cleanup(void) {
        while(clients)
                destroyclient(clients);
        g_free(cookiefile);
+       g_free(historyfile);
        g_free(scriptfile);
        g_free(stylefile);
 }
@@ -689,6 +690,7 @@ setup(void) {
 
        /* dirs and files */
        cookiefile = buildpath(cookiefile);
+  historyfile = buildpath(historyfile);                                        
              
        scriptfile = buildpath(scriptfile);
        stylefile = buildpath(stylefile);
 
@@ -746,7 +748,10 @@ stop(Client *c, const Arg *arg) {
 
 void
 titlechange(WebKitWebView *v, WebKitWebFrame *f, const char *t, Client *c) {
-       c->title = copystr(&c->title, t);
+  FILE* h = fopen(historyfile, "a+");                                          
                    
+  fprintf(h, "%s - %s\n", t, webkit_web_frame_get_uri(f));
+  fclose(h);                                                                   
              
+       c->title = g_strdup_printf("%s - %s", t, webkit_web_frame_get_uri(f));
        update(c);
 }
 

Reply via email to