From c71ec9dab0ae22e0985ea12f4e1aeb0cc5811733 Mon Sep 17 00:00:00 2001 From: bertrand Date: Fri, 3 Mar 2000 19:43:49 +0000 Subject: initialize gdkrgb. Push visual/colormap. (on_url_requested): in the case 2000-03-03 bertrand * 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. Message browser shows inline images. Woohoo ! svn path=/trunk/; revision=2022 --- tests/ui-tests/message-browser.c | 46 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) (limited to 'tests') 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 . @@ -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); -- cgit