tazweb rev 14

main.c: create a toolbar, 2 button and pack it at bottom window
author Christophe Lincoln <pankso@slitaz.org>
date Mon Apr 04 19:25:11 2011 +0200 (2011-04-04)
parents e60526b4d075
children fb0574167aa3
files src/main.c
line diff
     1.1 --- a/src/main.c	Mon Apr 04 19:23:04 2011 +0200
     1.2 +++ b/src/main.c	Mon Apr 04 19:25:11 2011 +0200
     1.3 @@ -54,6 +54,24 @@
     1.4      gtk_main_quit ();
     1.5  }
     1.6  
     1.7 +/* Home button function */
     1.8 +static void
     1.9 +go_home (GtkWidget* widget, gpointer data)
    1.10 +{
    1.11 +    const gchar* uri = ("file:///usr/share/webhome/index.html");
    1.12 +    g_assert (uri);
    1.13 +    webkit_web_view_load_uri (web_view, uri);
    1.14 +}
    1.15 +
    1.16 +/* TazWeb doc function */
    1.17 +static void
    1.18 +tazweb_doc (GtkWidget* widget, gpointer data)
    1.19 +{
    1.20 +    const gchar* uri = ("file:///usr/share/doc/slitaz/tazweb.html");
    1.21 +    g_assert (uri);
    1.22 +    webkit_web_view_load_uri (web_view, uri);
    1.23 +}
    1.24 +
    1.25  static GtkWidget*
    1.26  create_browser ()
    1.27  {
    1.28 @@ -69,6 +87,34 @@
    1.29      return scrolled_window;
    1.30  }
    1.31  
    1.32 +static GtkWidget*
    1.33 +create_toolbar ()
    1.34 +{
    1.35 +    GtkWidget* toolbar = gtk_toolbar_new ();
    1.36 +
    1.37 +    gtk_toolbar_set_orientation (GTK_TOOLBAR (toolbar), GTK_ORIENTATION_HORIZONTAL);
    1.38 +    gtk_toolbar_set_style (GTK_TOOLBAR (toolbar), GTK_TOOLBAR_BOTH_HORIZ);
    1.39 +
    1.40 +    GtkToolItem* item;
    1.41 +
    1.42 +    /* The Home button */
    1.43 +    item = gtk_tool_button_new_from_stock (GTK_STOCK_HOME);
    1.44 +    g_signal_connect (G_OBJECT (item), "clicked", G_CALLBACK (go_home), NULL);
    1.45 +    gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
    1.46 +    
    1.47 +    /* Expand to have help icon on the right */
    1.48 +    item = gtk_tool_item_new ();
    1.49 +    gtk_tool_item_set_expand (item, TRUE);
    1.50 +    gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1); 
    1.51 +    
    1.52 +    /* The TazWeb doc button */
    1.53 +    item = gtk_tool_button_new_from_stock (GTK_STOCK_INFO);
    1.54 +    g_signal_connect (G_OBJECT (item), "clicked", G_CALLBACK (tazweb_doc), NULL);
    1.55 +    gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
    1.56 +
    1.57 +    return toolbar;
    1.58 +}
    1.59 +
    1.60  /* Create an icon */
    1.61  static GdkPixbuf*
    1.62  create_pixbuf (const gchar * image)
    1.63 @@ -102,6 +148,7 @@
    1.64  
    1.65      GtkWidget* vbox = gtk_vbox_new (FALSE, 0);
    1.66      gtk_box_pack_start (GTK_BOX (vbox), create_browser (), TRUE, TRUE, 0);
    1.67 +    gtk_box_pack_start (GTK_BOX (vbox), create_toolbar (), FALSE, FALSE, 0);
    1.68  
    1.69      main_window = create_window ();
    1.70      gtk_container_add (GTK_CONTAINER (main_window), vbox);