tazweb rev 35
Handle a Bookmarks file in /home/pankso/.config/tazweb/bookmarks.html
author | Christophe Lincoln <pankso@slitaz.org> |
---|---|
date | Fri Apr 15 00:22:20 2011 +0200 (2011-04-15) |
parents | 8fde5fee9c8b |
children | 46c4cc2696fc |
files | Makefile data/bookmarks.html src/main.c |
line diff
1.1 --- a/Makefile Thu Apr 14 23:00:52 2011 +0200 1.2 +++ b/Makefile Fri Apr 15 00:22:20 2011 +0200 1.3 @@ -16,14 +16,17 @@ 1.4 mkdir -p \ 1.5 $(DESTDIR)$(DOCDIR)/$(PACKAGE) \ 1.6 $(DESTDIR)$(PREFIX)/bin \ 1.7 + $(DESTDIR)$(PREFIX)/share/tazweb \ 1.8 $(DESTDIR)$(PREFIX)/share/pixmaps \ 1.9 $(DESTDIR)$(PREFIX)/share/applications 1.10 install -m 0755 $(PACKAGE) $(DESTDIR)$(PREFIX)/bin 1.11 cp -a doc/*.html $(DESTDIR)$(DOCDIR)/$(PACKAGE) 1.12 - cp -f data/tazweb-icon.png \ 1.13 + install -m 0644 data/tazweb-icon.png \ 1.14 $(DESTDIR)$(PREFIX)/share/pixmaps/tazweb.png 1.15 install -m 0644 data/tazweb.desktop \ 1.16 $(DESTDIR)$(PREFIX)/share/applications 1.17 + install -m 0644 data/bookmarks.html \ 1.18 + $(DESTDIR)$(PREFIX)/share/tazweb 1.19 1.20 clean: 1.21 rm -f $(PACKAGE)
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 2.2 +++ b/data/bookmarks.html Fri Apr 15 00:22:20 2011 +0200 2.3 @@ -0,0 +1,57 @@ 2.4 +<!DOCTYPE html> 2.5 +<html xmlns="http://www.w3.org/1999/xhtml"> 2.6 +<head> 2.7 + <title>My Bookmarks</title> 2.8 + <meta charset="utf-8" /> 2.9 + <style type="text/css"> 2.10 + body { font: 88% sans-serif, vernada, arial; margin: 0; } 2.11 + #header { background: #351a0a; height: 40px; border-bottom: 8px solid #d66018; } 2.12 + #content { margin: 40px 80px; text-align: justify; } 2.13 + h1 { margin: 0; padding: 8px; color: #fff; font-size: 20px; } 2.14 + h2 { color: #444; } h3 { color: #666; font-size: 140%; } 2.15 + ul { list-style-type: square; line-height: 140%; } 2.16 + a { color: #215090; } a:hover { text-decoration: none; color: blue; } 2.17 + </style> 2.18 +</head> 2.19 +<body> 2.20 + 2.21 +<div id="header"> 2.22 + <h1>My Bookmarks</h1> 2.23 +</div> 2.24 + 2.25 +<!-- Start content --> 2.26 +<div id="content"> 2.27 + 2.28 +<!-- 2.29 + Welcome to your TazWeb Bookmarks page a pure xHTML 5 file with some 2.30 + CSS for the design, you can customize it as you want. To add a section 2.31 + title you can use <h2></h2> elements or sub-section with <h3></h3> 2.32 + 2.33 + Here is an example of a bookmark entry, copy and past it somewhere 2.34 + between an <ul></ul> element to add a entry in the list. 2.35 + 2.36 + <li><a href="URL">NAME</a></li> 2.37 +--> 2.38 + 2.39 +<h2>SliTaz Network</h2> 2.40 +<ul> 2.41 + <li><a href="http://www.slitaz.org/">Website</a></li> 2.42 + <li><a href="http://scn.slitaz.org/">Community</a></li> 2.43 + <li><a href="http://forum.slitaz.org/">Forum</a></li> 2.44 + <li><a href="http://doc.slitaz.org/">Documentation</a></li> 2.45 + <li><a href="http://bugs.slitaz.org/">Bugs</a></li> 2.46 +</ul> 2.47 + 2.48 +<h2>Search Engines</h2> 2.49 +<ul> 2.50 + <li><a href="http://www.google.com/">Google</a></li> 2.51 + <li><a href="http://en.wikipedia.org/wiki/Special:Search">Wikipedia</a></li> 2.52 + <li><a href="http://scroogle.org/">Scroogle</a></li> 2.53 + <li><a href="http://search.yahoo.com/">Yahoo</a></li> 2.54 +</ul> 2.55 + 2.56 +<!-- End content --> 2.57 +</div> 2.58 + 2.59 +</body> 2.60 +</html>
3.1 --- a/src/main.c Thu Apr 14 23:00:52 2011 +0200 3.2 +++ b/src/main.c Fri Apr 15 00:22:20 2011 +0200 3.3 @@ -82,6 +82,17 @@ 3.4 webkit_web_view_load_uri (web_view, uri); 3.5 } 3.6 3.7 +/* Bookmarks button function */ 3.8 +static void 3.9 +bookmarks_cb (GtkWidget* widget, gpointer data) 3.10 +{ 3.11 + const gchar* uri = g_strdup_printf ("file://%s/.config/tazweb/bookmarks.html", 3.12 + g_get_home_dir ()); 3.13 + g_assert (uri); 3.14 + webkit_web_view_load_uri (web_view, uri); 3.15 +} 3.16 + 3.17 +/* Navigation button function */ 3.18 static void 3.19 go_back_cb (GtkWidget* widget, gpointer data) 3.20 { 3.21 @@ -138,6 +149,16 @@ 3.22 return scrolled_window; 3.23 } 3.24 3.25 +/* Create an icon */ 3.26 +static GdkPixbuf* 3.27 +create_pixbuf (const gchar * image) 3.28 +{ 3.29 + GdkPixbuf *pixbuf; 3.30 + pixbuf = gdk_pixbuf_new_from_file (image, NULL); 3.31 + 3.32 + return pixbuf; 3.33 +} 3.34 + 3.35 static GtkWidget* 3.36 create_toolbar () 3.37 { 3.38 @@ -162,12 +183,6 @@ 3.39 item = gtk_tool_button_new_from_stock (GTK_STOCK_REFRESH); 3.40 g_signal_connect (G_OBJECT (item), "clicked", G_CALLBACK (refresh_cb), NULL); 3.41 gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1); 3.42 - 3.43 - /* Expand to have help icon on the right 3.44 - * item = gtk_tool_item_new (); 3.45 - * gtk_tool_item_set_expand (item, TRUE); 3.46 - * gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1); 3.47 - */ 3.48 3.49 /* The URL entry */ 3.50 item = gtk_tool_item_new (); 3.51 @@ -183,29 +198,24 @@ 3.52 g_signal_connect (G_OBJECT (item), "clicked", G_CALLBACK (go_home_cb), NULL); 3.53 gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1); 3.54 3.55 - /* The Fullscreen button */ 3.56 - item = gtk_tool_button_new_from_stock (GTK_STOCK_FULLSCREEN); 3.57 - g_signal_connect (G_OBJECT (item), "clicked", G_CALLBACK (fullscreen_cb), NULL); 3.58 + /* The Bookmarks button */ 3.59 + item = gtk_tool_button_new_from_stock (GTK_STOCK_PREFERENCES); 3.60 + g_signal_connect (G_OBJECT (item), "clicked", G_CALLBACK (bookmarks_cb), NULL); 3.61 gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1); 3.62 - 3.63 + 3.64 /* The TazWeb doc button */ 3.65 item = gtk_tool_button_new_from_stock (GTK_STOCK_INFO); 3.66 g_signal_connect (G_OBJECT (item), "clicked", G_CALLBACK (tazweb_doc_cb), NULL); 3.67 gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1); 3.68 3.69 + /* The Fullscreen button */ 3.70 + item = gtk_tool_button_new_from_stock (GTK_STOCK_FULLSCREEN); 3.71 + g_signal_connect (G_OBJECT (item), "clicked", G_CALLBACK (fullscreen_cb), NULL); 3.72 + gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1); 3.73 + 3.74 return toolbar; 3.75 } 3.76 3.77 -/* Create an icon */ 3.78 -static GdkPixbuf* 3.79 -create_pixbuf (const gchar * image) 3.80 -{ 3.81 - GdkPixbuf *pixbuf; 3.82 - pixbuf = gdk_pixbuf_new_from_file (image, NULL); 3.83 - 3.84 - return pixbuf; 3.85 -} 3.86 - 3.87 static GtkWidget* 3.88 create_window () 3.89 { 3.90 @@ -235,7 +245,8 @@ 3.91 gtk_container_add (GTK_CONTAINER (main_window), vbox); 3.92 3.93 /* Home page url or file */ 3.94 - gchar* uri = (gchar*) (argc > 1 ? argv[1] : "file:///usr/share/webhome/index.html"); 3.95 + gchar* uri = (gchar*) (argc > 1 ? argv[1] : 3.96 + "file:///usr/share/webhome/index.html"); 3.97 webkit_web_view_load_uri (web_view, uri); 3.98 3.99 gtk_widget_grab_focus (GTK_WIDGET (web_view));