r2995 - in trunk/src/target/OM-2007.2/applications/openmoko-browser2: . src
zecke at sita.openmoko.org
zecke at sita.openmoko.org
Tue Sep 18 03:40:48 CEST 2007
Author: zecke
Date: 2007-09-18 03:40:46 +0200 (Tue, 18 Sep 2007)
New Revision: 2995
Added:
trunk/src/target/OM-2007.2/applications/openmoko-browser2/src/go-page.c
trunk/src/target/OM-2007.2/applications/openmoko-browser2/src/go-page.h
Modified:
trunk/src/target/OM-2007.2/applications/openmoko-browser2/ChangeLog
trunk/src/target/OM-2007.2/applications/openmoko-browser2/src/Makefile.am
trunk/src/target/OM-2007.2/applications/openmoko-browser2/src/browser-data.h
trunk/src/target/OM-2007.2/applications/openmoko-browser2/src/main.c
Log:
2007-09-17 Holger Hans Peter Freyther <zecke at selfish.org>
Add the skeleton of the Go-Page to be able to create
new pages.
* src/Makefile.am:
* src/browser-data.h:
* src/go-page.c: Added.
(entry_focus_in):
(entry_focus_out):
(search_url_entry_changed):
(go_clicked):
(create_new_page_clicked):
(switched_notebook_tab):
(setup_go_page):
* src/go-page.h: Added.
* src/main.c:
(setup_ui):
Modified: trunk/src/target/OM-2007.2/applications/openmoko-browser2/ChangeLog
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-browser2/ChangeLog 2007-09-18 01:40:45 UTC (rev 2994)
+++ trunk/src/target/OM-2007.2/applications/openmoko-browser2/ChangeLog 2007-09-18 01:40:46 UTC (rev 2995)
@@ -1,5 +1,24 @@
2007-09-17 Holger Hans Peter Freyther <zecke at selfish.org>
+ Add the skeleton of the Go-Page to be able to create
+ new pages.
+
+ * src/Makefile.am:
+ * src/browser-data.h:
+ * src/go-page.c: Added.
+ (entry_focus_in):
+ (entry_focus_out):
+ (search_url_entry_changed):
+ (go_clicked):
+ (create_new_page_clicked):
+ (switched_notebook_tab):
+ (setup_go_page):
+ * src/go-page.h: Added.
+ * src/main.c:
+ (setup_ui):
+
+2007-09-17 Holger Hans Peter Freyther <zecke at selfish.org>
+
Add the "Close Current Page" button, document how the
ownership and destroying of the WebKitGtkPage is planned. When
the "Go"-Page will create a Page, we will additionally add a
Modified: trunk/src/target/OM-2007.2/applications/openmoko-browser2/src/Makefile.am
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-browser2/src/Makefile.am 2007-09-18 01:40:45 UTC (rev 2994)
+++ trunk/src/target/OM-2007.2/applications/openmoko-browser2/src/Makefile.am 2007-09-18 01:40:46 UTC (rev 2995)
@@ -7,8 +7,8 @@
bin_PROGRAMS = openmoko-browser
-EXTRA_DIST = browser-data.h current-page.h
-openmoko_browser_SOURCES = main.c current-page.c
+EXTRA_DIST = browser-data.h current-page.h go-page.h
+openmoko_browser_SOURCES = main.c current-page.c go-page.c
openmoko_browser_LDADD = @OPENMOKO_LIBS@ @WEBKITGTK_LIBS@ @GTHREAD_LIBS@
CLEANFILES = $(stamp_files)
Modified: trunk/src/target/OM-2007.2/applications/openmoko-browser2/src/browser-data.h
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-browser2/src/browser-data.h 2007-09-18 01:40:45 UTC (rev 2994)
+++ trunk/src/target/OM-2007.2/applications/openmoko-browser2/src/browser-data.h 2007-09-18 01:40:46 UTC (rev 2995)
@@ -68,6 +68,15 @@
GtkToolItem* currentStop;
GtkToolItem* currentAdd;
GtkToolItem* currentClose;
+
+ /*
+ * Go-Page
+ */
+ GtkWidget* goBox;
+ GtkEntry* goUrlEntry;
+ GtkEntry* goSearchEntry;
+ GtkWidget* goButton;
+ GtkWidget* goButtonNewPage;
};
#endif
Added: trunk/src/target/OM-2007.2/applications/openmoko-browser2/src/go-page.c
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-browser2/src/go-page.c 2007-09-18 01:40:45 UTC (rev 2994)
+++ trunk/src/target/OM-2007.2/applications/openmoko-browser2/src/go-page.c 2007-09-18 01:40:46 UTC (rev 2995)
@@ -0,0 +1,128 @@
+/*
+ * A simple WebBrowser
+ *
+ * Copyright (C) 2007 Holger Hans Peter Freyther
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Current Version: $Rev$ ($Date$) [$Author$]
+ */
+
+#include "config.h"
+#include "go-page.h"
+
+#include <glib/gi18n.h>
+#include <strings.h>
+
+enum {
+ UrlEntry,
+ SearchEntry,
+ GoUrl,
+ GoSearch,
+ GoNewPageUrl,
+ GoNewPageSearch
+};
+
+static const char* search_names[] = {
+ N_("Url"),
+ N_("Search"),
+ N_("Open Url"),
+ N_("Search"),
+ N_("Open Url in a new page"),
+ N_("Search in a new page")
+};
+
+static gboolean entry_focus_in(GtkEntry* entry, GdkEventFocus* even, gchar* field_name)
+{
+ if (!strcmp (gtk_entry_get_text (entry), field_name)) {
+ gtk_entry_set_text (GTK_ENTRY (entry), "");
+ gtk_widget_modify_text (GTK_WIDGET (entry), GTK_STATE_NORMAL, NULL);
+ }
+
+ return FALSE;
+}
+
+static gboolean entry_focus_out(GtkEntry* entry, GdkEventFocus* event, gchar* field_name)
+{
+ if (gtk_entry_get_has_frame (entry) && strlen (gtk_entry_get_text (entry)) == 0) {
+ gtk_entry_set_text (entry, field_name);
+ gtk_widget_modify_text (GTK_WIDGET (entry), GTK_STATE_NORMAL, >K_WIDGET(entry)->style->text[GTK_STATE_INSENSITIVE]);
+ }
+
+ return FALSE;
+}
+
+static void search_url_entry_changed(GtkEntry* entry, GtkWidget* complementary_entry)
+{
+ const gchar* text = gtk_entry_get_text (entry);
+ gtk_widget_set_sensitive(complementary_entry, !strcmp(text, search_names[SearchEntry]) || !strcmp(text, search_names[UrlEntry]) || strlen(text) == 0);
+}
+
+static void go_clicked(GtkButton* btn, struct BrowserData* data)
+{
+}
+
+static void create_new_page_clicked(GtkButton* btn, struct BrowserData* data)
+{
+}
+
+/*
+ * If the "Go"-Page is shown we will do the following:
+ * 1.) check if we have a open page and change the sensitivity of the "Open Bar"
+ * 2.) make sure to remove the text from the search and set the default text to the buttons
+ */
+static void switched_notebook_tab(GtkNotebook* notebook, GtkNotebookPage* page, guint page_num, struct BrowserData* data)
+{
+ if (gtk_notebook_get_nth_page (notebook, page_num) == data->goBox) {
+ gtk_entry_set_text (data->goUrlEntry, "");
+ gtk_entry_set_text (data->goSearchEntry, "");
+ entry_focus_out (data->goUrlEntry, NULL, _(search_names[UrlEntry]));
+ entry_focus_out (data->goSearchEntry, NULL, _(search_names[SearchEntry]));
+ gtk_button_set_label (GTK_BUTTON(data->goButton), _(search_names[GoUrl]));
+ gtk_button_set_label (GTK_BUTTON(data->goButtonNewPage), _(search_names[GoNewPageUrl]));
+ gtk_widget_set_sensitive(data->goButton, data->currentPage != 0);
+ }
+}
+
+void setup_go_page(GtkBox* box, struct BrowserData* data)
+{
+ data->goBox = GTK_WIDGET (box);
+ g_signal_connect (data->mainNotebook, "switch-page", G_CALLBACK(switched_notebook_tab), data);
+
+ data->goUrlEntry = GTK_ENTRY (gtk_entry_new ());
+ data->goSearchEntry = GTK_ENTRY (gtk_entry_new ());
+ gtk_box_pack_start (box, GTK_WIDGET (data->goUrlEntry), FALSE, TRUE, 0);
+ g_signal_connect(data->goUrlEntry, "changed", G_CALLBACK(search_url_entry_changed), data->goSearchEntry);
+ g_signal_connect(data->goUrlEntry, "focus-in-event", G_CALLBACK(entry_focus_in), (gpointer)search_names[UrlEntry]);
+ g_signal_connect(data->goUrlEntry, "focus-out-event", G_CALLBACK(entry_focus_out), (gpointer)search_names[UrlEntry]);
+
+ gtk_box_pack_start (box, GTK_WIDGET (data->goSearchEntry), FALSE, TRUE, 0);
+ g_signal_connect(data->goSearchEntry, "changed", G_CALLBACK(search_url_entry_changed), data->goUrlEntry);
+ g_signal_connect(data->goSearchEntry, "focus-in-event", G_CALLBACK(entry_focus_in), (gpointer)search_names[SearchEntry]);
+ g_signal_connect(data->goSearchEntry, "focus-out-event", G_CALLBACK(entry_focus_out), (gpointer)search_names[SearchEntry]);
+
+ data->goButton = gtk_button_new_with_label (search_names[GoUrl]);
+ gtk_box_pack_start (box, GTK_WIDGET (data->goButton), FALSE, TRUE, 0);
+ g_signal_connect(data->goButton, "clicked", G_CALLBACK(go_clicked), data);
+
+ data->goButtonNewPage = gtk_button_new_with_label (search_names[GoNewPageUrl]);
+ gtk_box_pack_start (box, GTK_WIDGET (data->goButtonNewPage), FALSE, TRUE, 0);
+ g_signal_connect(data->goButtonNewPage, "clicked", G_CALLBACK(create_new_page_clicked), data);
+
+}
Added: trunk/src/target/OM-2007.2/applications/openmoko-browser2/src/go-page.h
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-browser2/src/go-page.h 2007-09-18 01:40:45 UTC (rev 2994)
+++ trunk/src/target/OM-2007.2/applications/openmoko-browser2/src/go-page.h 2007-09-18 01:40:46 UTC (rev 2995)
@@ -0,0 +1,35 @@
+/*
+ * A simple WebBrowser
+ *
+ * Copyright (C) 2007 Holger Hans Peter Freyther
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Current Version: $Rev$ ($Date$) [$Author$]
+ */
+
+#ifndef OPENMOKO_BROWSER_GO_PAGE_H
+#define OPENMOKO_BROWSER_GO_PAGE_H
+
+#include "browser-data.h"
+
+void setup_go_page(GtkBox* box, struct BrowserData* data);
+
+
+#endif
Modified: trunk/src/target/OM-2007.2/applications/openmoko-browser2/src/main.c
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-browser2/src/main.c 2007-09-18 01:40:45 UTC (rev 2994)
+++ trunk/src/target/OM-2007.2/applications/openmoko-browser2/src/main.c 2007-09-18 01:40:46 UTC (rev 2995)
@@ -25,7 +25,9 @@
*/
#include "config.h"
+
#include "current-page.h"
+#include "go-page.h"
#include <gtk/gtk.h>
#include <glib/gi18n.h>
@@ -86,9 +88,14 @@
GtkWidget* box = gtk_vbox_new (FALSE, 0);
gtk_notebook_append_page (GTK_NOTEBOOK (data->mainNotebook), box, gtk_image_new_from_stock (GTK_STOCK_NETWORK, GTK_ICON_SIZE_LARGE_TOOLBAR));
gtk_container_child_set (GTK_CONTAINER (data->mainNotebook), box, "tab-expand", TRUE, "tab-fill", TRUE, NULL);
- setup_current_page(GTK_BOX (box), data);
+ setup_current_page (GTK_BOX (box), data);
+ box = gtk_vbox_new (FALSE, 0);
+ gtk_notebook_append_page (GTK_NOTEBOOK (data->mainNotebook), box, gtk_image_new_from_icon_name("browser-go", GTK_ICON_SIZE_LARGE_TOOLBAR));
+ gtk_container_child_set (GTK_CONTAINER (data->mainNotebook), box, "tab-expand", TRUE, "tab-fill", TRUE, NULL);
+ setup_go_page (GTK_BOX(box), data);
+
gtk_widget_show_all (GTK_WIDGET (data->mainWindow));
}
More information about the commitlog
mailing list