diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/.cvsignore | 11 | ||||
-rw-r--r-- | tests/Makefile.am | 26 | ||||
-rw-r--r-- | tests/test1.c | 119 | ||||
-rw-r--r-- | tests/test2.c | 46 | ||||
-rw-r--r-- | tests/test3.c | 29 | ||||
-rw-r--r-- | tests/test4.c | 68 | ||||
-rw-r--r-- | tests/test5.c | 60 | ||||
-rw-r--r-- | tests/test6.c | 50 | ||||
-rw-r--r-- | tests/test7.c | 24 | ||||
-rw-r--r-- | tests/test8.c | 78 | ||||
-rw-r--r-- | tests/ui-tests/.cvsignore | 6 | ||||
-rw-r--r-- | tests/ui-tests/Makefile.am | 16 | ||||
-rw-r--r-- | tests/ui-tests/store_listing.c | 424 | ||||
-rw-r--r-- | tests/ui-tests/store_listing.glade | 489 |
14 files changed, 0 insertions, 1446 deletions
diff --git a/tests/.cvsignore b/tests/.cvsignore deleted file mode 100644 index 10cdebc6d6..0000000000 --- a/tests/.cvsignore +++ /dev/null @@ -1,11 +0,0 @@ -test1 -test2 -test3 -test4 -test5 -test6 -test7 -Makefile.in -Makefile -.deps -.libs diff --git a/tests/Makefile.am b/tests/Makefile.am deleted file mode 100644 index 85ee40b3a1..0000000000 --- a/tests/Makefile.am +++ /dev/null @@ -1,26 +0,0 @@ -# process this file with automake to create Makefile.in - -INCLUDES = -I$(top_srcdir)/intl -I$(top_srcdir) -I$(top_srcdir)/camel \ - -I$(includedir) -I$(top_srcdir)/camel/providers/MH -LDADD = \ - $(top_builddir)/camel/libcamel.la \ - $(GNOME_LIBDIR) \ - $(GNOMEUI_LIBS) $(INTLLIBS) $(PTHREAD_LIB) $(EXTRA_GNOME_LIBS) -# $(BONOBO_LIBS) - - - - -#test4_LDADD = \ -# $(top_builddir)/camel/libcamel.la \ -# $(top_builddir)/camel/providers/MH/libcamelmh.la \ -# $(GNOME_LIBDIR) \ -# $(GNOMEUI_LIBS) $(INTLLIBS) $(PTHREAD_LIB) - - -noinst_PROGRAMS = \ - test1 \ - test2 \ - test3 \ - test7 \ - test8 diff --git a/tests/test1.c b/tests/test1.c deleted file mode 100644 index 5caac29c74..0000000000 --- a/tests/test1.c +++ /dev/null @@ -1,119 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -#include <stdio.h> - -#include "camel-mime-message.h" -#include "camel-mime-body-part.h" -#include "camel-multipart.h" -#include "camel-stream.h" -#include "camel-stream-fs.h" -#include "camel-stream-data-wrapper.h" -#include "camel-log.h" -#include "camel.h" - -int -main (int argc, char**argv) -{ - CamelMimeMessage *message; - CamelMultipart *multipart; - CamelMimeBodyPart *body_part; - CamelMimeBodyPart *attachment_part; - CamelStream *attachment_stream; - - /* FILE *output_file; */ - CamelStream *stream; - - gtk_init (&argc, &argv); - camel_init (); - - if (argc < 2) { - attachment_stream = NULL; - } else { - if (argc == 2) { - attachment_stream = camel_stream_fs_new_with_name - (argv[1], CAMEL_STREAM_FS_READ); - if (attachment_stream == NULL) { - fprintf (stderr, "Cannot open `%s'\n", - argv[1]); - return 1; - } - } else { - fprintf (stderr, "Usage: %s [<attachment>]\n", - argv[0]); - return 1; - } - } - - message = camel_mime_message_new_with_session ((CamelSession *)NULL); - - camel_mime_part_set_description (CAMEL_MIME_PART (message), "a test"); - - camel_medium_add_header (CAMEL_MEDIUM (message), "X-test1", "the value of a test"); - camel_medium_add_header (CAMEL_MEDIUM (message), "X-test2", "the value of another test"); - /*camel_mime_part_add_content_language (CAMEL_MIME_PART (message), g_string_new ("es-ca"));*/ - - camel_mime_message_set_received_date (message, g_strdup ("Thu, 20 May 1999, 10:39:14 +0200")); - camel_mime_message_set_subject (message, g_strdup ("A test message")); - camel_mime_message_set_reply_to (message, g_strdup ("toto@toto.com")); - camel_mime_message_set_from (message, g_strdup ("Bertrand.Guiheneuf@aful.org")); - - camel_mime_message_add_recipient (message, CAMEL_RECIPIENT_TYPE_TO, - g_strdup ("franck.dechamps@alseve.fr")); - camel_mime_message_add_recipient (message, CAMEL_RECIPIENT_TYPE_TO, - g_strdup ("mc@alseve.fr")); - camel_mime_message_add_recipient (message, CAMEL_RECIPIENT_TYPE_TO, - g_strdup ("richard.lengagne@aful.org")); - camel_mime_message_add_recipient (message, CAMEL_RECIPIENT_TYPE_CC, - g_strdup ("Francois.fleuret@aful.org")); - camel_mime_message_add_recipient (message, CAMEL_RECIPIENT_TYPE_CC, - g_strdup ("maury@justmagic.com")); - camel_mime_message_add_recipient (message, CAMEL_RECIPIENT_TYPE_BCC, - g_strdup ("Bertrand.Guiheneuf@aful.org")); - - multipart = camel_multipart_new (); - body_part = camel_mime_body_part_new (); - camel_mime_part_set_text (CAMEL_MIME_PART (body_part), "This is a test.\nThis is only a test.\n"); - camel_multipart_add_part (multipart, body_part); - - if (attachment_stream == NULL) { - attachment_part = NULL; - } else { - CamelDataWrapper *stream_wrapper; - - stream_wrapper = camel_stream_data_wrapper_new - (attachment_stream); - - attachment_part = camel_mime_body_part_new (); - camel_mime_part_set_encoding (CAMEL_MIME_PART (attachment_part), - CAMEL_MIME_PART_ENCODING_BASE64); - camel_medium_set_content_object (CAMEL_MEDIUM (attachment_part), - stream_wrapper); - camel_multipart_add_part (multipart, attachment_part); - - gtk_object_unref (GTK_OBJECT (stream_wrapper)); - } - - camel_medium_set_content_object (CAMEL_MEDIUM (message), CAMEL_DATA_WRAPPER (multipart)); - - stream = camel_stream_fs_new_with_name ("mail1.test", CAMEL_STREAM_FS_WRITE ); - if (!stream) { - CAMEL_LOG_FULL_DEBUG ("could not open output file"); - exit(2); - } - - camel_data_wrapper_write_to_stream (CAMEL_DATA_WRAPPER (message), - stream); - camel_stream_close (stream); - gtk_object_unref (GTK_OBJECT (stream)); - - gtk_object_unref (GTK_OBJECT (message)); - gtk_object_unref (GTK_OBJECT (multipart)); - gtk_object_unref (GTK_OBJECT (body_part)); - - if (attachment_part != NULL) - gtk_object_unref (GTK_OBJECT (attachment_part)); - - printf ("Test1 finished\n"); - return 1; -} - diff --git a/tests/test2.c b/tests/test2.c deleted file mode 100644 index 20e8b739b9..0000000000 --- a/tests/test2.c +++ /dev/null @@ -1,46 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* tests mime message file parsing */ -#include "gmime-utils.h" -#include "stdio.h" -#include "camel-log.h" -#include "camel-mime-message.h" -#include "camel-mime-part.h" -#include "camel-stream.h" -#include "camel-stream-fs.h" -#include "camel.h" - -int -main (int argc, char**argv) -{ - GHashTable *header_table; - CamelMimeMessage *message; - CamelStream *input_stream, *output_stream; - - gtk_init (&argc, &argv); - camel_init (); - camel_debug_level = CAMEL_LOG_LEVEL_FULL_DEBUG; - message = camel_mime_message_new_with_session( (CamelSession *)NULL); - - - input_stream = camel_stream_fs_new_with_name ("mail.test", CAMEL_STREAM_FS_READ); - if (!input_stream) { - perror ("could not open input file"); - printf ("You must create the file mail.test before running this test"); - exit(2); - } - - camel_data_wrapper_construct_from_stream ( CAMEL_DATA_WRAPPER (message), input_stream); - camel_medium_get_content_object (CAMEL_MEDIUM (message)); - camel_stream_close (input_stream); - gtk_object_unref (GTK_OBJECT (input_stream)); - - output_stream = camel_stream_fs_new_with_name ("mail2.test", CAMEL_STREAM_FS_WRITE); - camel_data_wrapper_write_to_stream (CAMEL_DATA_WRAPPER (message), output_stream); - camel_stream_close (output_stream); - gtk_object_unref (GTK_OBJECT (output_stream)); - - gtk_object_unref (GTK_OBJECT (message)); - - return 0; - -} diff --git a/tests/test3.c b/tests/test3.c deleted file mode 100644 index 9893e2e507..0000000000 --- a/tests/test3.c +++ /dev/null @@ -1,29 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -#include "camel.h" - -int -main (int argc, char**argv) -{ - GtkType type; - - gtk_init (&argc, &argv); - camel_init (); - - printf ("Test 3 : data wrapper repository\n"); - - printf ("\nMime type : \"multipart\"\n"); - type = data_wrapper_repository_get_data_wrapper_type ("multipart"); - printf ("Type found %s\n", gtk_type_name (type) ); - - printf ("\nMime type : \"multipart/alternative\"\n"); - type = data_wrapper_repository_get_data_wrapper_type ("multipart/alternative"); - printf ("Type found %s\n", gtk_type_name (type) ); - - printf ("\nMime type : \"toto/titi\"\n"); - type = data_wrapper_repository_get_data_wrapper_type ("toto/titi"); - printf ("Type found %s\n", gtk_type_name (type) ); - - printf ("Test3 finished\n"); - return 1; -} - diff --git a/tests/test4.c b/tests/test4.c deleted file mode 100644 index 99285cec43..0000000000 --- a/tests/test4.c +++ /dev/null @@ -1,68 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -/* testing mh providers - do not use CamelMhFolder and CamelMhStore directly. - We do it here for test purpose only */ - - - -#include "camel-folder.h" -#include "camel-mh-folder.h" -#include "camel-mh-store.h" -#include "camel.h" -#include "camel-log.h" - -int -main (int argc, char**argv) -{ - CamelStore *store; - CamelFolder *inbox_folder; - CamelFolder *root_mh_folder; - GList *mh_subfolders_name; - CamelMimeMessage *message_1; - gboolean inbox_exists; - - camel_debug_level = CAMEL_LOG_LEVEL_FULL_DEBUG; - - gtk_init (&argc, &argv); - camel_init (); - - - store = gtk_type_new (CAMEL_MH_STORE_TYPE); - camel_store_init (store, (CamelSession *)NULL, g_strdup ("mh:///root/Mail")); - - root_mh_folder = camel_store_get_folder (store, ""); - mh_subfolders_name = camel_folder_list_subfolders (root_mh_folder, NULL); - - printf ("\n------------- Listing root Mh folder subfolders --------\n"); - while (mh_subfolders_name) { - printf ("\t\"%s\"\n", (gchar *)mh_subfolders_name->data); - mh_subfolders_name = mh_subfolders_name->next; - } - printf ("--------------------------------------------------------\n\n"); - - inbox_folder = camel_store_get_folder (store, "inbox"); - if (!inbox_folder) { - printf ("** Error: could not get inbox folder from store\n"); - return 1; - } - - /* test existence */ - inbox_exists = camel_folder_exists (inbox_folder, NULL); - if (inbox_exists) - printf ("MH folder inbox exists, continuing tests\n"); - else { - printf ("MH folder inbox does not exist. Stopping \n"); - return 1; - } - - printf ("\n Inbox folder contains %d messages\n", camel_folder_get_message_count (inbox_folder, NULL)); - printf ("\n------------- Gettting message numer 3 in inbox --------\n"); - message_1 = camel_folder_get_message (inbox_folder, 3, NULL); - printf ("--------------------------------------------------------\n\n"); - - - return 1; - - -} diff --git a/tests/test5.c b/tests/test5.c deleted file mode 100644 index 2f47fda418..0000000000 --- a/tests/test5.c +++ /dev/null @@ -1,60 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -/* test for the RFC 2047 decoder */ - -#include <string.h> -#include <unicode.h> - -#include "gmime-utils.h" -#include "stdio.h" -#include "camel-log.h" -#include "camel-mime-message.h" -#include "camel-mime-part.h" -#include "camel-stream.h" -#include "camel-stream-fs.h" -#include "camel.h" -#include "gmime-rfc2047.h" - -#define TERMINAL_CHARSET "UTF-8" - -/* - * Info on many unicode issues, including, utf-8 xterms from : - * - * http://www.cl.cam.ac.uk/~mgk/unicode.html - * - */ - -const char *tests[] = -{ -/* these strings come from RFC 2047. Ought to add a few torture cases here. */ - "=?US-ASCII?Q?Keith_Moore?= <moore@cs.utk.edu>", - "=?ISO-8859-1?Q?Keld_J=F8rn_Simonsen?= <keld@dkuug.dk>", - "=?ISO-8859-1?Q?Andr=E9?= Pirard <PIRARD@vm1.ulg.ac.be>", - "=?ISO-8859-1?B?SWYgeW91IGNhbiByZWFkIHRoaXMgeW8=?= =?ISO-8859-2?B?dSB1bmRlcnN0YW5kIHRoZSBleGFtcGxlLg==?=", - "=?ISO-8859-1?Q?Olle_J=E4rnefors?= <ojarnef@admin.kth.se>", - "=?ISO-8859-1?Q?Patrik_F=E4ltstr=F6m?= <paf@nada.kth.se>", - "Nathaniel Borenstein <nsb@thumper.bellcore.com> (=?iso-8859-8?b?7eXs+SDv4SDp7Oj08A==?=)", - "", - "(=?ISO-8859-1?Q?a?=)", /* should be displayed as (a) */ - "(=?ISO-8859-1?Q?a?= b)", /* (a b) */ - "(=?ISO-8859-1?Q?a?= =?ISO-8859-1?Q?b?=)", /* (ab) */ - "(=?ISO-8859-1?Q?a?= =?ISO-8859-1?Q?b?=)", /* (ab) */ - "(=?ISO-8859-1?Q?a?= \n=?ISO-8859-1?Q?b?=)", /* (ab) */ - "(=?ISO-8859-1?Q?a_b?=)", /* (a b) */ - "(=?ISO-8859-1?Q?a?= =?ISO-8859-2?Q?_b?=)", /* (ab) */ - NULL -}; - - -int -main (int argc, char**argv) -{ - const char **b = tests; - while (*b) { - printf("%s\n", gmime_rfc2047_decode(*b, TERMINAL_CHARSET)); - b++; - } - - return 0; - -} diff --git a/tests/test6.c b/tests/test6.c deleted file mode 100644 index ead8312c52..0000000000 --- a/tests/test6.c +++ /dev/null @@ -1,50 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -/* test for the RFC 2047 encoder */ - -#include <string.h> -#include <unicode.h> - -#include "gmime-utils.h" -#include "stdio.h" -#include "camel-log.h" -#include "camel-mime-message.h" -#include "camel-mime-part.h" -#include "camel-stream.h" -#include "camel-stream-fs.h" -#include "camel.h" -#include "gmime-rfc2047.h" - -#define TERMINAL_CHARSET "UTF-8" - -/* - * Info on many unicode issues, including, utf-8 xterms from : - * - * http://www.cl.cam.ac.uk/~mgk25/unicode.html - * - */ - -const char *tests[] = -{ - "is is a test", "ISO-8859-1", - "Itrtinlation", "ISO-8859-1", - "Καλημέρα κόσμε", "UTF-8", - "コンニチハ", "UTF-8", - "ði ıntəˈnæʃənəl fəˈnɛtık əsoʊsiˈeıʃn", "UTF-8", - NULL -}; - - -int -main (int argc, char**argv) -{ - const char **b = tests; - while (*b) { - char *e = gmime_rfc2047_encode(b[0], b[1]); - printf("%s\t%s\n", e, gmime_rfc2047_decode(e, TERMINAL_CHARSET)); - b+=2; - } - - return 0; - -} diff --git a/tests/test7.c b/tests/test7.c deleted file mode 100644 index 44c73d275b..0000000000 --- a/tests/test7.c +++ /dev/null @@ -1,24 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -/* test provider stuff */ - - -#include "camel.h" - - -int -main (int argc, char**argv) -{ - const CamelProvider *new_provider; - - camel_debug_level = CAMEL_LOG_LEVEL_FULL_DEBUG; - - gtk_init (&argc, &argv); - camel_init (); - - - new_provider = camel_provider_register_as_module ("../camel/providers/MH/.libs/libcamelmh.so"); - - - return 1; -} diff --git a/tests/test8.c b/tests/test8.c deleted file mode 100644 index 1f446e171d..0000000000 --- a/tests/test8.c +++ /dev/null @@ -1,78 +0,0 @@ -/* test posix thread folder proxy */ - - -#include "camel.h" -#include "camel-log.h" - -CamelThreadProxy *proxy; -CamelFuncDef *func_def; - - -void -test_sync_func (int num) -{ - printf ("Sync function number %d\n", num); - printf ("Sync function : current thread : %d\n", pthread_self ()); - -} - - -void -test_async_cb (int num) -{ - printf ("Callback number %d\n", num); - printf ("Callback : current thread : %d\n", pthread_self ()); -} - -void -test_async_func (int num) -{ - CamelOp *cb; - - printf ("Async function number %d\n", num); - printf ("Async function : current thread : %d\n", pthread_self ()); - sleep (1); - cb = camel_marshal_create_op (func_def, test_async_cb, num); - camel_thread_proxy_push_cb (proxy, cb); - - -} - -int -main (int argc, char **argv) -{ - int i; - CamelOp *op; - - camel_debug_level = CAMEL_LOG_LEVEL_WARNING; - - camel_init (); - - func_def = - camel_func_def_new (camel_marshal_NONE__INT, - 1, - GTK_TYPE_INT); - - printf ("--== Testing Simple marshalling system ==--\n"); - for (i=0; i<5; i++) { - printf ("Iterration number %d\n", i); - op = camel_marshal_create_op (func_def, test_sync_func, i); - camel_op_run (op); - camel_op_free (op); - - } - printf ("\n\n"); - - proxy = camel_thread_proxy_new (); - - printf ("--== Testing Asynchronous Operation System ==--\n"); - for (i=0; i<5; i++) { - printf ("Pushing async operation number %d for execution\n", i); - op = camel_marshal_create_op (func_def, test_async_func, i); - camel_thread_proxy_push_op (proxy, op); - } - printf ("\n\n"); - printf ("--== Operations execution planned ==--\n"); - gtk_main (); -} - diff --git a/tests/ui-tests/.cvsignore b/tests/ui-tests/.cvsignore deleted file mode 100644 index 10c9ca5909..0000000000 --- a/tests/ui-tests/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -Makefile.in -Makefile -.deps -.libs -store_listing -msg-composer-test diff --git a/tests/ui-tests/Makefile.am b/tests/ui-tests/Makefile.am deleted file mode 100644 index 7c26399bbb..0000000000 --- a/tests/ui-tests/Makefile.am +++ /dev/null @@ -1,16 +0,0 @@ -# process this file with automake to create Makefile.in - -INCLUDES = \ - -I$(top_srcdir)/intl \ - -I$(top_srcdir)/camel \ - -I$(includedir) \ - -I$(top_srcdir)/camel/providers/MH \ - -I$(top_srcdir)/widgets \ - $(EXTRA_GNOME_CFLAGS) - -LDADD = \ - $(top_builddir)/widgets/libevolutionwidgets.la \ - $(top_builddir)/camel/libcamel.la \ - $(INTLLIBS) \ - $(EXTRA_GNOME_LIBS) \ - $(PTHREAD_LIB) diff --git a/tests/ui-tests/store_listing.c b/tests/ui-tests/store_listing.c deleted file mode 100644 index fb7c2ae0f7..0000000000 --- a/tests/ui-tests/store_listing.c +++ /dev/null @@ -1,424 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* Author : Bertrand.Guiheneuf@aful.org */ - - - -/* A simple and very dirty hack written to test - (and perhaps demonstrate) Camel */ - - -#include <gnome.h> -#include <glade/glade.h> - -#include "camel-folder.h" -#include "camel-mh-folder.h" -#include "camel-mh-store.h" -#include "camel.h" -#include "camel-folder-summary.h" - -static GladeXML *xml; -static CamelSession *_session; -static CamelFolder *currently_selected_folder = NULL; - -static GList *store_list; -static GList *folder_list; - -static void add_mail_store (const gchar *store_url); -static void show_folder_messages (CamelFolder *folder); - - - -static void -_destroy_menu (gpointer data) -{ - gtk_widget_destroy (GTK_WIDGET (data)); -} - -static void -_copy_message (GtkWidget *widget, gpointer data) -{ - CamelFolder *dest_folder = CAMEL_FOLDER (data); - GtkWidget *message_clist; - gint current_row; - GList *selected; - gint selected_row; - - CamelMimeMessage *message; - - printf ("Selected \"copy to folder\" with destination folder %s\n", camel_folder_get_name (dest_folder)); - message_clist = glade_xml_get_widget (xml, "message-clist"); - selected = GTK_CLIST (message_clist)->selection; - while (selected) { - selected_row = GPOINTER_TO_INT (selected->data); - message = CAMEL_MIME_MESSAGE (gtk_clist_get_row_data (GTK_CLIST (message_clist), selected_row)); - camel_folder_copy_message_to (currently_selected_folder, message, dest_folder); - selected = selected->next; - } - -} - -static GnomeUIInfo mailbox_popup_menu[] = { - GNOMEUIINFO_ITEM_STOCK ("_Copy selected message here", NULL, _copy_message, GNOME_STOCK_MENU_NEW), - GNOMEUIINFO_END -}; - -static void -_show_mailbox_context_menu (CamelFolder *folder) { - GtkWidget *menu; - GtkCTree *mailbox_and_store_tree; - - mailbox_and_store_tree = GTK_CTREE (glade_xml_get_widget (xml, "store-and-mailbox-tree")); - menu = gtk_object_get_data (GTK_OBJECT (mailbox_and_store_tree), "mailbox_popup_menu"); - if (!menu) { - menu = gnome_popup_menu_new (mailbox_popup_menu); - gtk_object_set_data_full (GTK_OBJECT (mailbox_and_store_tree), "mailbox_popup_menu", menu, _destroy_menu); - } - - gnome_popup_menu_do_popup (menu, NULL, NULL, NULL, folder); - - -} -static gboolean -mailbox_button_clicked_on_row (gint button, gint row) -{ - GtkCTreeNode *mailbox_node; - CamelFolder *folder; - GtkCTree *mailbox_and_store_tree; - const gchar *mailbox_name; - - mailbox_and_store_tree = GTK_CTREE (glade_xml_get_widget (xml, "store-and-mailbox-tree")); - - mailbox_node = gtk_ctree_node_nth (mailbox_and_store_tree, row); - - folder = gtk_ctree_node_get_row_data (mailbox_and_store_tree, mailbox_node); - if (folder && IS_CAMEL_FOLDER (folder)) { - - mailbox_name = camel_folder_get_name (folder); - printf ("mailbox %s clicked with button %d\n", mailbox_name, button); - switch (button) { - case 1: - currently_selected_folder = folder; - show_folder_messages (folder); - break; - case 2: - break; - case 3: - _show_mailbox_context_menu (folder); - } - return TRUE; - } else { - printf ("Node is a store\n"); - return FALSE; - } -} - - -static void -message_destroy_notify (gpointer data) -{ - CamelMimeMessage *message = CAMEL_MIME_MESSAGE (data); - - gtk_object_unref (GTK_OBJECT (message)); - -} - - - - - -static void -show_folder_messages (CamelFolder *folder) -{ - GtkWidget *message_clist; - gint folder_message_count; - CamelMimeMessage *message; - gint i; - const gchar *clist_row_text[3]; - const char *sent_date, *subject, *sender; - gint current_row; - CamelFolderSummary *summary; - - message_clist = glade_xml_get_widget (xml, "message-clist"); - - /* clear old message list */ - gtk_clist_clear (GTK_CLIST (message_clist)); - - if (camel_folder_has_summary_capability (folder)) { - const GList *message_info_list; - CamelMessageInfo *msg_info; - - printf ("Folder has summary. Good\n"); - summary = camel_folder_get_summary (folder); - message_info_list = camel_folder_summary_get_message_info_list (summary); - printf ("message_info_list = %p\n", message_info_list); - while (message_info_list) { - msg_info = (CamelMessageInfo *)message_info_list->data; - clist_row_text [0] = msg_info->date; - clist_row_text [1] = msg_info->sender; - clist_row_text [2] = msg_info->subject; - - current_row = gtk_clist_append (GTK_CLIST (message_clist), clist_row_text); - - message_info_list = message_info_list->next; - } - } else { - printf ("Folder does not have summary. Opening all messages\n"); - folder_message_count = camel_folder_get_message_count (folder); - - for (i=0; i<folder_message_count; i++) { - message = camel_folder_get_message (folder, i); - gtk_object_ref (GTK_OBJECT (message)); - sent_date = camel_mime_message_get_sent_date (message); - sender = camel_mime_message_get_from (message); - subject = camel_mime_message_get_subject (message); - - - if (sent_date) clist_row_text [0] = sent_date; - else clist_row_text [0] = NULL; - if (sender) clist_row_text [1] = sender; - else clist_row_text [1] = NULL; - if (subject) clist_row_text [2] = subject; - else clist_row_text [2] = NULL; - - current_row = gtk_clist_append (GTK_CLIST (message_clist), clist_row_text); - gtk_clist_set_row_data_full (GTK_CLIST (message_clist), current_row, (gpointer)message, message_destroy_notify); - } - - } -} - - -/* add a mail store given by its URL */ -static void -add_mail_store (const gchar *store_url) -{ - - CamelStore *store; - GtkWidget *mailbox_and_store_tree; - GtkCTreeNode* new_store_node; - GtkCTreeNode* new_folder_node; - char *new_tree_text[1]; - GList *subfolder_list; - CamelFolder *root_folder; - CamelFolder *new_folder; - - - - store = camel_session_get_store (_session, store_url); - if (!store) return; - - /* remember store */ - store_list = g_list_prepend (store_list, store); - - //store_list = g_list_append (store_list, (gpointer)store); - mailbox_and_store_tree = glade_xml_get_widget (xml, "store-and-mailbox-tree"); - new_tree_text[0] = g_strdup (store_url); - new_store_node = gtk_ctree_insert_node (GTK_CTREE (mailbox_and_store_tree), - NULL, - NULL, - new_tree_text, - 0, - NULL, - NULL, - NULL, - NULL, - FALSE, - FALSE); - - /* normally, use get_root_folder */ - root_folder = camel_store_get_folder (store, ""); - camel_folder_open (root_folder, FOLDER_OPEN_RW); - subfolder_list = camel_folder_list_subfolders (root_folder); - while (subfolder_list) { - new_tree_text[0] = subfolder_list->data; - new_folder = camel_store_get_folder (store, subfolder_list->data); - camel_folder_open (new_folder, FOLDER_OPEN_RW); - folder_list = g_list_prepend (folder_list, new_folder); - - new_folder_node = gtk_ctree_insert_node (GTK_CTREE (mailbox_and_store_tree), - new_store_node, - NULL, - new_tree_text, - 0, - NULL, - NULL, - NULL, - NULL, - FALSE, - FALSE); - - - gtk_ctree_node_set_row_data (GTK_CTREE (mailbox_and_store_tree), new_folder_node, (gpointer)new_folder); - subfolder_list = subfolder_list->next; - } -} - -static void -delete_selected_messages () -{ - GtkWidget *message_clist; - gint current_row; - GList *selected; - gint selected_row; - - CamelMimeMessage *message; - message_clist = glade_xml_get_widget (xml, "message-clist"); - selected = GTK_CLIST (message_clist)->selection; - while (selected) { - selected_row = GPOINTER_TO_INT (selected->data); - message = CAMEL_MIME_MESSAGE (gtk_clist_get_row_data (GTK_CLIST (message_clist), selected_row)); - camel_mime_message_set_flag (message, "DELETED", TRUE); - selected = selected->next; - } - -} - - -static void -expunge_selected_folders () -{ - GtkWidget *mailbox_and_store_tree; - CamelFolder *folder; - GtkCTreeNode* selected_node; - GList *selected; - const gchar *folder_name; - - mailbox_and_store_tree = glade_xml_get_widget (xml, "store-and-mailbox-tree"); - - selected = GTK_CLIST (mailbox_and_store_tree)->selection; - while (selected) { - - selected_node= GTK_CTREE_NODE (selected->data); - folder = CAMEL_FOLDER (gtk_ctree_node_get_row_data (GTK_CTREE (mailbox_and_store_tree), - selected_node)); - if (folder && IS_CAMEL_FOLDER (folder)) { - folder_name = camel_folder_get_name (folder); - printf ("folder to expunge : %s\n", folder_name); - camel_folder_expunge (folder, FALSE); - /* reshowing the folder this way is uggly - but allows to check the message are - correctly renoved and the cache works correctly */ - show_folder_messages (folder); - - } else { - printf ("A selected node is a store\n"); - } - - selected = selected->next; - } - - -} - -void -close_all () -{ - while (folder_list) { - camel_folder_close (CAMEL_FOLDER (folder_list->data), TRUE); - folder_list = folder_list->next; - } - - while (store_list) { - //camel_store_close (CAMEL_STORE (store_list->data)); - store_list = store_list->next; - } - -} - -/* ----- libglade callbacks */ -void -on_exit_activate (GtkWidget *widget, void *data) -{ - close_all (); - gtk_main_quit (); -} - - -void -on_about_activate (GtkWidget *widget, void *data) -{ - GtkWidget *about_widget; - - about_widget = glade_xml_get_widget (xml, "about_widget"); - gtk_widget_show (about_widget); -} - -void -on_new_store_activate (GtkWidget *widget, void *data) -{ - GtkWidget *new_store_dialog; - GtkWidget *new_store_gnome_entry; - GtkWidget *new_store_entry; - gchar *url_text; - - - gint pressed_button; - - new_store_dialog = glade_xml_get_widget (xml, "new_store_dialog"); - pressed_button = gnome_dialog_run (GNOME_DIALOG (new_store_dialog)); - - if ((pressed_button != 0) && (pressed_button != 1)) - return; - - new_store_gnome_entry = glade_xml_get_widget (xml, "new-store-entry"); - new_store_entry = gnome_entry_gtk_entry (GNOME_ENTRY (new_store_gnome_entry)); - url_text = gtk_entry_get_text (GTK_ENTRY (new_store_entry)); - - if (url_text) - add_mail_store (url_text); - -} - - -void -on_expunge_activate (GtkWidget *widget, void *data) -{ - expunge_selected_folders (); -} - - -void -on_message_delete_activate (GtkWidget *widget, void *data) -{ - delete_selected_messages(); -} - -gboolean -on_store_and_mailbox_tree_button_press_event (GtkWidget *widget, GdkEventButton *event, void *data) -{ - gint row; - GtkCList *clist = GTK_CLIST (widget); - - if (!gtk_clist_get_selection_info (clist, event->x, event->y, &row, NULL)) - return FALSE; - if (!mailbox_button_clicked_on_row (event->button, row)) - return FALSE; - - return TRUE; - -} - -/* ----- init */ -int -main(int argc, char *argv[]) -{ - GtkWidget *new_store_gnome_entry; - - gnome_init ("store_listing", "1.0", argc, argv); - - glade_gnome_init (); - camel_init (); - xml = glade_xml_new ("store_listing.glade", NULL); - if (xml) glade_xml_signal_autoconnect (xml); - - _session = camel_session_new (); - camel_provider_register_as_module ("../../camel/providers/MH/.libs/libcamelmh.so"); - - new_store_gnome_entry = glade_xml_get_widget (xml, "new-store-entry"); - gnome_entry_load_history (GNOME_ENTRY (new_store_gnome_entry)); - gtk_main (); - gnome_entry_save_history (GNOME_ENTRY (new_store_gnome_entry)); - - return 0; -} - diff --git a/tests/ui-tests/store_listing.glade b/tests/ui-tests/store_listing.glade deleted file mode 100644 index d551c90dbb..0000000000 --- a/tests/ui-tests/store_listing.glade +++ /dev/null @@ -1,489 +0,0 @@ -<?xml version="1.0"?> -<GTK-Interface> - -<project> - <name>store_listing</name> - <program_name>store_listing</program_name> - <directory></directory> - <source_directory>src</source_directory> - <pixmaps_directory>pixmaps</pixmaps_directory> - <language>C</language> - <gnome_support>True</gnome_support> - <gettext_support>True</gettext_support> - <use_widget_names>False</use_widget_names> - <output_main_file>True</output_main_file> - <output_support_files>True</output_support_files> - <output_build_files>True</output_build_files> - <backup_source_files>True</backup_source_files> - <main_source_file>interface.c</main_source_file> - <main_header_file>interface.h</main_header_file> - <handler_source_file>callbacks.c</handler_source_file> - <handler_header_file>callbacks.h</handler_header_file> - <support_source_file>support.c</support_source_file> - <support_header_file>support.h</support_header_file> - <translatable_strings_file></translatable_strings_file> -</project> - -<widget> - <class>GnomeApp</class> - <name>app1</name> - <width>600</width> - <height>400</height> - <title>store_listing</title> - <type>GTK_WINDOW_TOPLEVEL</type> - <position>GTK_WIN_POS_NONE</position> - <modal>False</modal> - <allow_shrink>False</allow_shrink> - <allow_grow>True</allow_grow> - <auto_shrink>False</auto_shrink> - <enable_layout_config>True</enable_layout_config> - - <widget> - <class>GnomeDock</class> - <child_name>GnomeApp:dock</child_name> - <name>dock1</name> - <allow_floating>True</allow_floating> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>GnomeDockItem</class> - <name>dockitem1</name> - <border_width>2</border_width> - <placement>GNOME_DOCK_TOP</placement> - <band>0</band> - <position>0</position> - <offset>0</offset> - <locked>False</locked> - <exclusive>True</exclusive> - <never_floating>False</never_floating> - <never_vertical>True</never_vertical> - <never_horizontal>False</never_horizontal> - <shadow_type>GTK_SHADOW_OUT</shadow_type> - - <widget> - <class>GtkMenuBar</class> - <name>menubar1</name> - <shadow_type>GTK_SHADOW_NONE</shadow_type> - - <widget> - <class>GtkMenuItem</class> - <name>file1</name> - <stock_item>GNOMEUIINFO_MENU_FILE_TREE</stock_item> - - <widget> - <class>GtkMenu</class> - <name>file1_menu</name> - - <widget> - <class>GtkMenuItem</class> - <name>separator1</name> - <right_justify>False</right_justify> - </widget> - - <widget> - <class>GtkPixmapMenuItem</class> - <name>exit</name> - <signal> - <name>activate</name> - <handler>on_exit_activate</handler> - <last_modification_time>Tue, 10 Aug 1999 12:06:35 GMT</last_modification_time> - </signal> - <stock_item>GNOMEUIINFO_MENU_EXIT_ITEM</stock_item> - </widget> - </widget> - </widget> - - <widget> - <class>GtkMenuItem</class> - <name>store2</name> - <label>_Store</label> - <right_justify>False</right_justify> - - <widget> - <class>GtkMenu</class> - <name>store2_menu</name> - - <widget> - <class>GtkPixmapMenuItem</class> - <name>new_store</name> - <signal> - <name>activate</name> - <handler>on_new_store_activate</handler> - <last_modification_time>Tue, 10 Aug 1999 10:29:12 GMT</last_modification_time> - </signal> - <stock_item>GNOMEUIINFO_MENU_NEW_ITEM</stock_item> - <label>_New store</label> - </widget> - </widget> - </widget> - - <widget> - <class>GtkMenuItem</class> - <name>folder1</name> - <signal> - <name>activate</name> - <handler>on_folder1_activate</handler> - <last_modification_time>Sat, 14 Aug 1999 17:23:25 GMT</last_modification_time> - </signal> - <label>Folder</label> - <right_justify>False</right_justify> - - <widget> - <class>GtkMenu</class> - <name>folder1_menu</name> - - <widget> - <class>GtkPixmapMenuItem</class> - <name>expunge</name> - <signal> - <name>activate</name> - <handler>on_expunge_activate</handler> - <last_modification_time>Sat, 14 Aug 1999 16:36:03 GMT</last_modification_time> - </signal> - <label>_Expunge</label> - <right_justify>False</right_justify> - <stock_icon>GNOME_STOCK_MENU_CONVERT</stock_icon> - </widget> - </widget> - </widget> - - <widget> - <class>GtkMenuItem</class> - <name>message_menu</name> - <label>_Message</label> - <right_justify>False</right_justify> - - <widget> - <class>GtkMenu</class> - <name>message_menu_menu</name> - - <widget> - <class>GtkPixmapMenuItem</class> - <name>message_delete</name> - <signal> - <name>activate</name> - <handler>on_message_delete_activate</handler> - <last_modification_time>Sat, 14 Aug 1999 14:54:04 GMT</last_modification_time> - </signal> - <label>_Delete</label> - <right_justify>False</right_justify> - <stock_icon>GNOME_STOCK_MENU_TRASH</stock_icon> - </widget> - </widget> - </widget> - - <widget> - <class>GtkMenuItem</class> - <name>help1</name> - <stock_item>GNOMEUIINFO_MENU_HELP_TREE</stock_item> - - <widget> - <class>GtkMenu</class> - <name>help1_menu</name> - - <widget> - <class>GtkPixmapMenuItem</class> - <name>about</name> - <signal> - <name>activate</name> - <handler>on_about_activate</handler> - <last_modification_time>Tue, 10 Aug 1999 12:06:58 GMT</last_modification_time> - </signal> - <stock_item>GNOMEUIINFO_MENU_ABOUT_ITEM</stock_item> - </widget> - </widget> - </widget> - </widget> - </widget> - - <widget> - <class>GnomeDockItem</class> - <name>dockitem2</name> - <border_width>1</border_width> - <placement>GNOME_DOCK_TOP</placement> - <band>1</band> - <position>0</position> - <offset>0</offset> - <locked>False</locked> - <exclusive>True</exclusive> - <never_floating>False</never_floating> - <never_vertical>False</never_vertical> - <never_horizontal>False</never_horizontal> - <shadow_type>GTK_SHADOW_OUT</shadow_type> - - <widget> - <class>GtkToolbar</class> - <name>toolbar1</name> - <border_width>1</border_width> - <orientation>GTK_ORIENTATION_HORIZONTAL</orientation> - <type>GTK_TOOLBAR_BOTH</type> - <space_size>16</space_size> - <space_style>GTK_TOOLBAR_SPACE_LINE</space_style> - <relief>GTK_RELIEF_NONE</relief> - <tooltips>True</tooltips> - - <widget> - <class>GtkButton</class> - <child_name>Toolbar:button</child_name> - <name>new_store_button</name> - <signal> - <name>clicked</name> - <handler>on_new_store_activate</handler> - <last_modification_time>Tue, 10 Aug 1999 12:17:17 GMT</last_modification_time> - </signal> - <label>new store</label> - <stock_pixmap>GNOME_STOCK_PIXMAP_NEW</stock_pixmap> - </widget> - </widget> - </widget> - - <widget> - <class>GtkHPaned</class> - <child_name>GnomeDock:contents</child_name> - <name>hpaned1</name> - <handle_size>10</handle_size> - <gutter_size>6</gutter_size> - <position>0</position> - - <widget> - <class>GtkCTree</class> - <name>store-and-mailbox-tree</name> - <width>150</width> - <can_focus>True</can_focus> - <signal> - <name>button_press_event</name> - <handler>on_store_and_mailbox_tree_button_press_event</handler> - <last_modification_time>Mon, 16 Aug 1999 13:06:15 GMT</last_modification_time> - </signal> - <columns>1</columns> - <column_widths>80</column_widths> - <selection_mode>GTK_SELECTION_SINGLE</selection_mode> - <show_titles>True</show_titles> - <shadow_type>GTK_SHADOW_IN</shadow_type> - <child> - <shrink>True</shrink> - <resize>False</resize> - </child> - - <widget> - <class>GtkLabel</class> - <child_name>CTree:title</child_name> - <name>store_and_inbox_name</name> - <label>name</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - </widget> - </widget> - - <widget> - <class>GtkCList</class> - <name>message-clist</name> - <can_focus>True</can_focus> - <columns>3</columns> - <column_widths>80,80,80</column_widths> - <selection_mode>GTK_SELECTION_SINGLE</selection_mode> - <show_titles>True</show_titles> - <shadow_type>GTK_SHADOW_IN</shadow_type> - <child> - <shrink>True</shrink> - <resize>True</resize> - </child> - - <widget> - <class>GtkLabel</class> - <child_name>CList:title</child_name> - <name>message_date_label</name> - <label>Date</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - </widget> - - <widget> - <class>GtkLabel</class> - <child_name>CList:title</child_name> - <name>message_sender_label</name> - <label>Sender</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - </widget> - - <widget> - <class>GtkLabel</class> - <child_name>CList:title</child_name> - <name>message_subject_label</name> - <label>Subject</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - </widget> - </widget> - </widget> - </widget> - - <widget> - <class>GnomeAppBar</class> - <child_name>GnomeApp:appbar</child_name> - <name>appbar1</name> - <has_progress>True</has_progress> - <has_status>True</has_status> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - </widget> -</widget> - -<widget> - <class>GnomeAbout</class> - <name>about_widget</name> - <visible>False</visible> - <modal>True</modal> - <copyright></copyright> - <authors>Bertrand Guiheneuf <Bertrand.Guiheneuf@aful.org> -</authors> - <comments>This is a very simple program to test Camel</comments> -</widget> - -<widget> - <class>GnomeDialog</class> - <name>new_store_dialog</name> - <visible>False</visible> - <title>New store</title> - <type>GTK_WINDOW_TOPLEVEL</type> - <position>GTK_WIN_POS_NONE</position> - <modal>False</modal> - <allow_shrink>False</allow_shrink> - <allow_grow>False</allow_grow> - <auto_shrink>False</auto_shrink> - <auto_close>True</auto_close> - <hide_on_close>True</hide_on_close> - - <widget> - <class>GtkVBox</class> - <child_name>GnomeDialog:vbox</child_name> - <name>dialog-vbox1</name> - <homogeneous>False</homogeneous> - <spacing>8</spacing> - <child> - <padding>4</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkVBox</class> - <name>vbox1</name> - <homogeneous>False</homogeneous> - <spacing>0</spacing> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkLabel</class> - <name>new_store_label</name> - <label>Enter complete store URL</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>29</ypad> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GnomeEntry</class> - <name>new-store-entry</name> - <history_id>store_name_history</history_id> - <max_saved>15</max_saved> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - - <widget> - <class>GtkEntry</class> - <child_name>GnomeEntry:entry</child_name> - <name>new-store-dialog-combo-entry</name> - <can_focus>True</can_focus> - <editable>True</editable> - <text_visible>True</text_visible> - <text_max_length>0</text_max_length> - <text></text> - </widget> - </widget> - </widget> - - <widget> - <class>GtkHButtonBox</class> - <child_name>GnomeDialog:action_area</child_name> - <name>dialog-action_area1</name> - <layout_style>GTK_BUTTONBOX_END</layout_style> - <spacing>8</spacing> - <child_min_width>85</child_min_width> - <child_min_height>27</child_min_height> - <child_ipad_x>7</child_ipad_x> - <child_ipad_y>0</child_ipad_y> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>True</fill> - <pack>GTK_PACK_END</pack> - </child> - - <widget> - <class>GtkButton</class> - <name>button1</name> - <can_default>True</can_default> - <can_focus>True</can_focus> - <stock_button>GNOME_STOCK_BUTTON_OK</stock_button> - </widget> - - <widget> - <class>GtkButton</class> - <name>button2</name> - <can_default>True</can_default> - <can_focus>True</can_focus> - <stock_button>GNOME_STOCK_BUTTON_APPLY</stock_button> - </widget> - - <widget> - <class>GtkButton</class> - <name>button3</name> - <can_default>True</can_default> - <can_focus>True</can_focus> - <stock_button>GNOME_STOCK_BUTTON_CANCEL</stock_button> - </widget> - </widget> - </widget> -</widget> - -</GTK-Interface> |