#include <tny-list.h>
#include <tny-iterator.h>
#include <tny-maemo-conic-device.h>
+#include <tny-error.h>
#include "modest-hildon-includes.h"
#include "modest-defs.h"
#include <string.h>
{ "HeaderViewCSMCut", NULL, N_("mcen_me_inbox_cut"), "<CTRL>X", NULL, G_CALLBACK (modest_ui_actions_on_cut) },
{ "HeaderViewCSMCopy", NULL, N_("mcen_me_inbox_copy"), "<CTRL>C", NULL, G_CALLBACK (modest_ui_actions_on_copy) },
{ "HeaderViewCSMPaste", NULL, N_("mcen_me_inbox_paste"), "<CTRL>V", NULL, G_CALLBACK (modest_ui_actions_on_paste) },
- { "HeaderViewCSMDelete", NULL, N_("mcen_me_inbox_delete"), NULL, NULL, G_CALLBACK (modest_ui_actions_on_delete) },
+ { "HeaderViewCSMDelete", NULL, N_("mcen_me_inbox_delete"), NULL, NULL, G_CALLBACK (modest_ui_actions_on_delete_message) },
{ "HeaderViewCSMCancelSending", NULL, N_("mcen_me_outbox_cancelsend"), NULL, NULL, G_CALLBACK (modest_ui_actions_cancel_send) },
{ "HeaderViewCSMHelp", NULL, N_("mcen_me_inbox_help"), NULL, NULL, G_CALLBACK (modest_ui_actions_on_help) },
};
/* return FALSE; */
/* } */
-typedef struct
-{
- ModestMainWindow *self;
- TnySendQueue *queue;
- TnyHeader *header;
-} OnResponseInfo;
-
-static void
-on_response (GtkDialog *dialog, gint arg1, gpointer user_data)
-{
- OnResponseInfo *info = (OnResponseInfo *) user_data;
- ModestMainWindow *self = info->self;
- TnyHeader *header = info->header;
- TnySendQueue *queue = info->queue;
-
- if (arg1 == GTK_RESPONSE_YES) {
- TnyFolder *outbox = tny_send_queue_get_outbox (queue);
- tny_folder_remove_msg (outbox, header, NULL);
- tny_folder_sync (outbox, TRUE, NULL);
- g_object_unref (outbox);
- }
-
- g_object_unref (queue);
- g_object_unref (header);
- g_object_unref (self);
-
- gtk_widget_destroy (GTK_WIDGET (dialog));
- g_slice_free (OnResponseInfo, info);
-}
-
-
static void
on_sendqueue_error_happened (TnySendQueue *self, TnyHeader *header, TnyMsg *msg, GError *err, ModestMainWindow *user_data)
{
printf ("DEBUG: %s: err->code=%d, err->message=%s\n", __FUNCTION__, err->code, err->message);
}
- if (header) {
- gchar *str = g_strdup_printf ("%s. Do you want to remove the message (%s)?",
- err->message, tny_header_get_subject (header));
- OnResponseInfo *info = g_slice_new (OnResponseInfo);
- GtkWidget *dialog = gtk_message_dialog_new (GTK_WINDOW (user_data), 0,
- GTK_MESSAGE_ERROR, GTK_BUTTONS_YES_NO, str);
- g_free (str);
- info->queue = g_object_ref (self);
- info->self = g_object_ref (user_data);
- info->header = g_object_ref (header);
- g_signal_connect (G_OBJECT (dialog), "response",
- G_CALLBACK (on_response), info);
- gtk_widget_show_all (dialog);
+ /* Get the account name: */
+ const gchar* server_name = NULL;
+
+ TnyCamelTransportAccount* server_account = tny_camel_send_queue_get_transport_account (
+ TNY_CAMEL_SEND_QUEUE (self));
+ if (server_account) {
+ server_name = tny_account_get_hostname (TNY_ACCOUNT (server_account));
+
+ g_object_unref (server_account);
+ server_account = NULL;
}
+
+ if (!server_name)
+ server_name = _("Unknown Server");
+
+ /* Show the appropriate message text for the GError: */
+ gchar *message = NULL;
+ if (err) {
+ switch (err->code) {
+ case TNY_TRANSPORT_ACCOUNT_ERROR_SEND_HOST_LOOKUP_FAILED:
+ message = g_strdup_printf (_("emev_ib_ui_smtp_server_invalid"), server_name);
+ break;
+ case TNY_TRANSPORT_ACCOUNT_ERROR_SEND_SERVICE_UNAVAILABLE:
+ message = g_strdup_printf (_("emev_ib_ui_smtp_server_invalid"), server_name);
+ break;
+ case TNY_TRANSPORT_ACCOUNT_ERROR_SEND_AUTHENTICATION_NOT_SUPPORTED:
+ /* TODO: This logical ID seems more suitable for a wrong username or password than for a
+ * wrong authentication method. The user is unlikely to guess at the real cause.
+ */
+ message = g_strdup_printf (_("eemev_ni_ui_smtp_authentication_fail_error"), server_name);
+ break;
+ case TNY_TRANSPORT_ACCOUNT_ERROR_SEND:
+ default:
+ message = g_strdup (_("emev_ib_ui_smtp_send_error"));
+ break;
+ }
+ } else {
+ message = g_strdup (_("emev_ib_ui_smtp_send_error"));
+ }
+
+ modest_maemo_show_information_note_and_forget (GTK_WINDOW (user_data), message);
+ g_free (message);
+
+ /* TODO: Offer to remove the message, to avoid messages in future? */
+ /*
+ TnyFolder *outbox = tny_send_queue_get_outbox (queue);
+ tny_folder_remove_msg (outbox, header, NULL);
+ tny_folder_sync (outbox, TRUE, NULL);
+ g_object_unref (outbox);
+ */
}
typedef struct {
GError *error = NULL;
ModestConf *conf = NULL;
GtkAction *action = NULL;
-
+ GdkPixbuf *window_icon;
+
self = MODEST_MAIN_WINDOW(g_object_new(MODEST_TYPE_MAIN_WINDOW, NULL));
priv = MODEST_MAIN_WINDOW_GET_PRIVATE(self);
parent_priv = MODEST_WINDOW_GET_PRIVATE(self);
g_signal_connect (G_OBJECT(self), "show",
G_CALLBACK (modest_main_window_on_show), folder_win);
+ /* Set window icon */
+ window_icon = modest_platform_get_icon (MODEST_APP_ICON);
+ if (window_icon) {
+ gtk_window_set_icon (GTK_WINDOW (self), window_icon);
+ g_object_unref (window_icon);
+ }
restore_settings (MODEST_MAIN_WINDOW(self), FALSE);
ModestAccountData *account_data = (ModestAccountData *) g_slist_nth_data (accounts, i);
- /* Create display name. The default account is shown differently */
+ /* Create display name. The UI specification specifies a different format string
+ * to use for the default account, though both seem to be "%s", so
+ * I don't see what the point is. murrayc. */
if (default_account && account_data->account_name &&
!(strcmp (default_account, account_data->account_name) == 0)) {
display_name = g_strdup_printf (_("mcen_me_toolbar_sendreceive_default"),
/* Add ui from account data. We allow 2^9-1 account
changes in a single execution because we're
downcasting the guint to a guint8 in order to use a
- GByteArray, it should be enough */
+ GByteArray. It should be enough. */
item_name = g_strconcat (account_data->account_name, "Menu", NULL);
merge_id = (guint8) gtk_ui_manager_new_merge_id (parent_priv->ui_manager);
priv->merge_ids = g_byte_array_append (priv->merge_ids, &merge_id, 1);
/* Get toolbar mode from operation id*/
op_type = modest_mail_operation_get_type_operation (mail_op);
switch (op_type) {
- case MODEST_MAIL_OPERATION_TYPE_SEND:
+/* case MODEST_MAIL_OPERATION_TYPE_SEND: */
case MODEST_MAIL_OPERATION_TYPE_RECEIVE:
case MODEST_MAIL_OPERATION_TYPE_OPEN:
mode = TOOLBAR_MODE_TRANSFER;