tazweb diff src/main.c @ 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
line diff
     1.1 --- a/src/main.c	Thu Apr 14 23:00:52 2011 +0200
     1.2 +++ b/src/main.c	Fri Apr 15 00:22:20 2011 +0200
     1.3 @@ -82,6 +82,17 @@
     1.4      webkit_web_view_load_uri (web_view, uri);
     1.5  }
     1.6  
     1.7 +/* Bookmarks button function */
     1.8 +static void
     1.9 +bookmarks_cb (GtkWidget* widget, gpointer data)
    1.10 +{
    1.11 +    const gchar* uri = g_strdup_printf ("file://%s/.config/tazweb/bookmarks.html",
    1.12 +        g_get_home_dir ());
    1.13 +    g_assert (uri);
    1.14 +    webkit_web_view_load_uri (web_view, uri);
    1.15 +}
    1.16 +
    1.17 +/* Navigation button function */
    1.18  static void
    1.19  go_back_cb (GtkWidget* widget, gpointer data)
    1.20  {
    1.21 @@ -138,6 +149,16 @@
    1.22      return scrolled_window;
    1.23  }
    1.24  
    1.25 +/* Create an icon */
    1.26 +static GdkPixbuf*
    1.27 +create_pixbuf (const gchar * image)
    1.28 +{
    1.29 +   GdkPixbuf *pixbuf;
    1.30 +   pixbuf = gdk_pixbuf_new_from_file (image, NULL);
    1.31 +
    1.32 +   return pixbuf;
    1.33 +}
    1.34 +
    1.35  static GtkWidget*
    1.36  create_toolbar ()
    1.37  {
    1.38 @@ -162,12 +183,6 @@
    1.39      item = gtk_tool_button_new_from_stock (GTK_STOCK_REFRESH);
    1.40      g_signal_connect (G_OBJECT (item), "clicked", G_CALLBACK (refresh_cb), NULL);
    1.41      gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
    1.42 -    
    1.43 -    /* Expand to have help icon on the right 
    1.44 -    * item = gtk_tool_item_new ();
    1.45 -    * gtk_tool_item_set_expand (item, TRUE);
    1.46 -    * gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1); 
    1.47 -    */
    1.48  
    1.49  	/* The URL entry */
    1.50  	item = gtk_tool_item_new ();
    1.51 @@ -183,29 +198,24 @@
    1.52      g_signal_connect (G_OBJECT (item), "clicked", G_CALLBACK (go_home_cb), NULL);
    1.53      gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
    1.54  
    1.55 -    /* The Fullscreen button */
    1.56 -    item = gtk_tool_button_new_from_stock (GTK_STOCK_FULLSCREEN);
    1.57 -    g_signal_connect (G_OBJECT (item), "clicked", G_CALLBACK (fullscreen_cb), NULL);
    1.58 +    /* The Bookmarks button */
    1.59 +    item = gtk_tool_button_new_from_stock (GTK_STOCK_PREFERENCES);
    1.60 +    g_signal_connect (G_OBJECT (item), "clicked", G_CALLBACK (bookmarks_cb), NULL);
    1.61      gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
    1.62 -    
    1.63 +
    1.64      /* The TazWeb doc button */
    1.65      item = gtk_tool_button_new_from_stock (GTK_STOCK_INFO);
    1.66      g_signal_connect (G_OBJECT (item), "clicked", G_CALLBACK (tazweb_doc_cb), NULL);
    1.67      gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
    1.68  
    1.69 +    /* The Fullscreen button */
    1.70 +    item = gtk_tool_button_new_from_stock (GTK_STOCK_FULLSCREEN);
    1.71 +    g_signal_connect (G_OBJECT (item), "clicked", G_CALLBACK (fullscreen_cb), NULL);
    1.72 +    gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
    1.73 +
    1.74      return toolbar;
    1.75  }
    1.76  
    1.77 -/* Create an icon */
    1.78 -static GdkPixbuf*
    1.79 -create_pixbuf (const gchar * image)
    1.80 -{
    1.81 -   GdkPixbuf *pixbuf;
    1.82 -   pixbuf = gdk_pixbuf_new_from_file (image, NULL);
    1.83 -
    1.84 -   return pixbuf;
    1.85 -}
    1.86 -
    1.87  static GtkWidget*
    1.88  create_window ()
    1.89  {
    1.90 @@ -235,7 +245,8 @@
    1.91      gtk_container_add (GTK_CONTAINER (main_window), vbox);
    1.92  
    1.93  	/* Home page url or file */
    1.94 -    gchar* uri = (gchar*) (argc > 1 ? argv[1] : "file:///usr/share/webhome/index.html");
    1.95 +    gchar* uri = (gchar*) (argc > 1 ? argv[1] :
    1.96 +		"file:///usr/share/webhome/index.html");
    1.97      webkit_web_view_load_uri (web_view, uri);
    1.98  
    1.99      gtk_widget_grab_focus (GTK_WIDGET (web_view));