aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/itip-formatter/ChangeLog11
-rw-r--r--plugins/itip-formatter/itip-formatter.c55
2 files changed, 60 insertions, 6 deletions
diff --git a/plugins/itip-formatter/ChangeLog b/plugins/itip-formatter/ChangeLog
index de65a85b92..b453e46dcd 100644
--- a/plugins/itip-formatter/ChangeLog
+++ b/plugins/itip-formatter/ChangeLog
@@ -1,3 +1,14 @@
+2007-10-04 Milan Crha <mcrha@redhat.com>
+
+ ** Fix for bug #331578
+
+ * itip-formatter.c: (struct _opencal_msg), (open_calendar_desc),
+ (open_calendar_do), (open_calendar_done), (open_calendar_free),
+ (struct _mail_msg_op open_calendar_op):
+ New functions and structures to run command line in other thread.
+ * itip-formatter.c: (idle_open_cb):
+ Run command line in other thread rather than in main thread.
+
2007-10-03 Milan Crha <mcrha@redhat.com>
** Fix for bug #346146
diff --git a/plugins/itip-formatter/itip-formatter.c b/plugins/itip-formatter/itip-formatter.c
index ec028ac078..952f45a622 100644
--- a/plugins/itip-formatter/itip-formatter.c
+++ b/plugins/itip-formatter/itip-formatter.c
@@ -48,6 +48,7 @@
#include <mail/em-format-html.h>
#include <mail/em-utils.h>
#include <mail/mail-tools.h>
+#include <mail/mail-mt.h>
#include <libedataserver/e-account-list.h>
#include <e-util/e-icon-factory.h>
#include <e-util/e-error.h>
@@ -1546,18 +1547,60 @@ extract_itip_data (FormatItipPObject *pitip, GtkContainer *container)
return TRUE;
}
+struct _opencal_msg {
+ struct _mail_msg msg;
+
+ char *command; /* command line to run */
+};
+
+static char *
+open_calendar_desc (struct _mail_msg *mm, int done)
+{
+ return g_strdup (_("Opening calendar"));
+}
+
+static void
+open_calendar_do (struct _mail_msg *mm)
+{
+ struct _opencal_msg *m = (struct _opencal_msg *)mm;
+
+ if (!g_spawn_command_line_async (m->command, NULL)) {
+ g_warning ("Could not launch %s", m->command);
+ }
+}
+
+static void
+open_calendar_done (struct _mail_msg *mm)
+{
+ /*struct _opencal_msg *m = (struct _opencal_msg *)mm;*/
+}
+
+static void
+open_calendar_free (struct _mail_msg *mm)
+{
+ struct _opencal_msg *m = (struct _opencal_msg *)mm;
+
+ g_free (m->command);
+ m->command = NULL;
+}
+
+static struct _mail_msg_op open_calendar_op = {
+ open_calendar_desc,
+ open_calendar_do,
+ open_calendar_done,
+ open_calendar_free,
+};
+
static gboolean
idle_open_cb (gpointer data)
{
FormatItipPObject *pitip = data;
- char *command;
+ struct _opencal_msg *m;
- command = g_strdup_printf ("evolution \"calendar://?startdate=%s&enddate=%s\"",
+ m = mail_msg_new (&open_calendar_op, NULL, sizeof (*m));
+ m->command = g_strdup_printf ("evolution \"calendar://?startdate=%s&enddate=%s\"",
isodate_from_time_t (pitip->start_time), isodate_from_time_t (pitip->end_time));
- if (!g_spawn_command_line_async (command, NULL)) {
- g_warning ("Could not launch %s", command);
- }
- g_free (command);
+ e_thread_put (mail_thread_queued_slow, (EMsg *)m);
return FALSE;
}