* make it compile again with latest Tinymail; does not work yet though.
[modest] / src / gtk / modest-edit-msg-window.c
index d09f149..ff5e5af 100644 (file)
@@ -53,7 +53,7 @@ struct _ModestEditMsgWindowPrivate {
        
        GtkWidget      *toolbar, *menubar;
        GtkWidget      *msg_body;
-       GtkWidget      *to_field, *cc_field, *bcc_field,
+       GtkWidget      *from_field, *to_field, *cc_field, *bcc_field,
                       *subject_field;
 };
 #define MODEST_EDIT_MSG_WINDOW_GET_PRIVATE(o)      (G_TYPE_INSTANCE_GET_PRIVATE((o), \
@@ -156,42 +156,42 @@ on_menu_quit (ModestEditMsgWindow *self, guint action, GtkWidget *widget)
 
 /* Our menu, an array of GtkItemFactoryEntry structures that defines each menu item */
 static GtkItemFactoryEntry menu_items[] = {
-       { "/_File",             NULL,                   NULL,           0, "<Branch>" },
+       { "/_File",             NULL,                   NULL,           0, "<Branch>" ,NULL},
        { "/File/_New",         "<control>N",           NULL,           0, "<StockItem>", GTK_STOCK_NEW },
        { "/File/_Open",        "<control>O",           NULL,           0, "<StockItem>", GTK_STOCK_OPEN },
        { "/File/_Save",        "<control>S",           NULL,           0, "<StockItem>", GTK_STOCK_SAVE },
-       { "/File/Save _As",     NULL,                   NULL,           0, "<Item>" },
-       { "/File/Save Draft",   "<control><shift>S",    NULL,           0, "<Item>" },
+       { "/File/Save _As",     NULL,                   NULL,           0, "<Item>", NULL} ,
+       { "/File/Save Draft",   "<control><shift>S",    NULL,           0, "<Item>",NULL },
 
 
-       { "/File/sep1",         NULL,                   NULL,           0, "<Separator>" },
+       { "/File/sep1",         NULL,                   NULL,           0, "<Separator>" ,NULL },
        { "/File/_Quit",        "<CTRL>Q",              on_menu_quit,   0, "<StockItem>", GTK_STOCK_QUIT },
 
-       { "/_Edit",             NULL,                   NULL,           0, "<Branch>" },
+       { "/_Edit",             NULL,                   NULL,           0, "<Branch>" ,NULL },
        { "/Edit/_Undo",        "<CTRL>Z",              NULL,           0, "<StockItem>", GTK_STOCK_UNDO },
        { "/Edit/_Redo",        "<shift><CTRL>Z",       NULL,           0, "<StockItem>", GTK_STOCK_REDO },
-       { "/File/sep1",         NULL,                   NULL,           0, "<Separator>" },
+       { "/File/sep1",         NULL,                   NULL,           0, "<Separator>",NULL },
        { "/Edit/Cut",          "<control>X",           NULL,           0, "<StockItem>", GTK_STOCK_CUT  },
        { "/Edit/Copy",         "<CTRL>C",              NULL,           0, "<StockItem>", GTK_STOCK_COPY },
        { "/Edit/Paste",        NULL,                   NULL,           0, "<StockItem>", GTK_STOCK_PASTE},
-       { "/Edit/sep1",         NULL,                   NULL,           0, "<Separator>" },
-       { "/Edit/Delete",       "<CTRL>Q",              NULL,           0, "<Item>" },
-       { "/Edit/Select all",   "<CTRL>A",              NULL,           0, "<Item>" },
-       { "/Edit/Deselect all",  "<Shift><CTRL>A",      NULL,           0, "<Item>" },
+       { "/Edit/sep1",         NULL,                   NULL,           0, "<Separator>",NULL },
+       { "/Edit/Delete",       "<CTRL>Q",              NULL,           0, "<Item>" ,NULL },
+       { "/Edit/Select all",   "<CTRL>A",              NULL,           0, "<Item>" ,NULL },
+       { "/Edit/Deselect all",  "<Shift><CTRL>A",      NULL,           0, "<Item>",NULL },
 
-       { "/_View",             NULL,           NULL,           0, "<Branch>" },
-       { "/View/To-field",          NULL,              NULL,           0, "<CheckItem>" },
+       { "/_View",             NULL,           NULL,                   0, "<Branch>",NULL },
+       { "/View/To-field",          NULL,              NULL,           0, "<CheckItem>",NULL },
        
-       { "/View/Cc-field:",          NULL,             NULL,           0, "<CheckItem>" },
-       { "/View/Bcc-field:",          NULL,            NULL,           0, "<CheckItem>" },
+       { "/View/Cc-field:",          NULL,             NULL,           0, "<CheckItem>",NULL },
+       { "/View/Bcc-field:",          NULL,            NULL,           0, "<CheckItem>",NULL },
        
        
-       { "/_Insert",             NULL,         NULL,           0, "<Branch>" },
+       { "/_Insert",             NULL,         NULL,           0, "<Branch>",NULL },
 /*     { "/Actions/_Reply",    NULL,                   NULL,           0, "<Item>" }, */
 /*     { "/Actions/_Forward",  NULL,                   NULL,           0, "<Item>" }, */
 /*     { "/Actions/_Bounce",   NULL,                   NULL,           0, "<Item>" },   */
        
-       { "/_Format",            NULL,                  NULL,           0, "<Branch>" }
+       { "/_Format",            NULL,                  NULL,           0, "<Branch>",NULL }
 /*     { "/Options/_Accounts",  NULL,                  on_menu_accounts,0, "<Item>" }, */
 /*     { "/Options/_Contacts",  NULL,                  NULL,           0, "<Item>" }, */
 
@@ -235,19 +235,19 @@ send_mail (ModestEditMsgWindow *self)
        const gchar *from, *to, *cc, *bcc, *subject;
        gchar *body;
        ModestEditMsgWindowPrivate *priv;
-
+       
        GtkTextBuffer *buf;
        GtkTextIter b, e;
        
        priv = MODEST_EDIT_MSG_WINDOW_GET_PRIVATE(self);
 
        /* don't free these */
-       from = "djcb@djcbsoftware.nl";
-       to   =  gtk_entry_get_text (GTK_ENTRY(priv->to_field));
-       cc   =  gtk_entry_get_text (GTK_ENTRY(priv->cc_field));
-       bcc  =  gtk_entry_get_text (GTK_ENTRY(priv->bcc_field));
-       to   =  gtk_entry_get_text (GTK_ENTRY(priv->subject_field));
-
+       from    = "djcb@djcbsoftware.nl";
+       to      =  gtk_entry_get_text (GTK_ENTRY(priv->to_field));
+       cc      =  gtk_entry_get_text (GTK_ENTRY(priv->cc_field));
+       bcc     =  gtk_entry_get_text (GTK_ENTRY(priv->bcc_field));
+       subject =  gtk_entry_get_text (GTK_ENTRY(priv->subject_field));
+       
        /* don't unref */
        buf   =  gtk_text_view_get_buffer (GTK_TEXT_VIEW(priv->msg_body));
        
@@ -319,7 +319,7 @@ toolbar_new (ModestEditMsgWindow *self)
 static void
 init_window (ModestEditMsgWindow *obj)
 {
-       GtkWidget *to_button, *cc_button, *bcc_button, *subject_label; 
+       GtkWidget *to_button, *cc_button, *bcc_button; 
        GtkWidget *header_table;
        GtkWidget *main_vbox;
        
@@ -329,27 +329,29 @@ init_window (ModestEditMsgWindow *obj)
        to_button     = gtk_button_new_with_label (_("To..."));
        cc_button     = gtk_button_new_with_label (_("Cc..."));
        bcc_button    = gtk_button_new_with_label (_("Bcc..."));
-       subject_label = gtk_label_new (_("Subject:"));
-       
+
+       priv->from_field    = modest_widget_factory_get_combo_box (priv->factory,
+                                                                  MODEST_COMBO_BOX_TYPE_TRANSPORTS);
        priv->to_field      = gtk_entry_new_with_max_length (40);
        priv->cc_field      = gtk_entry_new_with_max_length (40);
        priv->bcc_field     = gtk_entry_new_with_max_length (40);
        priv->subject_field = gtk_entry_new_with_max_length (40);
-
-       header_table = gtk_table_new (4,2, FALSE);
-       gtk_table_attach (GTK_TABLE(header_table), to_button,     0,1,0,1,
-                         GTK_SHRINK, 0, 0, 0);
-       gtk_table_attach (GTK_TABLE(header_table), cc_button,     0,1,1,2,
-                         GTK_SHRINK, 0, 0, 0);
-       gtk_table_attach (GTK_TABLE(header_table), bcc_button,    0,1,2,3,
-                         GTK_SHRINK, 0, 0, 0);
-       gtk_table_attach (GTK_TABLE(header_table), subject_label, 0,1,3,4,
-                         GTK_SHRINK, 0, 0, 0);
-       gtk_table_attach_defaults (GTK_TABLE(header_table), priv->to_field,     1,2,0,1);
-       gtk_table_attach_defaults (GTK_TABLE(header_table), priv->cc_field,     1,2,1,2);
-       gtk_table_attach_defaults (GTK_TABLE(header_table), priv->bcc_field,    1,2,2,3);
-       gtk_table_attach_defaults (GTK_TABLE(header_table), priv->subject_field,1,2,3,4);
+       
+       header_table = gtk_table_new (5,2, FALSE);
+       
+       gtk_table_attach (GTK_TABLE(header_table), gtk_label_new (_("From:")),
+                         0,1,0,1, GTK_SHRINK, 0, 0, 0);
+       gtk_table_attach (GTK_TABLE(header_table), to_button,     0,1,1,2, GTK_SHRINK, 0, 0, 0);
+       gtk_table_attach (GTK_TABLE(header_table), cc_button,     0,1,2,3, GTK_SHRINK, 0, 0, 0);
+       gtk_table_attach (GTK_TABLE(header_table), bcc_button,    0,1,3,4, GTK_SHRINK, 0, 0, 0);
+       gtk_table_attach (GTK_TABLE(header_table), gtk_label_new (_("Subject:")),
+                         0,1,4,5, GTK_SHRINK, 0, 0, 0);
+
+       gtk_table_attach_defaults (GTK_TABLE(header_table), priv->from_field,   1,2,0,1);
+       gtk_table_attach_defaults (GTK_TABLE(header_table), priv->to_field,     1,2,1,2);
+       gtk_table_attach_defaults (GTK_TABLE(header_table), priv->cc_field,     1,2,2,3);
+       gtk_table_attach_defaults (GTK_TABLE(header_table), priv->bcc_field,    1,2,3,4);
+       gtk_table_attach_defaults (GTK_TABLE(header_table), priv->subject_field,1,2,4,5);
 
        priv->msg_body = gtk_text_view_new ();
        
@@ -405,7 +407,7 @@ modest_edit_msg_window_new (ModestConf *conf, ModestWidgetFactory *factory,
 
        g_return_val_if_fail (conf, NULL);
        g_return_val_if_fail (factory, NULL);
-       g_return_val_if_fail (type >= 0 && type < MODEST_EDIT_TYPE_NUM, NULL);
+       g_return_val_if_fail (type < MODEST_EDIT_TYPE_NUM, NULL);
        g_return_val_if_fail (!(type==MODEST_EDIT_TYPE_NEW && msg), NULL); 
        g_return_val_if_fail (!(type!=MODEST_EDIT_TYPE_NEW && !msg), NULL);