<commit_before>#include "jesus.h"

Evas_Object *win;
Evas_Object *preview;
Evas_Object *layout;

static void
on_done(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
{
   // quit the mainloop (elm_run function will return)
   elm_exit();
}

void
printHelp()
{
   printf("usage: jesus [Path] \n If path is not given $HOME will be taken, if this is not set / will be used.");
}

static Eina_Bool
_dir_changed(void *data EINA_UNUSED, Eo *obj EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED, void *event)
{
   titlebar_path_set(event);

   return EINA_FALSE;
}

static void
ui_init()
{
   Evas_Object *icon;

   win = elm_win_util_standard_add("efm", "efm - Jesus");

   icon = elm_icon_add(win);
   elm_icon_standard_set(icon, "system-file-manager");
   evas_object_show(icon);
   elm_win_icon_object_set(win, icon);

   evas_object_smart_callback_add(win, "delete,request", on_done, NULL);

   layout = elm_layout_add(win);
   eo_do(layout, efl_file_set(THEME_PATH"/efm.edc.edj", "headbar"));
   evas_object_size_hint_align_set(layout, EVAS_HINT_FILL, EVAS_HINT_FILL);
   evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
   evas_object_show(layout);

   preview = eo_add(ELM_FILE_DISPLAY_CLASS, win);
   evas_object_size_hint_align_set(preview, EVAS_HINT_FILL, EVAS_HINT_FILL);
   evas_object_size_hint_weight_set(preview, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
   elm_object_part_content_set(layout, "jesus.content", preview);
   eo_do(preview, eo_event_callback_add(ELM_FILE_DISPLAY_EVENT_PATH_CHANGED_USER,
                                 _dir_changed, NULL););
   evas_object_show(preview);

   titlebar_init();

   shortcuts_init();

   elm_win_resize_object_add(win, layout);
   evas_object_resize(win, 800,600);
   evas_object_show(win);
}

EAPI_MAIN int
elm_main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
{
   char *path = NULL;

   //check if someone gave us a path
   if (argc > 2)
     {
        printHelp();
     }
   else if (argc > 1)
     {
        path = argv[1];
     }

   //if not check if $HOME is set<commit_msg>jesus: Focus the preview at the beginning.<commit_after>#include "jesus.h"

Evas_Object *win;
Evas_Object *preview;
Evas_Object *layout;

static void
on_done(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
{
   // quit the mainloop (elm_run function will return)
   elm_exit();
}

void
printHelp()
{
   printf("usage: jesus [Path] \n If path is not given $HOME will be taken, if this is not set / will be used.");
}

static Eina_Bool
_dir_changed(void *data EINA_UNUSED, Eo *obj EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED, void *event)
{
   titlebar_path_set(event);

   return EINA_FALSE;
}

static void
ui_init()
{
   Evas_Object *icon;

   win = elm_win_util_standard_add("efm", "efm - Jesus");

   icon = elm_icon_add(win);
   elm_icon_standard_set(icon, "system-file-manager");
   evas_object_show(icon);
   elm_win_icon_object_set(win, icon);

   evas_object_smart_callback_add(win, "delete,request", on_done, NULL);

   layout = elm_layout_add(win);
   eo_do(layout, efl_file_set(THEME_PATH"/efm.edc.edj", "headbar"));
   evas_object_size_hint_align_set(layout, EVAS_HINT_FILL, EVAS_HINT_FILL);
   evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
   evas_object_show(layout);

   preview = eo_add(ELM_FILE_DISPLAY_CLASS, win);
   evas_object_size_hint_align_set(preview, EVAS_HINT_FILL, EVAS_HINT_FILL);
   evas_object_size_hint_weight_set(preview, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
   elm_object_part_content_set(layout, "jesus.content", preview);
   eo_do(preview, eo_event_callback_add(ELM_FILE_DISPLAY_EVENT_PATH_CHANGED_USER,
                                 _dir_changed, NULL););
   evas_object_show(preview);

   elm_object_focus_set(preview, EINA_TRUE);

   titlebar_init();

   shortcuts_init();

   elm_win_resize_object_add(win, layout);
   evas_object_resize(win, 800,600);
   evas_object_show(win);
}

EAPI_MAIN int
elm_main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
{
   char *path = NULL;

   //check if someone gave us a path
   if (argc > 2)
     {
        printHelp();
     }
   else if (argc > 1)
     {
        path = argv[1];
     }

   //if not check if $HOME is set
{'fraction_non_alphanumeric': 0.10389005357558817, 'fraction_numerical': 0.0041928721174004195, 'mean_word_length': 4.505128205128205, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3255364', 'n_tokens_mistral': 1711, 'n_tokens_neox': 1659, 'n_words': 323}