# HG changeset patch # User Christophe Lincoln # Date 1302812659 -7200 # Node ID 2b9ac01011b0ab45b07567b10e8c2001e8759353 # Parent e616e93f48341331067e08ee4ab5af62860af595 So lets have and uri entry in the toolbar :-) diff -r e616e93f4834 -r 2b9ac01011b0 README --- a/README Fri Apr 08 06:12:50 2011 +0200 +++ b/README Thu Apr 14 22:24:19 2011 +0200 @@ -3,10 +3,10 @@ TazWeb is radically simple and very light web browser providing a single -window with one small bottom toolbar, but no menubar or tabs. Please keep -the code simple and clean, if you are motivated and want to add some entries -to the context menu, please talk to the AUTHOR before commiting anything -in the repos. +window with one small bottom toolbar with buttons and URL entry, but no +menubar or tabs. Please keep the code simple and clean, if you are +motivated and want to add some entries to the context menu, please talk +to the AUTHOR before commiting anything in the repos. This application have been created for Tazpanel and future SliTaz integrated Web applications. The goal is by far to have a fully-featured web browser. But @@ -28,39 +28,7 @@ $ make $ ./tazweb -For the version with a toolbar: - -$ make toolbar -$ ./tazweb-toolbar - Install with 'make install' (PREFIX and DESTDIR are supported for packaging) -URL in the toolbar ------------------- -Like said above, Tazweb must keep a simple interface and only one small toolbar -with a few buttons. In the first stage of the project I hesitated to put an URL -entry in the bar, but finally came to the conclusion that it is not useful and -not the goal of tazweb. But here is the code for posterity: - -static GtkWidget* uri_entry; - -static void -activate_uri_entry_cb (GtkWidget* entry, gpointer data) -{ - const gchar* uri = gtk_entry_get_text (GTK_ENTRY (entry)); - g_assert (uri); - webkit_web_view_load_uri (web_view, uri); -} - -/* The URL entry */ -item = gtk_tool_item_new (); -gtk_tool_item_set_expand (item, TRUE); -uri_entry = gtk_entry_new (); -gtk_container_add (GTK_CONTAINER (item), uri_entry); -g_signal_connect (G_OBJECT (uri_entry), "activate", - G_CALLBACK (activate_uri_entry_cb), NULL); -gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1); - - ================================================================================ diff -r e616e93f4834 -r 2b9ac01011b0 src/main.c --- a/src/main.c Fri Apr 08 06:12:50 2011 +0200 +++ b/src/main.c Thu Apr 14 22:24:19 2011 +0200 @@ -1,6 +1,6 @@ /* * TazWeb is a radicaly simple web browser providing a single window - * with no toolbar, menu or tabs. + * with a single toolbar with buttons and URL entry but no menu or tabs. * * * Copyright (C) 2011 SliTaz GNU/Linux @@ -16,6 +16,7 @@ static gchar* main_title; static gdouble load_progress; static guint status_context_id; +static GtkWidget* uri_entry; /* Page title to window title */ static void @@ -48,6 +49,14 @@ } static void +activate_uri_entry_cb (GtkWidget* entry, gpointer data) +{ + const gchar* uri = gtk_entry_get_text (GTK_ENTRY (entry)); + g_assert (uri); + webkit_web_view_load_uri (web_view, uri); +} + +static void destroy_cb (GtkWidget* widget, gpointer data) { gtk_main_quit (); @@ -136,10 +145,20 @@ g_signal_connect (G_OBJECT (item), "clicked", G_CALLBACK (go_forward_cb), NULL); gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1); - /* Expand to have help icon on the right */ - item = gtk_tool_item_new (); - gtk_tool_item_set_expand (item, TRUE); - gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1); + /* Expand to have help icon on the right + * item = gtk_tool_item_new (); + * gtk_tool_item_set_expand (item, TRUE); + * gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1); + */ + + /* The URL entry */ + item = gtk_tool_item_new (); + gtk_tool_item_set_expand (item, TRUE); + uri_entry = gtk_entry_new (); + gtk_container_add (GTK_CONTAINER (item), uri_entry); + g_signal_connect (G_OBJECT (uri_entry), "activate", + G_CALLBACK (activate_uri_entry_cb), NULL); + gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1); /* The TazWeb doc button */ item = gtk_tool_button_new_from_stock (GTK_STOCK_INFO);