<commit_before>/* Copyright 2011-2014 Yorba Foundation
 *
 * This software is licensed under the GNU Lesser General Public License
 * (version 2.1 or later).  See the COPYING file in this distribution.
 */

// Window for sending messages.
public class ComposerWindow : Gtk.Window, ComposerContainer {

    private const string DEFAULT_TITLE = _("New Message");
    
    public ComposerWindow(ComposerWidget composer) {
        Object(type: Gtk.WindowType.TOPLEVEL);
        
        add(composer);
        composer.subject_entry.changed.connect(() => {
            title = Geary.String.is_empty(composer.subject_entry.text.strip()) ? DEFAULT_TITLE :
                composer.subject_entry.text.strip();
        });
        composer.subject_entry.changed();
        
        add_accel_group(composer.ui.get_accel_group());
        show_all();
        set_position(Gtk.WindowPosition.CENTER);
    }
    
    public Gtk.Window top_window {
        get { return this; }
    }
    
    public override void show_all() {
        set_default_size(680, 600);
        base.show_all();
    }
    
    public override bool delete_event(Gdk.EventAny event) {
        return !(((ComposerWidget) get_child()).should_close() == ComposerWidget.CloseStatus.DO_CLOSE);
    }
    
    public void vanish() {
        hide();
    }
}
<commit_msg>Don't prompt on delete_event if in the process of closing<commit_after>/* Copyright 2011-2014 Yorba Foundation
 *
 * This software is licensed under the GNU Lesser General Public License
 * (version 2.1 or later).  See the COPYING file in this distribution.
 */

// Window for sending messages.
public class ComposerWindow : Gtk.Window, ComposerContainer {

    private const string DEFAULT_TITLE = _("New Message");
    
    private bool closing = false;
    
    public ComposerWindow(ComposerWidget composer) {
        Object(type: Gtk.WindowType.TOPLEVEL);
        
        add(composer);
        composer.subject_entry.changed.connect(() => {
            title = Geary.String.is_empty(composer.subject_entry.text.strip()) ? DEFAULT_TITLE :
                composer.subject_entry.text.strip();
        });
        composer.subject_entry.changed();
        
        add_accel_group(composer.ui.get_accel_group());
        show_all();
        set_position(Gtk.WindowPosition.CENTER);
    }
    
    public Gtk.Window top_window {
        get { return this; }
    }
    
    public override void show_all() {
        set_default_size(680, 600);
        base.show_all();
    }
    
    public new void close() {
        closing = true;
        base.close();
    }
    
    public override bool delete_event(Gdk.EventAny event) {
        return !(closing ||
            ((ComposerWidget) get_child()).should_close() == ComposerWidget.CloseStatus.DO_CLOSE);
    }
    
    public void vanish() {
        hide();
    }
}

{'fraction_non_alphanumeric': 0.1037636299683433, 'fraction_numerical': 0.011255715793176222, 'mean_word_length': 2.45985401459854, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6527591', 'n_tokens_mistral': 846, 'n_tokens_neox': 814, 'n_words': 187}