tazweb rev 75

No space before function(argument)
author Christophe Lincoln <pankso@slitaz.org>
date Sun Apr 24 00:12:47 2011 +0200 (2011-04-24)
parents 22ccdae2c559
children dd5c73a60acc
files src/main.c
line diff
     1.1 --- a/src/main.c	Sun Apr 24 00:03:07 2011 +0200
     1.2 +++ b/src/main.c	Sun Apr 24 00:12:47 2011 +0200
     1.3 @@ -4,7 +4,7 @@
     1.4   * as a contextual menu, but no menu bar or tabs. Commented line code
     1.5   * starts with // and comments are between * *
     1.6   *
     1.7 - * Copyright (C) 2011 SliTaz GNU/Linux - BSD License
     1.8 + * Copyright(C) 2011 SliTaz GNU/Linux - BSD License
     1.9   * See AUTHORS and LICENSE for detailed information
    1.10   * 
    1.11   */
    1.12 @@ -12,10 +12,10 @@
    1.13  #include <gtk/gtk.h>
    1.14  #include <webkit/webkit.h>
    1.15  
    1.16 -#define CONFIG   g_strdup_printf ("%s/.config/tazweb", g_get_home_dir ())
    1.17 +#define CONFIG   g_strdup_printf("%s/.config/tazweb", g_get_home_dir())
    1.18  #define START    "file:///usr/share/webhome/index.html"
    1.19  
    1.20 -/* Colors (Loader: #d66018 #7b705c) */
    1.21 +/* Colors(Loader: #d66018 #7b705c) */
    1.22  static gchar *loadfg    = "#351a0a";
    1.23  static gchar *toolbarbg = "#f1efeb";
    1.24  
    1.25 @@ -30,415 +30,417 @@
    1.26  
    1.27  /* Create an icon */
    1.28  static GdkPixbuf*
    1.29 -create_pixbuf (const gchar* image)
    1.30 +create_pixbuf(const gchar* image)
    1.31  {
    1.32  	GdkPixbuf *pixbuf;
    1.33 -	pixbuf = gdk_pixbuf_new_from_file (image, NULL);
    1.34 +	pixbuf = gdk_pixbuf_new_from_file(image, NULL);
    1.35  	return pixbuf;
    1.36  }
    1.37  
    1.38  /* Can be: http://hg.slitaz.org or hg.slitaz.org */
    1.39  static void
    1.40 -check_requested_uri ()
    1.41 +check_requested_uri()
    1.42  {
    1.43 -	uri = g_strrstr (uri, "://") ? g_strdup (uri)
    1.44 -		: g_strdup_printf ("http://%s", uri);
    1.45 +	uri = g_strrstr(uri, "://") ? g_strdup(uri)
    1.46 +		: g_strdup_printf("http://%s", uri);
    1.47  }
    1.48  
    1.49  /* Loader area */
    1.50  static void
    1.51 -draw_loader ()
    1.52 +draw_loader()
    1.53  {
    1.54  	GdkGC* gc;
    1.55  	GdkColor fg;
    1.56  	gint width;
    1.57  
    1.58 -	gc = gdk_gc_new (loader->window);
    1.59 +	gc = gdk_gc_new(loader->window);
    1.60  	width = progress * loader->allocation.width / 100;
    1.61  	
    1.62 -	gdk_color_parse (loadfg, &fg);
    1.63 -	gdk_gc_set_rgb_fg_color (gc, &fg);
    1.64 -	gdk_draw_rectangle (loader->window,
    1.65 -			loader->style->bg_gc [GTK_WIDGET_STATE (loader)],
    1.66 +	gdk_color_parse(loadfg, &fg);
    1.67 +	gdk_gc_set_rgb_fg_color(gc, &fg);
    1.68 +	gdk_draw_rectangle(loader->window,
    1.69 +			loader->style->bg_gc [GTK_WIDGET_STATE(loader)],
    1.70  			TRUE, 0, 0, loader->allocation.width, loader->allocation.height);
    1.71 -	gdk_draw_rectangle (loader->window, gc, TRUE, 0, 0, width,
    1.72 +	gdk_draw_rectangle(loader->window, gc, TRUE, 0, 0, width,
    1.73  			loader->allocation.height);
    1.74 -	g_object_unref (gc);
    1.75 +	g_object_unref(gc);
    1.76  }
    1.77  
    1.78  /* Loader progress */
    1.79  static gboolean
    1.80 -expose_loader_cb (GtkWidget *loader, GdkEventExpose *event, gpointer data)
    1.81 +expose_loader_cb(GtkWidget *loader, GdkEventExpose *event, gpointer data)
    1.82  {
    1.83 -	draw_loader ();
    1.84 +	draw_loader();
    1.85  	return TRUE;
    1.86  }
    1.87  
    1.88  /* Update title and loader */
    1.89  static void
    1.90 -update ()
    1.91 +update()
    1.92  {
    1.93 -	title = g_strdup (pagetitle);
    1.94 -	if (! pagetitle)
    1.95 -		title = g_strdup_printf ("Unknow - TazWeb", pagetitle);
    1.96 -	draw_loader ();
    1.97 -	gtk_window_set_title (GTK_WINDOW (mainwindow), title);
    1.98 -	g_free (title);
    1.99 +	title = g_strdup(pagetitle);
   1.100 +	if(! pagetitle)
   1.101 +		title = g_strdup_printf("Unknow - TazWeb", pagetitle);
   1.102 +	draw_loader();
   1.103 +	gtk_window_set_title(GTK_WINDOW(mainwindow), title);
   1.104 +	g_free(title);
   1.105  }
   1.106  
   1.107  /* Get the page title */
   1.108  static void
   1.109 -notify_title_cb (WebKitWebView* webview, GParamSpec* pspec, gpointer data)
   1.110 +notify_title_cb(WebKitWebView* webview, GParamSpec* pspec, gpointer data)
   1.111  {
   1.112 -	pagetitle = g_strdup (webkit_web_view_get_title (webview));
   1.113 -	update ();
   1.114 +	pagetitle = g_strdup(webkit_web_view_get_title(webview));
   1.115 +	update();
   1.116  }
   1.117  
   1.118  /* Request progress in window title */
   1.119  static void
   1.120 -notify_progress_cb (WebKitWebView* webview, GParamSpec* pspec, gpointer data)
   1.121 +notify_progress_cb(WebKitWebView* webview, GParamSpec* pspec, gpointer data)
   1.122  {
   1.123 -	progress = webkit_web_view_get_progress (webview) * 100;
   1.124 -	update ();
   1.125 +	progress = webkit_web_view_get_progress(webview) * 100;
   1.126 +	update();
   1.127  }
   1.128  
   1.129  /* Notify loader and url entry */
   1.130  static void
   1.131 -notify_load_status_cb (WebKitWebView* webview, GParamSpec* pspec, gpointer data)
   1.132 +notify_load_status_cb(WebKitWebView* webview, GParamSpec* pspec, gpointer data)
   1.133  {
   1.134 -	switch (webkit_web_view_get_load_status (webview))
   1.135 +	switch(webkit_web_view_get_load_status(webview))
   1.136  	{
   1.137  	case WEBKIT_LOAD_COMMITTED:
   1.138  		break;
   1.139  	case WEBKIT_LOAD_FINISHED:
   1.140  		progress = 0;
   1.141 -		update ();
   1.142 +		update();
   1.143  		break;
   1.144  	}
   1.145 -	frame = webkit_web_view_get_main_frame (webview);
   1.146 -	uri = webkit_web_frame_get_uri (frame);
   1.147 +	frame = webkit_web_view_get_main_frame(webview);
   1.148 +	uri = webkit_web_frame_get_uri(frame);
   1.149  		if (uri)
   1.150 -			gtk_entry_set_text (GTK_ENTRY (urientry), uri);
   1.151 +			gtk_entry_set_text(GTK_ENTRY(urientry), uri);
   1.152  }
   1.153  
   1.154  static void
   1.155 -destroy_cb (GtkWidget* widget, GtkWindow* window)
   1.156 +destroy_cb(GtkWidget* widget, GtkWindow* window)
   1.157  {
   1.158 -	gtk_main_quit ();
   1.159 +	gtk_main_quit();
   1.160  }
   1.161  
   1.162  /* Show page source */
   1.163  static void
   1.164 -view_source_cb ()
   1.165 +view_source_cb()
   1.166  {
   1.167  	gboolean source;
   1.168  	
   1.169 -	frame = webkit_web_view_get_main_frame (webview);
   1.170 -	uri = webkit_web_frame_get_uri (frame);
   1.171 -	source = webkit_web_view_get_view_source_mode (webview);
   1.172 +	frame = webkit_web_view_get_main_frame(webview);
   1.173 +	uri = webkit_web_frame_get_uri(frame);
   1.174 +	source = webkit_web_view_get_view_source_mode(webview);
   1.175  	
   1.176  	webkit_web_view_set_view_source_mode(webview, !source);
   1.177 -	webkit_web_view_load_uri (webview, uri);
   1.178 +	webkit_web_view_load_uri(webview, uri);
   1.179  }
   1.180  
   1.181  /* URL entry callback function */
   1.182  static void
   1.183 -uri_entry_cb (GtkWidget* entry, gpointer data)
   1.184 +uri_entry_cb(GtkWidget* entry, gpointer data)
   1.185  {
   1.186 -	uri = gtk_entry_get_text (GTK_ENTRY (entry));
   1.187 -	g_assert (uri);
   1.188 -	check_requested_uri ();
   1.189 -	webkit_web_view_load_uri (webview, uri);
   1.190 +	uri = gtk_entry_get_text(GTK_ENTRY(entry));
   1.191 +	g_assert(uri);
   1.192 +	check_requested_uri();
   1.193 +	webkit_web_view_load_uri(webview, uri);
   1.194  }
   1.195  
   1.196  /* Search entry callback function */
   1.197  static void
   1.198 -search_entry_cb (GtkWidget* entry, gpointer data)
   1.199 +search_entry_cb(GtkWidget* entry, gpointer data)
   1.200  {
   1.201 -	uri = g_strdup_printf ("http://www.google.com/search?q=%s",
   1.202 -			gtk_entry_get_text (GTK_ENTRY (entry)));
   1.203 -	g_assert (uri);
   1.204 -	webkit_web_view_load_uri (webview, uri);
   1.205 +	uri = g_strdup_printf("http://www.google.com/search?q=%s",
   1.206 +			gtk_entry_get_text(GTK_ENTRY(entry)));
   1.207 +	g_assert(uri);
   1.208 +	webkit_web_view_load_uri(webview, uri);
   1.209  }
   1.210  
   1.211  /* Home button callback function */
   1.212  static void
   1.213 -go_home_cb (GtkWidget* widget, gpointer data)
   1.214 +go_home_cb(GtkWidget* widget, gpointer data)
   1.215  {
   1.216 -	uri = g_strdup_printf ("file://%s/home.html", CONFIG);
   1.217 -	g_assert (uri);
   1.218 -	webkit_web_view_load_uri (webview, uri);
   1.219 +	uri = g_strdup_printf("file://%s/home.html", CONFIG);
   1.220 +	g_assert(uri);
   1.221 +	webkit_web_view_load_uri(webview, uri);
   1.222  }
   1.223  
   1.224  /* Navigation button function */
   1.225  static void
   1.226 -go_back_cb (GtkWidget* widget, gpointer data)
   1.227 +go_back_cb(GtkWidget* widget, gpointer data)
   1.228  {
   1.229 -    webkit_web_view_go_back (webview);
   1.230 +    webkit_web_view_go_back(webview);
   1.231  }
   1.232  
   1.233  static void
   1.234 -go_forward_cb (GtkWidget* widget, gpointer data)
   1.235 +go_forward_cb(GtkWidget* widget, gpointer data)
   1.236  {
   1.237 -    webkit_web_view_go_forward (webview);
   1.238 +    webkit_web_view_go_forward(webview);
   1.239  }
   1.240  
   1.241  /* Fullscreen and unfullscreen callback function */
   1.242  static void
   1.243 -fullscreen_cb (GtkWindow* window, gpointer data)
   1.244 +fullscreen_cb(GtkWindow* window, gpointer data)
   1.245  {
   1.246  	GdkWindowState state;
   1.247 -	state = gdk_window_get_state (gtk_widget_get_window (GTK_WIDGET (mainwindow)));
   1.248 +	state = gdk_window_get_state(gtk_widget_get_window(GTK_WIDGET(mainwindow)));
   1.249  
   1.250 -	if (state & GDK_WINDOW_STATE_FULLSCREEN)
   1.251 -		gtk_window_unfullscreen (GTK_WINDOW (mainwindow));
   1.252 +	if(state & GDK_WINDOW_STATE_FULLSCREEN)
   1.253 +		gtk_window_unfullscreen(GTK_WINDOW(mainwindow));
   1.254  	else
   1.255 -		gtk_window_fullscreen (GTK_WINDOW (mainwindow));
   1.256 +		gtk_window_fullscreen(GTK_WINDOW(mainwindow));
   1.257  }
   1.258  
   1.259  /* TazWeb doc callback function */
   1.260  static void
   1.261 -tazweb_doc_cb (GtkWidget* widget, gpointer data)
   1.262 +tazweb_doc_cb(GtkWidget* widget, gpointer data)
   1.263  {
   1.264  	uri = ("file:///usr/share/doc/tazweb/tazweb.html");
   1.265 -	g_assert (uri);
   1.266 -	webkit_web_view_load_uri (webview, uri);
   1.267 +	g_assert(uri);
   1.268 +	webkit_web_view_load_uri(webview, uri);
   1.269  }
   1.270  
   1.271  /* Download function */
   1.272  static gboolean
   1.273 -download_requested_cb (WebKitWebView *webview, WebKitDownload *download,
   1.274 +download_requested_cb(WebKitWebView *webview, WebKitDownload *download,
   1.275  		gpointer user_data)
   1.276  {
   1.277 -	uri = webkit_download_get_uri (download);
   1.278 +	uri = webkit_download_get_uri(download);
   1.279  	const gchar* buffer;
   1.280 -	asprintf (&buffer,
   1.281 +	asprintf(&buffer,
   1.282  			"xterm -T 'Download' -geom 72x10+0-24 -e 'cd $HOME/Downloads && \
   1.283  				wget -c %s; sleep 2' &", uri);
   1.284 -	system (buffer);
   1.285 +	system(buffer);
   1.286  }
   1.287  
   1.288  /* Zoom out and in callback function */
   1.289  static void
   1.290 -zoom_out_cb (GtkWidget *mainwindow)
   1.291 +zoom_out_cb(GtkWidget *mainwindow)
   1.292  {
   1.293 -	webkit_web_view_zoom_out (webview);
   1.294 +	webkit_web_view_zoom_out(webview);
   1.295  }
   1.296  
   1.297  static void
   1.298 -zoom_in_cb (GtkWidget *mainwindow)
   1.299 +zoom_in_cb(GtkWidget *mainwindow)
   1.300  {
   1.301 -	webkit_web_view_zoom_in (webview);
   1.302 +	webkit_web_view_zoom_in(webview);
   1.303  }
   1.304  
   1.305  /* Add items to WebKit contextual menu */
   1.306  static void
   1.307 -populate_menu_cb (WebKitWebView *webview, GtkMenu *menu, gpointer data)
   1.308 +populate_menu_cb(WebKitWebView *webview, GtkMenu *menu, gpointer data)
   1.309  {
   1.310  	GtkWidget* item;
   1.311  	
   1.312  	/* Separator */
   1.313 -	item = gtk_separator_menu_item_new ();
   1.314 -	gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
   1.315 +	item = gtk_separator_menu_item_new();
   1.316 +	gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
   1.317  
   1.318  	/* Zoom in */
   1.319 -	item = gtk_image_menu_item_new_with_label ("Zoom in");
   1.320 -	gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item),
   1.321 -	gtk_image_new_from_stock (GTK_STOCK_ZOOM_IN, GTK_ICON_SIZE_MENU));
   1.322 -	gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
   1.323 -	g_signal_connect (item, "activate", G_CALLBACK (zoom_in_cb), NULL);
   1.324 +	item = gtk_image_menu_item_new_with_label("Zoom in");
   1.325 +	gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(item),
   1.326 +	gtk_image_new_from_stock(GTK_STOCK_ZOOM_IN, GTK_ICON_SIZE_MENU));
   1.327 +	gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
   1.328 +	g_signal_connect(item, "activate", G_CALLBACK(zoom_in_cb), NULL);
   1.329  	
   1.330  	/* Zoom out */
   1.331 -	item = gtk_image_menu_item_new_with_label ("Zoom out");
   1.332 -	gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item),
   1.333 -	gtk_image_new_from_stock (GTK_STOCK_ZOOM_OUT, GTK_ICON_SIZE_MENU));
   1.334 -	gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
   1.335 -	g_signal_connect (item, "activate", G_CALLBACK (zoom_out_cb), NULL);
   1.336 +	item = gtk_image_menu_item_new_with_label("Zoom out");
   1.337 +	gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(item),
   1.338 +	gtk_image_new_from_stock(GTK_STOCK_ZOOM_OUT, GTK_ICON_SIZE_MENU));
   1.339 +	gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
   1.340 +	g_signal_connect(item, "activate", G_CALLBACK(zoom_out_cb), NULL);
   1.341  
   1.342  	/* Separator */
   1.343 -	item = gtk_separator_menu_item_new ();
   1.344 -	gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
   1.345 +	item = gtk_separator_menu_item_new();
   1.346 +	gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
   1.347  
   1.348  	/* TazWeb documentation */
   1.349 -	item = gtk_image_menu_item_new_with_label ("TazWeb manual");
   1.350 -	gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item),
   1.351 -	gtk_image_new_from_stock (GTK_STOCK_INFO, GTK_ICON_SIZE_MENU));
   1.352 -	gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
   1.353 -	g_signal_connect (item, "activate", G_CALLBACK (tazweb_doc_cb), NULL);
   1.354 +	item = gtk_image_menu_item_new_with_label("TazWeb manual");
   1.355 +	gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(item),
   1.356 +	gtk_image_new_from_stock(GTK_STOCK_INFO, GTK_ICON_SIZE_MENU));
   1.357 +	gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
   1.358 +	g_signal_connect(item, "activate", G_CALLBACK(tazweb_doc_cb), NULL);
   1.359  
   1.360  	/* View source mode */
   1.361 -	item = gtk_image_menu_item_new_with_label ("View source mode");
   1.362 -	gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item),
   1.363 -	gtk_image_new_from_stock (GTK_STOCK_PROPERTIES, GTK_ICON_SIZE_MENU));
   1.364 -	gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
   1.365 -	g_signal_connect (item, "activate", G_CALLBACK (view_source_cb), NULL);
   1.366 +	item = gtk_image_menu_item_new_with_label("View source mode");
   1.367 +	gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(item),
   1.368 +	gtk_image_new_from_stock(GTK_STOCK_PROPERTIES, GTK_ICON_SIZE_MENU));
   1.369 +	gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
   1.370 +	g_signal_connect(item, "activate", G_CALLBACK(view_source_cb), NULL);
   1.371  	
   1.372 -	gtk_widget_show_all (GTK_WIDGET (menu));
   1.373 +	gtk_widget_show_all(GTK_WIDGET(menu));
   1.374  }
   1.375  
   1.376  /* Open in a new window from menu */
   1.377  static WebKitWebView*
   1.378 -create_web_view_cb (WebKitWebView* webview, GtkWidget* window)
   1.379 +create_web_view_cb(WebKitWebView* webview, GtkWidget* window)
   1.380  {
   1.381 -	return WEBKIT_WEB_VIEW (webview);
   1.382 +	return WEBKIT_WEB_VIEW(webview);
   1.383  }
   1.384  
   1.385  /* Scrolled window for the webview */
   1.386  static GtkWidget*
   1.387 -create_browser ()
   1.388 +create_browser()
   1.389  {
   1.390 -	scrolled = gtk_scrolled_window_new (NULL, NULL);
   1.391 -	gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled),
   1.392 +	scrolled = gtk_scrolled_window_new(NULL, NULL);
   1.393 +	gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled),
   1.394  			GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
   1.395  
   1.396 -	webview = WEBKIT_WEB_VIEW (webkit_web_view_new ());
   1.397 -	gtk_container_add (GTK_CONTAINER (scrolled), GTK_WIDGET (webview));
   1.398 +	webview = WEBKIT_WEB_VIEW(webkit_web_view_new());
   1.399 +	gtk_container_add(GTK_CONTAINER(scrolled), GTK_WIDGET(webview));
   1.400  
   1.401  	/* Connect WebKit events */
   1.402 -	g_signal_connect (webview, "notify::title",
   1.403 -			G_CALLBACK (notify_title_cb), webview);
   1.404 -	g_signal_connect (webview, "notify::progress",
   1.405 -			G_CALLBACK (notify_progress_cb), webview);
   1.406 -	g_signal_connect (webview, "notify::load-status",
   1.407 -			G_CALLBACK (notify_load_status_cb), webview);
   1.408 -	g_signal_connect (webview, "download-requested",
   1.409 -			G_CALLBACK (download_requested_cb), NULL);
   1.410 -	g_signal_connect (webview, "create-web-view",
   1.411 -			G_CALLBACK (create_web_view_cb), webview);
   1.412 +	g_signal_connect(webview, "notify::title",
   1.413 +			G_CALLBACK(notify_title_cb), webview);
   1.414 +	g_signal_connect(webview, "notify::progress",
   1.415 +			G_CALLBACK(notify_progress_cb), webview);
   1.416 +	g_signal_connect(webview, "notify::load-status",
   1.417 +			G_CALLBACK(notify_load_status_cb), webview);
   1.418 +	g_signal_connect(webview, "download-requested",
   1.419 +			G_CALLBACK(download_requested_cb), NULL);
   1.420 +	g_signal_connect(webview, "create-web-view",
   1.421 +			G_CALLBACK(create_web_view_cb), webview);
   1.422  
   1.423  	/* Connect WebKit contextual menu items */
   1.424 -	g_object_connect (G_OBJECT (webview), "signal::populate-popup",
   1.425 -		G_CALLBACK (populate_menu_cb), webview, NULL);
   1.426 +	g_object_connect(G_OBJECT(webview), "signal::populate-popup",
   1.427 +		G_CALLBACK(populate_menu_cb), webview, NULL);
   1.428  
   1.429  	return scrolled;
   1.430  }
   1.431  
   1.432  /* Loader area */
   1.433  static GtkWidget*
   1.434 -create_loader ()
   1.435 +create_loader()
   1.436  {
   1.437 -	loader = gtk_drawing_area_new ();
   1.438 -	gtk_widget_set_size_request (loader, 0, 2);
   1.439 -	g_signal_connect (G_OBJECT (loader), "expose_event",
   1.440 -		G_CALLBACK (expose_loader_cb), NULL);
   1.441 +	loader = gtk_drawing_area_new();
   1.442 +	gtk_widget_set_size_request(loader, 0, 2);
   1.443 +	g_signal_connect(G_OBJECT(loader), "expose_event",
   1.444 +		G_CALLBACK(expose_loader_cb), NULL);
   1.445  	
   1.446  	return loader;
   1.447  }
   1.448  
   1.449  static GtkWidget*
   1.450 -create_toolbar ()
   1.451 +create_toolbar()
   1.452  {
   1.453  	GtkToolItem* item;
   1.454  	GdkColor bg;
   1.455  	
   1.456 -	toolbar = gtk_toolbar_new ();
   1.457 -	//gtk_widget_set_size_request (toolbar, 0, 24);
   1.458 -	gtk_toolbar_set_orientation (GTK_TOOLBAR (toolbar),
   1.459 +	toolbar = gtk_toolbar_new();
   1.460 +	//gtk_widget_set_size_request(toolbar, 0, 24);
   1.461 +	gtk_toolbar_set_orientation(GTK_TOOLBAR(toolbar),
   1.462  			GTK_ORIENTATION_HORIZONTAL);
   1.463 -	gtk_toolbar_set_style (GTK_TOOLBAR (toolbar),
   1.464 +	gtk_toolbar_set_style(GTK_TOOLBAR(toolbar),
   1.465  			GTK_TOOLBAR_BOTH_HORIZ);
   1.466 -	gdk_color_parse (toolbarbg, &bg);
   1.467 -	gtk_widget_modify_bg (toolbar, GTK_STATE_NORMAL, &bg);
   1.468 +	gdk_color_parse(toolbarbg, &bg);
   1.469 +	gtk_widget_modify_bg(toolbar, GTK_STATE_NORMAL, &bg);
   1.470  
   1.471  	/* The back button */
   1.472 -    item = gtk_tool_button_new_from_stock (GTK_STOCK_GO_BACK);
   1.473 -    g_signal_connect (G_OBJECT (item), "clicked", G_CALLBACK (go_back_cb), NULL);
   1.474 -    gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
   1.475 +    item = gtk_tool_button_new_from_stock(GTK_STOCK_GO_BACK);
   1.476 +    g_signal_connect(G_OBJECT(item), "clicked", G_CALLBACK(go_back_cb), NULL);
   1.477 +    gtk_toolbar_insert(GTK_TOOLBAR(toolbar), item, -1);
   1.478  
   1.479      /* The forward button */
   1.480 -    item = gtk_tool_button_new_from_stock (GTK_STOCK_GO_FORWARD);
   1.481 -    g_signal_connect (G_OBJECT (item), "clicked", G_CALLBACK (go_forward_cb), NULL);
   1.482 -    gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
   1.483 +    item = gtk_tool_button_new_from_stock(GTK_STOCK_GO_FORWARD);
   1.484 +    g_signal_connect(G_OBJECT(item), "clicked", G_CALLBACK(go_forward_cb), NULL);
   1.485 +    gtk_toolbar_insert(GTK_TOOLBAR(toolbar), item, -1);
   1.486  
   1.487      /* Home button */
   1.488 -	item = gtk_tool_button_new_from_stock (GTK_STOCK_HOME);
   1.489 -	g_signal_connect (G_OBJECT (item), "clicked",
   1.490 -			G_CALLBACK (go_home_cb), NULL);
   1.491 -	gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
   1.492 +	item = gtk_tool_button_new_from_stock(GTK_STOCK_HOME);
   1.493 +	g_signal_connect(G_OBJECT(item), "clicked",
   1.494 +			G_CALLBACK(go_home_cb), NULL);
   1.495 +	gtk_toolbar_insert(GTK_TOOLBAR(toolbar), item, -1);
   1.496  
   1.497  	/* URL entry */
   1.498 -	item = gtk_tool_item_new ();
   1.499 -	gtk_tool_item_set_expand (item, TRUE);
   1.500 +	item = gtk_tool_item_new();
   1.501 +	gtk_tool_item_set_expand(item, TRUE);
   1.502  	
   1.503 -	urientry = gtk_entry_new ();
   1.504 -	gtk_widget_modify_base ( GTK_WIDGET (urientry),
   1.505 +	urientry = gtk_entry_new();
   1.506 +	gtk_widget_modify_base( GTK_WIDGET(urientry),
   1.507  			GTK_STATE_NORMAL, &bg);
   1.508 -	gtk_entry_set_inner_border (GTK_ENTRY (urientry), NULL);
   1.509 -	gtk_entry_set_has_frame (GTK_ENTRY (urientry), FALSE);
   1.510 +	gtk_entry_set_inner_border(GTK_ENTRY(urientry), NULL);
   1.511 +	gtk_entry_set_has_frame(GTK_ENTRY(urientry), FALSE);
   1.512  	
   1.513 -	gtk_container_add (GTK_CONTAINER (item), urientry);
   1.514 -	g_signal_connect (G_OBJECT (urientry), "activate",
   1.515 -			G_CALLBACK (uri_entry_cb), NULL);
   1.516 -	gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
   1.517 +	gtk_container_add(GTK_CONTAINER(item), urientry);
   1.518 +	g_signal_connect(G_OBJECT(urientry), "activate",
   1.519 +			G_CALLBACK(uri_entry_cb), NULL);
   1.520 +	gtk_toolbar_insert(GTK_TOOLBAR(toolbar), item, -1);
   1.521  
   1.522  	/* Separator */
   1.523 -	item = gtk_separator_tool_item_new ();
   1.524 -	gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1); 
   1.525 +	item = gtk_separator_tool_item_new();
   1.526 +	gtk_toolbar_insert(GTK_TOOLBAR(toolbar), item, -1); 
   1.527  	
   1.528  	/* Search entry */
   1.529 -	item = gtk_tool_item_new ();
   1.530 -	search = gtk_entry_new ();
   1.531 -	gtk_widget_set_size_request (search, 150, 20);
   1.532 -	gtk_container_add (GTK_CONTAINER (item), search);
   1.533 -	g_signal_connect (G_OBJECT (search), "activate",
   1.534 -			G_CALLBACK (search_entry_cb), NULL);
   1.535 -	gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
   1.536 +	item = gtk_tool_item_new();
   1.537 +	search = gtk_entry_new();
   1.538 +	gtk_widget_set_size_request(search, 150, 20);
   1.539 +	gtk_container_add(GTK_CONTAINER(item), search);
   1.540 +	g_signal_connect(G_OBJECT(search), "activate",
   1.541 +			G_CALLBACK(search_entry_cb), NULL);
   1.542 +	gtk_toolbar_insert(GTK_TOOLBAR(toolbar), item, -1);
   1.543  
   1.544  	/* The Fullscreen button */
   1.545 -	item = gtk_tool_button_new_from_stock (GTK_STOCK_FULLSCREEN);
   1.546 -	g_signal_connect (G_OBJECT (item), "clicked",
   1.547 -			G_CALLBACK (fullscreen_cb), NULL);
   1.548 -	gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
   1.549 +	item = gtk_tool_button_new_from_stock(GTK_STOCK_FULLSCREEN);
   1.550 +	g_signal_connect(G_OBJECT(item), "clicked",
   1.551 +			G_CALLBACK(fullscreen_cb), NULL);
   1.552 +	gtk_toolbar_insert(GTK_TOOLBAR(toolbar), item, -1);
   1.553  
   1.554  	return toolbar;
   1.555  }
   1.556  
   1.557  /* Main window */
   1.558  static GtkWidget*
   1.559 -create_window ()
   1.560 +create_window()
   1.561  {
   1.562 -	GtkWidget* window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
   1.563 -	GtkWidget* vbox = gtk_vbox_new (FALSE, 0);
   1.564 +	GtkWidget* window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
   1.565 +	GtkWidget* vbox = gtk_vbox_new(FALSE, 0);
   1.566  
   1.567  	/* Default TazWeb window size ratio to 3/4 --> 720, 540 */
   1.568 -	gtk_window_set_default_size (GTK_WINDOW (window), 800, 600);
   1.569 -	gtk_window_set_icon (GTK_WINDOW (window),
   1.570 -			create_pixbuf ("/usr/share/pixmaps/tazweb.png"));
   1.571 -	gtk_widget_set_name (window, "TazWeb");
   1.572 -	g_signal_connect (window, "destroy", G_CALLBACK (destroy_cb), NULL);
   1.573 +	gtk_window_set_default_size(GTK_WINDOW(window), 800, 600);
   1.574 +	gtk_window_set_icon(GTK_WINDOW(window),
   1.575 +			create_pixbuf("/usr/share/pixmaps/tazweb.png"));
   1.576 +	gtk_widget_set_name(window, "TazWeb");
   1.577 +	g_signal_connect(window, "destroy", G_CALLBACK(destroy_cb), NULL);
   1.578  
   1.579  	/* Pack box and container */
   1.580 -	gtk_box_pack_start (GTK_BOX (vbox), create_browser (), TRUE, TRUE, 0);
   1.581 -	gtk_container_add (GTK_CONTAINER (vbox), create_loader());
   1.582 -	gtk_box_set_child_packing (GTK_BOX (vbox), loader,
   1.583 +	gtk_box_pack_start(GTK_BOX(vbox), create_browser(), TRUE, TRUE, 0);
   1.584 +	gtk_container_add(GTK_CONTAINER(vbox), create_loader());
   1.585 +	gtk_box_set_child_packing(GTK_BOX(vbox), loader,
   1.586  		FALSE, FALSE, 0, GTK_PACK_START);
   1.587 -	gtk_box_pack_start (GTK_BOX (vbox), create_toolbar (), FALSE, FALSE, 0);
   1.588 -	gtk_container_add (GTK_CONTAINER (window), vbox);
   1.589 +	gtk_box_pack_start(GTK_BOX(vbox), create_toolbar(), FALSE, FALSE, 0);
   1.590 +	gtk_container_add(GTK_CONTAINER(window), vbox);
   1.591  
   1.592  	return window;	
   1.593  }
   1.594  
   1.595  int
   1.596 -main (int argc, char* argv[])
   1.597 +main(int argc, char* argv[])
   1.598  {
   1.599 -	gtk_init (&argc, &argv);
   1.600 -	if (!g_thread_supported ())
   1.601 -		g_thread_init (NULL);
   1.602 +	gtk_init(&argc, &argv);
   1.603 +	if (!g_thread_supported())
   1.604 +		g_thread_init(NULL);
   1.605  
   1.606  	/* Get a default home.html if missing */
   1.607 -	if (! g_file_test (CONFIG, G_FILE_TEST_EXISTS))
   1.608 -		system ("cp -r /usr/share/tazweb $HOME/.config/tazweb");
   1.609 +	if (! g_file_test(CONFIG, G_FILE_TEST_EXISTS))
   1.610 +		system("cp -r /usr/share/tazweb $HOME/.config/tazweb");
   1.611  
   1.612  	/* Load the start page file or the url in argument */
   1.613 -	uri = (char*) (argc > 1 ? argv[1] : START);
   1.614 +	uri =(char*)(argc > 1 ? argv[1] : START);
   1.615  	if (argv[1])
   1.616 -		check_requested_uri ();
   1.617 +		check_requested_uri();
   1.618  		
   1.619 -	mainwindow = create_window ();
   1.620 -	gtk_widget_show_all (mainwindow);
   1.621 -	webkit_web_view_load_uri (webview, uri);
   1.622 -	gtk_widget_grab_focus (GTK_WIDGET (webview));
   1.623 -	gtk_main ();
   1.624 +	mainwindow = create_window();
   1.625 +	gtk_widget_show_all(mainwindow);
   1.626 +	
   1.627 +	webkit_web_view_load_uri(webview, uri);
   1.628 +	gtk_widget_grab_focus(GTK_WIDGET(webview));
   1.629 +	
   1.630 +	gtk_main();
   1.631  	
   1.632  	return 0;
   1.633  }