Add main_new_with_dir() to enable open a term in a specifc path

devs/discomfitor/demos
José Roberto de Souza 9 years ago
parent 7530e8d304
commit f5687a7e32
  1. 16
      src/bin/main.c
  2. 1
      src/bin/main.h

@ -354,19 +354,17 @@ _term_focus_show(Split *sp, Term *term)
}
void
main_new(Evas_Object *win, Evas_Object *term)
main_new_with_dir(Evas_Object *win, Evas_Object *term, const char *wdir)
{
Split *sp = _split_find(win, term);
Config *config;
int w, h;
char buf[PATH_MAX], *wdir = NULL;
if (!sp) return;
_term_resize_track_stop(sp);
evas_object_hide(sp->term->bg);
config = config_fork(sp->term->config);
termio_size_get(sp->term->term, &w, &h);
if (termio_cwd_get(sp->term->term, buf, sizeof(buf))) wdir = buf;
sp->term = main_term_new(sp->wn, config,
NULL, EINA_FALSE, wdir,
w, h, EINA_FALSE);
@ -379,6 +377,16 @@ main_new(Evas_Object *win, Evas_Object *term)
_split_tabcount_update(sp, sp->term);
}
void
main_new(Evas_Object *win, Evas_Object *term)
{
Split *sp = _split_find(win, term);
char buf[PATH_MAX], *wdir = NULL;
if (termio_cwd_get(sp->term->term, buf, sizeof(buf))) wdir = buf;
main_new_with_dir(win, term, wdir);
}
void
main_split_h(Evas_Object *win, Evas_Object *term)
{

@ -8,6 +8,7 @@ typedef struct _Term Term;
typedef struct _Split Split;
void main_new(Evas_Object *win, Evas_Object *term);
void main_new_with_dir(Evas_Object *win, Evas_Object *term, const char *wdir);
void main_split_h(Evas_Object *win, Evas_Object *term);
void main_split_v(Evas_Object *win, Evas_Object *term);
void main_close(Evas_Object *win, Evas_Object *term);

Loading…
Cancel
Save