2005-06-22 [colin] 1.9.11cvs90
[claws.git] / src / toolbar.c
index 429c5b74f61bd37571f682d395f439e5b795bf08..e6ff75175f91ccc028ad88f2aaf4907d6ccf54d7 100644 (file)
@@ -28,6 +28,7 @@
 #include "defs.h"
 
 #include <glib.h>
+#include <glib/gi18n.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <dirent.h>
@@ -35,7 +36,6 @@
 #include <math.h>
 #include <setjmp.h>
 
-#include "intl.h"
 #include "mainwindow.h"
 #include "summaryview.h"
 #include "compose.h"
@@ -154,7 +154,7 @@ struct {
 } toolbar_text [] = {
        { "A_RECEIVE_ALL",      N_("Receive Mail on all Accounts")         },
        { "A_RECEIVE_CUR",      N_("Receive Mail on current Account")      },
-       { "A_SEND_QUEUED",      N_("Send Queued Message(s)")               },
+       { "A_SEND_QUEUED",      N_("Send Queued Messages")                 },
        { "A_COMPOSE_EMAIL",    N_("Compose Email")                        },
        { "A_COMPOSE_NEWS",     N_("Compose News")                         },
        { "A_REPLY_MESSAGE",    N_("Reply to Message")                     },
@@ -232,7 +232,7 @@ gint toolbar_ret_val_from_descr(const gchar *descr)
        gint i;
 
        for (i = 0; i < N_ACTION_VAL; i++) {
-               if (g_strcasecmp(gettext(toolbar_text[i].descr), descr) == 0)
+               if (g_utf8_collate(gettext(toolbar_text[i].descr), descr) == 0)
                                return i;
        }
        
@@ -251,7 +251,7 @@ static gint toolbar_ret_val_from_text(const gchar *text)
        gint i;
        
        for (i = 0; i < N_ACTION_VAL; i++) {
-               if (g_strcasecmp(toolbar_text[i].index_str, text) == 0)
+               if (g_utf8_collate(toolbar_text[i].index_str, text) == 0)
                                return i;
        }
        
@@ -345,11 +345,11 @@ static void toolbar_parse_item(XMLFile *file, ToolbarType source)
                name = ((XMLAttr *)attr->data)->name;
                value = ((XMLAttr *)attr->data)->value;
                
-               if (g_strcasecmp(name, TOOLBAR_ICON_FILE) == 0) 
+               if (g_utf8_collate(name, TOOLBAR_ICON_FILE) == 0) 
                        item->file = g_strdup (value);
-               else if (g_strcasecmp(name, TOOLBAR_ICON_TEXT) == 0)
+               else if (g_utf8_collate(name, TOOLBAR_ICON_TEXT) == 0)
                        item->text = g_strdup (value);
-               else if (g_strcasecmp(name, TOOLBAR_ICON_ACTION) == 0)
+               else if (g_utf8_collate(name, TOOLBAR_ICON_ACTION) == 0)
                        item->index = toolbar_ret_val_from_text(value);
 
                attr = g_list_next(attr);
@@ -528,8 +528,7 @@ void toolbar_save_config_file(ToolbarType source)
        g_free( fileSpec );
        if( pfile ) {
                fp = pfile->fp;
-               fprintf(fp, "<?xml version=\"1.0\" encoding=\"%s\" ?>\n",
-                       conv_get_current_charset_str());
+               fprintf(fp, "<?xml version=\"1.0\" encoding=\"%s\" ?>\n", CS_INTERNAL);
 
                fprintf(fp, "<%s>\n", TOOLBAR_TAG_INDEX);
 
@@ -693,7 +692,7 @@ void toolbar_action_execute(GtkWidget    *widget,
 
                                action_p = strstr(action, ": ");
                                action_p[0] = 0x00;
-                               if (g_strcasecmp(act->name, action) == 0) {
+                               if (g_utf8_collate(act->name, action) == 0) {
                                        found = TRUE;
                                        g_free(action);
                                        break;
@@ -779,7 +778,7 @@ void toolbar_set_style(GtkWidget *toolbar_wid, GtkWidget *handlebox_wid, guint a
        }
 
        prefs_common.toolbar_style = (ToolbarStyle)action;
-       gtk_widget_set_usize(handlebox_wid, 1, -1);
+       gtk_widget_set_size_request(handlebox_wid, 1, -1);
        
        if (prefs_common.toolbar_style != TOOLBAR_NONE) {
                gtk_widget_show(handlebox_wid);
@@ -899,7 +898,7 @@ static void toolbar_delete_cb(GtkWidget *widget, gpointer data)
                break;
         case TOOLBAR_MAIN:
                mainwin = (MainWindow *)toolbar_item->parent;
-               summary_delete(mainwin->summaryview);
+               summary_delete_trash(mainwin->summaryview);
                break;
         default: 
                debug_print("toolbar event not supported\n");
@@ -1302,7 +1301,7 @@ Toolbar *toolbar_create(ToolbarType        type,
        
        for (cur = toolbar_list; cur != NULL; cur = cur->next) {
 
-               if (g_strcasecmp(((ToolbarItem*)cur->data)->file, TOOLBAR_TAG_SEPARATOR) == 0) {
+               if (g_ascii_strcasecmp(((ToolbarItem*)cur->data)->file, TOOLBAR_TAG_SEPARATOR) == 0) {
                        gtk_toolbar_append_space(GTK_TOOLBAR(toolbar));
                        continue;
                }
@@ -1345,7 +1344,7 @@ Toolbar *toolbar_create(ToolbarType        type,
                        toolbar_data->send_btn = item; 
                        gtk_tooltips_set_tip(GTK_TOOLTIPS(toolbar_tips), 
                                             toolbar_data->send_btn,
-                                          _("Send Queued Message(s)"), NULL);
+                                          _("Send Queued Messages"), NULL);
                        break;
                case A_COMPOSE_EMAIL:
                        icon_news = stock_pixmap_widget(container, STOCK_PIXMAP_NEWS_COMPOSE);
@@ -1683,6 +1682,10 @@ void toolbar_main_set_sensitive(gpointer data)
        if (toolbar->fwd_btn)
                SET_WIDGET_COND(GTK_WIDGET_PTR(toolbar->fwd_combo),
                        M_HAVE_ACCOUNT|M_TARGET_EXIST); 
+       if (toolbar->fwd_combo) {
+               GtkWidget *submenu = gtk_item_factory_get_widget(toolbar->fwd_combo->factory, "/Redirect");
+               SET_WIDGET_COND(submenu, M_HAVE_ACCOUNT|M_SINGLE_TARGET_EXIST); 
+       }
 
        if (prefs_common.next_unread_msg_dialog == NEXTUNREADMSGDIALOG_ASSUME_NO) {
                SET_WIDGET_COND(toolbar->next_btn, M_MSG_EXIST);
@@ -1808,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);
 
@@ -1820,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:
@@ -1827,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 */
@@ -1869,7 +1868,10 @@ void send_queue_cb(gpointer data, guint action, GtkWidget *widget)
                Folder *folder = list->data;
 
                if (folder->queue) {
-                       procmsg_send_queue(folder->queue, prefs_common.savemsg);
+                       if (procmsg_send_queue(folder->queue, 
+                                              prefs_common.savemsg) < 0)
+                               alertpanel_error(_("Some errors occurred while "
+                                                  "sending queued messages."));
                        folder_item_scan(folder->queue);
                }
        }