2005-01-27 [colin] 1.0.0cvs16
authorColin Leroy <colin@colino.net>
Thu, 27 Jan 2005 10:51:15 +0000 (10:51 +0000)
committerColin Leroy <colin@colino.net>
Thu, 27 Jan 2005 10:51:15 +0000 (10:51 +0000)
* src/messageview.c
* src/summaryview.c
* src/compose.c
* src/compose.h
* src/toolbar.c
* src/mainwindow.c
Factorize this reply mess

ChangeLog.claws
PATCHSETS
configure.ac
src/compose.c
src/compose.h
src/mainwindow.c
src/messageview.c
src/summaryview.c
src/toolbar.c

index 390e591..e2fc3b8 100644 (file)
@@ -1,3 +1,13 @@
+2005-01-27 [colin]     1.0.0cvs16
+
+       * src/messageview.c
+       * src/summaryview.c
+       * src/compose.c
+       * src/compose.h
+       * src/toolbar.c
+       * src/mainwindow.c
+               Factorize this reply mess
+
 2005-01-26 [paul]      1.0.0cvs15
 
        * ChangeLog
index ee67750..3e391d0 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.456 -r 1.457 src/summaryview.c; ) > 1.0.0cvs13.patchset
 ( cvs diff -u -r 1.466 -r 1.467 src/compose.c; ) > 1.0.0cvs14.patchset
 ( cvs diff -u -r 1.456 -r 1.457 ChangeLog; cvs diff -u -r 1.451 -r 1.452 ChangeLog.jp; cvs diff -u -r 1.3 -r 1.4 src/common/template.c; ) > 1.0.0cvs15.patchset
+( cvs diff -u -r 1.129 -r 1.130 src/messageview.c; cvs diff -u -r 1.457 -r 1.458 src/summaryview.c; cvs diff -u -r 1.467 -r 1.468 src/compose.c; cvs diff -u -r 1.57 -r 1.58 src/compose.h; cvs diff -u -r 1.56 -r 1.57 src/toolbar.c; cvs diff -u -r 1.316 -r 1.317 src/mainwindow.c; ) > 1.0.0cvs16.patchset
index d280ab3..82e0411 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=0
 MICRO_VERSION=0
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=15
+EXTRA_VERSION=16
 EXTRA_RELEASE=
 
 if test \( $EXTRA_VERSION -eq 0 \) -o \( "x$EXTRA_RELEASE" != "x" \); then
index 82d7791..78c7478 100644 (file)
@@ -6923,3 +6923,16 @@ static void compose_add_field_list( Compose *compose, GList *listAddress ) {
  * End of Source.
  */
 
+void compose_reply_from_messageview(MessageView *msgview, GSList *msginfo_list, 
+                                   guint action)
+{
+       gchar *body;
+
+       g_return_if_fail(msgview != NULL);
+
+       g_return_if_fail(msginfo_list != NULL);
+
+       body = messageview_get_selection(msgview);
+       compose_reply_mode((ComposeMode)action, msginfo_list, body);
+       g_free(body);
+}
index a442584..80a550a 100644 (file)
@@ -33,6 +33,7 @@ typedef struct _AttachInfo    AttachInfo;
 #include "prefs_account.h"
 #include "undo.h"
 #include "toolbar.h"
+#include "messageview.h"
 
 #ifdef USE_ASPELL
 #include "gtkaspell.h"
@@ -279,5 +280,8 @@ void compose_destroy_all                (void);
 void compose_draft                     (gpointer data);
 void compose_toolbar_cb                        (gint           action, 
                                         gpointer       data);
+void compose_reply_from_messageview    (MessageView    *msgview, 
+                                        GSList         *msginfo_list, 
+                                        guint           action);
 
 #endif /* __COMPOSE_H__ */
index 7b36423..498f824 100644 (file)
@@ -2455,16 +2455,12 @@ void main_window_reply_cb(MainWindow *mainwin, guint action,
 {
        MessageView *msgview = (MessageView*)mainwin->messageview;
        GSList *msginfo_list = NULL;
-       gchar *body;
 
        g_return_if_fail(msgview != NULL);
 
        msginfo_list = summary_get_selection(mainwin->summaryview);
        g_return_if_fail(msginfo_list != NULL);
-       
-       body = messageview_get_selection(msgview);
-       compose_reply_mode((ComposeMode)action, msginfo_list, body);
-       g_free(body);
+       compose_reply_from_messageview(msgview, msginfo_list, action);
        g_slist_free(msginfo_list);
 }
 
index 5e0dfa9..d4b3cb8 100644 (file)
@@ -1363,94 +1363,14 @@ static void compose_cb(gpointer data, guint action, GtkWidget *widget)
 static void reply_cb(gpointer data, guint action, GtkWidget *widget)
 {
        MessageView *messageview = (MessageView *)data;
-       GSList *mlist = NULL;
+       GSList *msginfo_list = NULL;
        MsgInfo *msginfo;
-       gchar *text = NULL;
-       ComposeMode mode = (ComposeMode)action;
-       TextView *textview;
-
-       msginfo = messageview->msginfo;
-       mlist = g_slist_append(NULL, msginfo);
 
-       textview = messageview_get_current_textview(messageview);
-       text = gtkut_editable_get_selection
-               (GTK_EDITABLE(textview->text));
-       if (text && *text == '\0') {
-               g_free(text);
-               text = NULL;
-       }
+       g_return_if_fail(messageview->msginfo);
 
-       switch (mode) {
-       case COMPOSE_REPLY:
-               compose_reply(msginfo, prefs_common.reply_with_quote,
-                             FALSE, prefs_common.default_reply_list, FALSE, text);
-               break;
-       case COMPOSE_REPLY_WITH_QUOTE:
-               compose_reply(msginfo, TRUE, FALSE, prefs_common.default_reply_list, FALSE, text);
-               break;
-       case COMPOSE_REPLY_WITHOUT_QUOTE:
-               compose_reply(msginfo, FALSE, FALSE, prefs_common.default_reply_list, FALSE, NULL);
-               break;
-       case COMPOSE_REPLY_TO_SENDER:
-               compose_reply(msginfo, prefs_common.reply_with_quote,
-                             FALSE, FALSE, TRUE, text);
-               break;
-       case COMPOSE_FOLLOWUP_AND_REPLY_TO:
-               compose_followup_and_reply_to(msginfo,
-                                             prefs_common.reply_with_quote,
-                                             FALSE, FALSE, text);
-               break;
-       case COMPOSE_REPLY_TO_SENDER_WITH_QUOTE:
-               compose_reply(msginfo, TRUE, FALSE, FALSE, TRUE, text);
-               break;
-       case COMPOSE_REPLY_TO_SENDER_WITHOUT_QUOTE:
-               compose_reply(msginfo, FALSE, FALSE, FALSE, TRUE, NULL);
-               break;
-       case COMPOSE_REPLY_TO_ALL:
-               compose_reply(msginfo, prefs_common.reply_with_quote,
-                             TRUE, FALSE, FALSE, text);
-               break;
-       case COMPOSE_REPLY_TO_ALL_WITH_QUOTE:
-               compose_reply(msginfo, TRUE, TRUE, FALSE, FALSE, text);
-               break;
-       case COMPOSE_REPLY_TO_ALL_WITHOUT_QUOTE:
-               compose_reply(msginfo, FALSE, TRUE, FALSE, FALSE, NULL);
-               break;
-       case COMPOSE_REPLY_TO_LIST:
-               compose_reply(msginfo, prefs_common.reply_with_quote,
-                             FALSE, TRUE, FALSE, text);
-               break;
-       case COMPOSE_REPLY_TO_LIST_WITH_QUOTE:
-               compose_reply(msginfo, TRUE, FALSE, TRUE, FALSE, text);
-               break;
-       case COMPOSE_REPLY_TO_LIST_WITHOUT_QUOTE:
-               compose_reply(msginfo, FALSE, FALSE, TRUE, FALSE, NULL);
-               break;
-       case COMPOSE_FORWARD:
-               if (prefs_common.forward_as_attachment) {
-                       compose_reply_mode(COMPOSE_FORWARD_AS_ATTACH, mlist, text);
-                       return;
-               } else {
-                       compose_reply_mode(COMPOSE_FORWARD_INLINE, mlist, text);
-                       return;
-               }
-               break;
-       case COMPOSE_FORWARD_INLINE:
-               compose_forward(NULL, msginfo, FALSE, text, FALSE);
-               break;
-       case COMPOSE_FORWARD_AS_ATTACH:
-               compose_forward_multiple(NULL, mlist);
-               break;
-       case COMPOSE_REDIRECT:
-               compose_redirect(NULL, msginfo);
-               break;
-       default:
-               g_warning("compose_reply(): invalid Compose Mode: %d\n", mode);
-       }
-
-       /* summary_set_marks_selected(summaryview); */
-       g_free(text);
-       g_slist_free(mlist);
+       msginfo_list = g_slist_append(msginfo_list, messageview->msginfo);
+       compose_reply_from_messageview(messageview, msginfo_list, action);
+       g_list_free(msginfo_list);
 }
 
 static void reedit_cb(gpointer data, guint action, GtkWidget *widget)
index fc32c31..d87da2f 100644 (file)
@@ -4621,17 +4621,12 @@ static void summary_reply_cb(SummaryView *summaryview, guint action,
 {
        MessageView *msgview = (MessageView*)summaryview->messageview;
        GSList *msginfo_list;
-       gchar *body;
 
        g_return_if_fail(msgview != NULL);
 
        msginfo_list = summary_get_selection(summaryview);
        g_return_if_fail(msginfo_list != NULL);
-
-       body = messageview_get_selection(msgview);
-
-       compose_reply_mode((ComposeMode)action, msginfo_list, body);
-       g_free(body);
+       compose_reply_from_messageview(msgview, msginfo_list, action);
        g_slist_free(msginfo_list);
 }
 
index 576d636..2b54778 100644 (file)
@@ -1811,7 +1811,6 @@ static void toolbar_reply(gpointer data, guint action)
        MainWindow *mainwin;
        MessageView *msgview;
        GSList *msginfo_list = NULL;
-       gchar *body;
 
        g_return_if_fail(toolbar_item != NULL);
 
@@ -1823,6 +1822,7 @@ static void toolbar_reply(gpointer data, guint action)
                break;
        case TOOLBAR_MSGVIEW:
                msgview = (MessageView*)toolbar_item->parent;
+               g_return_if_fail(msgview != NULL);      
                msginfo_list = g_slist_append(msginfo_list, msgview->msginfo);
                break;
        default:
@@ -1830,12 +1830,8 @@ static void toolbar_reply(gpointer data, guint action)
        }
 
        g_return_if_fail(msgview != NULL);
-       body = messageview_get_selection(msgview);
-
        g_return_if_fail(msginfo_list != NULL);
-       compose_reply_mode((ComposeMode)action, msginfo_list, body);
-
-       g_free(body);
+       compose_reply_from_messageview(msgview, msginfo_list, action);
        g_slist_free(msginfo_list);
 
        /* TODO: update reply state ion summaryview */