2 * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
3 * Copyright (C) 1999-2002 Hiroyuki Yamamoto
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
28 #include <gdk/gdkkeysyms.h>
34 #include <sys/types.h>
40 #include "prefs_gtk.h"
44 #include "manage_window.h"
45 #include "mainwindow.h"
46 #include "prefs_common.h"
47 #include "alertpanel.h"
48 #include "prefs_actions.h"
53 #include "description_window.h"
59 ACTION_PIPE_IN = 1 << 1,
60 ACTION_PIPE_OUT = 1 << 2,
61 ACTION_SINGLE = 1 << 3,
62 ACTION_MULTIPLE = 1 << 4,
63 ACTION_ASYNC = 1 << 5,
64 ACTION_OPEN_IN = 1 << 6,
65 ACTION_HIDE_IN = 1 << 7,
66 ACTION_INSERT = 1 << 8,
67 ACTION_ERROR = 1 << 9,
76 GtkWidget *name_entry;
79 GtkWidget *actions_clist;
82 typedef struct _Children Children;
83 typedef struct _ChildInfo ChildInfo;
89 GtkWidget *input_entry;
90 GtkWidget *input_hbox;
93 GtkWidget *scrolledwin;
122 /* widget creating functions */
123 static void prefs_actions_create (MainWindow *mainwin);
124 static void prefs_actions_set_dialog (void);
125 static gint prefs_actions_clist_set_row (gint row);
127 /* callback functions */
128 static void prefs_actions_help_cb (GtkWidget *w,
130 static void prefs_actions_register_cb (GtkWidget *w,
132 static void prefs_actions_substitute_cb (GtkWidget *w,
134 static void prefs_actions_delete_cb (GtkWidget *w,
136 static void prefs_actions_up (GtkWidget *w,
138 static void prefs_actions_down (GtkWidget *w,
140 static void prefs_actions_select (GtkCList *clist,
144 static void prefs_actions_row_move (GtkCList *clist,
147 static gint prefs_actions_deleted (GtkWidget *widget,
150 static void prefs_actions_key_pressed (GtkWidget *widget,
153 static void prefs_actions_cancel (GtkWidget *w,
155 static void prefs_actions_ok (GtkWidget *w,
157 static void update_actions_menu (GtkItemFactory *ifactory,
161 static void compose_actions_execute_cb (Compose *compose,
164 static void mainwin_actions_execute_cb (MainWindow *mainwin,
167 static void msgview_actions_execute_cb (MessageView *msgview,
170 static void message_actions_execute (MessageView *msgview,
173 static guint get_action_type (gchar *action);
175 static gboolean execute_actions (gchar *action,
182 static gchar *parse_action_cmd (gchar *action,
186 static gboolean parse_append_filename (GString **cmd,
189 static gboolean parse_append_msgpart (GString **cmd,
193 ChildInfo *fork_child (gchar *cmd,
200 static gint wait_for_children (gpointer data);
202 static void free_children (Children *children);
204 static void childinfo_close_pipes (ChildInfo *child_info);
206 static void create_io_dialog (Children *children);
207 static void update_io_dialog (Children *children);
209 static void hide_io_dialog_cb (GtkWidget *widget,
211 static gint io_dialog_key_pressed_cb (GtkWidget *widget,
214 static void catch_output (gpointer data,
216 GdkInputCondition cond);
217 static void catch_input (gpointer data,
219 GdkInputCondition cond);
220 static void catch_status (gpointer data,
222 GdkInputCondition cond);
225 void prefs_actions_open(MainWindow *mainwin)
228 if (prefs_rc_is_readonly(ACTIONS_RC))
234 prefs_actions_create(mainwin);
236 manage_window_set_transient(GTK_WINDOW(actions.window));
237 gtk_widget_grab_focus(actions.ok_btn);
239 prefs_actions_set_dialog();
241 gtk_widget_show(actions.window);
244 static void prefs_actions_create(MainWindow *mainwin)
249 GtkWidget *cancel_btn;
250 GtkWidget *confirm_area;
254 GtkWidget *entry_vbox;
256 GtkWidget *name_label;
257 GtkWidget *name_entry;
258 GtkWidget *cmd_label;
259 GtkWidget *cmd_entry;
265 GtkWidget *subst_btn;
268 GtkWidget *cond_hbox;
269 GtkWidget *cond_scrolledwin;
270 GtkWidget *cond_clist;
272 GtkWidget *help_button;
280 debug_print("Creating actions configuration window...\n");
282 window = gtk_window_new (GTK_WINDOW_DIALOG);
284 gtk_container_set_border_width(GTK_CONTAINER (window), 8);
285 gtk_window_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
286 gtk_window_set_modal(GTK_WINDOW(window), TRUE);
287 gtk_window_set_policy(GTK_WINDOW(window), FALSE, TRUE, TRUE);
288 gtk_window_set_default_size(GTK_WINDOW(window), 400, -1);
290 vbox = gtk_vbox_new(FALSE, 6);
291 gtk_widget_show(vbox);
292 gtk_container_add(GTK_CONTAINER(window), vbox);
294 gtkut_button_set_create(&confirm_area, &ok_btn, _("OK"),
295 &cancel_btn, _("Cancel"), NULL, NULL);
296 gtk_widget_show(confirm_area);
297 gtk_box_pack_end(GTK_BOX(vbox), confirm_area, FALSE, FALSE, 0);
298 gtk_widget_grab_default(ok_btn);
300 gtk_window_set_title(GTK_WINDOW(window), _("Actions configuration"));
301 gtk_signal_connect(GTK_OBJECT(window), "delete_event",
302 GTK_SIGNAL_FUNC(prefs_actions_deleted), NULL);
303 gtk_signal_connect(GTK_OBJECT(window), "key_press_event",
304 GTK_SIGNAL_FUNC(prefs_actions_key_pressed), NULL);
305 MANAGE_WINDOW_SIGNALS_CONNECT(window);
306 gtk_signal_connect(GTK_OBJECT(ok_btn), "clicked",
307 GTK_SIGNAL_FUNC(prefs_actions_ok), mainwin);
308 gtk_signal_connect(GTK_OBJECT(cancel_btn), "clicked",
309 GTK_SIGNAL_FUNC(prefs_actions_cancel), NULL);
311 vbox1 = gtk_vbox_new(FALSE, 8);
312 gtk_widget_show(vbox1);
313 gtk_box_pack_start(GTK_BOX(vbox), vbox1, TRUE, TRUE, 0);
314 gtk_container_set_border_width(GTK_CONTAINER(vbox1), 2);
316 entry_vbox = gtk_vbox_new(FALSE, 4);
317 gtk_box_pack_start(GTK_BOX(vbox1), entry_vbox, FALSE, FALSE, 0);
319 hbox = gtk_hbox_new(FALSE, 8);
320 gtk_box_pack_start(GTK_BOX(entry_vbox), hbox, FALSE, FALSE, 0);
322 name_label = gtk_label_new(_("Menu name:"));
323 gtk_box_pack_start(GTK_BOX(hbox), name_label, FALSE, FALSE, 0);
325 name_entry = gtk_entry_new();
326 gtk_box_pack_start(GTK_BOX(hbox), name_entry, TRUE, TRUE, 0);
328 hbox = gtk_hbox_new(FALSE, 8);
329 gtk_box_pack_start(GTK_BOX(entry_vbox), hbox, TRUE, TRUE, 0);
331 cmd_label = gtk_label_new(_("Command line:"));
332 gtk_box_pack_start(GTK_BOX(hbox), cmd_label, FALSE, FALSE, 0);
334 cmd_entry = gtk_entry_new();
335 gtk_box_pack_start(GTK_BOX(hbox), cmd_entry, TRUE, TRUE, 0);
337 gtk_widget_show_all(entry_vbox);
339 /* register / substitute / delete */
341 reg_hbox = gtk_hbox_new(FALSE, 4);
342 gtk_widget_show(reg_hbox);
343 gtk_box_pack_start(GTK_BOX(vbox1), reg_hbox, FALSE, FALSE, 0);
345 arrow = gtk_arrow_new(GTK_ARROW_DOWN, GTK_SHADOW_OUT);
346 gtk_widget_show(arrow);
347 gtk_box_pack_start(GTK_BOX(reg_hbox), arrow, FALSE, FALSE, 0);
348 gtk_widget_set_usize(arrow, -1, 16);
350 btn_hbox = gtk_hbox_new(TRUE, 4);
351 gtk_widget_show(btn_hbox);
352 gtk_box_pack_start(GTK_BOX(reg_hbox), btn_hbox, FALSE, FALSE, 0);
354 reg_btn = gtk_button_new_with_label(_("Add"));
355 gtk_widget_show(reg_btn);
356 gtk_box_pack_start(GTK_BOX(btn_hbox), reg_btn, FALSE, TRUE, 0);
357 gtk_signal_connect(GTK_OBJECT(reg_btn), "clicked",
358 GTK_SIGNAL_FUNC(prefs_actions_register_cb), NULL);
360 subst_btn = gtk_button_new_with_label(_(" Replace "));
361 gtk_widget_show(subst_btn);
362 gtk_box_pack_start(GTK_BOX(btn_hbox), subst_btn, FALSE, TRUE, 0);
363 gtk_signal_connect(GTK_OBJECT(subst_btn), "clicked",
364 GTK_SIGNAL_FUNC(prefs_actions_substitute_cb),
367 del_btn = gtk_button_new_with_label(_("Delete"));
368 gtk_widget_show(del_btn);
369 gtk_box_pack_start(GTK_BOX(btn_hbox), del_btn, FALSE, TRUE, 0);
370 gtk_signal_connect(GTK_OBJECT(del_btn), "clicked",
371 GTK_SIGNAL_FUNC(prefs_actions_delete_cb), NULL);
373 help_button = gtk_button_new_with_label(_(" Syntax help "));
374 gtk_widget_show(help_button);
375 gtk_box_pack_end(GTK_BOX(reg_hbox), help_button, FALSE, FALSE, 0);
376 gtk_signal_connect(GTK_OBJECT(help_button), "clicked",
377 GTK_SIGNAL_FUNC(prefs_actions_help_cb), NULL);
379 cond_hbox = gtk_hbox_new(FALSE, 8);
380 gtk_widget_show(cond_hbox);
381 gtk_box_pack_start(GTK_BOX(vbox1), cond_hbox, TRUE, TRUE, 0);
383 cond_scrolledwin = gtk_scrolled_window_new(NULL, NULL);
384 gtk_widget_show(cond_scrolledwin);
385 gtk_widget_set_usize(cond_scrolledwin, -1, 150);
386 gtk_box_pack_start(GTK_BOX(cond_hbox), cond_scrolledwin,
388 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW (cond_scrolledwin),
389 GTK_POLICY_AUTOMATIC,
390 GTK_POLICY_AUTOMATIC);
392 title[0] = _("Current actions");
393 cond_clist = gtk_clist_new_with_titles(1, title);
394 gtk_widget_show(cond_clist);
395 gtk_container_add(GTK_CONTAINER (cond_scrolledwin), cond_clist);
396 gtk_clist_set_column_width(GTK_CLIST (cond_clist), 0, 80);
397 gtk_clist_set_selection_mode(GTK_CLIST (cond_clist),
398 GTK_SELECTION_BROWSE);
399 GTK_WIDGET_UNSET_FLAGS(GTK_CLIST(cond_clist)->column[0].button,
401 gtk_signal_connect(GTK_OBJECT(cond_clist), "select_row",
402 GTK_SIGNAL_FUNC(prefs_actions_select), NULL);
403 gtk_signal_connect_after(GTK_OBJECT(cond_clist), "row_move",
404 GTK_SIGNAL_FUNC(prefs_actions_row_move),
407 btn_vbox = gtk_vbox_new(FALSE, 8);
408 gtk_widget_show(btn_vbox);
409 gtk_box_pack_start(GTK_BOX(cond_hbox), btn_vbox, FALSE, FALSE, 0);
411 up_btn = gtk_button_new_with_label(_("Up"));
412 gtk_widget_show(up_btn);
413 gtk_box_pack_start(GTK_BOX(btn_vbox), up_btn, FALSE, FALSE, 0);
414 gtk_signal_connect(GTK_OBJECT(up_btn), "clicked",
415 GTK_SIGNAL_FUNC(prefs_actions_up), NULL);
417 down_btn = gtk_button_new_with_label(_("Down"));
418 gtk_widget_show(down_btn);
419 gtk_box_pack_start(GTK_BOX(btn_vbox), down_btn, FALSE, FALSE, 0);
420 gtk_signal_connect(GTK_OBJECT(down_btn), "clicked",
421 GTK_SIGNAL_FUNC(prefs_actions_down), NULL);
423 gtk_widget_show(window);
425 actions.window = window;
426 actions.ok_btn = ok_btn;
428 actions.name_entry = name_entry;
429 actions.cmd_entry = cmd_entry;
431 actions.actions_clist = cond_clist;
435 void prefs_actions_read_config(void)
439 gchar buf[PREFSBUFSIZE];
442 debug_print("Reading actions configurations...\n");
444 rcpath = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, ACTIONS_RC, NULL);
445 if ((fp = fopen(rcpath, "rb")) == NULL) {
446 if (ENOENT != errno) FILE_OP_ERROR(rcpath, "fopen");
452 while (prefs_common.actions_list != NULL) {
453 act = (gchar *)prefs_common.actions_list->data;
454 prefs_common.actions_list =
455 g_slist_remove(prefs_common.actions_list, act);
459 while (fgets(buf, sizeof(buf), fp) != NULL) {
461 act = strstr(buf, ": ");
463 get_action_type(&act[2]) != ACTION_ERROR)
464 prefs_common.actions_list =
465 g_slist_append(prefs_common.actions_list,
471 void prefs_actions_write_config(void)
477 debug_print("Writing actions configuration...\n");
479 rcpath = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, ACTIONS_RC, NULL);
480 if ((pfile= prefs_write_open(rcpath)) == NULL) {
481 g_warning("failed to write configuration to file\n");
486 for (cur = prefs_common.actions_list; cur != NULL; cur = cur->next) {
487 gchar *act = (gchar *)cur->data;
488 if (fputs(act, pfile->fp) == EOF ||
489 fputc('\n', pfile->fp) == EOF) {
490 FILE_OP_ERROR(rcpath, "fputs || fputc");
491 prefs_file_close_revert(pfile);
499 if (prefs_file_close(pfile) < 0) {
500 g_warning("failed to write configuration to file\n");
505 static guint get_action_type(gchar *action)
508 guint action_type = ACTION_NONE;
510 g_return_val_if_fail(action, ACTION_ERROR);
511 g_return_val_if_fail(*action, ACTION_ERROR);
516 action_type |= ACTION_PIPE_IN;
518 } else if (p[0] == '>') {
519 action_type |= ACTION_OPEN_IN;
521 } else if (p[0] == '*') {
522 action_type |= ACTION_HIDE_IN;
529 while (*p && action_type != ACTION_ERROR) {
533 action_type |= ACTION_SINGLE;
536 action_type |= ACTION_MULTIPLE;
539 action_type |= ACTION_SINGLE;
542 action_type = ACTION_ERROR;
545 } else if (p[0] == '|') {
547 action_type |= ACTION_PIPE_OUT;
548 } else if (p[0] == '>') {
550 action_type |= ACTION_INSERT;
551 } else if (p[0] == '&') {
553 action_type |= ACTION_ASYNC;
561 static gchar *parse_action_cmd(gchar *action, MsgInfo *msginfo,
562 GtkCTree *ctree, MimeView *mimeview)
571 if (p[0] == '|' || p[0] == '>' || p[0] == '*')
574 cmd = g_string_sized_new(strlen(action));
577 !((p[0] == '|' || p[0] == '>' || p[0] == '&') && !p[1])) {
578 if (p[0] == '%' && p[1]) {
581 if (!parse_append_filename(&cmd, msginfo)) {
582 g_string_free(cmd, TRUE);
588 for (cur = GTK_CLIST(ctree)->selection;
589 cur != NULL; cur = cur->next) {
590 msg = gtk_ctree_node_get_row_data(ctree,
591 GTK_CTREE_NODE(cur->data));
592 if (!parse_append_filename(&cmd, msg)) {
593 g_string_free(cmd, TRUE);
597 cmd = g_string_append_c(cmd, ' ');
602 if (!parse_append_msgpart(&cmd, msginfo,
604 g_string_free(cmd, TRUE);
610 cmd = g_string_append_c(cmd, p[0]);
611 cmd = g_string_append_c(cmd, p[1]);
615 cmd = g_string_append_c(cmd, p[0]);
620 g_string_free(cmd, TRUE);
625 g_string_free(cmd, FALSE);
629 static gboolean parse_append_filename(GString **cmd, MsgInfo *msginfo)
633 g_return_val_if_fail(msginfo, FALSE);
635 filename = procmsg_get_message_file(msginfo);
638 *cmd = g_string_append(*cmd, filename);
641 alertpanel_error(_("Could not get message file %d"),
649 static gboolean parse_append_msgpart(GString **cmd, MsgInfo *msginfo,
660 if ((fp = procmsg_open_message_decrypted(msginfo, &partinfo))
662 alertpanel_error(_("Could not get message file."));
666 if ((fp = procmsg_open_message(msginfo)) == NULL) {
667 alertpanel_error(_("Could not get message file."));
670 partinfo = procmime_scan_mime_header(fp);
674 procmime_mimeinfo_free_all(partinfo);
675 alertpanel_error(_("Could not get message part."));
678 filename = procmsg_get_message_file(msginfo);
680 if (!mimeview->opened) {
681 alertpanel_error(_("No message part selected."));
684 if (!mimeview->file) {
685 alertpanel_error(_("No message file selected."));
688 partinfo = gtk_ctree_node_get_row_data
689 (GTK_CTREE(mimeview->ctree),
691 g_return_val_if_fail(partinfo != NULL, FALSE);
692 filename = mimeview->file;
694 partname = procmime_get_tmp_file_name(partinfo);
696 ret = procmime_get_part(partname, filename, partinfo);
699 procmime_mimeinfo_free_all(partinfo);
704 alertpanel_error(_("Can't get part of multipart message"));
709 *cmd = g_string_append(*cmd, partname);
716 static void prefs_actions_set_dialog(void)
718 GtkCList *clist = GTK_CLIST(actions.actions_clist);
720 gchar *action_str[1];
723 gtk_clist_freeze(clist);
724 gtk_clist_clear(clist);
726 action_str[0] = _("(New)");
727 row = gtk_clist_append(clist, action_str);
728 gtk_clist_set_row_data(clist, row, NULL);
730 for (cur = prefs_common.actions_list; cur != NULL; cur = cur->next) {
733 action[0] = (gchar *)cur->data;
734 row = gtk_clist_append(clist, action);
735 gtk_clist_set_row_data(clist, row, action[0]);
738 gtk_clist_thaw(clist);
741 static void prefs_actions_set_list(void)
746 g_slist_free(prefs_common.actions_list);
747 prefs_common.actions_list = NULL;
749 while ((action = (gchar *)gtk_clist_get_row_data
750 (GTK_CLIST(actions.actions_clist), row)) != NULL) {
751 prefs_common.actions_list =
752 g_slist_append(prefs_common.actions_list, action);
757 #define GET_ENTRY(entry) \
758 entry_text = gtk_entry_get_text(GTK_ENTRY(entry))
760 static gint prefs_actions_clist_set_row(gint row)
762 GtkCList *clist = GTK_CLIST(actions.actions_clist);
765 gchar action[PREFSBUFSIZE];
768 g_return_val_if_fail(row != 0, -1);
770 GET_ENTRY(actions.name_entry);
771 if (entry_text[0] == '\0') {
772 alertpanel_error(_("Menu name is not set."));
776 if (strchr(entry_text, ':')) {
777 alertpanel_error(_("Colon ':' is not allowed in the menu name."));
781 strncpy(action, entry_text, PREFSBUFSIZE - 1);
784 /* Keep space for the ': ' delimiter */
785 len = strlen(action) + 2;
786 if (len >= PREFSBUFSIZE - 1) {
787 alertpanel_error(_("Menu name is too long."));
791 strcat(action, ": ");
793 GET_ENTRY(actions.cmd_entry);
795 if (entry_text[0] == '\0') {
796 alertpanel_error(_("Command line not set."));
800 if (len + strlen(entry_text) >= PREFSBUFSIZE - 1) {
801 alertpanel_error(_("Menu name and command are too long."));
805 if (get_action_type(entry_text) == ACTION_ERROR) {
806 alertpanel_error(_("The command\n%s\nhas a syntax error."),
811 strcat(action, entry_text);
815 row = gtk_clist_append(clist, buf);
818 gtk_clist_set_text(clist, row, 0, action);
819 old_action = (gchar *) gtk_clist_get_row_data(clist, row);
824 buf[0] = g_strdup(action);
826 gtk_clist_set_row_data(clist, row, buf[0]);
828 prefs_actions_set_list();
833 /* callback functions */
835 static void prefs_actions_register_cb(GtkWidget *w, gpointer data)
837 prefs_actions_clist_set_row(-1);
840 static void prefs_actions_substitute_cb(GtkWidget *w, gpointer data)
842 GtkCList *clist = GTK_CLIST(actions.actions_clist);
846 if (!clist->selection) return;
848 row = GPOINTER_TO_INT(clist->selection->data);
849 if (row == 0) return;
851 action = gtk_clist_get_row_data(clist, row);
854 prefs_actions_clist_set_row(row);
857 static void prefs_actions_delete_cb(GtkWidget *w, gpointer data)
859 GtkCList *clist = GTK_CLIST(actions.actions_clist);
863 if (!clist->selection) return;
864 row = GPOINTER_TO_INT(clist->selection->data);
865 if (row == 0) return;
867 if (alertpanel(_("Delete action"),
868 _("Do you really want to delete this action?"),
869 _("Yes"), _("No"), NULL) == G_ALERTALTERNATE)
872 action = gtk_clist_get_row_data(clist, row);
874 gtk_clist_remove(clist, row);
875 prefs_common.actions_list = g_slist_remove(prefs_common.actions_list,
879 static void prefs_actions_up(GtkWidget *w, gpointer data)
881 GtkCList *clist = GTK_CLIST(actions.actions_clist);
884 if (!clist->selection) return;
886 row = GPOINTER_TO_INT(clist->selection->data);
888 gtk_clist_row_move(clist, row, row - 1);
891 static void prefs_actions_down(GtkWidget *w, gpointer data)
893 GtkCList *clist = GTK_CLIST(actions.actions_clist);
896 if (!clist->selection) return;
898 row = GPOINTER_TO_INT(clist->selection->data);
899 if (row > 0 && row < clist->rows - 1)
900 gtk_clist_row_move(clist, row, row + 1);
903 #define ENTRY_SET_TEXT(entry, str) \
904 gtk_entry_set_text(GTK_ENTRY(entry), str ? str : "")
906 static void prefs_actions_select(GtkCList *clist, gint row, gint column,
911 gchar buf[PREFSBUFSIZE];
912 action = gtk_clist_get_row_data(clist, row);
915 ENTRY_SET_TEXT(actions.name_entry, "");
916 ENTRY_SET_TEXT(actions.cmd_entry, "");
920 strncpy(buf, action, PREFSBUFSIZE - 1);
921 buf[PREFSBUFSIZE - 1] = 0x00;
922 cmd = strstr(buf, ": ");
925 ENTRY_SET_TEXT(actions.cmd_entry, &cmd[2]);
930 ENTRY_SET_TEXT(actions.name_entry, buf);
933 static void prefs_actions_row_move(GtkCList *clist,
934 gint source_row, gint dest_row)
936 prefs_actions_set_list();
937 if (gtk_clist_row_is_visible(clist, dest_row) != GTK_VISIBILITY_FULL) {
938 gtk_clist_moveto(clist, dest_row, -1,
939 source_row < dest_row ? 1.0 : 0.0, 0.0);
943 static gint prefs_actions_deleted(GtkWidget *widget, GdkEventAny *event,
946 prefs_actions_cancel(widget, data);
950 static void prefs_actions_key_pressed(GtkWidget *widget, GdkEventKey *event,
953 if (event && event->keyval == GDK_Escape)
954 prefs_actions_cancel(widget, data);
957 static void prefs_actions_cancel(GtkWidget *w, gpointer data)
959 prefs_actions_read_config();
960 gtk_widget_hide(actions.window);
964 static void prefs_actions_ok(GtkWidget *widget, gpointer data)
966 GtkItemFactory *ifactory;
967 MainWindow *mainwin = (MainWindow *)data;
969 prefs_actions_write_config();
970 ifactory = gtk_item_factory_from_widget(mainwin->menubar);
971 update_mainwin_actions_menu(ifactory, mainwin);
972 gtk_widget_hide(actions.window);
976 void update_mainwin_actions_menu(GtkItemFactory *ifactory,
979 update_actions_menu(ifactory, "/Tools/Actions",
980 mainwin_actions_execute_cb,
984 void update_compose_actions_menu(GtkItemFactory *ifactory,
988 update_actions_menu(ifactory, branch_path,
989 compose_actions_execute_cb,
994 void actions_execute(gpointer data,
999 if (source == TOOLBAR_MAIN)
1000 mainwin_actions_execute_cb((MainWindow*)data, action_nb, widget);
1001 else if (source == TOOLBAR_COMPOSE)
1002 compose_actions_execute_cb((Compose*)data, action_nb, widget);
1003 else if (source == TOOLBAR_MSGVIEW)
1004 msgview_actions_execute_cb((MessageView*)data, action_nb, widget);
1008 static void update_actions_menu(GtkItemFactory *ifactory,
1013 GtkWidget *menuitem;
1016 gchar *action, *action_p;
1018 GtkItemFactoryEntry ifentry = {NULL, NULL, NULL, 0, "<Branch>"};
1020 ifentry.path = branch_path;
1021 menuitem = gtk_item_factory_get_widget(ifactory, branch_path);
1022 g_return_if_fail(menuitem != NULL);
1024 amenu = GTK_MENU_SHELL(menuitem)->children;
1025 while (amenu != NULL) {
1026 GList *alist = amenu->next;
1027 gtk_widget_destroy(GTK_WIDGET(amenu->data));
1031 ifentry.accelerator = NULL;
1032 ifentry.callback_action = 0;
1033 ifentry.callback = callback;
1034 ifentry.item_type = NULL;
1036 for (cur = prefs_common.actions_list; cur; cur = cur->next) {
1037 action = g_strdup((gchar *)cur->data);
1038 action_p = strstr(action, ": ");
1039 if (action_p && action_p[2] &&
1040 get_action_type(&action_p[2]) != ACTION_ERROR) {
1042 menu_path = g_strdup_printf("%s/%s", branch_path,
1044 ifentry.path = menu_path;
1045 gtk_item_factory_create_item(ifactory, &ifentry, data,
1050 ifentry.callback_action++;
1054 static void compose_actions_execute_cb(Compose *compose, guint action_nb,
1057 gchar *buf, *action;
1060 g_return_if_fail(action_nb < g_slist_length(prefs_common.actions_list));
1062 buf = (gchar *)g_slist_nth_data(prefs_common.actions_list, action_nb);
1063 g_return_if_fail(buf != NULL);
1064 action = strstr(buf, ": ");
1065 g_return_if_fail(action != NULL);
1067 /* Point to the beginning of the command-line */
1070 action_type = get_action_type(action);
1071 if (action_type & (ACTION_SINGLE | ACTION_MULTIPLE)) {
1073 (_("The selected action cannot be used in the compose window\n"
1074 "because it contains %%f, %%F or %%p."));
1078 execute_actions(action, NULL, compose->text, NULL, 0, NULL);
1081 static void mainwin_actions_execute_cb(MainWindow *mainwin, guint action_nb,
1084 message_actions_execute(mainwin->messageview, action_nb,
1085 GTK_CTREE(mainwin->summaryview->ctree));
1088 static void msgview_actions_execute_cb(MessageView *msgview, guint action_nb,
1091 message_actions_execute(msgview, action_nb, NULL);
1095 static void message_actions_execute(MessageView *msgview, guint action_nb,
1098 TextView *textview = NULL;
1101 MimeView *mimeview = NULL;
1102 GdkFont *msgfont = NULL;
1104 GtkWidget *text = NULL;
1106 g_return_if_fail(action_nb < g_slist_length(prefs_common.actions_list));
1108 buf = (gchar *)g_slist_nth_data(prefs_common.actions_list, action_nb);
1110 g_return_if_fail(buf);
1111 g_return_if_fail(action = strstr(buf, ": "));
1113 /* Point to the beginning of the command-line */
1116 switch (msgview->type) {
1118 if (msgview->textview && msgview->textview->text)
1119 textview = msgview->textview;
1122 if (msgview->mimeview) {
1123 mimeview = msgview->mimeview;
1124 if (msgview->mimeview->type == MIMEVIEW_TEXT &&
1125 msgview->mimeview->textview &&
1126 msgview->mimeview->textview->text)
1127 textview = msgview->mimeview->textview;
1133 text = textview->text;
1134 msgfont = textview->msgfont;
1135 body_pos = textview->body_pos;
1138 execute_actions(action, ctree, text, msgfont, body_pos, mimeview);
1141 static gboolean execute_actions(gchar *action,
1148 GList *cur, *selection = NULL;
1149 GSList *children_list = NULL;
1151 gint selection_len = 0;
1153 ChildInfo *child_info;
1158 g_return_val_if_fail(action && *action, FALSE);
1160 action_type = get_action_type(action);
1162 if (action_type == ACTION_ERROR)
1163 return FALSE; /* ERR: syntax error */
1165 if (action_type & (ACTION_SINGLE | ACTION_MULTIPLE) &&
1166 !(ctree && GTK_CLIST(ctree)->selection))
1167 return FALSE; /* ERR: file command without selection */
1170 selection = GTK_CLIST(ctree)->selection;
1171 selection_len = g_list_length(selection);
1174 if (action_type & (ACTION_PIPE_OUT | ACTION_PIPE_IN | ACTION_INSERT)) {
1175 if (ctree && selection_len > 1)
1176 return FALSE; /* ERR: pipe + multiple selection */
1178 return FALSE; /* ERR: pipe and no displayed text */
1181 children = g_new0(Children, 1);
1183 if (action_type & ACTION_SINGLE) {
1184 for (cur = selection; cur && is_ok == TRUE; cur = cur->next) {
1185 msginfo = gtk_ctree_node_get_row_data(ctree,
1186 GTK_CTREE_NODE(cur->data));
1188 is_ok = FALSE; /* ERR: msginfo missing */
1191 cmd = parse_action_cmd(action, msginfo, ctree,
1194 debug_print("Action command error\n");
1195 is_ok = FALSE; /* ERR: incorrect command */
1198 if ((child_info = fork_child(cmd, action_type, text,
1201 children_list = g_slist_append(children_list,
1203 children->open_in = (selection_len == 1) ?
1206 ACTION_HIDE_IN)) : 0;
1211 cmd = parse_action_cmd(action, NULL, ctree, mimeview);
1213 if ((child_info = fork_child(cmd, action_type, text,
1216 children_list = g_slist_append(children_list,
1218 children->open_in = action_type &
1224 is_ok = FALSE; /* ERR: incorrect command */
1227 if (!children_list) {
1228 /* If not waiting for children, return */
1233 children->action = g_strdup(action);
1234 children->dialog = NULL;
1235 children->list = children_list;
1236 children->nb = g_slist_length(children_list);
1238 for (cur = children_list; cur; cur = cur->next) {
1239 child_info = (ChildInfo *) cur->data;
1240 child_info->tag_status =
1241 gdk_input_add(child_info->chld_status,
1243 catch_status, child_info);
1246 create_io_dialog(children);
1252 ChildInfo *fork_child(gchar *cmd, gint action_type, GtkWidget *text,
1253 GdkFont *msgfont, gint body_pos, Children *children)
1255 gint chld_in[2], chld_out[2], chld_err[2], chld_status[2];
1257 gint start, end, is_selection;
1260 ChildInfo *child_info;
1263 sync = !(action_type & ACTION_ASYNC);
1265 chld_in[0] = chld_in[1] = chld_out[0] = chld_out[1] = chld_err[0]
1266 = chld_err[1] = chld_status[0] = chld_status[1] = -1;
1269 if (pipe(chld_status) || pipe(chld_in) || pipe(chld_out) ||
1271 alertpanel_error(_("Command could not be started. "
1272 "Pipe creation failed.\n%s"),
1274 /* Closing fd = -1 fails silently */
1281 close(chld_status[0]);
1282 close(chld_status[1]);
1283 return NULL; /* Pipe error */
1287 debug_print("Forking child and grandchild.\n");
1290 if (pid == 0) { /* Child */
1294 close(ConnectionNumber(gdk_display));
1299 if (setpgid(0, getppid()))
1306 close(fileno(stdin));
1312 close(fileno(stdout));
1317 close(fileno(stderr));
1327 execvp("/bin/sh", cmdline);
1331 } else if (gch_pid < (pid_t) 0) { /* Fork error */
1333 write(chld_status[1], "1\n", 2);
1344 close(chld_status[0]);
1347 debug_print("Child: Waiting for grandchild\n");
1348 waitpid(gch_pid, NULL, 0);
1349 debug_print("Child: grandchild ended\n");
1350 write(chld_status[1], "0\n", 2);
1351 close(chld_status[1]);
1355 } else if (pid < 0) { /* Fork error */
1356 alertpanel_error(_("Could not fork to execute the following "
1357 "command:\n%s\n%s"),
1358 cmd, g_strerror(errno));
1365 waitpid(pid, NULL, 0);
1370 if (!(action_type & (ACTION_PIPE_IN | ACTION_OPEN_IN | ACTION_HIDE_IN)))
1374 close(chld_status[1]);
1376 child_info = g_new0(ChildInfo, 1);
1378 child_info->children = children;
1380 child_info->pid = pid;
1381 child_info->cmd = g_strdup(cmd);
1382 child_info->type = action_type;
1383 child_info->new_out = FALSE;
1384 child_info->output = g_string_sized_new(0);
1385 child_info->chld_in =
1387 (ACTION_PIPE_IN | ACTION_OPEN_IN | ACTION_HIDE_IN))
1389 child_info->chld_out = chld_out[0];
1390 child_info->chld_err = chld_err[0];
1391 child_info->chld_status = chld_status[0];
1392 child_info->tag_in = -1;
1393 child_info->tag_out = gdk_input_add(chld_out[0], GDK_INPUT_READ,
1394 catch_output, child_info);
1395 child_info->tag_err = gdk_input_add(chld_err[0], GDK_INPUT_READ,
1396 catch_output, child_info);
1398 if (!(action_type & (ACTION_PIPE_IN | ACTION_PIPE_OUT | ACTION_INSERT)))
1401 child_info->text = text;
1402 child_info->msgfont = msgfont;
1405 end = gtk_stext_get_length(GTK_STEXT(text));
1407 if (GTK_EDITABLE(text)->has_selection) {
1408 start = GTK_EDITABLE(text)->selection_start_pos;
1409 end = GTK_EDITABLE(text)->selection_end_pos;
1416 is_selection = TRUE;
1419 end = gtk_stext_get_length(GTK_STEXT(text));
1420 is_selection = FALSE;
1424 selection = gtk_editable_get_chars(GTK_EDITABLE(text), start, end);
1426 if (action_type & ACTION_PIPE_IN) {
1427 write(chld_in[1], selection, strlen(selection));
1428 if (!(action_type & (ACTION_OPEN_IN | ACTION_HIDE_IN)))
1430 child_info->chld_in = -1; /* No more input */
1434 gtk_stext_freeze(GTK_STEXT(text));
1435 if (action_type & ACTION_PIPE_OUT) {
1436 gtk_stext_set_point(GTK_STEXT(text), start);
1437 gtk_stext_forward_delete(GTK_STEXT(text), end - start);
1440 gtk_stext_thaw(GTK_STEXT(text));
1445 static void kill_children_cb(GtkWidget *widget, gpointer data)
1448 Children *children = (Children *) data;
1449 ChildInfo *child_info;
1451 for (cur = children->list; cur; cur = cur->next) {
1452 child_info = (ChildInfo *)(cur->data);
1453 debug_print("Killing child group id %d\n", child_info->pid);
1454 if (child_info->pid && kill(-child_info->pid, SIGTERM) < 0)
1459 static gint wait_for_children(gpointer data)
1461 gboolean new_output;
1462 Children *children = (Children *)data;
1463 ChildInfo *child_info;
1465 gint nb = children->nb;
1469 cur = children->list;
1472 child_info = (ChildInfo *)cur->data;
1473 if (child_info->pid)
1475 new_output |= child_info->new_out;
1479 children->output |= new_output;
1481 if (new_output || (children->dialog && (nb != children->nb)))
1482 update_io_dialog(children);
1487 if (!children->dialog) {
1488 free_children(children);
1489 } else if (!children->output) {
1490 gtk_widget_destroy(children->dialog);
1496 static void send_input(GtkWidget *w, gpointer data)
1498 Children *children = (Children *) data;
1499 ChildInfo *child_info = (ChildInfo *) children->list->data;
1501 child_info->tag_in = gdk_input_add(child_info->chld_in,
1503 catch_input, children);
1504 gtk_widget_set_sensitive(children->input_hbox, FALSE);
1507 static gint delete_io_dialog_cb(GtkWidget *w, GdkEvent *e, gpointer data)
1509 hide_io_dialog_cb(w, data);
1513 static void hide_io_dialog_cb(GtkWidget *w, gpointer data)
1516 Children *children = (Children *)data;
1518 if (!children->nb) {
1519 gtk_signal_disconnect_by_data(GTK_OBJECT(children->dialog),
1521 gtk_widget_destroy(children->dialog);
1522 free_children(children);
1526 static gint io_dialog_key_pressed_cb(GtkWidget *widget,
1530 if (event && event->keyval == GDK_Escape)
1531 hide_io_dialog_cb(widget, data);
1535 static void childinfo_close_pipes(ChildInfo *child_info)
1537 if (child_info->tag_in > 0)
1538 gdk_input_remove(child_info->tag_in);
1539 gdk_input_remove(child_info->tag_out);
1540 gdk_input_remove(child_info->tag_err);
1542 if (child_info->chld_in >= 0)
1543 close(child_info->chld_in);
1544 close(child_info->chld_out);
1545 close(child_info->chld_err);
1546 close(child_info->chld_status);
1549 static void free_children(Children *children)
1552 ChildInfo *child_info;
1554 debug_print("Freeing children data %p\n", children);
1556 g_free(children->action);
1557 for (cur = children->list; cur;) {
1558 child_info = (ChildInfo *)cur->data;
1559 g_free(child_info->cmd);
1560 g_string_free(child_info->output, TRUE);
1561 children->list = g_slist_remove(children->list, child_info);
1563 cur = children->list;
1568 static void update_io_dialog(Children *children)
1572 debug_print("Updating actions input/output dialog.\n");
1574 if (!children->nb) {
1575 gtk_widget_set_sensitive(children->abort_btn, FALSE);
1576 gtk_widget_set_sensitive(children->close_btn, TRUE);
1577 if (children->input_hbox)
1578 gtk_widget_set_sensitive(children->input_hbox, FALSE);
1579 gtk_widget_grab_focus(children->close_btn);
1580 gtk_signal_connect(GTK_OBJECT(children->dialog),
1582 GTK_SIGNAL_FUNC(io_dialog_key_pressed_cb),
1586 if (children->output) {
1587 GtkWidget *text = children->text;
1589 ChildInfo *child_info;
1591 gtk_widget_show(children->scrolledwin);
1592 gtk_text_freeze(GTK_TEXT(text));
1593 gtk_text_set_point(GTK_TEXT(text), 0);
1594 gtk_text_forward_delete(GTK_TEXT(text),
1595 gtk_text_get_length(GTK_TEXT(text)));
1596 for (cur = children->list; cur; cur = cur->next) {
1597 child_info = (ChildInfo *)cur->data;
1598 if (child_info->pid)
1599 caption = g_strdup_printf
1600 (_("--- Running: %s\n"),
1603 caption = g_strdup_printf
1604 (_("--- Ended: %s\n"),
1607 gtk_text_insert(GTK_TEXT(text), NULL, NULL, NULL,
1609 gtk_text_insert(GTK_TEXT(text), NULL, NULL, NULL,
1610 child_info->output->str, -1);
1612 child_info->new_out = FALSE;
1614 gtk_text_thaw(GTK_TEXT(text));
1618 static void create_io_dialog(Children *children)
1622 GtkWidget *entry = NULL;
1623 GtkWidget *input_hbox = NULL;
1624 GtkWidget *send_button;
1627 GtkWidget *scrolledwin;
1629 GtkWidget *abort_button;
1630 GtkWidget *close_button;
1632 debug_print("Creating action IO dialog\n");
1634 dialog = gtk_dialog_new();
1635 gtk_container_set_border_width
1636 (GTK_CONTAINER(GTK_DIALOG(dialog)->action_area), 5);
1637 gtk_window_set_position(GTK_WINDOW(dialog), GTK_WIN_POS_CENTER);
1638 gtk_window_set_title(GTK_WINDOW(dialog), _("Action's input/output"));
1639 gtk_window_set_modal(GTK_WINDOW(dialog), TRUE);
1640 manage_window_set_transient(GTK_WINDOW(dialog));
1641 gtk_signal_connect(GTK_OBJECT(dialog), "delete_event",
1642 GTK_SIGNAL_FUNC(delete_io_dialog_cb), children);
1643 gtk_signal_connect(GTK_OBJECT(dialog), "destroy",
1644 GTK_SIGNAL_FUNC(hide_io_dialog_cb),
1647 vbox = gtk_vbox_new(FALSE, 8);
1648 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), vbox);
1649 gtk_container_set_border_width(GTK_CONTAINER(vbox), 8);
1650 gtk_widget_show(vbox);
1652 label = gtk_label_new(children->action);
1653 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
1654 gtk_widget_show(label);
1656 scrolledwin = gtk_scrolled_window_new(NULL, NULL);
1657 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolledwin),
1658 GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
1659 gtk_box_pack_start(GTK_BOX(vbox), scrolledwin, TRUE, TRUE, 0);
1660 gtk_widget_set_usize(scrolledwin, 480, 200);
1661 gtk_widget_hide(scrolledwin);
1663 text = gtk_text_new(gtk_scrolled_window_get_hadjustment
1664 (GTK_SCROLLED_WINDOW(scrolledwin)),
1665 gtk_scrolled_window_get_vadjustment
1666 (GTK_SCROLLED_WINDOW(scrolledwin)));
1667 gtk_text_set_editable(GTK_TEXT(text), FALSE);
1668 gtk_container_add(GTK_CONTAINER(scrolledwin), text);
1669 gtk_widget_show(text);
1671 if (children->open_in) {
1672 input_hbox = gtk_hbox_new(FALSE, 8);
1673 gtk_widget_show(input_hbox);
1675 entry = gtk_entry_new();
1676 gtk_widget_set_usize(entry, 320, -1);
1677 gtk_signal_connect(GTK_OBJECT(entry), "activate",
1678 GTK_SIGNAL_FUNC(send_input), children);
1679 gtk_box_pack_start(GTK_BOX(input_hbox), entry, TRUE, TRUE, 0);
1680 if (children->open_in & ACTION_HIDE_IN)
1681 gtk_entry_set_visibility(GTK_ENTRY(entry), FALSE);
1682 gtk_widget_show(entry);
1684 send_button = gtk_button_new_with_label(_(" Send "));
1685 gtk_signal_connect(GTK_OBJECT(send_button), "clicked",
1686 GTK_SIGNAL_FUNC(send_input), children);
1687 gtk_box_pack_start(GTK_BOX(input_hbox), send_button, FALSE,
1689 gtk_widget_show(send_button);
1691 gtk_box_pack_start(GTK_BOX(vbox), input_hbox, FALSE, FALSE, 0);
1692 gtk_widget_grab_focus(entry);
1695 gtkut_button_set_create(&hbox, &abort_button, _("Abort"),
1696 &close_button, _("Close"), NULL, NULL);
1697 gtk_signal_connect(GTK_OBJECT(abort_button), "clicked",
1698 GTK_SIGNAL_FUNC(kill_children_cb), children);
1699 gtk_signal_connect(GTK_OBJECT(close_button), "clicked",
1700 GTK_SIGNAL_FUNC(hide_io_dialog_cb), children);
1701 gtk_widget_show(hbox);
1704 gtk_widget_set_sensitive(close_button, FALSE);
1706 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->action_area), hbox);
1708 children->dialog = dialog;
1709 children->scrolledwin = scrolledwin;
1710 children->text = text;
1711 children->input_hbox = children->open_in ? input_hbox : NULL;
1712 children->input_entry = children->open_in ? entry : NULL;
1713 children->abort_btn = abort_button;
1714 children->close_btn = close_button;
1716 gtk_widget_show(dialog);
1719 static void catch_status(gpointer data, gint source, GdkInputCondition cond)
1721 ChildInfo *child_info = (ChildInfo *)data;
1725 gdk_input_remove(child_info->tag_status);
1727 c = read(source, &buf, 1);
1728 debug_print("Child returned %c\n", buf);
1730 waitpid(-child_info->pid, NULL, 0);
1731 childinfo_close_pipes(child_info);
1732 child_info->pid = 0;
1734 wait_for_children(child_info->children);
1737 static void catch_input(gpointer data, gint source, GdkInputCondition cond)
1739 Children *children = (Children *)data;
1740 ChildInfo *child_info = (ChildInfo *)children->list->data;
1744 debug_print("Sending input to grand child.\n");
1745 if (!(cond && GDK_INPUT_WRITE))
1748 gdk_input_remove(child_info->tag_in);
1749 child_info->tag_in = -1;
1751 input = gtk_editable_get_chars(GTK_EDITABLE(children->input_entry),
1753 c = write(child_info->chld_in, input, strlen(input));
1757 write(child_info->chld_in, "\n", 2);
1759 gtk_entry_set_text(GTK_ENTRY(children->input_entry), "");
1760 gtk_widget_set_sensitive(children->input_hbox, TRUE);
1761 debug_print("Input to grand child sent.\n");
1764 static void catch_output(gpointer data, gint source, GdkInputCondition cond)
1766 ChildInfo *child_info = (ChildInfo *)data;
1768 gchar buf[PREFSBUFSIZE];
1770 debug_print("Catching grand child's output.\n");
1771 if (child_info->type & (ACTION_PIPE_OUT | ACTION_INSERT)
1772 && source == child_info->chld_out) {
1773 gboolean is_selection = FALSE;
1774 GtkWidget *text = child_info->text;
1775 if (GTK_EDITABLE(text)->has_selection)
1776 is_selection = TRUE;
1777 gtk_stext_freeze(GTK_STEXT(text));
1779 c = read(source, buf, PREFSBUFSIZE - 1);
1782 gtk_stext_insert(GTK_STEXT(text), child_info->msgfont,
1783 NULL, NULL, buf, c);
1786 /* Using the select_region draws things. Should not.
1787 * so we just change selection position and
1788 * defere drawing when thawing. Hack?
1790 GTK_EDITABLE(text)->selection_end_pos =
1791 gtk_stext_get_point(GTK_STEXT(text));
1793 gtk_stext_thaw(GTK_STEXT(child_info->text));
1795 c = read(source, buf, PREFSBUFSIZE - 1);
1796 for (i = 0; i < c; i++)
1797 child_info->output = g_string_append_c
1798 (child_info->output, buf[i]);
1800 child_info->new_out = TRUE;
1802 wait_for_children(child_info->children);
1806 * Strings describing action format strings
1808 * When adding new lines, remember to put one string for each line
1810 static gchar *actions_desc_strings[] = {
1811 N_("MENU NAME:"), NULL,
1812 " ", N_("Use / in menu name to make submenus."),
1814 N_("COMMAND LINE:"), NULL,
1815 N_("Begin with:"), NULL,
1816 " |", N_("to send message body or selection to command"),
1817 " >", N_("to send user provided text to command"),
1818 " *", N_("to send user provided hidden text to command"),
1819 N_("End with:"), NULL,
1820 " |", N_("to replace message body or selection with command output"),
1821 " >", N_("to insert command's output without replacing old text"),
1822 " &", N_("to run command asynchronously"),
1824 " %f", N_("for message file name"),
1825 " %F", N_("for the list of the file names of selected messages"),
1826 " %p", N_("for the selected message MIME part."),
1831 static DescriptionWindow actions_desc_win = {
1834 N_("Description of symbols"),
1835 actions_desc_strings
1839 static void prefs_actions_help_cb(GtkWidget *w, gpointer data)
1841 description_window_create(&actions_desc_win);