diff options
Diffstat (limited to 'mail/mail-ops.c')
-rw-r--r-- | mail/mail-ops.c | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/mail/mail-ops.c b/mail/mail-ops.c index 8626a5acbb..6bb3f5b5f0 100644 --- a/mail/mail-ops.c +++ b/mail/mail-ops.c @@ -30,6 +30,7 @@ /* #include <ctype.h> */ #include <errno.h> +#include <gnome.h> #include <gal/util/e-util.h> #include <gal/widgets/e-unicode.h> #include <gal/util/e-unicode-i18n.h> @@ -2170,3 +2171,57 @@ mail_store_set_offline (CamelStore *store, gboolean offline, e_thread_put(mail_thread_queued, (EMsg *)m); } + + +/* ** Execute Shell Command ***************************************************** */ + +struct _execute_shell_command_msg { + struct _mail_msg msg; + + char *command; +}; + +static char *execute_shell_command_desc (struct _mail_msg *mm, int done) +{ + struct _execute_shell_command_msg *m = (struct _execute_shell_command_msg *) mm; + char *msg; + + msg = g_strdup_printf (_("Executing shell command: %s"), m->command); + + return msg; +} + +static void execute_shell_command_do (struct _mail_msg *mm) +{ + struct _execute_shell_command_msg *m = (struct _execute_shell_command_msg *) mm; + + gnome_execute_shell (NULL, m->command); +} + +static void execute_shell_command_free (struct _mail_msg *mm) +{ + struct _execute_shell_command_msg *m = (struct _execute_shell_command_msg *) mm; + + g_free (m->command); +} + +static struct _mail_msg_op execute_shell_command_op = { + execute_shell_command_desc, + execute_shell_command_do, + NULL, + execute_shell_command_free, +}; + +void +mail_execute_shell_command (const char *command) +{ + struct _execute_shell_command_msg *m; + + if (command == NULL) + return; + + m = mail_msg_new (&execute_shell_command_op, NULL, sizeof (*m)); + m->command = g_strdup (command); + + e_thread_put (mail_thread_queued, (EMsg *) m); +} |