2005-02-24 [colin] 1.0.1cvs15.10
[claws.git] / src / messageview.c
index d98eb1448814f4a7147f8b764520a6889bc87dee..d2e22da4945fb082f7a6dd2709eed30688295145 100644 (file)
@@ -20,6 +20,7 @@
 #include "defs.h"
 
 #include <glib.h>
+#include <glib/gi18n.h>
 #include <gdk/gdkkeysyms.h>
 #include <gtk/gtkvbox.h>
 #include <gtk/gtkcontainer.h>
@@ -32,7 +33,6 @@
 #include <ctype.h>
 #include <string.h>
 
-#include "intl.h"
 #include "main.h"
 #include "messageview.h"
 #include "message_search.h"
@@ -178,17 +178,14 @@ static GtkItemFactoryEntry msgview_entries[] =
        {N_("/_View/_Code set/7bit ascii (US-ASC_II)"),
         CODESET_ACTION(C_US_ASCII)},
 
-#if HAVE_ICONV
        {N_("/_View/_Code set/Unicode (_UTF-8)"),
         CODESET_ACTION(C_UTF_8)},
        CODESET_SEPARATOR,
-#endif
        {N_("/_View/_Code set/Western European (ISO-8859-_1)"),
         CODESET_ACTION(C_ISO_8859_1)},
        {N_("/_View/_Code set/Western European (ISO-8859-15)"),
         CODESET_ACTION(C_ISO_8859_15)},
        CODESET_SEPARATOR,
-#if HAVE_ICONV
        {N_("/_View/_Code set/Central European (ISO-8859-_2)"),
         CODESET_ACTION(C_ISO_8859_2)},
        CODESET_SEPARATOR,
@@ -212,18 +209,14 @@ static GtkItemFactoryEntry msgview_entries[] =
        {N_("/_View/_Code set/Cyrillic (Windows-1251)"),
         CODESET_ACTION(C_CP1251)},
        CODESET_SEPARATOR,
-#endif
        {N_("/_View/_Code set/Japanese (ISO-2022-_JP)"),
         CODESET_ACTION(C_ISO_2022_JP)},
-#if HAVE_ICONV
        {N_("/_View/_Code set/Japanese (ISO-2022-JP-2)"),
         CODESET_ACTION(C_ISO_2022_JP_2)},
-#endif
        {N_("/_View/_Code set/Japanese (_EUC-JP)"),
         CODESET_ACTION(C_EUC_JP)},
        {N_("/_View/_Code set/Japanese (_Shift__JIS)"),
         CODESET_ACTION(C_SHIFT_JIS)},
-#if HAVE_ICONV
        CODESET_SEPARATOR,
        {N_("/_View/_Code set/Simplified Chinese (_GB2312)"),
         CODESET_ACTION(C_GB2312)},
@@ -243,7 +236,6 @@ static GtkItemFactoryEntry msgview_entries[] =
         CODESET_ACTION(C_TIS_620)},
        {N_("/_View/_Code set/Thai (Windows-874)"),
         CODESET_ACTION(C_WINDOWS_874)},
-#endif
 
 #undef CODESET_SEPARATOR
 #undef CODESET_ACTION
@@ -666,7 +658,13 @@ static gint disposition_notification_send(MsgInfo *msginfo)
                unlink(tmp);
                return -1;
        }
-       
+               
+       if (prefs_common.work_offline)
+               if (alertpanel(_("Offline warning"), 
+                              _("You're working offline. Override?"),
+                              _("Yes"), _("No"), NULL) != G_ALERTDEFAULT)
+                       return 0;
+
        /* send it */
        path = folder_item_fetch_msg(queue, num);
        ok = procmsg_send_message_queue(path);
@@ -757,6 +755,13 @@ gint messageview_show(MessageView *messageview, MsgInfo *msginfo,
        else 
                noticeview_hide(messageview->noticeview);
 
+       mimeinfo = procmime_mimeinfo_next(mimeinfo);
+       if (mimeinfo && (mimeinfo->type != MIMETYPE_TEXT || 
+           (strcmp(mimeinfo->subtype, "plain") &&
+            strcmp(mimeinfo->subtype, "html")))) {
+               mimeview_show_part(messageview->mimeview,mimeinfo);
+       }
+
        g_free(file);
 
        return 0;
@@ -915,10 +920,28 @@ void messageview_copy_clipboard(MessageView *messageview)
 void messageview_select_all(MessageView *messageview)
 {
        TextView *text;
+       GtkTextView *edit = NULL;
+       GtkTextBuffer *textbuf;
+       gint body_pos = 0;
+       GtkTextIter start, end;
+       
+       g_return_if_fail(messageview != NULL);
 
        text = messageview_get_current_textview(messageview);
-       if (text)
-               gtk_editable_select_region(GTK_EDITABLE(text->text), 0, -1);
+       g_return_if_fail(text != NULL);
+
+       edit = GTK_TEXT_VIEW(text->text);
+       g_return_if_fail(edit != NULL);
+
+       textbuf = gtk_text_view_get_buffer(edit);
+       g_return_if_fail(textbuf != NULL);
+
+       gtk_text_buffer_get_bounds(textbuf, &start, &end);
+       
+       gtk_text_buffer_move_mark_by_name(textbuf, 
+               "selection_bound", &start);
+       gtk_text_buffer_move_mark_by_name(textbuf, 
+               "insert", &end);
 }
 
 void messageview_set_position(MessageView *messageview, gint pos)
@@ -979,7 +1002,7 @@ void messageview_save_as(MessageView *messageview)
 
                aval = alertpanel(_("Overwrite"),
                                  _("Overwrite existing file?"),
-                                 _("OK"), _("Cancel"), NULL);
+                                 GTK_STOCK_OK, GTK_STOCK_CANCEL, NULL);
                if (G_ALERTDEFAULT != aval) return;
        }
 
@@ -1387,7 +1410,7 @@ static void reply_cb(gpointer data, guint action, GtkWidget *widget)
 
        msginfo_list = g_slist_append(msginfo_list, messageview->msginfo);
        compose_reply_from_messageview(messageview, msginfo_list, action);
-       g_list_free(msginfo_list);
+       g_slist_free(msginfo_list);
 }
 
 static void reedit_cb(gpointer data, guint action, GtkWidget *widget)