~ubuntu-branches/ubuntu/saucy/geary/saucy-updates

« back to all changes in this revision

Viewing changes to src/client/accounts/account-dialog.vala

  • Committer: Package Import Robot
  • Author(s): Sebastien Bacher
  • Date: 2013-04-10 10:57:25 UTC
  • mfrom: (1.1.5)
  • Revision ID: package-import@ubuntu.com-20130410105725-f532n2cfre2sq6mf
Tags: 0.3.1-0ubuntu1
* New upstream bugfix version:
  - Reduced CPU and memory footprint
  - Account dialog bugs fixed
  - Stability improvements

Show diffs side-by-side

added added

removed removed

Lines of Context:
84
84
    }
85
85
    
86
86
    private void on_edit_account(string email_address) {
 
87
        on_edit_account_async.begin(email_address);
 
88
    }
 
89
    
 
90
    private async void on_edit_account_async(string email_address) {
87
91
        Geary.AccountInformation? account = get_account_info_for_email(email_address);
88
92
        if (account == null)
89
93
            return;
90
94
        
 
95
        try {
 
96
            yield account.get_passwords_async(Geary.CredentialsMediator.ServiceFlag.IMAP |
 
97
                Geary.CredentialsMediator.ServiceFlag.SMTP);
 
98
        } catch (Error err) {
 
99
            debug("Unable to fetch password(s) for account: %s", err.message);
 
100
        }
 
101
        
91
102
        add_edit_pane.set_mode(AddEditPage.PageMode.EDIT);
92
103
        add_edit_pane.set_account_information(account);
93
104
        add_edit_pane.present();
136
147
        // Show the busy spinner.
137
148
        spinner_pane.present();
138
149
        
 
150
        // For account edits, we only need to validate the connection if the credentials have changed.
 
151
        bool validate_connection = true;
 
152
        if (add_edit_pane.get_mode() == AddEditPage.PageMode.EDIT && info.is_copy()) {
 
153
            Geary.AccountInformation? real_info =
 
154
                GearyApplication.instance.get_real_account_information(info);
 
155
            if (real_info != null) {
 
156
                validate_connection = !real_info.imap_credentials.equals(info.imap_credentials) ||
 
157
                    (info.smtp_credentials != null && !real_info.smtp_credentials.equals(info.smtp_credentials));
 
158
            }
 
159
        }
 
160
        
139
161
        // Validate account.
140
 
        GearyApplication.instance.validate_async.begin(info, null, on_save_add_or_edit_completed);
 
162
        GearyApplication.instance.validate_async.begin(info, validate_connection, null,
 
163
            on_save_add_or_edit_completed);
141
164
    }
142
165
    
143
166
    private void on_save_add_or_edit_completed(Object? source, AsyncResult result) {