summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosé Roberto de Souza <jose.souza@intel.com>2013-09-06 15:35:52 -0300
committerJosé Roberto de Souza <jose.souza@intel.com>2013-09-19 15:53:43 -0300
commitf5687a7e32deaab6481b3dabf426c172cd7789a8 (patch)
tree67dff158a9c0ef7802b1538f32318be131104ec8
parent7530e8d3049d42dfb98cbe8b448d59d25c4bf6d0 (diff)
Add main_new_with_dir() to enable open a term in a specifc path
-rw-r--r--src/bin/main.c16
-rw-r--r--src/bin/main.h1
2 files changed, 13 insertions, 4 deletions
diff --git a/src/bin/main.c b/src/bin/main.c
index 20f7c61..fa65df3 100644
--- a/src/bin/main.c
+++ b/src/bin/main.c
@@ -354,19 +354,17 @@ _term_focus_show(Split *sp, Term *term)
354} 354}
355 355
356void 356void
357main_new(Evas_Object *win, Evas_Object *term) 357main_new_with_dir(Evas_Object *win, Evas_Object *term, const char *wdir)
358{ 358{
359 Split *sp = _split_find(win, term); 359 Split *sp = _split_find(win, term);
360 Config *config; 360 Config *config;
361 int w, h; 361 int w, h;
362 char buf[PATH_MAX], *wdir = NULL; 362
363
364 if (!sp) return; 363 if (!sp) return;
365 _term_resize_track_stop(sp); 364 _term_resize_track_stop(sp);
366 evas_object_hide(sp->term->bg); 365 evas_object_hide(sp->term->bg);
367 config = config_fork(sp->term->config); 366 config = config_fork(sp->term->config);
368 termio_size_get(sp->term->term, &w, &h); 367 termio_size_get(sp->term->term, &w, &h);
369 if (termio_cwd_get(sp->term->term, buf, sizeof(buf))) wdir = buf;
370 sp->term = main_term_new(sp->wn, config, 368 sp->term = main_term_new(sp->wn, config,
371 NULL, EINA_FALSE, wdir, 369 NULL, EINA_FALSE, wdir,
372 w, h, EINA_FALSE); 370 w, h, EINA_FALSE);
@@ -380,6 +378,16 @@ main_new(Evas_Object *win, Evas_Object *term)
380} 378}
381 379
382void 380void
381main_new(Evas_Object *win, Evas_Object *term)
382{
383 Split *sp = _split_find(win, term);
384 char buf[PATH_MAX], *wdir = NULL;
385
386 if (termio_cwd_get(sp->term->term, buf, sizeof(buf))) wdir = buf;
387 main_new_with_dir(win, term, wdir);
388}
389
390void
383main_split_h(Evas_Object *win, Evas_Object *term) 391main_split_h(Evas_Object *win, Evas_Object *term)
384{ 392{
385 Split *sp = _split_find(win, term); 393 Split *sp = _split_find(win, term);
diff --git a/src/bin/main.h b/src/bin/main.h
index bf03aba..3904435 100644
--- a/src/bin/main.h
+++ b/src/bin/main.h
@@ -8,6 +8,7 @@ typedef struct _Term Term;
8typedef struct _Split Split; 8typedef struct _Split Split;
9 9
10void main_new(Evas_Object *win, Evas_Object *term); 10void main_new(Evas_Object *win, Evas_Object *term);
11void main_new_with_dir(Evas_Object *win, Evas_Object *term, const char *wdir);
11void main_split_h(Evas_Object *win, Evas_Object *term); 12void main_split_h(Evas_Object *win, Evas_Object *term);
12void main_split_v(Evas_Object *win, Evas_Object *term); 13void main_split_v(Evas_Object *win, Evas_Object *term);
13void main_close(Evas_Object *win, Evas_Object *term); 14void main_close(Evas_Object *win, Evas_Object *term);