struct _Children
{
- GtkWidget *window;
GtkWidget *dialog;
GtkWidget *text;
GtkWidget *input_entry;
gchar *branch_path,
gpointer callback,
gpointer data);
-static void mainwin_actions_execute_cb (MainWindow *mainwin,
- guint action_nb,
- GtkWidget *widget);
static void compose_actions_execute_cb (Compose *compose,
guint action_nb,
GtkWidget *widget);
+static void mainwin_actions_execute_cb (MainWindow *mainwin,
+ guint action_nb,
+ GtkWidget *widget);
static void msgview_actions_execute_cb (MessageView *msgview,
guint action_nb,
GtkWidget *widget);
+static void message_actions_execute (MessageView *msgview,
+ guint action_nb,
+ GtkCTree *ctree);
static guint get_action_type (gchar *action);
static gboolean execute_actions (gchar *action,
- GtkWidget *window,
GtkCTree *ctree,
GtkWidget *text,
GdkFont *msgfont,
static void hide_io_dialog_cb (GtkWidget *widget,
gpointer data);
-
+static gint io_dialog_key_pressed_cb (GtkWidget *widget,
+ GdkEventKey *event,
+ gpointer data);
static void catch_output (gpointer data,
gint source,
GdkInputCondition cond);
} else if (p[0] == '&') {
if (p[1] == 0x00)
action_type |= ACTION_ASYNC;
- else
- action_type = ACTION_ERROR;
}
p++;
}
return;
}
- execute_actions(action, compose->window, NULL, compose->text, NULL, 0,
- NULL);
+ execute_actions(action, NULL, compose->text, NULL, 0, NULL);
}
static void mainwin_actions_execute_cb(MainWindow *mainwin, guint action_nb,
GtkWidget *widget)
{
- MessageView *messageview = mainwin->messageview;
- TextView *textview = NULL;
- gchar *buf,
- *action;
- MimeView *mimeview = NULL;
-
- g_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, ": "));
-
- /* Point to the beginning of the command-line */
- action += 2;
-
- switch (messageview->type) {
- case MVIEW_TEXT:
- if (messageview->textview && messageview->textview->text)
- textview = messageview->textview;
- break;
- case MVIEW_MIME:
- if (messageview->mimeview) {
- mimeview = messageview->mimeview;
- if (messageview->mimeview->type == MIMEVIEW_TEXT &&
- messageview->mimeview->textview &&
- messageview->mimeview->textview->text)
- textview = messageview->mimeview->textview;
- }
- break;
- }
-
- execute_actions(action, mainwin->window,
- GTK_CTREE(mainwin->summaryview->ctree), textview->text,
- textview->msgfont, textview->body_pos, mimeview);
+ message_actions_execute(mainwin->messageview, action_nb,
+ GTK_CTREE(mainwin->summaryview->ctree));
}
-/* FIXME: Code duplication mainwindow_actions_execute_cb
- */
static void msgview_actions_execute_cb(MessageView *msgview, guint action_nb,
GtkWidget *widget)
+{
+ message_actions_execute(msgview, action_nb, NULL);
+
+}
+
+static void message_actions_execute(MessageView *msgview, guint action_nb,
+ GtkCTree *ctree)
{
TextView *textview = NULL;
gchar *buf,
*action;
MimeView *mimeview = NULL;
+ GdkFont *msgfont = NULL;
+ guint body_pos = 0;
+ GtkWidget *text = NULL;
g_return_if_fail(action_nb < g_slist_length(prefs_common.actions_list));
break;
}
- execute_actions(action, msgview->window, NULL, textview->text,
- textview->msgfont, textview->body_pos, mimeview);
+ if (textview) {
+ text = textview->text;
+ msgfont = textview->msgfont;
+ body_pos = textview->body_pos;
+ }
+
+ execute_actions(action, ctree, text, msgfont, body_pos, mimeview);
}
-static gboolean execute_actions(gchar *action, GtkWidget *window,
- GtkCTree *ctree, GtkWidget *text,
- GdkFont *msgfont, gint body_pos,
- MimeView *mimeview)
+static gboolean execute_actions(gchar *action,
+ GtkCTree *ctree,
+ GtkWidget *text,
+ GdkFont *msgfont,
+ gint body_pos,
+ MimeView *mimeview)
{
GList *cur, *selection = NULL;
GSList *children_list = NULL;
GSList *cur;
children->action = g_strdup(action);
- children->window = window;
children->dialog = NULL;
children->list = children_list;
children->nb = g_slist_length(children_list);
}
}
+static gint io_dialog_key_pressed_cb(GtkWidget *widget,
+ GdkEventKey *event,
+ gpointer data)
+{
+ if (event && event->keyval == GDK_Escape)
+ hide_io_dialog_cb(widget, data);
+ return TRUE;
+}
+
static void childinfo_close_pipes(ChildInfo *child_info)
{
if (child_info->tag_in > 0)
gtk_widget_set_sensitive(children->close_btn, TRUE);
if (children->input_hbox)
gtk_widget_set_sensitive(children->input_hbox, FALSE);
+ gtk_widget_grab_focus(children->close_btn);
+ gtk_signal_connect(GTK_OBJECT(children->dialog),
+ "key_press_event",
+ GTK_SIGNAL_FUNC(io_dialog_key_pressed_cb),
+ children);
}
if (children->output) {
* When adding new lines, remember to put one string for each line
*/
static gchar *actions_desc_strings[] = {
- N_("Menu name:"),
- N_(" Use / in menu name to make submenus."),
- N_(""),
- N_("Command line:"),
- N_(" Begin with:"),
- N_(" | to send message body or selection to command"),
- N_(" > to send user provided text to command"),
- N_(" * to send user provided hidden text to command"),
- N_(" End with:"),
- N_(" | to replace message body or selection with command output"),
- N_(" > to insert command's output without replacing old text"),
- N_(" & to run command asynchronously"),
- N_(" Use %f for message file name"),
- N_(" %F for the list of the file names of selected messages"),
- N_(" %p for the selected message MIME part."),
+ N_("Menu name:"), NULL,
+ " ", N_("Use / in menu name to make submenus."),
+ "", NULL,
+ N_("Command line:"), NULL,
+ N_("* Begin with:"), NULL,
+ " |", N_("to send message body or selection to command"),
+ " >", N_("to send user provided text to command"),
+ " *", N_("to send user provided hidden text to command"),
+ N_("* End with:"), NULL,
+ " |", N_("to replace message body or selection with command output"),
+ " >", N_("to insert command's output without replacing old text"),
+ " &", N_("to run command asynchronously"),
+ N_("* Use:"), NULL,
+ " %f", N_("for message file name"),
+ " %F", N_("for the list of the file names of selected messages"),
+ " %p", N_("for the selected message MIME part."),
NULL
};
static DescriptionWindow actions_desc_win = {
NULL,
- 1,
+ 2,
N_("Description of symbols"),
actions_desc_strings
};