/*
* Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2007 Hiroyuki Yamamoto & The Claws Mail Team
+ * Copyright (C) 1999-2009 Hiroyuki Yamamoto & The Claws Mail Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
ActionType action_get_type(const gchar *action_str)
{
const gchar *p;
+ gboolean in_filtering_action = FALSE;
ActionType action_type = ACTION_NONE;
- g_return_val_if_fail(action_str, ACTION_ERROR);
- g_return_val_if_fail(*action_str, ACTION_ERROR);
+ cm_return_val_if_fail(action_str, ACTION_ERROR);
+ cm_return_val_if_fail(*action_str, ACTION_ERROR);
p = action_str;
return ACTION_ERROR;
while (*p && action_type != ACTION_ERROR) {
- if (p[0] == '%' && p[1]) {
- switch (p[1]) {
- case 'a':
- /* CLAWS: filtering action is a mutually exclusive
- * action. we can enable others if needed later. we
- * add ACTION_SINGLE | ACTION_MULTIPLE so it will
- * only be executed from the main window toolbar */
- if (p[2] == 's') /* source messages */
- action_type = ACTION_FILTERING_ACTION
- | ACTION_SINGLE
- | ACTION_MULTIPLE;
- break;
- case 'f':
- action_type |= ACTION_SINGLE;
- break;
- case 'F':
- action_type |= ACTION_MULTIPLE;
- break;
- case 'p':
- action_type |= ACTION_SINGLE;
- break;
- case 's':
- action_type |= ACTION_SELECTION_STR;
- break;
- case 'u':
- action_type |= ACTION_USER_STR;
- break;
- case 'h':
- action_type |= ACTION_USER_HIDDEN_STR;
- break;
- case '%':
- /* literal '%' */
- break;
- default:
- action_type = ACTION_ERROR;
- break;
+ if (!in_filtering_action) {
+ if (p[0] == '%' && p[1]) {
+ switch (p[1]) {
+ case 'a':
+ /* CLAWS: filtering action is a mutually exclusive
+ * action. we can enable others if needed later. we
+ * add ACTION_SINGLE | ACTION_MULTIPLE so it will
+ * only be executed from the main window toolbar */
+ if (p[2] == 's') /* source messages */
+ action_type = ACTION_FILTERING_ACTION
+ | ACTION_SINGLE
+ | ACTION_MULTIPLE;
+ in_filtering_action = TRUE;
+ break;
+ case 'f':
+ action_type |= ACTION_SINGLE;
+ break;
+ case 'F':
+ action_type |= ACTION_MULTIPLE;
+ break;
+ case 'p':
+ action_type |= ACTION_SINGLE;
+ break;
+ case 's':
+ action_type |= ACTION_SELECTION_STR;
+ break;
+ case 'u':
+ action_type |= ACTION_USER_STR;
+ break;
+ case 'h':
+ action_type |= ACTION_USER_HIDDEN_STR;
+ break;
+ case '%':
+ /* literal '%' */
+ break;
+ default:
+ action_type = ACTION_ERROR;
+ break;
+ }
+ p++;
+ } else if (p[0] == '|') {
+ if (p[1] == '\0')
+ action_type |= ACTION_PIPE_OUT;
+ } else if (p[0] == '>') {
+ if (p[1] == '\0')
+ action_type |= ACTION_INSERT;
+ } else if (p[0] == '&') {
+ if (p[1] == '\0')
+ action_type |= ACTION_ASYNC;
+ } else if (p[0] == '}') {
+ in_filtering_action = FALSE;
}
- p++;
- } else if (p[0] == '|') {
- if (p[1] == '\0')
- action_type |= ACTION_PIPE_OUT;
- } else if (p[0] == '>') {
- if (p[1] == '\0')
- action_type |= ACTION_INSERT;
- } else if (p[0] == '&') {
- if (p[1] == '\0')
- action_type |= ACTION_ASYNC;
}
- p++;
+ p++;
}
return action_type;
gchar *p, *q;
gchar escape_ch[] = "\\ ";
- g_return_val_if_fail(msginfo, FALSE);
+ cm_return_val_if_fail(msginfo, FALSE);
filename = procmsg_get_message_file(msginfo);
gchar *buf, *action;
ActionType action_type;
- g_return_if_fail(action_nb < g_slist_length(prefs_common.actions_list));
+ cm_return_if_fail(action_nb < g_slist_length(prefs_common.actions_list));
buf = (gchar *)g_slist_nth_data(prefs_common.actions_list, action_nb);
- g_return_if_fail(buf != NULL);
+ cm_return_if_fail(buf != NULL);
action = strstr(buf, ": ");
- g_return_if_fail(action != NULL);
+ cm_return_if_fail(action != NULL);
/* Point to the beginning of the command-line */
action += 2;
guint body_pos = 0;
ActionType action_type;
- g_return_if_fail(action_nb < g_slist_length(prefs_common.actions_list));
+ cm_return_if_fail(action_nb < g_slist_length(prefs_common.actions_list));
buf = (gchar *)g_slist_nth_data(prefs_common.actions_list, action_nb);
- g_return_if_fail(buf);
- g_return_if_fail((action = strstr(buf, ": ")));
+ cm_return_if_fail(buf);
+ cm_return_if_fail((action = strstr(buf, ": ")));
/* Point to the beginning of the command-line */
action += 2;
GtkTextIter start_iter, end_iter;
gboolean is_selection = FALSE;
- g_return_val_if_fail(action && *action, FALSE);
+ cm_return_val_if_fail(action && *action, FALSE);
action_type = action_get_type(action);
child_info->callback = callback;
child_info->data = data;
child_info->tag_status =
- gdk_input_add(child_info->chld_status,
+ claws_input_add(child_info->chld_status,
GDK_INPUT_READ,
- catch_status, child_info);
+ catch_status, child_info,
+ FALSE);
}
create_io_dialog(children);
child_info->chld_err = chld_err[0];
child_info->chld_status = chld_status[0];
child_info->tag_in = -1;
- child_info->tag_out = gdk_input_add(chld_out[0], GDK_INPUT_READ,
- catch_output, child_info);
- child_info->tag_err = gdk_input_add(chld_err[0], GDK_INPUT_READ,
- catch_output, child_info);
+ child_info->tag_out = claws_input_add(chld_out[0], GDK_INPUT_READ,
+ catch_output, child_info, FALSE);
+ child_info->tag_err = claws_input_add(chld_err[0], GDK_INPUT_READ,
+ catch_output, child_info, FALSE);
if (!(children->action_type &
(ACTION_PIPE_IN | ACTION_PIPE_OUT | ACTION_INSERT)))
Children *children = (Children *) data;
ChildInfo *child_info = (ChildInfo *) children->list->data;
- child_info->tag_in = gdk_input_add(child_info->chld_in,
+ child_info->tag_in = claws_input_add(child_info->chld_in,
GDK_INPUT_WRITE,
- catch_input, children);
+ catch_input, children, FALSE);
}
static gint delete_io_dialog_cb(GtkWidget *w, GdkEvent *e, gpointer data)
* them if necessary
*/
if (child_info->tag_in > 0)
- gdk_input_remove(child_info->tag_in);
+ g_source_remove(child_info->tag_in);
if (child_info->tag_out > 0)
- gdk_input_remove(child_info->tag_out);
+ g_source_remove(child_info->tag_out);
if (child_info->tag_err > 0)
- gdk_input_remove(child_info->tag_err);
+ g_source_remove(child_info->tag_err);
if (child_info->chld_in >= 0)
(void)close(child_info->chld_in);
gchar buf;
gint c;
- gdk_input_remove(child_info->tag_status);
+ g_source_remove(child_info->tag_status);
c = read(source, &buf, 1);
debug_print("Child returned %c\n", buf);
gtk_widget_set_sensitive(children->input_hbox, FALSE);
gtk_widget_grab_focus(children->abort_btn);
- gdk_input_remove(child_info->tag_in);
+ g_source_remove(child_info->tag_in);
child_info->tag_in = -1;
input = gtk_editable_get_chars(GTK_EDITABLE(children->input_entry),
}
if (c == 0) {
if (source == child_info->chld_out) {
- gdk_input_remove(child_info->tag_out);
+ g_source_remove(child_info->tag_out);
child_info->tag_out = -1;
(void)close(child_info->chld_out);
child_info->chld_out = -1;
} else {
- gdk_input_remove(child_info->tag_err);
+ g_source_remove(child_info->tag_err);
child_info->tag_err = -1;
(void)close(child_info->chld_err);
child_info->chld_err = -1;