tazweb diff src/main.c @ rev 61
Use #define to handle config dir
author | Christophe Lincoln <pankso@slitaz.org> |
---|---|
date | Fri Apr 22 05:04:17 2011 +0200 (2011-04-22) |
parents | 246560e6885c |
children | 8389defee9b9 |
line diff
1.1 --- a/src/main.c Fri Apr 22 04:15:49 2011 +0200 1.2 +++ b/src/main.c Fri Apr 22 05:04:17 2011 +0200 1.3 @@ -1,23 +1,25 @@ 1.4 /* 1.5 * TazWeb is a radically simple web browser providing a single window 1.6 - * with a single toolbar with buttons and an URL entry, but no menu or 1.7 - * tabs. 1.8 + * with a single toolbar with buttons, an URL entry and search as well 1.9 + * as a contextual menu, but no menu bar or tabs. 1.10 * 1.11 * Copyright (C) 2011 SliTaz GNU/Linux <devel@slitaz.org> 1.12 - * 1.13 + * See AUTHORS and LICENSE for detailed information 1.14 + * 1.15 */ 1.16 1.17 #include <gtk/gtk.h> 1.18 #include <webkit/webkit.h> 1.19 1.20 -static GtkWidget *main_window, *scrolled, *toolbar, *uri_entry, *search_entry; 1.21 +#define CONFIG g_strdup_printf ("%s/.config/tazweb", g_get_home_dir ()) 1.22 + 1.23 +static GtkWidget *main_window, *scrolled, *toolbar; 1.24 +static GtkWidget *uri_entry, *search_entry; 1.25 static WebKitWebView* web_view; 1.26 static WebKitWebFrame* frame; 1.27 static gdouble load_progress; 1.28 static guint status_context_id; 1.29 static gchar* main_title; 1.30 - 1.31 -const gchar* config; 1.32 const gchar* uri; 1.33 1.34 /* Create an icon */ 1.35 @@ -29,14 +31,12 @@ 1.36 return pixbuf; 1.37 } 1.38 1.39 -/* Get a default page.html if missing */ 1.40 +/* Get a default home.html if missing */ 1.41 static void 1.42 get_config () 1.43 { 1.44 - config = g_strdup_printf ("%s/.config/tazweb", g_get_home_dir ()); 1.45 - if (! g_file_test(config, G_FILE_TEST_EXISTS)) { 1.46 - g_mkdir (config, 0700); 1.47 - system ("cp /usr/share/tazweb/* $HOME/.config/tazweb"); 1.48 + if (! g_file_test (CONFIG, G_FILE_TEST_EXISTS)) { 1.49 + system ("cp -r /usr/share/tazweb $HOME/.config/tazweb"); 1.50 } 1.51 } 1.52 1.53 @@ -124,8 +124,7 @@ 1.54 static void 1.55 go_home_cb (GtkWidget* widget, gpointer data) 1.56 { 1.57 - uri = g_strdup_printf ("file://%s/.config/tazweb/home.html", 1.58 - g_get_home_dir ()); 1.59 + uri = g_strdup_printf ("file://%s/home.html", CONFIG); 1.60 g_assert (uri); 1.61 webkit_web_view_load_uri (web_view, uri); 1.62 }