diff options
author | bertrand <Bertrand.Guiheneuf@aful.org> | 1999-08-11 01:31:48 +0800 |
---|---|---|
committer | Bertrand Guiheneuf <bertrand@src.gnome.org> | 1999-08-11 01:31:48 +0800 |
commit | 7d7f5423308313eb30558700598091b4ba1f0d20 (patch) | |
tree | 020433e7bc24d30d192737a4cce7c11314a38e4f /tests/ui-tests | |
parent | 6cb08f0bc177cd0de35b852fac94a181f4d2233c (diff) | |
download | gsoc2013-evolution-7d7f5423308313eb30558700598091b4ba1f0d20.tar gsoc2013-evolution-7d7f5423308313eb30558700598091b4ba1f0d20.tar.gz gsoc2013-evolution-7d7f5423308313eb30558700598091b4ba1f0d20.tar.bz2 gsoc2013-evolution-7d7f5423308313eb30558700598091b4ba1f0d20.tar.lz gsoc2013-evolution-7d7f5423308313eb30558700598091b4ba1f0d20.tar.xz gsoc2013-evolution-7d7f5423308313eb30558700598091b4ba1f0d20.tar.zst gsoc2013-evolution-7d7f5423308313eb30558700598091b4ba1f0d20.zip |
Quick and (very) dirty hack to test Camel more easily.
1999-08-09 bertrand <Bertrand.Guiheneuf@aful.org>
* 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
Diffstat (limited to 'tests/ui-tests')
-rw-r--r-- | tests/ui-tests/Makefile.am | 1 | ||||
-rw-r--r-- | tests/ui-tests/store_listing.c | 211 | ||||
-rw-r--r-- | tests/ui-tests/store_listing.glade | 151 |
3 files changed, 335 insertions, 28 deletions
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 <gnome.h> #include <glade/glade.h> +#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; i<folder_message_count; i++) { + message = camel_folder_get_message (folder, i); + + 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] = g_strdup (sent_date); + else clist_row_text [0] = g_strdup ('\0'); + if (sender) clist_row_text [1] = g_strdup (sender); + else clist_row_text [1] = g_strdup ('\0'); + if (subject) clist_row_text [2] = g_strdup (subject); + else clist_row_text [2] = g_strdup ('\0'); + + 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; + + + /* normally the store type is found automatically + with the URL, this is not implemented for + the moment */ + store = gtk_type_new (CAMEL_MH_STORE_TYPE); + camel_store_init (store, (CamelSession *)NULL, g_strdup (store_url)); + + //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, ""); + 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); + 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 @@ <widget> <class>GtkPixmapMenuItem</class> - <name>exit1</name> + <name>exit</name> <signal> <name>activate</name> - <handler>on_exit1_activate</handler> - <last_modification_time>Tue, 10 Aug 1999 10:25:52 GMT</last_modification_time> + <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> @@ -120,11 +120,11 @@ <widget> <class>GtkPixmapMenuItem</class> - <name>about1</name> + <name>about</name> <signal> <name>activate</name> - <handler>on_about1_activate</handler> - <last_modification_time>Tue, 10 Aug 1999 10:25:52 GMT</last_modification_time> + <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> @@ -163,6 +163,11 @@ <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> @@ -179,8 +184,14 @@ <widget> <class>GtkCTree</class> - <name>ctree1</name> + <name>store-and-mailbox-tree</name> + <width>150</width> <can_focus>True</can_focus> + <signal> + <name>tree_select_row</name> + <handler>mailbox_row_selected</handler> + <last_modification_time>Tue, 10 Aug 1999 16:25:40 GMT</last_modification_time> + </signal> <columns>1</columns> <column_widths>80</column_widths> <selection_mode>GTK_SELECTION_SINGLE</selection_mode> @@ -207,7 +218,7 @@ <widget> <class>GtkCList</class> - <name>clist1</name> + <name>message-clist</name> <can_focus>True</can_focus> <columns>3</columns> <column_widths>80,80,80</column_widths> @@ -286,4 +297,128 @@ <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> + <style> + <style_font>-adobe-helvetica-bold-r-normal-*-*-140-*-*-p-*-iso8859-1</style_font> + </style> + <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> + <max_saved>10</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> |