<commit_before>#!/usr/bin/env seed

Seed.import_namespace("Gtk");
Gtk.init(null, null);

var window = new Gtk.Window({title: "Browser"});

function quit()
{
    Gtk.main_quit();
}

window.signal.hide.connect(quit);

function create_ui()
{
    var main_ui = new Gtk.VBox();
    var toolbar = new Gtk.HBox();

    var back_button = new Gtk.ToolButton({stock_id: "gtk-go-back"});
    var forward_button = new Gtk.ToolButton({stock_id: "gtk-go-forward"});
    var refresh_button = new Gtk.ToolButton({stock_id: "gtk-refresh"});

    var url_entry = new Gtk.Entry();

    back_button.signal.clicked.connect(back);
    forward_button.signal.clicked.connect(forward);
    refresh_button.signal.clicked.connect(refresh);

    url_entry.signal.activate.connect(browse);

    toolbar.pack_start(back_button);
    toolbar.pack_start(forward_button);
    toolbar.pack_start(refresh_button);
    toolbar.pack_start(url_entry, true, true);

    main_ui.pack_start(toolbar);
    return main_ui;
}

function forward(button)
{
    Seed.print("forward");
}

function back(button)
{
    Seed.print("back");
}

function refresh(button)
{
    Seed.print("refresh");
}

function browse(button)
{
    Seed.print("browser");
}

window.add(create_ui());
window.show_all();

Gtk.main();<commit_msg>Redo first part of tutorial (the code, not the tut. yet)<commit_after>#!/usr/bin/env seed

Seed.import_namespace("Gtk");
Gtk.init(null, null);

BrowserToolbarType = {
    parent: Gtk.HBox.type,
    name: "BrowserToolbar",
    instance_init: function(klass)
    {
        this.urlBar = new Gtk.Entry();

        this.back = new Gtk.ToolButton({stock_id:"gtk-go-back"});
        this.forward = new Gtk.ToolButton({stock_id:"gtk-go-forward"});
        this.refresh = new Gtk.ToolButton({stock_id:"gtk-refresh"});

        this.back.signal.clicked.connect(back);
        this.forward.signal.clicked.connect(forward);
        this.refresh.signal.clicked.connect(refresh);
        this.urlBar.signal.activate.connect(browse);

        this.pack_start(this.back);
        this.pack_start(this.forward);
        this.pack_start(this.refresh);

        this.pack_start(this.urlBar, true, true);
    }};
BrowserToolbar = new GType(BrowserToolbarType);

function forward(button)
{
    Seed.print("forward");
}

function back(button)
{
    Seed.print("back");
}

function refresh(button)
{
    Seed.print("refresh");
}

function browse(button)
{
    Seed.print("browse");
}

window = new Gtk.Window({title: "Browser"});
window.signal.hide.connect(function () { Gtk.main_quit() });
window.add(new BrowserToolbar());
window.show_all();

Gtk.main();
{'fraction_non_alphanumeric': 0.15848042977743668, 'fraction_numerical': 0.0, 'mean_word_length': 3.956273764258555, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '2201223', 'n_tokens_mistral': 925, 'n_tokens_neox': 889, 'n_words': 139}