tazweb rev 76 1.3

Lets have a custom user agent string!
author Christophe Lincoln <pankso@slitaz.org>
date Sun Apr 24 00:43:36 2011 +0200 (2011-04-24)
parents 27fbc3a5a826
children fc03448598a1
files README src/main.c
line diff
     1.1 --- a/README	Sun Apr 24 00:12:47 2011 +0200
     1.2 +++ b/README	Sun Apr 24 00:43:36 2011 +0200
     1.3 @@ -45,7 +45,7 @@
     1.4        
     1.5      * Check mime-type before download (needs a callback function)
     1.6        g_signal_connect (web_view, "mime-type-policy-decision-requested",
     1.7 -                        G_CALLBACK (mime_type_decision_cb), web_view);
     1.8 +                        G_CALLBACK (mime_type_decision_cb), webview);
     1.9  
    1.10      * Get user config directory path in $HOME
    1.11        config = g_strdup_printf ("%s/.config/tazweb", g_get_home_dir ());
    1.12 @@ -55,7 +55,7 @@
    1.13        
    1.14        /* User agent */
    1.15        WebKitWebSettings *settings;
    1.16 -      settings = webkit_web_view_get_settings (web_view);
    1.17 +      settings = webkit_web_view_get_settings (webview);
    1.18        g_object_set (G_OBJECT (settings), "user-agent", useragent, NULL);
    1.19  
    1.20  
     2.1 --- a/src/main.c	Sun Apr 24 00:12:47 2011 +0200
     2.2 +++ b/src/main.c	Sun Apr 24 00:43:36 2011 +0200
     2.3 @@ -19,9 +19,12 @@
     2.4  static gchar *loadfg    = "#351a0a";
     2.5  static gchar *toolbarbg = "#f1efeb";
     2.6  
     2.7 +/* Needs AppleWebKit/531.2+ to handle all sites ? */
     2.8 +static gchar *useragent = "TazWeb (X11; SliTaz GNU/Linux; U; en_US)";
     2.9 +
    2.10  static gchar* pagetitle;
    2.11  static gchar* title;
    2.12 -static GtkWidget *mainwindow, *scrolled, *loader, *toolbar;
    2.13 +static GtkWidget *mainwindow, *browser, *loader, *toolbar;
    2.14  static GtkWidget *urientry, *search;
    2.15  static WebKitWebView* webview;
    2.16  static WebKitWebFrame* frame;
    2.17 @@ -287,12 +290,18 @@
    2.18  static GtkWidget*
    2.19  create_browser()
    2.20  {
    2.21 -	scrolled = gtk_scrolled_window_new(NULL, NULL);
    2.22 -	gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled),
    2.23 +	WebKitWebSettings *settings;
    2.24 +	
    2.25 +	browser = gtk_scrolled_window_new(NULL, NULL);
    2.26 +	gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(browser),
    2.27  			GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
    2.28  
    2.29  	webview = WEBKIT_WEB_VIEW(webkit_web_view_new());
    2.30 -	gtk_container_add(GTK_CONTAINER(scrolled), GTK_WIDGET(webview));
    2.31 +	gtk_container_add(GTK_CONTAINER(browser), GTK_WIDGET(webview));
    2.32 +
    2.33 +	/* User agent */
    2.34 +	settings = webkit_web_view_get_settings (webview);
    2.35 +	g_object_set (G_OBJECT (settings), "user-agent", useragent, NULL);
    2.36  
    2.37  	/* Connect WebKit events */
    2.38  	g_signal_connect(webview, "notify::title",
    2.39 @@ -310,7 +319,7 @@
    2.40  	g_object_connect(G_OBJECT(webview), "signal::populate-popup",
    2.41  		G_CALLBACK(populate_menu_cb), webview, NULL);
    2.42  
    2.43 -	return scrolled;
    2.44 +	return browser;
    2.45  }
    2.46  
    2.47  /* Loader area */
    2.48 @@ -372,8 +381,8 @@
    2.49  	gtk_toolbar_insert(GTK_TOOLBAR(toolbar), item, -1);
    2.50  
    2.51  	/* Separator */
    2.52 -	item = gtk_separator_tool_item_new();
    2.53 -	gtk_toolbar_insert(GTK_TOOLBAR(toolbar), item, -1); 
    2.54 +	//item = gtk_separator_tool_item_new();
    2.55 +	//gtk_toolbar_insert(GTK_TOOLBAR(toolbar), item, -1); 
    2.56  	
    2.57  	/* Search entry */
    2.58  	item = gtk_tool_item_new();