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

« back to all changes in this revision

Viewing changes to src/client/accounts/add-edit-page.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:
166
166
    
167
167
    private Geary.Engine.ValidationResult last_validation_result = Geary.Engine.ValidationResult.OK;
168
168
    
 
169
    private bool first_ui_update = true;
 
170
    
169
171
    public signal void info_changed();
170
172
    
171
173
    public signal void size_changed();
259
261
        
260
262
        entry_nickname.insert_text.connect(on_nickname_insert_text);
261
263
        
262
 
        // Shows/hides settings.
263
 
        update_ui();
 
264
        // Reset the "first update" flag when the window is mapped.
 
265
        map.connect(() => { first_ui_update = true; });
264
266
    }
265
267
    
266
268
    // Sets the account information to display on this page.
271
273
            info.imap_credentials.user,
272
274
            info.imap_credentials.pass,
273
275
            info.imap_remember_password && info.smtp_remember_password,
274
 
            info.smtp_credentials.user,
275
 
            info.smtp_credentials.pass,
 
276
            info.smtp_credentials != null ? info.smtp_credentials.user : null,
 
277
            info.smtp_credentials != null ? info.smtp_credentials.pass : null,
276
278
            info.service_provider,
277
279
            info.default_imap_server_host,
278
280
            info.default_imap_server_port,
317
319
        password = initial_imap_password != null ? initial_imap_password : "";
318
320
        remember_password = initial_remember_password;
319
321
        set_service_provider((Geary.ServiceProvider) initial_service_provider);
 
322
        combo_imap_encryption.active = Encryption.NONE; // Must be default; set to real value below.
 
323
        combo_smtp_encryption.active = Encryption.NONE;
320
324
        
321
325
        // Set defaults for IMAP info
322
326
        imap_host = initial_default_imap_host ?? "";
338
342
        set_validation_result(result);
339
343
        
340
344
        set_storage_length(prefetch_period_days);
341
 
        
342
 
        if (Geary.String.is_empty(real_name))
343
 
            entry_real_name.grab_focus();
344
 
        else
345
 
            entry_email.grab_focus();
346
345
    }
347
346
    
348
347
    public void set_validation_result(Geary.Engine.ValidationResult result) {
353
352
    public void reset_all() {
354
353
        // Take advantage of set_all_info()'s defaults.
355
354
        set_all_info(get_default_real_name());
 
355
        
 
356
        edited_imap_port = false;
 
357
        edited_smtp_port = false;
356
358
    }
357
359
    
358
360
    /** Puts this page into one of three different modes:
598
600
            entry_smtp_port.sensitive =
599
601
            entry_smtp_username.sensitive =
600
602
            combo_smtp_encryption.sensitive =
 
603
            check_smtp_noauth.sensitive =
601
604
                mode != PageMode.EDIT;
602
605
        
 
606
        if (smtp_noauth) {
 
607
            entry_smtp_username.sensitive = false;
 
608
            entry_smtp_password.sensitive = false;
 
609
        }
 
610
        
603
611
        // Update error text.
604
612
        label_error.visible = false;
605
613
        if (last_validation_result == Geary.Engine.ValidationResult.OK) {
637
645
        }
638
646
        
639
647
        size_changed();
 
648
        
 
649
        // Set initial field focus.
 
650
        // This has to be done here because the window isn't completely setup until the first time
 
651
        // this method runs.
 
652
        if (first_ui_update && parent.get_visible()) {
 
653
            if (mode == PageMode.EDIT) {
 
654
                if (get_service_provider() != Geary.ServiceProvider.OTHER)
 
655
                    entry_password.grab_focus();
 
656
                else
 
657
                    entry_imap_password.grab_focus();
 
658
            } else {
 
659
                if (Geary.String.is_empty(real_name))
 
660
                    entry_real_name.grab_focus();
 
661
                else if (mode == PageMode.ADD)
 
662
                    entry_nickname.grab_focus();
 
663
                else
 
664
                    entry_email.grab_focus();
 
665
            }
 
666
            
 
667
            first_ui_update = false;
 
668
        }
640
669
    }
641
670
    
642
671
    public Geary.ServiceProvider get_service_provider() {