tazweb rev 33

So lets have and uri entry in the toolbar :-)
author Christophe Lincoln <pankso@slitaz.org>
date Thu Apr 14 22:24:19 2011 +0200 (2011-04-14)
parents e616e93f4834
children 8fde5fee9c8b
files README src/main.c
line diff
     1.1 --- a/README	Fri Apr 08 06:12:50 2011 +0200
     1.2 +++ b/README	Thu Apr 14 22:24:19 2011 +0200
     1.3 @@ -3,10 +3,10 @@
     1.4  
     1.5  
     1.6  TazWeb is radically simple and very light web browser providing a single
     1.7 -window with one small bottom toolbar, but no menubar or tabs. Please keep
     1.8 -the code simple and clean, if you are motivated and want to add some entries
     1.9 -to the context menu, please talk to the AUTHOR before commiting anything
    1.10 -in the repos.
    1.11 +window with one small bottom toolbar with buttons and URL entry, but no
    1.12 +menubar or tabs. Please keep the code simple and clean, if you are
    1.13 +motivated and want to add some entries to the context menu, please talk
    1.14 +to the AUTHOR before commiting anything in the repos.
    1.15  
    1.16  This application have been created for Tazpanel and future SliTaz integrated
    1.17  Web applications. The goal is by far to have a fully-featured web browser. But
    1.18 @@ -28,39 +28,7 @@
    1.19  $ make
    1.20  $ ./tazweb
    1.21  
    1.22 -For the version with a toolbar:
    1.23 -
    1.24 -$ make toolbar
    1.25 -$ ./tazweb-toolbar
    1.26 -
    1.27  Install with 'make install' (PREFIX and DESTDIR are supported for packaging)
    1.28  
    1.29  
    1.30 -URL in the toolbar
    1.31 -------------------
    1.32 -Like said above, Tazweb must keep a simple interface and only one small toolbar
    1.33 -with a few buttons. In the first stage of the project I hesitated to put an URL
    1.34 -entry in the bar, but finally came to the conclusion that it is not useful and
    1.35 -not the goal of tazweb. But here is the code for posterity:
    1.36 -
    1.37 -static GtkWidget* uri_entry;
    1.38 -
    1.39 -static void
    1.40 -activate_uri_entry_cb (GtkWidget* entry, gpointer data)
    1.41 -{
    1.42 -	const gchar* uri = gtk_entry_get_text (GTK_ENTRY (entry));
    1.43 -	g_assert (uri);
    1.44 -	webkit_web_view_load_uri (web_view, uri);
    1.45 -}
    1.46 -
    1.47 -/* The URL entry */
    1.48 -item = gtk_tool_item_new ();
    1.49 -gtk_tool_item_set_expand (item, TRUE);
    1.50 -uri_entry = gtk_entry_new ();
    1.51 -gtk_container_add (GTK_CONTAINER (item), uri_entry);
    1.52 -g_signal_connect (G_OBJECT (uri_entry), "activate",
    1.53 -	G_CALLBACK (activate_uri_entry_cb), NULL);
    1.54 -gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
    1.55 -
    1.56 -
    1.57  ================================================================================
     2.1 --- a/src/main.c	Fri Apr 08 06:12:50 2011 +0200
     2.2 +++ b/src/main.c	Thu Apr 14 22:24:19 2011 +0200
     2.3 @@ -1,6 +1,6 @@
     2.4  /*
     2.5   * TazWeb is a radicaly simple web browser providing a single window
     2.6 - * with no toolbar, menu or tabs.
     2.7 + * with a single toolbar with buttons and URL entry but no menu or tabs.
     2.8   *
     2.9   * 
    2.10   * Copyright (C) 2011 SliTaz GNU/Linux <devel@slitaz.org>
    2.11 @@ -16,6 +16,7 @@
    2.12  static gchar* main_title;
    2.13  static gdouble load_progress;
    2.14  static guint status_context_id;
    2.15 +static GtkWidget* uri_entry;
    2.16  
    2.17  /* Page title to window title */
    2.18  static void
    2.19 @@ -48,6 +49,14 @@
    2.20  }
    2.21  
    2.22  static void
    2.23 +activate_uri_entry_cb (GtkWidget* entry, gpointer data)
    2.24 +{
    2.25 +	const gchar* uri = gtk_entry_get_text (GTK_ENTRY (entry));
    2.26 +	g_assert (uri);
    2.27 +	webkit_web_view_load_uri (web_view, uri);
    2.28 +}
    2.29 +
    2.30 +static void
    2.31  destroy_cb (GtkWidget* widget, gpointer data)
    2.32  {
    2.33      gtk_main_quit ();
    2.34 @@ -136,10 +145,20 @@
    2.35      g_signal_connect (G_OBJECT (item), "clicked", G_CALLBACK (go_forward_cb), NULL);
    2.36      gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
    2.37      
    2.38 -    /* Expand to have help icon on the right */
    2.39 -    item = gtk_tool_item_new ();
    2.40 -    gtk_tool_item_set_expand (item, TRUE);
    2.41 -    gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1); 
    2.42 +    /* Expand to have help icon on the right 
    2.43 +    * item = gtk_tool_item_new ();
    2.44 +    * gtk_tool_item_set_expand (item, TRUE);
    2.45 +    * gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1); 
    2.46 +    */
    2.47 +
    2.48 +	/* The URL entry */
    2.49 +	item = gtk_tool_item_new ();
    2.50 +	gtk_tool_item_set_expand (item, TRUE);
    2.51 +	uri_entry = gtk_entry_new ();
    2.52 +	gtk_container_add (GTK_CONTAINER (item), uri_entry);
    2.53 +	g_signal_connect (G_OBJECT (uri_entry), "activate",
    2.54 +		G_CALLBACK (activate_uri_entry_cb), NULL);
    2.55 +	gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
    2.56      
    2.57      /* The TazWeb doc button */
    2.58      item = gtk_tool_button_new_from_stock (GTK_STOCK_INFO);