tazweb diff src/main.c @ 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 | de9970ba1162 |
children | 8fde5fee9c8b |
line diff
1.1 --- a/src/main.c Mon Apr 04 22:54:32 2011 +0200 1.2 +++ b/src/main.c Thu Apr 14 22:24:19 2011 +0200 1.3 @@ -1,6 +1,6 @@ 1.4 /* 1.5 * TazWeb is a radicaly simple web browser providing a single window 1.6 - * with no toolbar, menu or tabs. 1.7 + * with a single toolbar with buttons and URL entry but no menu or tabs. 1.8 * 1.9 * 1.10 * Copyright (C) 2011 SliTaz GNU/Linux <devel@slitaz.org> 1.11 @@ -16,6 +16,7 @@ 1.12 static gchar* main_title; 1.13 static gdouble load_progress; 1.14 static guint status_context_id; 1.15 +static GtkWidget* uri_entry; 1.16 1.17 /* Page title to window title */ 1.18 static void 1.19 @@ -48,6 +49,14 @@ 1.20 } 1.21 1.22 static void 1.23 +activate_uri_entry_cb (GtkWidget* entry, gpointer data) 1.24 +{ 1.25 + const gchar* uri = gtk_entry_get_text (GTK_ENTRY (entry)); 1.26 + g_assert (uri); 1.27 + webkit_web_view_load_uri (web_view, uri); 1.28 +} 1.29 + 1.30 +static void 1.31 destroy_cb (GtkWidget* widget, gpointer data) 1.32 { 1.33 gtk_main_quit (); 1.34 @@ -136,10 +145,20 @@ 1.35 g_signal_connect (G_OBJECT (item), "clicked", G_CALLBACK (go_forward_cb), NULL); 1.36 gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1); 1.37 1.38 - /* Expand to have help icon on the right */ 1.39 - item = gtk_tool_item_new (); 1.40 - gtk_tool_item_set_expand (item, TRUE); 1.41 - gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1); 1.42 + /* Expand to have help icon on the right 1.43 + * item = gtk_tool_item_new (); 1.44 + * gtk_tool_item_set_expand (item, TRUE); 1.45 + * gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1); 1.46 + */ 1.47 + 1.48 + /* The URL entry */ 1.49 + item = gtk_tool_item_new (); 1.50 + gtk_tool_item_set_expand (item, TRUE); 1.51 + uri_entry = gtk_entry_new (); 1.52 + gtk_container_add (GTK_CONTAINER (item), uri_entry); 1.53 + g_signal_connect (G_OBJECT (uri_entry), "activate", 1.54 + G_CALLBACK (activate_uri_entry_cb), NULL); 1.55 + gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1); 1.56 1.57 /* The TazWeb doc button */ 1.58 item = gtk_tool_button_new_from_stock (GTK_STOCK_INFO);