<commit_before>#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
#include <glib.h>

static void
main_window_open_sync_window ()
{
  g_print ("open sync window\n");
}

static void
main_window_open_highlights_window ()
{
  g_print ("open queued highlights window\n");
}

static void
main_window_open_about_dialog ()
{
  g_print ("open about dialog\n");
}

static void
main_window_destroy_from_accel (GtkAccelGroup *group, GObject *acceleratable,
    guint keyval, GdkModifierType modifier, gpointer user_data)
{
  gtk_widget_destroy (GTK_WIDGET (user_data));
}

static void
main_window_destroy_from_menu (GtkWidget *widget, gpointer user_data)
{
  gtk_widget_destroy (GTK_WIDGET (user_data));
}

static void
main_window_open_sync_window_from_accel (GtkAccelGroup *group, GObject *acceleratable,
    guint keyval, GdkModifierType modifier, gpointer user_data)
{
  main_window_open_sync_window ();
}

static void
main_window_open_highlights_window_from_accel (GtkAccelGroup *group, GObject *acceleratable,
    guint keyval, GdkModifierType modifier, gpointer user_data)
{
  main_window_open_highlights_window ();
}

void
main_window_bind_keys (GtkWidget *window)
{
  GtkAccelGroup *group = gtk_accel_group_new ();

  GClosure *quit_closure = g_cclosure_new (G_CALLBACK (gtk_main_quit), window, NULL);
  gtk_accel_group_connect (group, GDK_KEY_q, GDK_CONTROL_MASK, 0, quit_closure);

  GClosure *close_closure = g_cclosure_new (G_CALLBACK (main_window_destroy_from_accel), window, NULL);
  gtk_accel_group_connect (group, GDK_KEY_w, GDK_CONTROL_MASK, 0, close_closure);

  GClosure *sync_closure = g_cclosure_new (G_CALLBACK (main_window_open_sync_window_from_accel), NULL, NULL);
  gtk_accel_group_connect (group, GDK_KEY_s, GDK_CONTROL_MASK, 0, sync_closure);

  GClosure *highlights_closure = g_cclosure_new (G_CALLBACK (main_window_open_highlights_window_from_accel), NULL, NULL);
  gtk_accel_group_connect (group, GDK_KEY_h, GDK_CONTROL_MASK, 0, highlights_closure);

  gtk_window_add_accel_group (GTK_WINDOW (window), group);
}

GtkWidget *
main_window_build_file_menu (GtkWidget *window)
{
  GtkWidget *menu = gtk_menu_new ();

  GtkWidget *sync_item = gtk_menu_item_new_with_mnemonic ("_Sync");
  g_signal_connect (sync_item, "activate", G_CALLBACK (main_window_open_sync_window), NULL);
  gtk_menu_shell_append (GTK_MENU_SHELL (menu), sync_item);

  GtkWidget *separator_item = gtk_separator_menu_item_new ();
  gtk_menu_shell_append (GTK_MENU_SHELL (menu), separator_item);

  GtkWidget *quit_item = gtk_menu_item_new_with_mnemonic ("_Quit");
  g_signal_connect (quit_item, "activate", G_CALLBACK (main_window_destroy_from_menu), window);
  gtk_menu_shell_append (GTK_MENU_SHELL (menu), quit_item);

  return menu;
}

GtkWidget *
main_window_build_view_menu ()
{
  GtkWidget *menu = gtk_menu_new ();

  GtkWidget *highlights_item = gtk_menu_item_new_with_mnemonic ("Queued _Highlights");
  g_signal_connect (highlights_item, "activate", G_CALLBACK (main_window_open_highlights_window), NULL);
  gtk_menu_shell_append (GTK_MENU_SHELL (menu), highlights_item);

  return menu;
}

GtkWidget *
main_window_build_help_menu ()
{
  GtkWidget *menu = gtk_menu_new ();

  GtkWidget *about_item = gtk_menu_item_new_with_mnemonic ("_About");
  g_signal_connect (about_item, "activate", G_CALLBACK (main_window_open_about_dialog), NULL);
  gtk_menu_shell_append (GTK_MENU_SHELL (menu), about_item);

  return menu;
}

GtkWidget *
main_window_build_menu_bar (GtkWidget *window)
{
  GtkWidget *bar = gtk_menu_bar_new ();

  GtkWidget *file_item = gtk_menu_item_new_with_mnemonic ("_File");
  gtk_menu_item_set_submenu (GTK_MENU_ITEM (file_item), main_window_build_file_menu (window));
  gtk_menu_shell_append (GTK_MENU_SHELL (bar), file_item);

  GtkWidget *view_item = gtk_menu_item_new_with_mnemonic ("_View");
  gtk_menu_item_set_submenu (GTK_MENU_ITEM (view_item), main_window_build_view_menu ());
  gtk_menu_shell_append (GTK_MENU_SHELL (bar), view_item);

  GtkWidget *help_item = gtk_menu_item_new_with_mnemonic ("_Help");
  gtk_menu_item_set_submenu (GTK_MENU_ITEM (help_item), main_window_build_help_menu ());
  gtk_menu_shell_append (GTK_MENU_SHELL (bar), help_item);

  return bar;
}

GtkWidget *
main_window_build_scrolled_window (guint width, guint height)
{
  GtkWidget *scrolled_window = gtk_scrolled_window_new (NULL, NULL);

  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
  gtk_widget_set_size_request (GTK_WIDGET (scrolled_window), width, height);

  return scrolled_window;
}

GtkWidget *
main_window_build_text_view ()
{
  GtkWidget *text_view = gtk_text_view_new ();

  gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (text_view), GTK_WRAP_WORD);
  gtk_text_view_set_accepts_tab (GTK_TEXT_VIEW (text_view), FALSE);

  return text_view;
}

GtkWidget *
main_window_create ()
{
  GtkWidget *window;
  GtkWidget *box;
  GtkWidget *highlight_scrolled_window;
  GtkWidget *highlight_text_view;
  GtkWidget *comment_scrolled_window;
  GtkWidget *comment_text_view;

  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  gtk_window_set_title (GTK_WINDOW (window), "ghighlighter");

  main_window_bind_keys (window);

  box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 1);
  gtk_box_pack_start (GTK_BOX (box), main_window_build_menu_bar (window), FALSE, FALSE, 0);

  highlight_scrolled_window = main_window_build_scrolled_window (600, 100);
  highlight_text_view = main_window_build_text_view ();
  gtk_container_add (GTK_CONTAINER (highlight_scrolled_window), highlight_text_view);
  gtk_container_add (GTK_CONTAINER (box), highlight_scrolled_window);

  comment_scrolled_window = main_window_build_scrolled_window (600, 40);
  comment_text_view = main_window_build_text_view ();
  gtk_container_add (GTK_CONTAINER (comment_scrolled_window), comment_text_view);
  gtk_container_add (GTK_CONTAINER (box), comment_scrolled_window);

  gtk_container_add (GTK_CONTAINER (window), box);

  g_signal_connect (window, "destroy", G_CALLBACK (gtk_main_quit), NULL);

  return window;
}<commit_msg>Rename box to main_box in main window<commit_after>#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
#include <glib.h>

static void
main_window_open_sync_window ()
{
  g_print ("open sync window\n");
}

static void
main_window_open_highlights_window ()
{
  g_print ("open queued highlights window\n");
}

static void
main_window_open_about_dialog ()
{
  g_print ("open about dialog\n");
}

static void
main_window_destroy_from_accel (GtkAccelGroup *group, GObject *acceleratable,
    guint keyval, GdkModifierType modifier, gpointer user_data)
{
  gtk_widget_destroy (GTK_WIDGET (user_data));
}

static void
main_window_destroy_from_menu (GtkWidget *widget, gpointer user_data)
{
  gtk_widget_destroy (GTK_WIDGET (user_data));
}

static void
main_window_open_sync_window_from_accel (GtkAccelGroup *group, GObject *acceleratable,
    guint keyval, GdkModifierType modifier, gpointer user_data)
{
  main_window_open_sync_window ();
}

static void
main_window_open_highlights_window_from_accel (GtkAccelGroup *group, GObject *acceleratable,
    guint keyval, GdkModifierType modifier, gpointer user_data)
{
  main_window_open_highlights_window ();
}

void
main_window_bind_keys (GtkWidget *window)
{
  GtkAccelGroup *group = gtk_accel_group_new ();

  GClosure *quit_closure = g_cclosure_new (G_CALLBACK (gtk_main_quit), window, NULL);
  gtk_accel_group_connect (group, GDK_KEY_q, GDK_CONTROL_MASK, 0, quit_closure);

  GClosure *close_closure = g_cclosure_new (G_CALLBACK (main_window_destroy_from_accel), window, NULL);
  gtk_accel_group_connect (group, GDK_KEY_w, GDK_CONTROL_MASK, 0, close_closure);

  GClosure *sync_closure = g_cclosure_new (G_CALLBACK (main_window_open_sync_window_from_accel), NULL, NULL);
  gtk_accel_group_connect (group, GDK_KEY_s, GDK_CONTROL_MASK, 0, sync_closure);

  GClosure *highlights_closure = g_cclosure_new (G_CALLBACK (main_window_open_highlights_window_from_accel), NULL, NULL);
  gtk_accel_group_connect (group, GDK_KEY_h, GDK_CONTROL_MASK, 0, highlights_closure);

  gtk_window_add_accel_group (GTK_WINDOW (window), group);
}

GtkWidget *
main_window_build_file_menu (GtkWidget *window)
{
  GtkWidget *menu = gtk_menu_new ();

  GtkWidget *sync_item = gtk_menu_item_new_with_mnemonic ("_Sync");
  g_signal_connect (sync_item, "activate", G_CALLBACK (main_window_open_sync_window), NULL);
  gtk_menu_shell_append (GTK_MENU_SHELL (menu), sync_item);

  GtkWidget *separator_item = gtk_separator_menu_item_new ();
  gtk_menu_shell_append (GTK_MENU_SHELL (menu), separator_item);

  GtkWidget *quit_item = gtk_menu_item_new_with_mnemonic ("_Quit");
  g_signal_connect (quit_item, "activate", G_CALLBACK (main_window_destroy_from_menu), window);
  gtk_menu_shell_append (GTK_MENU_SHELL (menu), quit_item);

  return menu;
}

GtkWidget *
main_window_build_view_menu ()
{
  GtkWidget *menu = gtk_menu_new ();

  GtkWidget *highlights_item = gtk_menu_item_new_with_mnemonic ("Queued _Highlights");
  g_signal_connect (highlights_item, "activate", G_CALLBACK (main_window_open_highlights_window), NULL);
  gtk_menu_shell_append (GTK_MENU_SHELL (menu), highlights_item);

  return menu;
}

GtkWidget *
main_window_build_help_menu ()
{
  GtkWidget *menu = gtk_menu_new ();

  GtkWidget *about_item = gtk_menu_item_new_with_mnemonic ("_About");
  g_signal_connect (about_item, "activate", G_CALLBACK (main_window_open_about_dialog), NULL);
  gtk_menu_shell_append (GTK_MENU_SHELL (menu), about_item);

  return menu;
}

GtkWidget *
main_window_build_menu_bar (GtkWidget *window)
{
  GtkWidget *bar = gtk_menu_bar_new ();

  GtkWidget *file_item = gtk_menu_item_new_with_mnemonic ("_File");
  gtk_menu_item_set_submenu (GTK_MENU_ITEM (file_item), main_window_build_file_menu (window));
  gtk_menu_shell_append (GTK_MENU_SHELL (bar), file_item);

  GtkWidget *view_item = gtk_menu_item_new_with_mnemonic ("_View");
  gtk_menu_item_set_submenu (GTK_MENU_ITEM (view_item), main_window_build_view_menu ());
  gtk_menu_shell_append (GTK_MENU_SHELL (bar), view_item);

  GtkWidget *help_item = gtk_menu_item_new_with_mnemonic ("_Help");
  gtk_menu_item_set_submenu (GTK_MENU_ITEM (help_item), main_window_build_help_menu ());
  gtk_menu_shell_append (GTK_MENU_SHELL (bar), help_item);

  return bar;
}

GtkWidget *
main_window_build_scrolled_window (guint width, guint height)
{
  GtkWidget *scrolled_window = gtk_scrolled_window_new (NULL, NULL);

  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
  gtk_widget_set_size_request (GTK_WIDGET (scrolled_window), width, height);

  return scrolled_window;
}

GtkWidget *
main_window_build_text_view ()
{
  GtkWidget *text_view = gtk_text_view_new ();

  gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (text_view), GTK_WRAP_WORD);
  gtk_text_view_set_accepts_tab (GTK_TEXT_VIEW (text_view), FALSE);

  return text_view;
}

GtkWidget *
main_window_create ()
{
  GtkWidget *window;
  GtkWidget *main_box;
  GtkWidget *highlight_scrolled_window;
  GtkWidget *highlight_text_view;
  GtkWidget *comment_scrolled_window;
  GtkWidget *comment_text_view;

  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  gtk_window_set_title (GTK_WINDOW (window), "ghighlighter");

  main_window_bind_keys (window);

  main_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 1);
  gtk_box_pack_start (GTK_BOX (main_box), main_window_build_menu_bar (window), FALSE, FALSE, 0);

  highlight_scrolled_window = main_window_build_scrolled_window (600, 100);
  highlight_text_view = main_window_build_text_view ();
  gtk_container_add (GTK_CONTAINER (highlight_scrolled_window), highlight_text_view);
  gtk_container_add (GTK_CONTAINER (main_box), highlight_scrolled_window);

  comment_scrolled_window = main_window_build_scrolled_window (600, 40);
  comment_text_view = main_window_build_text_view ();
  gtk_container_add (GTK_CONTAINER (comment_scrolled_window), comment_text_view);
  gtk_container_add (GTK_CONTAINER (main_box), comment_scrolled_window);

  gtk_container_add (GTK_CONTAINER (window), main_box);

  g_signal_connect (window, "destroy", G_CALLBACK (gtk_main_quit), NULL);

  return window;
}
{'fraction_non_alphanumeric': 0.0901612372490951, 'fraction_numerical': 0.002796972688384337, 'mean_word_length': 7.739755571531273, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '743001', 'n_tokens_mistral': 4814, 'n_tokens_neox': 4598, 'n_words': 788}