tazweb 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 08c04b52a6c4
files data/home.html data/style.css src/main.c
line diff
     1.1 --- a/data/home.html	Fri Apr 22 04:15:49 2011 +0200
     1.2 +++ b/data/home.html	Fri Apr 22 05:04:17 2011 +0200
     1.3 @@ -1,14 +1,14 @@
     1.4  <!DOCTYPE html>
     1.5  <html xmlns="http://www.w3.org/1999/xhtml">
     1.6  <head>
     1.7 -	<title>My Page</title>
     1.8 +	<title>My Web Page</title>
     1.9  	<meta charset="utf-8" />
    1.10  	<link rel="stylesheet" type="text/css" href="style.css" />
    1.11  </head>
    1.12  <body>
    1.13  
    1.14  <div id="header">
    1.15 -	<h1>My Home page</h1>
    1.16 +	<h1>My Web Home</h1>
    1.17  </div>
    1.18  
    1.19  <!-- Start content -->
     2.1 --- a/data/style.css	Fri Apr 22 04:15:49 2011 +0200
     2.2 +++ b/data/style.css	Fri Apr 22 05:04:17 2011 +0200
     2.3 @@ -5,7 +5,8 @@
     2.4  	margin: 0;
     2.5  }
     2.6  
     2.7 -h1 { margin: 0; padding: 8px; color: #fff; font-size: 20px; }
     2.8 +h1 { margin: 0; padding: 8px;
     2.9 +	color: #fff; font-size: 20px; font-style: italic; }
    2.10  h2 { color: #444; }
    2.11  h3 { color: #666; font-size: 140%; }
    2.12  ul { list-style-type: square; line-height: 140%; }
     3.1 --- a/src/main.c	Fri Apr 22 04:15:49 2011 +0200
     3.2 +++ b/src/main.c	Fri Apr 22 05:04:17 2011 +0200
     3.3 @@ -1,23 +1,25 @@
     3.4  /*
     3.5   * TazWeb is a radically simple web browser providing a single window
     3.6 - * with a single toolbar with buttons and an URL entry, but no menu or
     3.7 - * tabs.
     3.8 + * with a single toolbar with buttons, an URL entry and search as well
     3.9 + * as a contextual menu, but no menu bar or tabs.
    3.10   *
    3.11   * Copyright (C) 2011 SliTaz GNU/Linux <devel@slitaz.org>
    3.12 - *
    3.13 + * See AUTHORS and LICENSE for detailed information
    3.14 + * 
    3.15   */
    3.16  
    3.17  #include <gtk/gtk.h>
    3.18  #include <webkit/webkit.h>
    3.19  
    3.20 -static GtkWidget *main_window, *scrolled, *toolbar, *uri_entry, *search_entry;
    3.21 +#define CONFIG g_strdup_printf ("%s/.config/tazweb", g_get_home_dir ())
    3.22 +
    3.23 +static GtkWidget *main_window, *scrolled, *toolbar;
    3.24 +static GtkWidget *uri_entry, *search_entry;
    3.25  static WebKitWebView* web_view;
    3.26  static WebKitWebFrame* frame;
    3.27  static gdouble load_progress;
    3.28  static guint status_context_id;
    3.29  static gchar* main_title;
    3.30 -
    3.31 -const gchar* config;
    3.32  const gchar* uri;
    3.33  
    3.34  /* Create an icon */
    3.35 @@ -29,14 +31,12 @@
    3.36  	return pixbuf;
    3.37  }
    3.38  
    3.39 -/* Get a default page.html if missing */
    3.40 +/* Get a default home.html if missing */
    3.41  static void
    3.42  get_config ()
    3.43  {
    3.44 -	config = g_strdup_printf ("%s/.config/tazweb", g_get_home_dir ());
    3.45 -	if (! g_file_test(config, G_FILE_TEST_EXISTS)) {
    3.46 -		g_mkdir (config, 0700);
    3.47 -		system ("cp /usr/share/tazweb/* $HOME/.config/tazweb");
    3.48 +	if (! g_file_test (CONFIG, G_FILE_TEST_EXISTS)) {
    3.49 +		system ("cp -r /usr/share/tazweb $HOME/.config/tazweb");
    3.50  	}
    3.51  }
    3.52  
    3.53 @@ -124,8 +124,7 @@
    3.54  static void
    3.55  go_home_cb (GtkWidget* widget, gpointer data)
    3.56  {
    3.57 -	uri = g_strdup_printf ("file://%s/.config/tazweb/home.html",
    3.58 -			g_get_home_dir ());
    3.59 +	uri = g_strdup_printf ("file://%s/home.html", CONFIG);
    3.60  	g_assert (uri);
    3.61  	webkit_web_view_load_uri (web_view, uri);
    3.62  }