aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/ui-tests/message-browser.c121
1 files changed, 90 insertions, 31 deletions
diff --git a/tests/ui-tests/message-browser.c b/tests/ui-tests/message-browser.c
index 1ae4395f7e..d6a675a717 100644
--- a/tests/ui-tests/message-browser.c
+++ b/tests/ui-tests/message-browser.c
@@ -25,6 +25,7 @@
#include <camel/camel-stream-fs.h>
#include <camel/gmime-utils.h>
#include "../../mail/html-stream.h"
+#include <camel/camel-formatter.h>
/* gtkhtml stuff */
#include <gtkhtml/gtkhtml.h>
@@ -55,7 +56,6 @@ handle_tree_item (CamelDataWrapper* object, GtkWidget* tree_ctrl)
GtkWidget* subtree = NULL;
-
tree_item = gtk_tree_item_new_with_label (label);
gtk_tree_append (GTK_TREE (tree_ctrl), tree_item);
@@ -106,6 +106,7 @@ handle_tree_item (CamelDataWrapper* object, GtkWidget* tree_ctrl)
GTK_WIDGET (subtree));
}
}
+ gtk_tree_item_expand (GTK_TREE_ITEM (tree_item));
}
}
@@ -160,14 +161,93 @@ filename_to_camel_msg (gchar* filename)
}
/*----------------------------------------------------------------------*
+ * Filling out the HTML view of a mime message
+ *----------------------------------------------------------------------*/
+
+static void
+mime_message_to_html (CamelMimeMessage *msg, gchar** header_string,
+ gchar** body_string)
+{
+ CamelFormatter* cmf = camel_formatter_new();
+ CamelStream* header_stream =
+ camel_stream_mem_new (CAMEL_STREAM_FS_WRITE);
+ CamelStream* body_stream =
+ camel_stream_mem_new (CAMEL_STREAM_FS_WRITE);
+
+ g_assert (header_string && body_string);
+
+ camel_formatter_mime_message_to_html (
+ cmf, msg, header_stream, body_stream);
+
+ *header_string = g_strndup (
+ CAMEL_STREAM_MEM (header_stream)->buffer->data,
+ CAMEL_STREAM_MEM (header_stream)->buffer->len);
+ *body_string = g_strndup (
+ CAMEL_STREAM_MEM (body_stream)->buffer->data,
+ CAMEL_STREAM_MEM (body_stream)->buffer->len);
+}
+
+static GtkWidget*
+get_gtk_html_window (gchar* filename)
+{
+ static GtkWidget* scroll_wnd = NULL;
+ static GtkWidget* html_widget = NULL;
+ CamelMimeMessage* mime_message;
+ HTMLStream* html_stream;
+ gchar *body_string;
+ gchar *header_string;
+
+ g_assert (filename);
+ g_print ("filename: %s\n", filename);
+
+ /* create the html widget and scroll window, if they haven't
+ already been created */
+ if (!html_widget) {
+ html_widget = gtk_html_new();
+ scroll_wnd = gtk_scrolled_window_new (NULL, NULL);
+ gtk_container_add (GTK_CONTAINER (scroll_wnd), html_widget);
+ }
+
+ html_stream = HTML_STREAM (html_stream_new (GTK_HTML (html_widget)));
+ mime_message = filename_to_camel_msg (filename);
+
+ g_assert (html_stream && mime_message);
+
+ /* turn the mime message into html, and
+ write it to the html stream */
+ mime_message_to_html (mime_message, &header_string, &body_string);
+ g_print ("strlen: %d\n%s\n", strlen (body_string), body_string);
+
+ camel_stream_write (CAMEL_STREAM (html_stream),
+ body_string,
+ strlen (body_string));
+
+ camel_stream_close (CAMEL_STREAM (html_stream));
+
+ g_free (header_string);
+ g_free (body_string);
+
+ gtk_widget_set_usize (scroll_wnd, 500, 400);
+ return scroll_wnd;
+}
+
+
+
+/*----------------------------------------------------------------------*
* Menu callbacks and information
*----------------------------------------------------------------------*/
+static gchar* fileselection_prev_file = NULL;
+
static void
open_ok (GtkWidget *widget, GtkFileSelection *fs)
{
int ret;
GtkWidget *error_dialog;
+
+ if (fileselection_prev_file)
+ g_free (fileselection_prev_file);
+
if(!g_file_exists (gtk_file_selection_get_filename (fs))) {
error_dialog = gnome_message_box_new (
_("File not found"),
@@ -183,8 +263,14 @@ open_ok (GtkWidget *widget, GtkFileSelection *fs)
else {
gchar *filename = gtk_file_selection_get_filename (fs);
CamelMimeMessage* message = filename_to_camel_msg (filename);
+
+ fileselection_prev_file = g_strdup (filename);
+
if (message)
+ {
get_message_tree_ctrl (message);
+ get_gtk_html_window (filename);
+ }
gtk_widget_destroy (GTK_WIDGET (fs));
}
@@ -195,9 +281,11 @@ static void
file_menu_open_cb (GtkWidget *widget, void* data)
{
GtkFileSelection *fs;
-
+
fs = GTK_FILE_SELECTION (
gtk_file_selection_new (_("Open Mime Message")));
+
+ gtk_file_selection_set_filename (fs, fileselection_prev_file);
gtk_signal_connect (GTK_OBJECT (fs->ok_button), "clicked",
(GtkSignalFunc) open_ok,
@@ -231,35 +319,6 @@ static GnomeUIInfo main_menu[] = {
};
-/*----------------------------------------------------------------------*
- * Filling out the HTML view of a mime message
- *----------------------------------------------------------------------*/
-
-static GtkWidget*
-get_gtk_html_window (gchar* filename)
-{
- static GtkWidget* scroll_wnd = NULL;
- static GtkWidget* html_widget = NULL;
- HTMLStream* html_stream;
-
- g_assert (filename);
-
- if (!html_widget) {
- html_widget = gtk_html_new();
- scroll_wnd = gtk_scrolled_window_new (NULL, NULL);
- gtk_container_add (GTK_CONTAINER (scroll_wnd), html_widget);
- }
-
- html_stream = html_stream_new (GTK_HTML (html_widget));
-
- camel_stream_write (CAMEL_STREAM (html_stream),
- "<html><body>hello</body></html>",
- sizeof("<html><body>hello</body></html>"));
-
- return scroll_wnd;
-}
-
-
int
main (int argc, char *argv[])
{
arved2004-10-111-1/+1 * Fix Environment for kdm/csh users.arved2004-10-111-1/+1 * Fix a typoarved2004-10-102-2/+2 * Fix bug in the default genkdmconf template - kdm would try and parselofi2004-09-243-6/+26 * The rc-script was botched, correct that and bump PORTREVISION.lofi2004-09-012-2/+3 * Update to KDE 3.3lofi2004-08-3112-443/+471 * A couple of patches didn't make it from the kde-freebsd repo into ports.lofi2004-08-136-1/+250 * Tell genkdmconf to ignore existing bits of xdm/kdm configuration, if itlofi2004-08-121-2/+1 * Factor out all but one of the build switches of the KDE main module portslofi2004-08-119-632/+757 * - Add the X_WINDOW_SYSTEM={xorg,xfree86-4,xfree86-3} variable to bsd.port.mk,anholt2004-07-241-1/+1 * Update to version 3.2.3lofi2004-06-104-15/+58 * Bump PORTREVISION.lofi2004-05-181-0/+1 * Fix a fat fingered commit I made two weeks ago:lofi2004-05-181-1/+1 * Put the pkg-message template back into PKGDIR.lofi2004-05-032-1/+1 * Process the pkg-message template earlier than post-install solofi2004-05-022-3/+7 * Update to KDE 3.2.2lofi2004-04-206-27/+27 * Respect WITHOUT_FOO.lofi2004-03-281-18/+1 * Enhance pkg-descr a little.lofi2004-03-221-1/+4 * Add the default path of of the linux-flashplugin to the list of pathslofi2004-03-181-0/+10 * Update to KDE 3.2.1 / QT 3.3.1lofi2004-03-106-63/+84 * Bump PORTREVISION.lofi2004-02-111-0/+1 * USE_MOTIF by default now - netscape plugins compat is en vogue againlofi2004-02-101-13/+6 * Shorten COMMENT.lofi2004-02-101-1/+1 * Update to KDE 3.2.0lofi2004-02-0512-523/+1148 * Bump PORTREVISION on all ports that depend on gettext to aid with upgrading.marcus2004-02-041-0/+1 * Add a patch to correct CPU states readout inlofi2003-12-131-0/+21 * Add a patch that should fix the "A window and A desktop icon sometimes havearved2003-11-201-0/+12 * Fix the -pthread problem in case the option gets removed again. Thiswill2003-10-041-0/+2 * From KDE_3_1_BRANCH:arved2003-09-291-0/+18 * Upgrade to Qt 3.2.1 / KDE 3.1.4. See x11/kde3/Makefile rev 1.64 for details.will2003-09-188-419/+2 * Multiple bugfixes and enhancements for kdebase.lofi2003-08-2910-9/+458 * Fix non-default dependency on openldap2[012] which is broken by splitting.kuriyama2003-08-151-1/+1 * Update KDE to the latest official release, KDE 3.1.3lofi2003-07-296-41/+14 * - Conditional ldap supportarved2003-06-032-5/+11 * Update to KDE 3.1.2lioux2003-05-203-3/+5 * Fix fetching.will2003-04-121-1/+1 * Upgrade to 3.1.1a to handle PS/PDF security advisory. There are additionalwill2003-04-112-2/+2 * Rejoice, for the long awaited upgrade to kde 3.1.1 is here!alane2003-04-068-70/+22 * Clear moonlight beckons.ade2003-03-072-1/+1 * Fix Build on CURRENT.arved2003-03-031-0/+24 * Add patch to fix ksysguard on -CURRENT. Will be committed to KDE.will2003-02-101-0/+15 * Re-enable Xinerama support and remove Java support by default. The formerwill2003-02-091-6/+6 * kdebase uses libfontconfig if it finds it. add dependency.alane2003-02-031-0/+8 * bump PORTREVISION for previous mod about 12 hours agoalane2003-01-301-1/+1 * Install desktop template masters with right perms (write perms, too).alane2003-01-301-0/+2 * update to 3.1 official releasealane2003-01-2913-1091/+1663 * Fetch from correct MASTER_SITE_SUBDIRlioux2002-11-171-1/+1 * Update these ports to 3.0.5 per KDE security advisory. Fix missing depsalane2002-11-168-116/+10 * removed redundant PACKAGE_BUILDING testalane2002-10-191-4/+0 * Bump PORTREVISION to force the last change out, as bugs were severe accordingalane2002-10-191-1/+1 * Undefault keramik due to bugs.alane2002-10-191-4/+0 * If defined(PACKAGE_BUILDING) then do not build with keramik/kwin backport.alane2002-10-131-0/+4 * Move <sys/types.h> higher up in the include list to fix build on current.alane2002-10-121-0/+18 * add warning about backported keramikalane2002-10-111-0/+7 * 1. Removed comments from pkg-plist files per will's request.alane2002-10-111-98/+0 * 1. Remove QT warning from kde3. It's been there long enough.alane2002-10-116-12/+120 * mi's patch to use gettext as BUILD_DEPEND. If there's a PR I don't havealane2002-09-211-1/+1 * Update to 3.0.3. Not much changed here: [1] i18n PKGNAMEs converted towill2002-08-253-41/+8 * Bump PORTREVISION. KDE is fragile enough in its dependencies; we don'talane2002-08-021-1/+1 * Chase shlib rev of devel/gettextade2002-08-021-1/+1 * Fixed obnoxious bug where a new ~/Desktop dir would be created with read-onlyalane2002-07-182-0/+23 * Update to 3.0.2 -- full log available in ports/x11/kde3/Makefile,v 1.51.will2002-07-053-4/+39 * Patch out the 'sshd' user from being shown (add to HiddenUsers).alane2002-06-291-1/+1 * Add smmsp (mail submitter) to list of hidden users in kdm.conf.alane2002-06-291-2/+11 * Fixed bad patch. Missed it when we moved to the rerolled tarball apparently.alane2002-06-271-5/+5 * Upgrade to KDE 3.0.1. The delay in this upgrade is mainly due to thewill2002-06-1615-516/+402 * Fix build on alpha.will2002-05-203-0/+53 * Fix missing %%MOTIF%% substitutions.petef2002-05-091-8/+8 * Update to 3.0. Sigh.will2002-04-231-0/+2527 * Oops, fix miscommit of patch.will2002-04-221-11/+11 * Fix kdm config file upon install.will2002-04-221-0/+11 * Please welcome Qt3/KDE3 to our ports tree. This includes work since thewill2002-04-2230-4244/+530 * gettext upgrade uber-patch (stage 3)ade2002-04-131-2/+2 * Fix the KDE ports to not use objprelink, if OSVERSION >= 500029. This iswill2002-03-301-2/+6 * Stage 1 of gettext update.ade2002-03-161-1/+1 * Make the "default" target failback on KDE if the user doesn't have apetef2002-03-032-3/+13 * Use ${ECHO_CMD} instead of ${ECHO} where you mean the echo command;knu2002-01-291-2/+2 * Bring in a few changes to the KDE ports infrastructure, and some fixes.will2002-01-111-15/+2 * If !WANT_KDE_NDEBUG and !PARALLEL_PACKAGE_BUILDING, also addwill2002-01-081-0/+3 * Fix problem where KDM doesn't cause the login records to be updated whenwill2002-01-062-6/+10 * Conditionalize use of objprelink based on whether we're running onwill2002-01-051-3/+8 * If not building WITH_MOTIF (required for Netscape plugins), don't try to loadpetef2001-12-251-0/+6 * - better kdmrc config file handling:petef2001-12-145-16/+45 * Fix a problem with auto{conf,make}: some build magic was introduced topetef2001-12-071-1/+1 * Upgrade KDE to 2.2.2:will2001-12-0417-32/+1423 * Remove stale files from share/config/kdm.olgeni2001-11-031-7/+1 * Bite the bullet and make kcheckpass setuid root by default so the lockwill2001-11-012-22/+2 * Upgrade to 2.2.1.demon2001-10-274-9/+175 * Fix pkg-plistkevlo2001-10-201-0/+3 * Set DIST_SUBDIR=KDEdemon2001-09-112-1/+2 * Add a message to the port/package warning users about kcheckpass'swill2001-09-042-1/+25 * Remove bogus file that I introduced in revision 1.40 (pointy hat).olgeni2001-09-021-1/+0 * Support the Motif-dependent files in pkg-plist, add some missing @dirrmolgeni2001-08-312-5/+49 * Make CATEGORIES and MAINTAINER overridable for japanese/kde*.knu2001-08-311-2/+2 * Reassign MAINTAINER to kde@FreeBSD.org, a group formed specifically towill2001-08-251-1/+1 * Argh! Get this plist right, for the last time...will2001-08-231-1/+0 * Remove the extra Worm.desktop screensaver entry. Leave only the screensaverolgeni2001-08-211-1/+0 * Add @exec/@unexec lines to pkg-plist, to handle the "emptydir" template.olgeni2001-08-201-0/+3 * Add a simple post-extract target: it overwrites ${WRKSRC}/mkpamserv with aolgeni2001-08-191-0/+4 * Disable kappfinder_install execution at install time. This will avoid theolgeni2001-08-192-28/+1 * Add forgotten emptydir which is required to create new directorieswill2001-08-182-0/+2 * *sigh* They changed the path to the tarballs again. This was verifiedwill2001-08-161-1/+1 * Update to KDE 2.2:will2001-08-156-1016/+753 * Remove three files:asami2001-08-121-3/+0 * Overhaul QT/KDE support:will2001-04-032-13/+4 * Thought I removed these PTHREAD_* things from the Makefile. FWIW, thewill2001-03-271-2/+2 * Bring in my fixes for KDE2 for users of XFree86 4.0.x. Basically, whatwill2001-03-251-34/+5 * Bring in my KDE 2.1 + X 4.0.2 + threads "fixes". WARNING: Doesn't quitewill2001-03-131-4/+34 * Fix plist. Kevin!!!! ;-)will2001-03-111-79/+0 * Disable OpenLDAP support by defaultkevlo2001-03-081-0/+1 * Fix pkg-plistkevlo2001-03-081-17/+89 * Fix build problem with kio_ldap where it was including <time.h> insteadwill2001-03-052-0/+109 * Attempt to fix conflicts with a local getopt.h (specifically, the fix iswill2001-03-051-1/+1 * Lo and behold, welcome KDE 2.1 to our ports tree. As a direct result ofwill2001-02-277-487/+718 * Style fixes for ports/x11.olgeni2001-02-061-1/+1 * Update to allow ksysguard to compile from KDE 2.0 using -CURRENTcokane2001-01-281-0/+80 * Upgrade to 2.0.1kevlo2000-12-125-17/+227 * Fix eject device.kevlo2000-12-011-0/+12 * Resign as maintainer of KDE2 ports, having brought them up from inceptionwill2000-11-181-1/+1 * Add patch to fix konsole crashes. Has been submitted to the KDE team.will2000-11-031-0/+11 * Remove 8 files that aren't build on everyone's systems.asami2000-11-021-8/+0 * Oops, forgot to remove -lqt2 along with -L${X11BASE}/lib, to allow peoplewill2000-10-291-1/+1 * Implement fix for configure scripts in regards to finding X libs onwill2000-10-291-2/+2 * Fix KDE2 PLISTs and build for kdelibs.will2000-10-291-0/+14 * Update to QT 2.2.1 / KDE 2.0 final release. At last! What a long road...will2000-10-253-175/+292 * Fix PLIST bogons.will2000-09-231-5/+0 * Update to KDE 1.94, the fifth and final beta release of KDE 2.0. If youwill2000-09-163-180/+171 * Update to 20000829A snapshot. Disable kdenetwork2 for the time being sowill2000-08-303-319/+304 * (1) Add new variable, XFREE86_VERSION, to specify which version ofasami2000-08-031-1/+1 * Update to 20000724A (custom-rolled snapshot). Rejoice, because nowwill2000-07-293-457/+746 * Mark these BROKEN, they don't compile/run properly.asami2000-07-201-0/+2 * Rename INSTALLS_SHLIBS to INSTALLS_SHLIB. (There was a typo in theasami2000-06-171-1/+1 * Fourth round of INSTALLS_SHLIBS conversion.sobomax2000-06-162-2/+1 * Mark FORBIDDEN due to local buffer overflow in kdesud yieldingkris2000-06-051-0/+2 * Fix for RELENG_3 systems. Also remove unnecessary USE_XLIB (because it'swill2000-05-241-2/+0 * Update to KDEBASE 1.90 (aka KDE2 beta).will2000-05-173-2404/+1748 * Update to use PORTNAME/PORTVERSIONcpiazza2000-04-141-2/+2 * Doing KDE style mtree in kdelibs.imura2000-03-261-23/+0 * Bump shlib versions of kdelibs11 and kdesupport11.asami2000-02-241-2/+2 * Remove giflib dependence.imura2000-02-151-2/+1 * Oops... my last change about kdm had no effect at all.imura2000-01-15