Changeset 90

Show
Ignore:
Timestamp:
04/25/08 14:01:07
Author:
pvanhoof
Message:
        • The From of transport-accounts
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/ChangeLog

    r88 r90  
    22 
    33        * Bugfix when error reporting on sending message 
     4        * The From of transport-accounts 
    45 
    562008-04-22  Philip Van Hoof  <pvanhoof@gnome.org> 
  • trunk/src/tmut-account-editor.c

    r87 r90  
    2929 
    3030#include <tny-camel-account.h> 
     31#include <tny-camel-transport-account.h> 
    3132#include <tny-simple-list.h> 
    3233#include <tny-list.h> 
     
    5152 
    5253        GtkWidget *name_entry, *hostname_entry, *enabled_checkbutton, 
    53                   *proto_entry, *type_entry, *user_entry, *options_entry; 
     54                  *proto_entry, *type_entry, *user_entry, *options_entry, 
     55                  *from_entry; 
    5456}; 
    5557 
     
    7779        return gtk_entry_get_text (GTK_ENTRY (priv->hostname_entry)); 
    7880} 
     81 
     82const gchar*  
     83tmut_account_editor_get_from (TMutAccountEditor *self) 
     84{ 
     85        TMutAccountEditorPriv *priv = TMUT_ACCOUNT_EDITOR_GET_PRIVATE (self); 
     86        return gtk_entry_get_text (GTK_ENTRY (priv->from_entry)); 
     87} 
     88 
    7989 
    8090const gchar*  
     
    137147                        tny_account_get_user (account)?tny_account_get_user (account):""); 
    138148 
     149                if (TNY_IS_CAMEL_TRANSPORT_ACCOUNT (account)) { 
     150                        TnyCamelTransportAccount *ta = (TnyCamelTransportAccount *) account; 
     151                        gtk_entry_set_text (GTK_ENTRY (priv->from_entry),  
     152                                tny_camel_transport_account_get_from (ta)?tny_camel_transport_account_get_from (ta):""); 
     153                } 
     154 
    139155                tny_camel_account_get_options (TNY_CAMEL_ACCOUNT (account), options); 
    140156                iter = tny_list_create_iterator (options); 
     
    203219        GtkWidget *ok_button, *cancel_button; 
    204220        GtkWidget *hbox = gtk_hbox_new (FALSE, 0); 
     221        GtkWidget *mhbox = gtk_hbox_new (FALSE, 0); 
     222 
    205223        table = gtk_table_new (6, 2, FALSE); 
    206224 
     
    211229        gtk_widget_show (cancel_button); 
    212230        gtk_widget_show (ok_button); 
     231        gtk_widget_show (mhbox); 
    213232 
    214233        gtk_box_pack_start (GTK_BOX (hbox), GTK_WIDGET (cancel_button),  
     
    245264        gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5); 
    246265 
    247         label = gtk_label_new (_("Type")); 
     266        label = gtk_label_new (_("Type (+ From)")); 
    248267        gtk_widget_show (label); 
    249268        gtk_table_attach (GTK_TABLE (table), label, 0, 1, 4, 5, 
     
    285304        priv->type_entry = gtk_entry_new (); 
    286305        gtk_widget_show (priv->type_entry); 
    287         gtk_table_attach (GTK_TABLE (table), priv->type_entry, 1, 2, 4, 5, 
    288                 (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 
    289                 (GtkAttachOptions) (0), 0, 0); 
     306 
     307        priv->from_entry = gtk_entry_new (); 
     308        gtk_widget_show (priv->from_entry); 
     309 
     310        gtk_box_pack_start (GTK_BOX (mhbox), GTK_WIDGET (priv->type_entry),  
     311                TRUE, TRUE, 0); 
     312        gtk_box_pack_start (GTK_BOX (mhbox), GTK_WIDGET (priv->from_entry),  
     313                TRUE, TRUE, 0); 
     314 
     315        gtk_table_attach (GTK_TABLE (table), mhbox, 1, 2, 4, 5, 
     316                (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 
     317                (GtkAttachOptions) (0), 0, 0); 
     318 
    290319 
    291320        priv->options_entry = gtk_entry_new (); 
  • trunk/src/tmut-account-editor.h

    r76 r90  
    6363const gchar* tmut_account_editor_get_account_type (TMutAccountEditor *self);  
    6464const gchar* tmut_account_editor_get_user (TMutAccountEditor *self); 
     65const gchar* tmut_account_editor_get_from (TMutAccountEditor *self); 
    6566gchar** tmut_account_editor_get_options (TMutAccountEditor *self); 
    6667TnyAccount *tmut_account_editor_get_account (TMutAccountEditor *self); 
  • trunk/src/tmut-account-manager.c

    r89 r90  
    7979                tmut_account_editor_get_account_type (editor),  
    8080                tmut_account_editor_get_user (editor),  
    81                 NULL, -1, 
     81                NULL,  
     82                tmut_account_editor_get_from (editor), 
     83                -1, 
    8284                (const char **) options); 
    8385 
     
    101103                tmut_account_editor_get_proto (editor),  
    102104                tmut_account_editor_get_user (editor),  
    103                 NULL, -1, 
     105                NULL,  
     106                tmut_account_editor_get_from (editor), 
     107                -1, 
    104108                (const char **) options); 
    105109 
  • trunk/src/tmut-account-store.c

    r89 r90  
    103103 
    104104static TnyAccount* 
    105 create_account_instance (TMutAccountStorePriv *priv, const gchar *type, const gchar *proto, const gchar *mech, const gchar *name, gchar **options, const gchar *user, const gchar *hostname, gint port, const gchar *url_string, const gchar *fullfilen
     105create_account_instance (TMutAccountStorePriv *priv, const gchar *type, const gchar *proto, const gchar *mech, const gchar *name, gchar **options, const gchar *user, const gchar *hostname, gint port, const gchar *url_string, const gchar *fullfilen, const gchar *from
    106106{ 
    107107        TnyAccount *account = NULL; 
     
    150150 
    151151                if (!g_ascii_strncasecmp (proto, "pop", 3) ||  
    152                     !g_ascii_strncasecmp (proto, "imap", 4)) { 
     152                    !g_ascii_strncasecmp (proto, "imap", 4) || 
     153                    !g_ascii_strncasecmp (proto, "smtp", 4)) { 
    153154                        tny_account_set_user (account, user); 
    154155                        tny_account_set_hostname (account, hostname); 
    155156                        if (port != -1) 
    156157                                tny_account_set_port (account, port); 
    157                 } else 
    158                         tny_account_set_url_string (account, url_string); 
     158                }  
    159159 
    160160                tny_account_set_id (account, fullfilen); 
     
    166166 
    167167        } 
     168 
     169        if (TNY_IS_CAMEL_TRANSPORT_ACCOUNT (account)) 
     170                tny_camel_transport_account_set_from (TNY_CAMEL_TRANSPORT_ACCOUNT (account), from); 
    168171 
    169172        return account; 
     
    179182                const gchar *user, 
    180183                const gchar *mech, 
     184                const gchar *from, 
    181185                gint port, 
    182186                const gchar **options) 
     
    231235 
    232236        account = create_account_instance (priv, type, proto, mech, name,  
    233                 (gchar **) options, user, hostname, port, NULL, filen); 
     237                (gchar **) options, user, hostname, port, NULL, filen, from); 
    234238 
    235239        if (account) { 
     
    271275} 
    272276 
    273 void tmut_account_store_edit_account (TMutAccountStore *self, TnyAccount *account,  
     277void  
     278tmut_account_store_edit_account (TMutAccountStore *self, TnyAccount *account,  
    274279                gboolean enabled, 
    275280                const gchar *name,  
     
    278283                const gchar *user, 
    279284                const gchar *mech, 
     285                const gchar *from, 
    280286                gint port, 
    281287                const gchar **options) 
     
    316322                tny_account_set_secure_auth_mech (account, mech); 
    317323                g_key_file_set_value (keyfile, "tmut", "mech", mech); 
     324        } 
     325 
     326        if (from && TNY_IS_CAMEL_TRANSPORT_ACCOUNT (account)) { 
     327                tny_camel_transport_account_set_from (TNY_CAMEL_TRANSPORT_ACCOUNT (account), from); 
     328                g_key_file_set_value (keyfile, "tmut", "from", from); 
    318329        } 
    319330 
     
    393404                GError *port_err = NULL; 
    394405                GKeyFile *keyfile; 
    395                 gchar *proto, *type, *user, *hostname, *url_string; 
     406                gchar *proto, *type, *from, *user, *hostname, *url_string; 
    396407                gchar *name, *mech, **options; 
    397408                gsize options_len; 
     
    423434                url_string = g_key_file_get_value (keyfile, "tmut", "url_string", NULL); 
    424435                port = g_key_file_get_integer (keyfile, "tmut", "port", &port_err); 
     436                from = g_key_file_get_value (keyfile, "tmut", "from", NULL); 
    425437 
    426438                if (port_err) { 
     
    429441                } 
    430442 
    431                 account = create_account_instance (priv, type, proto, mech, name, options, user, hostname, port, url_string, fullfilen); 
     443                account = create_account_instance (priv, type, proto, mech, name, options, user, hostname, port, url_string, fullfilen, from); 
    432444 
    433445                if (account) 
  • trunk/src/tmut-account-store.h

    r79 r90  
    6161                const gchar *user, 
    6262                const gchar *mech, 
     63                const gchar *from, 
    6364                gint port, 
    6465                const gchar **options); 
     
    7374                const gchar *user, 
    7475                const gchar *mech, 
     76                const gchar *from, 
    7577                gint port, 
    7678                const gchar **options); 
  • trunk/src/tmut-msg-creator.c

    r88 r90  
    3737#include <tny-camel-send-queue.h> 
    3838#include <tny-camel-mime-part.h> 
     39#include <tny-camel-transport-account.h> 
    3940 
    4041#include <string.h> 
     
    220221 
    221222                        tny_header_set_subject (header, gtk_entry_get_text (priv->subject_entry)); 
    222                         tny_header_set_from (header, tny_account_get_name (account)); 
     223 
     224                        if (TNY_IS_CAMEL_TRANSPORT_ACCOUNT (account)) { 
     225                                TnyCamelTransportAccount *ta = (TnyCamelTransportAccount *) account; 
     226                                if (tny_camel_transport_account_get_from (ta)) 
     227                                        tny_header_set_from (header, tny_camel_transport_account_get_from (ta)); 
     228                                else 
     229                                        tny_header_set_from (header, tny_account_get_name (account)); 
     230                        } else 
     231                                tny_header_set_from (header, tny_account_get_name (account)); 
     232 
    223233                        tny_header_set_to (header, gtk_entry_get_text (priv->to_entry)); 
    224234