From 7d7f5423308313eb30558700598091b4ba1f0d20 Mon Sep 17 00:00:00 2001 From: bertrand Date: Tue, 10 Aug 1999 17:31:48 +0000 Subject: Quick and (very) dirty hack to test Camel more easily. 1999-08-09 bertrand * tests/ui-tests/store_listing.c: * tests/ui-tests/store_listing.glade: Quick and (very) dirty hack to test Camel more easily. * camel/camel-folder.c (camel_folder_append_message): new method. svn path=/trunk/; revision=1102 --- tests/ui-tests/Makefile.am | 1 + tests/ui-tests/store_listing.c | 211 +++++++++++++++++++++++++++++++++---- tests/ui-tests/store_listing.glade | 151 ++++++++++++++++++++++++-- 3 files changed, 335 insertions(+), 28 deletions(-) (limited to 'tests') diff --git a/tests/ui-tests/Makefile.am b/tests/ui-tests/Makefile.am index 19bbb6c8d4..8ed5393e8a 100644 --- a/tests/ui-tests/Makefile.am +++ b/tests/ui-tests/Makefile.am @@ -6,6 +6,7 @@ INCLUDES = -I$(top_srcdir)/intl -I$(top_srcdir)/camel \ LDADD = \ $(top_builddir)/camel/libcamel.la \ + $(top_builddir)/camel/providers/MH/libcamelmh.la \ $(INTLLIBS) $(EXTRA_GNOME_LIBS) diff --git a/tests/ui-tests/store_listing.c b/tests/ui-tests/store_listing.c index 1eee741286..64f95f0b1d 100644 --- a/tests/ui-tests/store_listing.c +++ b/tests/ui-tests/store_listing.c @@ -1,4 +1,5 @@ -/* Bertrand.Guiheneuf@aful.org */ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ +/* Author : Bertrand.Guiheneuf@aful.org */ @@ -12,43 +13,213 @@ #include #include +#include "camel-folder.h" +#include "camel-mh-folder.h" +#include "camel-mh-store.h" +#include "camel.h" static GladeXML *xml; +static void add_mail_store (const gchar *store_url); +static void show_folder_messages (CamelFolder *folder); + void -on_exit1_activate (GtkWidget *widget, void *data) +mailbox_row_selected (GtkCTree *ctree, GList *node, gint column, gpointer user_data) { - gtk_main_quit (); + GtkCTreeNode *mailbox_node = GTK_CTREE_NODE (node); + CamelFolder *folder; + const gchar *mailbox_name; + + folder = gtk_ctree_node_get_row_data (ctree, mailbox_node); + if (folder && IS_CAMEL_FOLDER (folder)) { + mailbox_name = camel_folder_get_name (folder); + printf ("Mailbox name : %s\n", mailbox_name); + show_folder_messages (folder); + } else { + printf ("Node is a store\n"); + } + } -void -on_about1_activate (GtkWidget *widget, void *data) +static void +message_destroy_notify (gpointer data) { - GtkWidget *about_widget; - - about_widget = glade_xml_get_widget (xml, "about_widget"); - gtk_widget_show (about_widget); + CamelMimeMessage *message = CAMEL_MIME_MESSAGE (data); + + gtk_object_unref (GTK_OBJECT (message)); + } -int -main(int argc, char *argv[]) + +static void +show_folder_messages (CamelFolder *folder) +{ + GtkWidget *message_clist; + gint folder_message_count; + CamelMimeMessage *message; + gint i; + gchar *clist_row_text[3]; + const char *sent_date, *subject, *sender; + gint current_row; + + message_clist = glade_xml_get_widget (xml, "message-clist"); + + /* clear old message list */ + gtk_clist_clear (GTK_CLIST (message_clist)); + + folder_message_count = camel_folder_get_message_count (folder); + for (i=0; idata; + new_folder = camel_store_get_folder (store, subfolder_list->data); + 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; + } + + +} + + +/* ----- */ +void +on_exit_activate (GtkWidget *widget, void *data) +{ + 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) { - - gnome_init ("store_listing", "1.0", argc, argv); + 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); + +} - glade_gnome_init(); - xml = glade_xml_new ("store_listing.glade", NULL); - if (xml) glade_xml_signal_autoconnect (xml); - - gtk_main (); - - return 0; + +int +main(int argc, char *argv[]) +{ + + 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); + + + gtk_main (); + + return 0; } diff --git a/tests/ui-tests/store_listing.glade b/tests/ui-tests/store_listing.glade index 32516494aa..d01d408db4 100644 --- a/tests/ui-tests/store_listing.glade +++ b/tests/ui-tests/store_listing.glade @@ -98,11 +98,11 @@ GtkPixmapMenuItem - exit1 + exit activate - on_exit1_activate - Tue, 10 Aug 1999 10:25:52 GMT + on_exit_activate + Tue, 10 Aug 1999 12:06:35 GMT GNOMEUIINFO_MENU_EXIT_ITEM @@ -120,11 +120,11 @@ GtkPixmapMenuItem - about1 + about activate - on_about1_activate - Tue, 10 Aug 1999 10:25:52 GMT + on_about_activate + Tue, 10 Aug 1999 12:06:58 GMT GNOMEUIINFO_MENU_ABOUT_ITEM @@ -163,6 +163,11 @@ GtkButton Toolbar:button new_store_button + + clicked + on_new_store_activate + Tue, 10 Aug 1999 12:17:17 GMT + GNOME_STOCK_PIXMAP_NEW @@ -179,8 +184,14 @@ GtkCTree - ctree1 + store-and-mailbox-tree + 150 True + + tree_select_row + mailbox_row_selected + Tue, 10 Aug 1999 16:25:40 GMT + 1 80 GTK_SELECTION_SINGLE @@ -207,7 +218,7 @@ GtkCList - clist1 + message-clist True 3 80,80,80 @@ -286,4 +297,128 @@ This is a very simple program to test Camel + + GnomeDialog + new_store_dialog + False + New store + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_NONE + False + False + False + False + True + True + + + GtkVBox + GnomeDialog:vbox + dialog-vbox1 + False + 8 + + 4 + True + True + + + + GtkVBox + vbox1 + False + 0 + + 0 + True + True + + + + GtkLabel + new_store_label + + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 29 + + 0 + False + False + + + + + GnomeEntry + new-store-entry + 10 + + 0 + False + False + + + + GtkEntry + GnomeEntry:entry + new-store-dialog-combo-entry + True + True + True + 0 + + + + + + + GtkHButtonBox + GnomeDialog:action_area + dialog-action_area1 + GTK_BUTTONBOX_END + 8 + 85 + 27 + 7 + 0 + + 0 + False + True + GTK_PACK_END + + + + GtkButton + button1 + True + True + GNOME_STOCK_BUTTON_OK + + + + GtkButton + button2 + True + True + GNOME_STOCK_BUTTON_APPLY + + + + GtkButton + button3 + True + True + GNOME_STOCK_BUTTON_CANCEL + + + + + -- cgit