From cf100885d02d81d8850ef58936776bf161f99ad6 Mon Sep 17 00:00:00 2001 From: Srinivasa Ragavan Date: Sat, 14 Jan 2006 07:05:08 +0000 Subject: ** Fixes bug #323011 2006-01-14 Srinivasa Ragavan ** Fixes bug #323011 * Makefile.am: Added org-gnome-mail-to-task.xml to build * mail-to-task.c (convert_to_task), (org_gnome_mail_to_task), (org_gnome_mail_to_task_menu): Added Code to handle menu. * org-gnome-mail-to-task.eplug.xml: Added plug to show Convert to Task menu item under Message menu. * org-gnome-mail-to-task.xml: Added UI files for menu item. svn path=/trunk/; revision=31179 --- plugins/mail-to-task/mail-to-task.c | 57 +++++++++++++++++++++++++++---------- 1 file changed, 42 insertions(+), 15 deletions(-) (limited to 'plugins/mail-to-task/mail-to-task.c') diff --git a/plugins/mail-to-task/mail-to-task.c b/plugins/mail-to-task/mail-to-task.c index b22f766811..65261ccf46 100644 --- a/plugins/mail-to-task/mail-to-task.c +++ b/plugins/mail-to-task/mail-to-task.c @@ -23,6 +23,7 @@ #include #include #include +#include "mail/em-menu.h" #include "mail/em-popup.h" typedef struct { @@ -188,6 +189,7 @@ do_mail_to_task (AsyncData *data) } void org_gnome_mail_to_task (void *ep, EMPopupTargetSelect *t); +void org_gnome_mail_to_task_menu (EPlugin *ep, EMMenuTargetSelect *target); static void copy_uids (char *uid, GPtrArray *uid_array) @@ -195,24 +197,13 @@ copy_uids (char *uid, GPtrArray *uid_array) g_ptr_array_add (uid_array, g_strdup (uid)); } -void -org_gnome_mail_to_task (void *ep, EMPopupTargetSelect *t) +static void +convert_to_task (GPtrArray *uid_array, struct _CamelFolder *folder) { GtkWidget *dialog; GConfClient *conf_client; ESourceList *source_list; - GPtrArray *uid_array = NULL; - - if (t->uids->len > 0) { - /* FIXME Some how in the thread function the values inside t->uids gets freed - and are corrupted which needs to be fixed, this is sought of work around fix for - the gui inresponsiveness */ - uid_array = g_ptr_array_new (); - g_ptr_array_foreach (t->uids, (GFunc)copy_uids, (gpointer) uid_array); - } else { - return; - } - + /* ask the user which tasks list to save to */ conf_client = gconf_client_get_default (); source_list = e_source_list_new_for_gconf (conf_client, "/apps/evolution/tasks/sources"); @@ -246,7 +237,7 @@ org_gnome_mail_to_task (void *ep, EMPopupTargetSelect *t) /* Fill the elements in AsynData */ data = g_new0 (AsyncData, 1); data->client = client; - data->folder = t->folder; + data->folder = folder; data->uids = uid_array; thread = g_thread_create ((GThreadFunc) do_mail_to_task, data, FALSE, &error); @@ -261,6 +252,42 @@ org_gnome_mail_to_task (void *ep, EMPopupTargetSelect *t) g_object_unref (conf_client); g_object_unref (source_list); gtk_widget_destroy (dialog); + +} + +void +org_gnome_mail_to_task (void *ep, EMPopupTargetSelect *t) +{ + GPtrArray *uid_array = NULL; + + if (t->uids->len > 0) { + /* FIXME Some how in the thread function the values inside t->uids gets freed + and are corrupted which needs to be fixed, this is sought of work around fix for + the gui inresponsiveness */ + uid_array = g_ptr_array_new (); + g_ptr_array_foreach (t->uids, (GFunc)copy_uids, (gpointer) uid_array); + } else { + return; + } + + convert_to_task (uid_array, t->folder); +} + +void org_gnome_mail_to_task_menu (EPlugin *ep, EMMenuTargetSelect *t) +{ + GPtrArray *uid_array = NULL; + + if (t->uids->len > 0) { + /* FIXME Some how in the thread function the values inside t->uids gets freed + and are corrupted which needs to be fixed, this is sought of work around fix for + the gui inresponsiveness */ + uid_array = g_ptr_array_new (); + g_ptr_array_foreach (t->uids, (GFunc)copy_uids, (gpointer) uid_array); + } else { + return; + } + + convert_to_task (uid_array, t->folder); } int e_plugin_lib_enable(EPluginLib *ep, int enable); -- cgit v1.2.3