tazweb rev 68

Connect create-web-view (right click and open in new window)but still dont do the job
author Christophe Lincoln <pankso@slitaz.org>
date Fri Apr 22 19:29:12 2011 +0200 (2011-04-22)
parents 72220b3cf20b
children 8961264a6475
files src/main.c
line diff
     1.1 --- a/src/main.c	Fri Apr 22 13:21:53 2011 +0200
     1.2 +++ b/src/main.c	Fri Apr 22 19:29:12 2011 +0200
     1.3 @@ -11,8 +11,8 @@
     1.4  #include <gtk/gtk.h>
     1.5  #include <webkit/webkit.h>
     1.6  
     1.7 -#define CONFIG		g_strdup_printf ("%s/.config/tazweb", g_get_home_dir ())
     1.8 -#define START		"file:///usr/share/webhome/index.html"
     1.9 +#define CONFIG   g_strdup_printf ("%s/.config/tazweb", g_get_home_dir ())
    1.10 +#define START    "file:///usr/share/webhome/index.html"
    1.11  
    1.12  /* Loader color - #d66018 #7b705c */
    1.13  static gchar *loader_color = "#351a0a";
    1.14 @@ -263,6 +263,13 @@
    1.15  	gtk_widget_show_all (GTK_WIDGET (menu));
    1.16  }
    1.17  
    1.18 +/* Open in a new window from menu */
    1.19 +static WebKitWebView*
    1.20 +create_web_view_cb (WebKitWebView* web_view, GtkWidget* window)
    1.21 +{
    1.22 +	return WEBKIT_WEB_VIEW (web_view);
    1.23 +}
    1.24 +
    1.25  /* Scrolled window for the web_view */
    1.26  static GtkWidget*
    1.27  create_browser ()
    1.28 @@ -283,6 +290,8 @@
    1.29  			G_CALLBACK (notify_load_status_cb), web_view);
    1.30  	g_signal_connect (web_view, "download-requested",
    1.31  			G_CALLBACK (download_requested_cb), NULL);
    1.32 +	g_signal_connect (web_view, "create-web-view",
    1.33 +			G_CALLBACK (create_web_view_cb), web_view);
    1.34  
    1.35  	/* Connect WebKit contextual menu items */
    1.36  	g_object_connect (G_OBJECT (web_view), "signal::populate-popup",
    1.37 @@ -296,7 +305,7 @@
    1.38  create_loader ()
    1.39  {
    1.40  	loader = gtk_drawing_area_new ();
    1.41 -	gtk_widget_set_size_request (loader, 0, 1);
    1.42 +	gtk_widget_set_size_request (loader, 0, 2);
    1.43  	g_signal_connect (G_OBJECT (loader), "expose_event",
    1.44  		G_CALLBACK (expose_loader_cb), NULL);
    1.45  	
    1.46 @@ -373,8 +382,7 @@
    1.47  	gtk_box_pack_start (GTK_BOX (vbox), create_toolbar (), FALSE, FALSE, 0);
    1.48  	gtk_container_add (GTK_CONTAINER (window), vbox);
    1.49  
    1.50 -	main_window = window;
    1.51 -	gtk_widget_show_all (main_window);
    1.52 +	return window;	
    1.53  }
    1.54  
    1.55  int
    1.56 @@ -392,12 +400,11 @@
    1.57  	uri = (char*) (argc > 1 ? argv[1] : START);
    1.58  	if (argv[1])
    1.59  		check_requested_uri ();
    1.60 -	
    1.61 -	
    1.62 -	create_window ();
    1.63 +		
    1.64 +	main_window = create_window ();
    1.65 +	gtk_widget_show_all (main_window);
    1.66  	webkit_web_view_load_uri (web_view, uri);
    1.67  	gtk_widget_grab_focus (GTK_WIDGET (web_view));
    1.68  	gtk_main ();
    1.69 -	
    1.70  	return 0;
    1.71  }