<commit_before>class ApplicationShellPresenter
  def initialize(view, event_aggregator)
    @view = view
    @event_aggregator = event_aggregator
  end

  def present
    @view.set_title("Hello World")
    @view.signal_connect "destroy" do
      puts "publishing halt to event aggregator"
      @event_aggregator.publish(:halt)
    end
    add_menu_to(@view)
    @view.set_default_size 250, 200
    @view.set_window_position Gtk::Window::POS_CENTER
    @view.show_all
  end

  private

  def add_menu_to(view)
    view.modify_bg(Gtk::STATE_NORMAL, Gdk::Color.new(6400, 6400, 6440))
    menu_bar = Gtk::MenuBar.new

    file_menu = Gtk::Menu.new
    file_menu_item = Gtk::MenuItem.new("_File")
    file_menu_item.set_submenu(file_menu)

    exit_menu_item = Gtk::MenuItem.new("E_xit")
    exit_menu_item.signal_connect "activate" do
      @event_aggregator.publish(:halt)
    end

    file_menu.append(exit_menu_item)
    menu_bar.append(file_menu_item)

    vbox = Gtk::VBox.new(false, 2)
    vbox.pack_start(menu_bar, false, false, 0)
    view.add(vbox)
  end
end<commit_msg>whittle away at building a menu bar.<commit_after>class ApplicationShellPresenter
  def initialize(view, event_aggregator)
    @view = view
    @event_aggregator = event_aggregator
  end

  def present
    @view.set_title("Hello World")
    @view.signal_connect "destroy" do
      puts "publishing halt to event aggregator"
      @event_aggregator.publish(:halt)
    end
    add_menu_to(@view)
    @view.set_default_size 250, 200
    @view.set_window_position Gtk::Window::POS_CENTER
    @view.show_all
  end

  private

  def add_menu_to(view)
    view.modify_bg(Gtk::STATE_NORMAL, Gdk::Color.new(6400, 6400, 6440))
    menu_bar = create_menu_bar.append(create_menu_item("_File", create_menu.append(create_menu_item("_Import", create_import_menu)).append(create_exit_menu)))
    view.add(create_vertical_box(menu_bar))
  end

  def create_vertical_box(menu_bar)
    vbox = Gtk::VBox.new(false, 2)
    vbox.pack_start(menu_bar, false, false, 0)
    vbox
  end

  def create_menu
    Gtk::Menu.new
  end

  def create_menu_item(name, sub_menu = nil)
    menu_item = Gtk::MenuItem.new(name)
    menu_item.set_submenu(sub_menu) if sub_menu
    menu_item
  end

  def create_menu_bar
    Gtk::MenuBar.new
  end

  def create_import_menu
    import_menu = create_menu
    import_menu.append(create_menu_item("Import news feed..."))
    import_menu.append(create_menu_item("Import bookmarks..."))
    import_menu.append(create_menu_item("Import mail..."))
    import_menu
  end

  def create_exit_menu
    menu_item = create_menu_item("E_xit")
    menu_item.signal_connect "activate" do
      @event_aggregator.publish(:halt)
    end
    menu_item
  end
end
{'fraction_non_alphanumeric': 0.1001100110011001, 'fraction_numerical': 0.014668133480014669, 'mean_word_length': 3.978102189781022, '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': '3433099', 'n_tokens_mistral': 1019, 'n_tokens_neox': 964, 'n_words': 172}