forked from enlightenment/evisum
procview: horrrible naming but no block
This commit is contained in:
parent
110b853c8f
commit
3931125e54
|
@ -835,6 +835,67 @@ _run_time_string(int64_t secs)
|
||||||
return strdup(buf);
|
return strdup(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_manual_cb(void *data, Ecore_Thread *thread)
|
||||||
|
{
|
||||||
|
Eina_List *lines;
|
||||||
|
char *line;
|
||||||
|
char buf[4096];
|
||||||
|
int n = 1;
|
||||||
|
Ui_Data *pd = data;
|
||||||
|
|
||||||
|
setenv("MANWIDTH", "75", 1);
|
||||||
|
|
||||||
|
ecore_thread_feedback(thread, strdup("<code>"));
|
||||||
|
snprintf(buf, sizeof(buf), "man %s | col -bx", pd->selected_cmd);
|
||||||
|
lines = _exe_response(buf);
|
||||||
|
if (!lines)
|
||||||
|
{
|
||||||
|
snprintf(buf, sizeof(buf), _("No documentation found for %s."),
|
||||||
|
pd->selected_cmd);
|
||||||
|
ecore_thread_feedback(thread, strdup(buf));
|
||||||
|
}
|
||||||
|
|
||||||
|
EINA_LIST_FREE(lines, line)
|
||||||
|
{
|
||||||
|
if (n++ > 1)
|
||||||
|
{
|
||||||
|
snprintf(buf, sizeof(buf), "%s<br>", line);
|
||||||
|
ecore_thread_feedback(thread, strdup(buf));
|
||||||
|
}
|
||||||
|
free(line);
|
||||||
|
}
|
||||||
|
|
||||||
|
ecore_thread_feedback(thread, strdup("</code>"));
|
||||||
|
|
||||||
|
unsetenv("MANWIDTH");
|
||||||
|
pd->manual.init = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_manual_feedback_cb(void *data, Ecore_Thread *thread, void *msgdata)
|
||||||
|
{
|
||||||
|
Ui_Data *pd = data;
|
||||||
|
Evas_Object *ent = pd->manual.entry;
|
||||||
|
char *s = msgdata;
|
||||||
|
|
||||||
|
elm_entry_entry_append(ent, s);
|
||||||
|
|
||||||
|
free(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_manual_init(Ui_Data *pd)
|
||||||
|
{
|
||||||
|
if ((!pd->selected_cmd) || (!pd->selected_cmd[0]) || (strchr(pd->selected_cmd, ' ')))
|
||||||
|
return;
|
||||||
|
|
||||||
|
ecore_thread_feedback_run(_manual_cb,
|
||||||
|
_manual_feedback_cb,
|
||||||
|
NULL, NULL, pd, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_general_view_update(Ui_Data *pd, Proc_Info *proc)
|
_general_view_update(Ui_Data *pd, Proc_Info *proc)
|
||||||
{
|
{
|
||||||
|
@ -1548,66 +1609,9 @@ _tab_manual_clicked_cb(void *data, Evas_Object *obj EINA_UNUSED,
|
||||||
pd = data;
|
pd = data;
|
||||||
_tab_change(pd, pd->manual_view, obj);
|
_tab_change(pd, pd->manual_view, obj);
|
||||||
elm_object_focus_set(pd->tab_general, 1);
|
elm_object_focus_set(pd->tab_general, 1);
|
||||||
}
|
if (pd->manual.init) return;
|
||||||
|
|
||||||
static void
|
_manual_init(pd);
|
||||||
_manual_get_cb(void *data, Ecore_Thread *thread)
|
|
||||||
{
|
|
||||||
Eina_List *lines;
|
|
||||||
char *line;
|
|
||||||
char buf[4096];
|
|
||||||
int n = 1;
|
|
||||||
Ui_Data *pd = data;
|
|
||||||
|
|
||||||
setenv("MANWIDTH", "75", 1);
|
|
||||||
|
|
||||||
ecore_thread_feedback(thread, strdup("<code>"));
|
|
||||||
snprintf(buf, sizeof(buf), "man %s | col -bx", pd->selected_cmd);
|
|
||||||
lines = _exe_response(buf);
|
|
||||||
if (!lines)
|
|
||||||
{
|
|
||||||
snprintf(buf, sizeof(buf), _("No documentation found for %s."),
|
|
||||||
pd->selected_cmd);
|
|
||||||
ecore_thread_feedback(thread, strdup(buf));
|
|
||||||
}
|
|
||||||
|
|
||||||
EINA_LIST_FREE(lines, line)
|
|
||||||
{
|
|
||||||
if (n++ > 1)
|
|
||||||
{
|
|
||||||
snprintf(buf, sizeof(buf), "%s<br>", line);
|
|
||||||
ecore_thread_feedback(thread, strdup(buf));
|
|
||||||
}
|
|
||||||
free(line);
|
|
||||||
}
|
|
||||||
|
|
||||||
ecore_thread_feedback(thread, strdup("</code>"));
|
|
||||||
|
|
||||||
unsetenv("MANWIDTH");
|
|
||||||
pd->manual.init = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_manual_feedback_cb(void *data, Ecore_Thread *thread, void *msgdata)
|
|
||||||
{
|
|
||||||
Ui_Data *pd = data;
|
|
||||||
Evas_Object *ent = pd->manual.entry;
|
|
||||||
char *s = msgdata;
|
|
||||||
|
|
||||||
elm_entry_entry_append(ent, s);
|
|
||||||
|
|
||||||
free(s);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_manual_init(Ui_Data *pd)
|
|
||||||
{
|
|
||||||
if ((!pd->selected_cmd) || (!pd->selected_cmd[0]) || (strchr(pd->selected_cmd, ' ')))
|
|
||||||
return;
|
|
||||||
|
|
||||||
ecore_thread_feedback_run(_manual_cb,
|
|
||||||
_manual_feedback_cb,
|
|
||||||
NULL, NULL, pd, 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static Evas_Object *
|
static Evas_Object *
|
||||||
|
@ -1827,7 +1831,6 @@ ui_process_view_win_add(int pid, Evisum_Proc_Action action)
|
||||||
elm_win_center(win, 1, 1);
|
elm_win_center(win, 1, 1);
|
||||||
evas_object_show(win);
|
evas_object_show(win);
|
||||||
|
|
||||||
_manual_init(pd);
|
|
||||||
_action_do(pd, action);
|
_action_do(pd, action);
|
||||||
|
|
||||||
pd->threads.cache = evisum_ui_item_cache_new(pd->threads.glist,
|
pd->threads.cache = evisum_ui_item_cache_new(pd->threads.glist,
|
||||||
|
|
Loading…
Reference in New Issue