edi_scm: Tidying.

This commit is contained in:
Alastair Poole 2020-08-13 22:52:43 +01:00
parent a24b6e00ad
commit 3f382eccfb
3 changed files with 19 additions and 30 deletions

View File

@ -66,48 +66,36 @@ int main(int argc, char **argv)
const char *arg, *root; const char *arg, *root;
Edi_Scm_Ui_Opts options; Edi_Scm_Ui_Opts options;
memset(&options,0, sizeof(Edi_Scm_Ui_Opts)); memset(&options, 0, sizeof(Edi_Scm_Ui_Opts));
ecore_init();
elm_init(argc, argv);
root = NULL; root = NULL;
for (int i = 1; i < argc; i++) for (int i = 1; i < argc; i++)
{ {
arg = argv[i]; arg = argv[i];
if (!strcmp("-h", arg) || !strcmp("--help", arg)) if (!strcmp("-h", arg) || !strcmp("--help", arg))
{ usage();
usage();
}
else if (!strcmp("-c", arg) || !strcmp("--commit", arg)) else if (!strcmp("-c", arg) || !strcmp("--commit", arg))
{ options.commit = EINA_TRUE;
}
else if (!strcmp("-l", arg) || !strcmp("--log", arg)) else if (!strcmp("-l", arg) || !strcmp("--log", arg))
{ options.log = EINA_TRUE;
options.log = EINA_TRUE;
}
else else
{ root = arg;
root = arg;
}
} }
if (root) if (!root) usage();
ecore_init();
elm_init(argc, argv);
if (!ecore_file_is_dir(root))
{ {
if (!ecore_file_is_dir(root)) fprintf(stderr, _("Root path must be a directory\n"));
{ exit(1);
fprintf(stderr, _("Root path must be a directory\n"));
exit(1 << 0);
}
engine = edi_scm_init_path(realpath(root, NULL));
}
else
{
engine = edi_scm_init();
} }
engine = edi_scm_init_path(realpath(root, NULL));
if (!engine) if (!engine)
exit(1 << 2); exit(1 << 7);
win = _win_add(engine); win = _win_add(engine);
edi_scm_ui_add(win, options); edi_scm_ui_add(win, options);

View File

@ -612,7 +612,7 @@ static Eina_Bool
_edi_scm_ui_log_fill_cb(void *data) _edi_scm_ui_log_fill_cb(void *data)
{ {
Edi_Scm_Engine *engine; Edi_Scm_Engine *engine;
Evas_Object *entry; Evas_Object *entry, *scr;
Eina_List *log; Eina_List *log;
char *line; char *line;
@ -666,7 +666,7 @@ _edi_scm_ui_log(Evas_Object *parent)
btn = elm_button_add(hbx); btn = elm_button_add(hbx);
evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, EVAS_HINT_FILL); evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_size_hint_weight_set(btn, 0.25, EVAS_HINT_EXPAND); evas_object_size_hint_weight_set(btn, 0.2, EVAS_HINT_EXPAND);
elm_object_text_set(btn, _("Close")); elm_object_text_set(btn, _("Close"));
evas_object_smart_callback_add(btn, "clicked", _edi_scm_ui_close_cb, NULL); evas_object_smart_callback_add(btn, "clicked", _edi_scm_ui_close_cb, NULL);
@ -690,7 +690,7 @@ edi_scm_ui_add(Evas_Object *parent, Edi_Scm_Ui_Opts options)
engine = edi_scm_engine_get(); engine = edi_scm_engine_get();
if (!engine) if (!engine)
exit(1 << 1); exit(1 << 7);
if (options.log) if (options.log)
{ {

View File

@ -14,6 +14,7 @@ extern "C" {
typedef struct _Edi_Scm_Ui_Opts { typedef struct _Edi_Scm_Ui_Opts {
Eina_Bool log; Eina_Bool log;
Eina_Bool commit;
} Edi_Scm_Ui_Opts; } Edi_Scm_Ui_Opts;
/** /**