aboutsummaryrefslogtreecommitdiffstats
path: root/tests/ui-tests/store_listing.c
diff options
context:
space:
mode:
authorbertrand <Bertrand.Guiheneuf@aful.org>1999-08-16 23:08:16 +0800
committerBertrand Guiheneuf <bertrand@src.gnome.org>1999-08-16 23:08:16 +0800
commit8efa5bea5494312b98c70c347cc7df84564eb86f (patch)
tree0bbdafb8895b35ec2122f28b73b8f08d7c0e4044 /tests/ui-tests/store_listing.c
parentf5aadb31ca2ab34332e8d75787090e48a510d665 (diff)
downloadgsoc2013-evolution-8efa5bea5494312b98c70c347cc7df84564eb86f.tar.gz
gsoc2013-evolution-8efa5bea5494312b98c70c347cc7df84564eb86f.tar.zst
gsoc2013-evolution-8efa5bea5494312b98c70c347cc7df84564eb86f.zip
Now has a popup menu on mailbox tree to allow easier tests. Implemented
1999-08-16 bertrand <Bertrand.Guiheneuf@aful.org> * tests/ui-tests/store_listing.c: Now has a popup menu on mailbox tree to allow easier tests. Implemented the copy stuff. Works well for the MH provider :))) * camel/providers/MH/camel-mh-folder.c (_copy_message_to): Test MH provider fast copy implemented. svn path=/trunk/; revision=1119
Diffstat (limited to 'tests/ui-tests/store_listing.c')
-rw-r--r--tests/ui-tests/store_listing.c96
1 files changed, 88 insertions, 8 deletions
diff --git a/tests/ui-tests/store_listing.c b/tests/ui-tests/store_listing.c
index 377c17baf7..526bd3c9f7 100644
--- a/tests/ui-tests/store_listing.c
+++ b/tests/ui-tests/store_listing.c
@@ -17,28 +17,95 @@
static GladeXML *xml;
static CamelSession *_session;
-
+static CamelFolder *currently_selected_folder = NULL;
static void add_mail_store (const gchar *store_url);
static void show_folder_messages (CamelFolder *folder);
-void
-mailbox_row_selected (GtkCTree *ctree, GList *node, gint column, gpointer user_data)
+
+static void
+_destroy_menu (gpointer data)
{
- GtkCTreeNode *mailbox_node = GTK_CTREE_NODE (node);
+ 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"));
- folder = gtk_ctree_node_get_row_data (ctree, mailbox_node);
+ 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 name : %s\n", mailbox_name);
- show_folder_messages (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;
}
-
}
@@ -271,7 +338,20 @@ 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