gettextify termcmd.c,termio.c,termpty.c,termptyesc.c

This commit is contained in:
Boris Faure 2014-07-21 23:51:26 +02:00
parent 793f42daa5
commit 8a3c15e08e
4 changed files with 51 additions and 47 deletions

View File

@ -63,7 +63,7 @@ _termcmd_font_size(Evas_Object *obj, Evas_Object *win EINA_UNUSED, Evas_Object *
termio_font_size_set(obj, config->font.size - 1);
}
else
ERR("Unknown font command: %s", cmd);
ERR(_("Unknown font command: %s"), cmd);
}
return EINA_TRUE;
}
@ -90,7 +90,7 @@ _termcmd_grid_size(Evas_Object *obj, Evas_Object *win EINA_UNUSED, Evas_Object *
if ((w > 0) && (h > 0))
termio_grid_size_set(obj, w, h);
else
ERR("Unknown grid size command: %s", cmd);
ERR(_("Unknown grid size command: %s"), cmd);
return EINA_TRUE;
}
@ -115,7 +115,7 @@ _termcmd_background(Evas_Object *obj, Evas_Object *win EINA_UNUSED, Evas_Object
main_media_update(config);
}
else
ERR("Background file cannot be read: %s", cmd);
ERR(_("Background file cannot be read: %s"), cmd);
return EINA_TRUE;
}
@ -144,6 +144,6 @@ termcmd_do(Evas_Object *obj, Evas_Object *win, Evas_Object *bg, const char *cmd)
if ((cmd[0] == 'b') || (cmd[0] == 'B'))
return _termcmd_background(obj, win, bg, cmd + 1);
ERR("Unknown command: %s", cmd);
ERR(_("Unknown command: %s"), cmd);
return EINA_FALSE;
}

View File

@ -379,12 +379,12 @@ _cb_link_down(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, voi
(type == TYPE_SCALE) ||
(type == TYPE_EDJE) ||
(type == TYPE_MOV))
elm_ctxpopup_item_append(ctxp, "Preview", NULL,
elm_ctxpopup_item_append(ctxp, _("Preview"), NULL,
_cb_ctxp_link_preview, sd->self);
}
elm_ctxpopup_item_append(ctxp, "Open", NULL, _cb_ctxp_link_open,
elm_ctxpopup_item_append(ctxp, _("Open"), NULL, _cb_ctxp_link_open,
sd->self);
elm_ctxpopup_item_append(ctxp, "Copy", NULL, _cb_ctxp_link_copy,
elm_ctxpopup_item_append(ctxp, _("Copy"), NULL, _cb_ctxp_link_copy,
sd->self);
evas_object_move(ctxp, ev->canvas.x, ev->canvas.y);
evas_object_show(ctxp);
@ -439,7 +439,7 @@ _cb_link_drag_move(void *data, Evas_Object *obj, Evas_Coord x, Evas_Coord y, Elm
Termio *sd = evas_object_smart_data_get(data);
EINA_SAFETY_ON_NULL_RETURN(sd);
printf("dnd %i %i act %i\n", x, y, action);
DBG("dnd %i %i act %i", x, y, action);
em = evas_key_modifier_get(evas_object_evas_get(sd->event));
if (em)
{
@ -456,7 +456,7 @@ _cb_link_drag_accept(void *data, Evas_Object *obj EINA_UNUSED, Eina_Bool doaccep
Termio *sd = evas_object_smart_data_get(data);
EINA_SAFETY_ON_NULL_RETURN(sd);
printf("dnd accept: %i\n", doaccept);
DBG("dnd accept: %i", doaccept);
}
static void
@ -465,7 +465,7 @@ _cb_link_drag_done(void *data, Evas_Object *obj EINA_UNUSED)
Termio *sd = evas_object_smart_data_get(data);
EINA_SAFETY_ON_NULL_RETURN(sd);
printf("dnd done\n");
DBG("dnd done");
sd->link.down.dnd = EINA_FALSE;
if ((sd->link.down.dndobjdel) && (sd->link.down.dndobj))
evas_object_del(sd->link.down.dndobj);
@ -506,7 +506,7 @@ _cb_link_move(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *event)
sd->link.down.down = EINA_FALSE;
sd->link.down.dnd = EINA_TRUE;
#if !((ELM_VERSION_MAJOR == 1) && (ELM_VERSION_MINOR < 8))
printf("dnd start %s %i %i\n", sd->link.string,
DBG("dnd start %s %i %i", sd->link.string,
evas_key_modifier_is_set(ev->modifiers, "Control"),
evas_key_modifier_is_set(ev->modifiers, "Shift"));
if (evas_key_modifier_is_set(ev->modifiers, "Control"))
@ -1895,7 +1895,7 @@ _getsel_cb(void *data, Evas_Object *obj EINA_UNUSED, Elm_Selection_Data *ev)
case ELM_SEL_FORMAT_VCARD: fmt = "VCARD"; break;
case ELM_SEL_FORMAT_HTML: fmt = "HTML"; break;
}
WRN("unsupported selection format '%s'", fmt);
WRN(_("unsupported selection format '%s'"), fmt);
}
return EINA_TRUE;
}
@ -3078,7 +3078,7 @@ _smart_cb_mouse_down(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUS
if ((ev->button == 3) && shift)
{
termio_debugwhite_set(data, !sd->debugwhite);
printf("debugwhite %i\n", sd->debugwhite);
DBG("debugwhite %i", sd->debugwhite);
return;
}
if (!shift && !ctrl)
@ -3834,7 +3834,7 @@ _smart_add(Evas_Object *obj)
(sd->imf, ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_DEFAULT);
imf_done:
if (sd->imf) DBG("Ecore IMF Setup");
else WRN("Ecore IMF failed");
else WRN(_("Ecore IMF failed"));
}
terms = eina_list_append(terms, obj);
}
@ -4394,19 +4394,19 @@ _smart_pty_command(void *data)
static void
_smart_cb_drag_enter(void *data EINA_UNUSED, Evas_Object *o EINA_UNUSED)
{
printf("dnd enter\n");
DBG("dnd enter");
}
static void
_smart_cb_drag_leave(void *data EINA_UNUSED, Evas_Object *o EINA_UNUSED)
{
printf("dnd leave\n");
DBG("dnd leave");
}
static void
_smart_cb_drag_pos(void *data EINA_UNUSED, Evas_Object *o EINA_UNUSED, Evas_Coord x, Evas_Coord y, Elm_Xdnd_Action action)
{
printf("dnd at %i %i act:%i\n", x, y, action);
DBG("dnd at %i %i act:%i", x, y, action);
}
static Eina_Bool
@ -4532,7 +4532,7 @@ termio_add(Evas_Object *parent, Config *config,
config->xterm_256color, config->erase_is_del, mod);
if (!sd->pty)
{
ERR("Cannot allocate termpty");
ERR(_("Cannot allocate termpty"));
evas_object_del(obj);
return NULL;
}
@ -4899,7 +4899,7 @@ termio_cwd_get(const Evas_Object *obj, char *buf, size_t size)
if (proc_pidinfo(pid, PROC_PIDVNODEPATHINFO, 0, &vpi, sizeof(vpi)) <= 0)
{
ERR("Cannot get working directory of pid %i (%s)",
ERR(_("Could not get working directory of pid %i: %s"),
pid, strerror(errno));
return EINA_FALSE;
}
@ -4913,7 +4913,7 @@ termio_cwd_get(const Evas_Object *obj, char *buf, size_t size)
snprintf(procpath, sizeof(procpath), "/proc/%d/cwd", pid);
if ((siz = readlink(procpath, buf, size)) < 1)
{
ERR("Could not load working directory %s: %s",
ERR(_("Could not load working directory %s: %s"),
procpath, strerror(errno));
return EINA_FALSE;
}

View File

@ -39,7 +39,7 @@ termpty_init(void)
_termpty_log_dom = eina_log_domain_register("termpty", NULL);
if (_termpty_log_dom < 0)
EINA_LOG_CRIT("could not create log domain 'termpty'.");
EINA_LOG_CRIT("Could not create logging domain '%s'.", "termpty");
}
void
@ -65,10 +65,10 @@ _handle_buf(Termpty *ty, const Eina_Unicode *codepoints, int len)
b = realloc(ty->buf, bytes);
if (!b)
{
ERR("memerr");
ERR(_("memerr: %s"), strerror(errno));
return;
}
INF("realloc add %i + %i", (int)(ty->buflen * sizeof(int)), (int)(len * sizeof(int)));
DBG("realloc add %i + %i", (int)(ty->buflen * sizeof(int)), (int)(len * sizeof(int)));
bytes = len * sizeof(Eina_Unicode);
memcpy(&(b[ty->buflen]), codepoints, bytes);
ty->buf = b;
@ -85,11 +85,11 @@ _handle_buf(Termpty *ty, const Eina_Unicode *codepoints, int len)
ty->buf = NULL;
ty->buflen = 0;
bytes = ((char *)ce - (char *)c) + sizeof(Eina_Unicode);
INF("malloc til %i", (int)(bytes - sizeof(Eina_Unicode)));
DBG("malloc till %i", (int)(bytes - sizeof(Eina_Unicode)));
ty->buf = malloc(bytes);
if (!ty->buf)
{
ERR("memerr");
ERR(_("memerr: %s"), strerror(errno));
return;
}
bytes = (char *)ce - (char *)c;
@ -120,10 +120,10 @@ _handle_buf(Termpty *ty, const Eina_Unicode *codepoints, int len)
{
bytes = ((char *)ce - (char *)c) + sizeof(Eina_Unicode);
ty->buf = malloc(bytes);
INF("malloc %i", (int)(bytes - sizeof(Eina_Unicode)));
DBG("malloc %i", (int)(bytes - sizeof(Eina_Unicode)));
if (!ty->buf)
{
ERR("memerr");
ERR(_("memerr: %s"), strerror(errno));
}
else
{
@ -149,7 +149,7 @@ _pty_size(Termpty *ty)
sz.ws_xpixel = 0;
sz.ws_ypixel = 0;
if (ioctl(ty->fd, TIOCSWINSZ, &sz) < 0)
ERR("Size set ioctl failed: %s", strerror(errno));
ERR(_("Size set ioctl failed: %s"), strerror(errno));
}
static Eina_Bool
@ -297,13 +297,15 @@ termpty_new(const char *cmd, Eina_Bool login_shell, const char *cd,
ty->screen = calloc(1, sizeof(Termcell) * ty->w * ty->h);
if (!ty->screen)
{
ERR("Allocation of term screen %ix%i", ty->w, ty->h);
ERR(_("Allocation of term %s %ix%i: %s"),
"screen", ty->w, ty->h, strerror(errno));
goto err;
}
ty->screen2 = calloc(1, sizeof(Termcell) * ty->w * ty->h);
if (!ty->screen2)
{
ERR("Allocation of term screen2 %ix%i", ty->w, ty->h);
ERR(_("Allocation of term %s %ix%i: %s"),
"screen2", ty->w, ty->h, strerror(errno));
goto err;
}
@ -312,35 +314,35 @@ termpty_new(const char *cmd, Eina_Bool login_shell, const char *cd,
ty->fd = posix_openpt(O_RDWR | O_NOCTTY);
if (ty->fd < 0)
{
ERR("posix_openpt failed: %s", strerror(errno));
ERR(_("Function %s failed: %s"), "posix_openpt()", strerror(errno));
goto err;
}
if (grantpt(ty->fd) != 0)
{
WRN("grantpt failed: %s", strerror(errno));
WRN(_("Function %s failed: %s"), "grantpt()", strerror(errno));
}
if (unlockpt(ty->fd) != 0)
{
ERR("unlockpt failed: %s", strerror(errno));
ERR(_("Function %s failed: %s"), "unlockpt()", strerror(errno));
goto err;
}
pty = ptsname(ty->fd);
ty->slavefd = open(pty, O_RDWR | O_NOCTTY);
if (ty->slavefd < 0)
{
ERR("open of pty '%s' failed: %s", pty, strerror(errno));
ERR(_("open() of pty '%s' failed: %s"), pty, strerror(errno));
goto err;
}
mode = fcntl(ty->fd, F_GETFL, 0);
if (mode < 0)
{
ERR("fcntl on pty '%s' failed: %s", pty, strerror(errno));
ERR(_("fcntl() on pty '%s' failed: %s"), pty, strerror(errno));
goto err;
}
if (!(mode & O_NDELAY))
if (fcntl(ty->fd, F_SETFL, mode | O_NDELAY))
{
ERR("fcntl on pty '%s' failed: %s", pty, strerror(errno));
ERR(_("fcntl() on pty '%s' failed: %s"), pty, strerror(errno));
goto err;
}
@ -356,7 +358,7 @@ termpty_new(const char *cmd, Eina_Bool login_shell, const char *cd,
_cb_exe_exit, ty);
if (!ty->hand_exe_exit)
{
ERR("event handler add failed");
ERR(_("event handler add failed"));
goto err;
}
ty->pid = fork();
@ -372,8 +374,8 @@ termpty_new(const char *cmd, Eina_Bool login_shell, const char *cd,
{
if (chdir(cd) != 0)
{
perror("chdir");
ERR("Cannot change to directory '%s'", cd);
ERR(_("Cannot change to directory '%s': %s"),
cd, strerror(errno));
exit(127);
}
}
@ -393,7 +395,7 @@ termpty_new(const char *cmd, Eina_Bool login_shell, const char *cd,
}
if (!shell)
{
WRN("Could not find shell, fallback to /bin/sh");
WRN(_("Could not find shell, falling back to %s"), "/bin/sh");
shell = "/bin/sh";
}
}
@ -588,7 +590,9 @@ void
termpty_write(Termpty *ty, const char *input, int len)
{
if (ty->fd < 0) return;
if (write(ty->fd, input, len) < 0) ERR("write %s", strerror(errno));
if (write(ty->fd, input, len) < 0)
ERR(_("Could not write to file descriptor %d: %s"),
ty->fd, strerror(errno));
}
ssize_t

View File

@ -331,7 +331,7 @@ _handle_esc_csi_color_set(Termpty *ty, Eina_Unicode **ptr)
ty->state.att.bgintense = 1;
break;
default: // not handled???
ERR(" color cmd [%i] not handled", arg);
ERR("Unhandled color cmd [%i]", arg);
break;
}
}
@ -868,7 +868,7 @@ _handle_esc_csi(Termpty *ty, const Eina_Unicode *c, Eina_Unicode *ce)
// INF("XXX: enable mouse wheel -> cursor key xlation %i", mode);
break;
default:
ERR("unhandled DEC Private Reset Mode arg %i", arg);
ERR("Unhandled DEC Private Reset Mode arg %i", arg);
break;
}
}
@ -907,7 +907,7 @@ _handle_esc_csi(Termpty *ty, const Eina_Unicode *c, Eina_Unicode *ce)
// }
default:
handled = 1;
ERR("unhandled ANSI Reset Mode arg %i", arg);
ERR("Unhandled ANSI Reset Mode arg %i", arg);
}
}
}
@ -1275,7 +1275,7 @@ _handle_esc_dcs(Termpty *ty EINA_UNUSED, const Eina_Unicode *c, const Eina_Unico
break;
default:
// many others
ERR("unhandled dcs esc '%c'", buf[0]);
ERR("Unhandled DCS escape '%c'", buf[0]);
break;
}
end:
@ -1410,7 +1410,7 @@ _handle_esc(Termpty *ty, const Eina_Unicode *c, Eina_Unicode *ce)
return 1;
*/
default:
ERR("eek - esc unhandled '%c' (0x%02x)", c[0], c[0]);
ERR("Unhandled escape '%c' (0x%02x)", c[0], c[0]);
return 1;
}
return 0;
@ -1528,7 +1528,7 @@ _termpty_handle_seq(Termpty *ty, Eina_Unicode *c, Eina_Unicode *ce)
else if (c[0] == 0x7f) // DEL
{
ty->state.had_cr = 0;
ERR("unhandled char 0x%02x [DEL]", c[0]);
ERR("Unhandled char 0x%02x [DEL]", c[0]);
return 1;
}
else if (c[0] == 0x9b) // ANSI ESC!!!