From f9e74bec45da468deedcc77a20499cd583059ad3 Mon Sep 17 00:00:00 2001 From: Andy Williams Date: Sat, 30 Dec 2017 18:52:41 +0000 Subject: [PATCH] scm: Make the titles consistent and add them to translations --- src/bin/edi_main.c | 4 ++-- src/bin/edi_scm_main.c | 25 ++++++++++--------------- 2 files changed, 12 insertions(+), 17 deletions(-) diff --git a/src/bin/edi_main.c b/src/bin/edi_main.c index 643e2f1..4a124df 100644 --- a/src/bin/edi_main.c +++ b/src/bin/edi_main.c @@ -1320,12 +1320,12 @@ _edi_win_title_get() if (provider) type = provider->id; else - type = "unknown"; + type = _("unknown"); name = edi_project_name_get(); len = 8 + 3 + strlen(name) + strlen(type); winname = malloc(len * sizeof(char)); - snprintf(winname, len, "Edi :: %s (%s)", name, type); + snprintf(winname, len, _("Edi :: %s (%s)"), name, type); return winname; } diff --git a/src/bin/edi_scm_main.c b/src/bin/edi_scm_main.c index 2429489..ec079c0 100644 --- a/src/bin/edi_scm_main.c +++ b/src/bin/edi_scm_main.c @@ -1,5 +1,7 @@ #include + #include "edi_scm_ui.h" +#include "edi_private.h" #define DEFAULT_WIDTH 480 #define DEFAULT_HEIGHT 240 @@ -12,28 +14,20 @@ _win_del_cb(void *data EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUS } static void -_win_title_set(Evas_Object *win) +_win_title_set(Evas_Object *win, Edi_Scm_Engine *engine) { Eina_Strbuf *title; - const char *directory; - char *project_root; - - directory = edi_scm_root_directory_get(); - if (!directory) - project_root = getcwd(NULL, PATH_MAX); - else - project_root = strdup(ecore_file_file_get(directory)); title = eina_strbuf_new(); - eina_strbuf_append_printf(title, "Edi Source Control :: %s", project_root); + eina_strbuf_append_printf(title, _("Edi Source Control :: %s (%s)"), + engine->root_directory, + engine->name ?: _("unknown")); elm_win_title_set(win, eina_strbuf_string_get(title)); eina_strbuf_free(title); - - free(project_root); } static Evas_Object * -_win_add(void) +_win_add(Edi_Scm_Engine *engine) { Evas_Object *win, *icon; @@ -47,7 +41,7 @@ _win_add(void) evas_object_resize(win, DEFAULT_WIDTH * elm_config_scale_get(), DEFAULT_HEIGHT * elm_config_scale_get()); evas_object_smart_callback_add(win, "delete,request", _win_del_cb, NULL); - _win_title_set(win); + _win_title_set(win, engine); return win; } @@ -55,6 +49,7 @@ _win_add(void) int main(int argc, char **argv) { Evas_Object *win; + Edi_Scm_Engine *engine; ecore_init(); elm_init(argc, argv); @@ -62,7 +57,7 @@ int main(int argc, char **argv) if (!edi_scm_generic_init()) exit(1 << 0); - win = _win_add(); + win = _win_add(engine); edi_scm_ui_add(win); elm_win_center(win, EINA_TRUE, EINA_TRUE); evas_object_show(win);