/* Append a row and fill in some data */
while (tmp != NULL)
{
- tmp2 = g_utf8_normalize(tmp, strlen(tmp), G_NORMALIZE_ALL);
+ //tmp2 = g_utf8_normalize(tmp, strlen(tmp), G_NORMALIZE_ALL);
gtk_list_store_append (ws_gui_app->ws_gui_w_list->ws_gui_store, &ws_gui_app->ws_gui_w_list->ws_gui_iter);
gtk_list_store_set (ws_gui_app->ws_gui_w_list->ws_gui_store, &ws_gui_app->ws_gui_w_list->ws_gui_iter, COL_WORD, tmp, -1);
i=i+1;
if (tmp != NULL)
{
ws_dbus_client_find_translation(ws_gui_app->dbus_data, tmp);
+ ws_gui_history_add(tmp, ws_gui_app);
}
return GTK_TREE_MODEL(ws_gui_app->ws_gui_w_list->ws_gui_store);
}
+void ws_gui_url_requested (GtkHTML *html, const char *url, GtkHTMLStream *stream)
+{
+ int fd;
+
+ if (url && !strncmp (url, "file:", 5)) {
+ url += 5;
+ fd = open (url, O_RDONLY);
+
+ if (fd != -1) {
+ gchar *buf;
+ size_t size;
+
+ buf = alloca (8192);
+ while ((size = read (fd, buf, 8192)) > 0) {
+ gtk_html_stream_write (stream, buf, size);
+ }
+ gtk_html_stream_close (stream,
+ size == -1
+ ? GTK_HTML_STREAM_ERROR
+ : GTK_HTML_STREAM_OK);
+ close (fd);
+
+ return;
+ }
+ }
+
+ gtk_html_stream_close (stream, GTK_HTML_STREAM_ERROR);
+}
+
{
WSGuiApp* ws_gui_app=(WSGuiApp*)user_data;
- ws_gui_app->ws_gui_w_list->ws_gui_list_item_data_string = "<font size=+2><center>Welcome to<br><b>WhiteStork</b><br>Dictionary.</font></center>";
+ ws_gui_app->ws_gui_w_list->ws_gui_list_item_data_string = "<font size=+2><center><br>Welcome to<br><b>WhiteStork</b><br>Dictionary.</font><br><IMG SRC=file:stork.png></center>";
GArray *array_tmp = g_array_new (TRUE, TRUE, sizeof(gchar*));
gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(ws_gui_app->ws_gui_scrolledwindow_left), ws_gui_app->ws_gui_w_list->ws_gui_view);
- ws_gui_app->ws_gui_html = gtk_html_new_from_string(ws_gui_app->ws_gui_w_list->ws_gui_list_item_data_string, strlen(ws_gui_app->ws_gui_w_list->ws_gui_list_item_data_string));
+ ws_gui_app->ws_gui_html = gtk_html_new();
+ //ws_gui_app->ws_gui_html = gtk_html_new_from_string(ws_gui_app->ws_gui_w_list->ws_gui_list_item_data_string, strlen(ws_gui_app->ws_gui_w_list->ws_gui_list_item_data_string));
+
+ g_signal_connect(GTK_OBJECT (ws_gui_app->ws_gui_html), "url_requested", G_CALLBACK(ws_gui_url_requested), ws_gui_app);
+
+ gtk_html_load_from_string(GTK_HTML(ws_gui_app->ws_gui_html), ws_gui_app->ws_gui_w_list->ws_gui_list_item_data_string, -1);
gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(ws_gui_app->ws_gui_scrolledwindow_right), ws_gui_app->ws_gui_html);
gtk_paned_add1(GTK_PANED(ws_gui_app->ws_gui_hpane), ws_gui_app->ws_gui_scrolledwindow_left);