diff options
-rw-r--r-- | ChangeLog | 10 | ||||
-rw-r--r-- | tests/ui-tests/message-browser.c | 46 |
2 files changed, 56 insertions, 0 deletions
@@ -1,3 +1,13 @@ +2000-03-03 bertrand <bertrand@helixcode.com> + + * tests/ui-tests/message-browser.c (main): initialize + gdkrgb. Push visual/colormap. + (on_url_requested): in the case where a camel url is requested, + write the camel stream to gtkhtml. + + * tests/ui-tests/Makefile.am (filter_LDADD): add + gnomeprint in the lib list. + 2000-03-01 Ettore Perazzoli <ettore@helixcode.com> * shell/Makefile.am (INCLUDES): use `top_srcdir' instead of diff --git a/tests/ui-tests/message-browser.c b/tests/ui-tests/message-browser.c index fbd0550571..71fd1324da 100644 --- a/tests/ui-tests/message-browser.c +++ b/tests/ui-tests/message-browser.c @@ -1,3 +1,4 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ /*--------------------------------*-C-*---------------------------------* * * Copyright 2000, Matt Loper <matt@helixcode.com>. @@ -301,6 +302,40 @@ on_link_clicked (GtkHTML *html, const gchar *url, gpointer data) } +static void +on_url_requested (GtkHTML *html, const gchar *url, GtkHTMLStreamHandle handle, gpointer data) +{ + CamelStream *stream; + gchar tmp_buffer[4096]; + gint nb_bytes_read; + + printf ("url _%s_ (%p) requested\n", url, url); + + if (sscanf (url, "camel://%p", &stream) == 1) + { + + do { + + /* read next chunk of text */ + nb_bytes_read = camel_stream_read (stream, + tmp_buffer, + 4096); + + /* If there's any text, write it to the stream */ + if (nb_bytes_read > 0) { + gtk_html_write (html, handle, tmp_buffer, nb_bytes_read); + } + + + } while (!camel_stream_eos (stream)); + + + } + +} + + + static GtkWidget* get_gtk_html_contents_window (CamelDataWrapper* data) { @@ -320,6 +355,11 @@ get_gtk_html_contents_window (CamelDataWrapper* data) GTK_SIGNAL_FUNC (on_link_clicked), NULL); + gtk_signal_connect (GTK_OBJECT (html_widget), + "url_requested", + GTK_SIGNAL_FUNC (on_url_requested), + NULL); + scroll_wnd = gtk_scrolled_window_new (NULL, NULL); gtk_container_add (GTK_CONTAINER (scroll_wnd), html_widget); } @@ -554,6 +594,12 @@ main (int argc, char *argv[]) /* initialization */ gnome_init ("MessageBrowser", "1.0", argc, argv); + + gdk_rgb_init (); + + gtk_widget_set_default_colormap (gdk_rgb_get_cmap ()); + gtk_widget_set_default_visual (gdk_rgb_get_visual ()); + app = gnome_app_new ("Message Browser Test", NULL); gnome_app_create_menus (GNOME_APP (app), main_menu); |