New trailing
authorMelvin Hadasht <melvin.hadasht@free.fr>
Fri, 6 Dec 2002 09:24:51 +0000 (09:24 +0000)
committerMelvin Hadasht <melvin.hadasht@free.fr>
Fri, 6 Dec 2002 09:24:51 +0000 (09:24 +0000)
ChangeLog.claws
configure.in
src/prefs_actions.c

index 8b0f0a58aa2983e27fdd2cfdd81a4fdc58637d75..735d78496248b7dee7bc4a615045b5f0beaa9be5 100644 (file)
@@ -1,3 +1,9 @@
+2002-12-06 [melvin]    0.8.6claws66
+
+       * src/prefs_actions.c
+               Added the trailing ">" syntax to insert command's output
+               without replacing old text (in contrast to trailing "|").
+
 2002-12-05 [colin]     0.8.6claws65
        
        * src/common/utils.c
index bbb2a841387ab56c3441fa8cc2ccc2b3234ca40f..7b88665a9d2b6c0890b35e1780fb088e1d160651 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=8
 MICRO_VERSION=6
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=claws65
+EXTRA_VERSION=claws66
 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
 
 dnl set $target
index 5d247e958a320d85a74a36e8f02f3370fb7c31e8..a36963262398c1b01b9a507e9d93b102636964ed 100644 (file)
@@ -62,7 +62,8 @@ typedef enum
        ACTION_ASYNC    = 1 << 5,
        ACTION_OPEN_IN  = 1 << 6,
        ACTION_HIDE_IN  = 1 << 7,
-       ACTION_ERROR    = 1 << 8,
+       ACTION_INSERT   = 1 << 8,
+       ACTION_ERROR    = 1 << 9,
 } ActionType;
 
 static struct Actions
@@ -342,6 +343,7 @@ static void prefs_actions_create(MainWindow *mainwin)
                   "   * 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"
@@ -568,6 +570,9 @@ static guint get_action_type(gchar *action)
                } else if (p[0] == '|') {
                        if (p[1] == 0x00)
                                action_type |= ACTION_PIPE_OUT;
+               } else if (p[0] == '>') {
+                       if (p[1] == 0x00)
+                               action_type |= ACTION_INSERT;
                } else if (p[0] == '&') {
                        if (p[1] == 0x00)
                                action_type |= ACTION_ASYNC;
@@ -595,7 +600,8 @@ static gchar *parse_action_cmd(gchar *action, MsgInfo *msginfo,
 
        cmd = g_string_sized_new(strlen(action));
 
-       while (p[0] && !(p[0] == '|' && !p[1]) && p[0] != '&') {
+       while (p[0] &&
+              !((p[0] == '|' || p[0] == '>' || p[0] == '&') && !p[1])) {
                if (p[0] == '%' && p[1]) {
                        switch (p[1]) {
                        case 'f':
@@ -1169,7 +1175,7 @@ static gboolean execute_actions(gchar *action, GtkWidget *window,
                selection_len = g_list_length(selection);
        }
 
-       if (action_type & (ACTION_PIPE_OUT | ACTION_PIPE_IN)) {
+       if (action_type & (ACTION_PIPE_OUT | ACTION_PIPE_IN | ACTION_INSERT)) {
                if (ctree && selection_len > 1)
                        return FALSE; /* ERR: pipe + multiple selection */
                if (!text)
@@ -1394,7 +1400,7 @@ ChildInfo *fork_child(gchar *cmd, gint action_type, GtkWidget *text,
        child_info->tag_err     = gdk_input_add(chld_err[0], GDK_INPUT_READ,
                                                catch_output, child_info);
 
-       if (!(action_type & (ACTION_PIPE_IN | ACTION_PIPE_OUT)))
+       if (!(action_type & (ACTION_PIPE_IN | ACTION_PIPE_OUT | ACTION_INSERT)))
                return child_info;
 
        child_info->text        = text;
@@ -1753,7 +1759,7 @@ static void catch_output(gpointer data, gint source, GdkInputCondition cond)
        gchar buf[PREFSBUFSIZE];
 
        debug_print("Catching grand child's output.\n");
-       if (child_info->type & ACTION_PIPE_OUT
+       if (child_info->type & (ACTION_PIPE_OUT | ACTION_INSERT)
            && source == child_info->chld_out) {
                gboolean is_selection = FALSE;
                GtkWidget *text = child_info->text;