* Added comparisons with "Invalid" string <- should be fixed in tinymail
[modest] / src / modest-ui.c
index dc3a7c5..5f8e194 100644 (file)
@@ -39,6 +39,7 @@
 #include "modest-icon-names.h"
 #include "modest-tny-platform-factory.h"
 #include "modest-account-view-window.h"
+#include "modest-account-mgr-helpers.h"
 #include "modest-main-window.h"
 #include "modest-mail-operation.h"
 #include <modest-widget-memory.h>
@@ -548,6 +549,7 @@ reply_forward_func (gpointer data, gpointer user_data)
                                                                 rf_helper->from, 
                                                                 rf_helper->reply_forward_type,
                                                                 MODEST_MAIL_OPERATION_REPLY_MODE_SENDER);
+               break;
        case ACTION_REPLY_TO_ALL:
                new_msg = 
                        modest_mail_operation_create_reply_mail (msg, rf_helper->from, rf_helper->reply_forward_type,
@@ -563,10 +565,15 @@ reply_forward_func (gpointer data, gpointer user_data)
                g_return_if_reached ();
        }
 
-       /* Set from */
-       new_header = tny_msg_get_header (new_msg);
-       tny_header_set_from (new_header, rf_helper->from);
-       g_object_unref (G_OBJECT (new_header));
+       if (!new_msg) {
+               g_warning ("Unable to create a message");
+               goto cleanup;
+       }
+
+/*     /\* Set from *\/ */
+/*     new_header = tny_msg_get_header (new_msg); */
+/*     tny_header_set_from (new_header, rf_helper->from); */
+/*     g_object_unref (G_OBJECT (new_header)); */
                
        /* Show edit window */
        widget_factory = modest_window_get_widget_factory (MODEST_WINDOW (helper->main_window));
@@ -576,12 +583,15 @@ reply_forward_func (gpointer data, gpointer user_data)
                                              MODEST_EDIT_TYPE_NEW);
        g_object_unref (G_OBJECT (widget_factory));
        g_object_unref (G_OBJECT (account_store));
+
        modest_edit_msg_window_set_msg (MODEST_EDIT_MSG_WINDOW (msg_win),
                                        new_msg);
        gtk_widget_show_all (GTK_WIDGET (msg_win));
        
        /* Clean */
        g_object_unref (G_OBJECT (new_msg));
+
+ cleanup:
        g_free (rf_helper->from);
        g_slice_free (ReplyForwardHelper, rf_helper);
 }
@@ -595,14 +605,16 @@ reply_forward (GtkWidget *widget,
               ModestMainWindow *main_window)
 {
        ModestHeaderView *header_view;
+       ModestAccountMgr *account_mgr;
        ModestWidgetFactory *widget_factory;
        TnyList *header_list;
        guint reply_forward_type;
-       ModestConf *conf;
+       ModestConf *conf;       
+       ModestAccountData *default_account_data;
        TnyPlatformFactory *plat_factory;
        TnyHeader *header;
        TnyFolder *folder;
-       gchar *from, *key;
+       gchar *from, *key, *default_account_name;
        GetMsgAsyncHelper *helper;
        ReplyForwardHelper *rf_helper;
 
@@ -630,9 +642,15 @@ reply_forward (GtkWidget *widget,
           same folder and that we reply all of them from the
           same account. In fact the interface currently only
           allows single selection */
-
-       /* TODO: get the from string from account */
-       from = g_strdup ("Invalid");
+       account_mgr = modest_tny_platform_factory_get_account_mgr_instance
+               (MODEST_TNY_PLATFORM_FACTORY(plat_factory));
+       default_account_name = modest_account_mgr_get_default_account (account_mgr);
+       default_account_data = 
+               modest_account_mgr_get_account_data (account_mgr,
+                                                    (const gchar*) default_account_name);
+       from = g_strdup (default_account_data->email);
+       modest_account_mgr_free_account_data (account_mgr, default_account_data);
+       g_free (default_account_name);
        
        /* Fill helpers */
        rf_helper = g_slice_new0 (ReplyForwardHelper);
@@ -899,6 +917,16 @@ _modest_ui_actions_on_folder_selection_changed (ModestFolderView *folder_view,
 }
 
 
+/****************************************************/
+/*
+ * below some stuff to clearup statusbar messages after 1,5 seconds....
+ */
+typedef struct {
+       GtkWidget *status_bar;
+       GtkWidget *progress_bar;
+       guint     msg_id;
+} StatusRemoveData;
+
 
 static gboolean
 progress_bar_clean (GtkWidget *bar)
@@ -909,6 +937,7 @@ progress_bar_clean (GtkWidget *bar)
        }
        return FALSE;
 }
+
 static gboolean
 statusbar_clean (GtkWidget *bar)
 {