tazweb diff src/main.c @ rev 50
Use get_config for file path
author | Christophe Lincoln <pankso@slitaz.org> |
---|---|
date | Thu Apr 21 17:33:27 2011 +0200 (2011-04-21) |
parents | de5799d6dbb6 |
children | 6f282db96e72 |
line diff
1.1 --- a/src/main.c Thu Apr 21 00:59:01 2011 +0200 1.2 +++ b/src/main.c Thu Apr 21 17:33:27 2011 +0200 1.3 @@ -17,6 +17,27 @@ 1.4 static gchar* main_title; 1.5 static gdouble load_progress; 1.6 static guint status_context_id; 1.7 +const char* config; 1.8 + 1.9 +/* Create an icon */ 1.10 +static GdkPixbuf* 1.11 +create_pixbuf (const gchar * image) 1.12 +{ 1.13 + GdkPixbuf *pixbuf; 1.14 + pixbuf = gdk_pixbuf_new_from_file (image, NULL); 1.15 + return pixbuf; 1.16 +} 1.17 + 1.18 +/* Get a default page.html if missing */ 1.19 +static void 1.20 +get_config () 1.21 +{ 1.22 + config = g_strdup_printf ("%s/.config/tazweb", g_get_home_dir ()); 1.23 + if (!g_file_test(config, G_FILE_TEST_EXISTS)) { 1.24 + g_mkdir (config, 0700); 1.25 + system ("cp /usr/share/tazweb/* $HOME/.config/tazweb"); 1.26 + } 1.27 +} 1.28 1.29 /* Page title to window title */ 1.30 static void 1.31 @@ -148,15 +169,7 @@ 1.32 return scrolled_window; 1.33 } 1.34 1.35 -/* Create an icon */ 1.36 -static GdkPixbuf* 1.37 -create_pixbuf (const gchar * image) 1.38 -{ 1.39 - GdkPixbuf *pixbuf; 1.40 - pixbuf = gdk_pixbuf_new_from_file (image, NULL); 1.41 1.42 - return pixbuf; 1.43 -} 1.44 1.45 static GtkWidget* 1.46 create_toolbar () 1.47 @@ -222,12 +235,7 @@ 1.48 if (!g_thread_supported ()) 1.49 g_thread_init (NULL); 1.50 1.51 - /* Get a default page.html if missing */ 1.52 - const gchar* config = g_strdup_printf ("%s/.config/tazweb", g_get_home_dir ()); 1.53 - if (!g_file_test(config, G_FILE_TEST_EXISTS)) { 1.54 - g_mkdir (config, 0700); 1.55 - system ("cp /usr/share/tazweb/* $HOME/.config/tazweb"); 1.56 - } 1.57 + get_config (); 1.58 1.59 GtkWidget* vbox = gtk_vbox_new (FALSE, 0); 1.60 gtk_box_pack_start (GTK_BOX (vbox), create_browser (), TRUE, TRUE, 0);