aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorBertrand Guiheneuf <bertrand@src.gnome.org>2000-03-04 13:15:28 +0800
committerBertrand Guiheneuf <bertrand@src.gnome.org>2000-03-04 13:15:28 +0800
commit7fc7a2644f6b6391ff478b253b05ab986fbd0965 (patch)
tree89eb2f258fbb0a20ccc363fc1942088872673dda /tests
parentb6788c4e5dbcd043e4ed54c9c10488f45d53bd95 (diff)
downloadgsoc2013-evolution-7fc7a2644f6b6391ff478b253b05ab986fbd0965.tar.gz
gsoc2013-evolution-7fc7a2644f6b6391ff478b253b05ab986fbd0965.tar.zst
gsoc2013-evolution-7fc7a2644f6b6391ff478b253b05ab986fbd0965.zip
laptop sync
svn path=/trunk/; revision=2038
Diffstat (limited to 'tests')
-rw-r--r--tests/ui-tests/message-browser.c93
1 files changed, 92 insertions, 1 deletions
diff --git a/tests/ui-tests/message-browser.c b/tests/ui-tests/message-browser.c
index ac5bc51a96..57b8b17448 100644
--- a/tests/ui-tests/message-browser.c
+++ b/tests/ui-tests/message-browser.c
@@ -32,7 +32,7 @@
#include <gtkhtml/gtkhtml.h>
/* corba/bonobo stuff */
-#include <bonobo/bonobo.h>
+#include <bonobo.h>
#include <libgnorba/gnorba.h>
static void
@@ -346,6 +346,17 @@ on_object_requested (GtkHTML *html, GtkHTMLEmbedded *eb, void *data)
gchar *uid;
GtkWidget *bonobo_embedable;
+ CamelStream *stream;
+ gchar tmp_buffer[4097];
+ gint nb_bytes_read;
+
+ GString *tmp_gstring = NULL;
+ BonoboStream *mem_stream;
+
+ CORBA_Environment ev;
+ BonoboObjectClient *server;
+ Bonobo_PersistStream persist;
+
uid = gtk_html_embedded_get_parameter (eb, "uid");
@@ -359,9 +370,89 @@ on_object_requested (GtkHTML *html, GtkHTMLEmbedded *eb, void *data)
gtk_widget_show (bonobo_embedable);
gtk_container_add (GTK_CONTAINER(eb), bonobo_embedable);
+
+
+ if (sscanf (uid, "camel://%p", &stream) == 1) {
+
+ server = bonobo_widget_get_server (BONOBO_WIDGET (bonobo_embedable));
+
+ /* if the component supports persistant streams,
+ * then we are going to create a mem stream */
+ if (bonobo_object_client_has_interface (server,
+ "IDL:Bonobo/PersistStream:1.0",
+ NULL)) {
+
+ tmp_gstring = g_string_new ("");
+
+ do {
+
+ /* read next chunk of text */
+ nb_bytes_read = camel_stream_read (stream,
+ tmp_buffer,
+ 4096);
+ tmp_buffer [nb_bytes_read] = '\0';
+
+ /* If there's any text, append it to the gstring */
+ if (nb_bytes_read > 0) {
+ tmp_gstring = g_string_append (tmp_gstring, tmp_buffer);
+ }
+
+
+ } while (!camel_stream_eos (stream));
+
+ if (tmp_gstring->len) {
+ mem_stream = bonobo_stream_mem_create (tmp_gstring->str,tmp_gstring->len , TRUE);
+
+ persist = bonobo_object_client_query_interface (server,
+ "IDL:Bonobo/PersistStream:1.0",
+ NULL);
+
+ /*
+ * If the component doesn't support PersistStream (and it
+ * really ought to -- we query it to see if it supports
+ * PersistStream before we even give the user the option of
+ * loading data into it with PersistStream), then we destroy
+ * the stream we created and bail.
+ */
+ if (persist == CORBA_OBJECT_NIL) {
+ gnome_warning_dialog (_("The component now claims that it "
+ "doesn't support PersistStream!"));
+ bonobo_object_unref (BONOBO_OBJECT (mem_stream));
+ return;
+ }
+
+ CORBA_exception_init (&ev);
+
+ /*
+ * Load the file into the component using PersistStream.
+ */
+ Bonobo_PersistStream_load (persist,
+ (Bonobo_Stream) bonobo_object_corba_objref (BONOBO_OBJECT (mem_stream)),
+ &ev);
+
+ if (ev._major != CORBA_NO_EXCEPTION) {
+ gnome_warning_dialog (_("An exception occured while trying "
+ "to load data into the component with "
+ "PersistStream"));
+ }
+
+ /*
+ * Now we destroy the PersistStream object.
+ */
+ Bonobo_Unknown_unref (persist, &ev);
+ CORBA_Object_release (persist, &ev);
+
+ CORBA_exception_free (&ev);
+
+ }
+ }
+ }
+
}
+
+
static GtkWidget*
get_gtk_html_contents_window (CamelDataWrapper* data)
{
ions'>-1/+1 * fix pthread detectionijliao2003-03-271-1/+1 * upgrade to 0.9.6ijliao2003-03-271-1/+1 * Update to 0.9.5.sobomax2003-02-281-1/+1 * De-pkg-comment.knu2003-02-211-0/+1 * Update to 0.9.2.sobomax2003-01-021-2/+3 * o Rollback PORTCOMMENT modifications while this feature's implementationlioux2002-11-111-2/+0 * Use PORTCOMMENT in the Makefile, and whack the pkg-comment.adamw2002-11-071-0/+2 * Improve libtool handling of library names.naddy2002-10-261-2/+3 * CC, CXX, CFLAGS, PTHREAD_CFLAGS and PTHREAD_LIBS may contain `/' inknu2002-10-101-1/+1 * upgrade to 0.8.9ijliao2002-09-071-1/+1 * upgrade to 0.8.8ijliao2002-07-071-1/+2 * Add USE_REINPLACE where appropriate.sobomax2002-06-191-0/+1