procview: manual init.
This commit is contained in:
parent
3931125e54
commit
41f3c6d532
|
@ -764,7 +764,6 @@ _graph(Evas_Object *parent, Ui_Data *pd)
|
||||||
evas_object_size_hint_min_set(obj, 100,
|
evas_object_size_hint_min_set(obj, 100,
|
||||||
(BAR_HEIGHT * pd->threads.graph.cpu_count)
|
(BAR_HEIGHT * pd->threads.graph.cpu_count)
|
||||||
* elm_config_scale_get());
|
* elm_config_scale_get());
|
||||||
|
|
||||||
elm_object_content_set(scr, obj);
|
elm_object_content_set(scr, obj);
|
||||||
|
|
||||||
_color_init(cpu_colormap_in, COLOR_CPU_NUM, pd->threads.graph.cpu_colormap);
|
_color_init(cpu_colormap_in, COLOR_CPU_NUM, pd->threads.graph.cpu_colormap);
|
||||||
|
@ -836,26 +835,28 @@ _run_time_string(int64_t secs)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_manual_cb(void *data, Ecore_Thread *thread)
|
_manual_init_cb(void *data, Ecore_Thread *thread)
|
||||||
{
|
{
|
||||||
Eina_List *lines;
|
Eina_List *lines = NULL;
|
||||||
char *line;
|
char *line;
|
||||||
char buf[4096];
|
char buf[4096];
|
||||||
int n = 1;
|
int n = 1;
|
||||||
Ui_Data *pd = data;
|
Ui_Data *pd = data;
|
||||||
|
|
||||||
setenv("MANWIDTH", "75", 1);
|
setenv("MANWIDTH", "75", 1);
|
||||||
|
|
||||||
ecore_thread_feedback(thread, strdup("<code>"));
|
ecore_thread_feedback(thread, strdup("<code>"));
|
||||||
snprintf(buf, sizeof(buf), "man %s | col -bx", pd->selected_cmd);
|
|
||||||
lines = _exe_response(buf);
|
if (!strchr(pd->selected_cmd, ' '))
|
||||||
|
{
|
||||||
|
snprintf(buf, sizeof(buf), "man %s | col -bx", pd->selected_cmd);
|
||||||
|
lines = _exe_response(buf);
|
||||||
|
}
|
||||||
if (!lines)
|
if (!lines)
|
||||||
{
|
{
|
||||||
snprintf(buf, sizeof(buf), _("No documentation found for %s."),
|
snprintf(buf, sizeof(buf), _("No documentation found for %s."),
|
||||||
pd->selected_cmd);
|
pd->selected_cmd);
|
||||||
ecore_thread_feedback(thread, strdup(buf));
|
ecore_thread_feedback(thread, strdup(buf));
|
||||||
}
|
}
|
||||||
|
|
||||||
EINA_LIST_FREE(lines, line)
|
EINA_LIST_FREE(lines, line)
|
||||||
{
|
{
|
||||||
if (n++ > 1)
|
if (n++ > 1)
|
||||||
|
@ -865,20 +866,20 @@ _manual_cb(void *data, Ecore_Thread *thread)
|
||||||
}
|
}
|
||||||
free(line);
|
free(line);
|
||||||
}
|
}
|
||||||
|
ecore_thread_feedback(thread, strdup("</code>"));
|
||||||
ecore_thread_feedback(thread, strdup("</code>"));
|
unsetenv("MANWIDTH");
|
||||||
|
pd->manual.init = 1;
|
||||||
unsetenv("MANWIDTH");
|
|
||||||
pd->manual.init = 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_manual_feedback_cb(void *data, Ecore_Thread *thread, void *msgdata)
|
_manual_init_feedback_cb(void *data, Ecore_Thread *thread, void *msgdata)
|
||||||
{
|
{
|
||||||
|
Evas_Object *ent;
|
||||||
|
char *s;
|
||||||
Ui_Data *pd = data;
|
Ui_Data *pd = data;
|
||||||
Evas_Object *ent = pd->manual.entry;
|
|
||||||
char *s = msgdata;
|
|
||||||
|
|
||||||
|
ent = pd->manual.entry;
|
||||||
|
s = msgdata;
|
||||||
elm_entry_entry_append(ent, s);
|
elm_entry_entry_append(ent, s);
|
||||||
|
|
||||||
free(s);
|
free(s);
|
||||||
|
@ -887,19 +888,21 @@ _manual_feedback_cb(void *data, Ecore_Thread *thread, void *msgdata)
|
||||||
static void
|
static void
|
||||||
_manual_init(Ui_Data *pd)
|
_manual_init(Ui_Data *pd)
|
||||||
{
|
{
|
||||||
if ((!pd->selected_cmd) || (!pd->selected_cmd[0]) || (strchr(pd->selected_cmd, ' ')))
|
if (pd->manual.init) return;
|
||||||
|
|
||||||
|
if ((!pd->selected_cmd) || (!pd->selected_cmd[0]))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ecore_thread_feedback_run(_manual_cb,
|
ecore_thread_feedback_run(_manual_init_cb,
|
||||||
_manual_feedback_cb,
|
_manual_init_feedback_cb,
|
||||||
NULL, NULL, pd, 1);
|
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)
|
||||||
{
|
{
|
||||||
struct passwd *pwd_entry;
|
struct passwd *pwd_entry;
|
||||||
|
char *s;
|
||||||
|
|
||||||
if (!strcmp(proc->state, "stop"))
|
if (!strcmp(proc->state, "stop"))
|
||||||
{
|
{
|
||||||
|
@ -940,26 +943,21 @@ _general_view_update(Ui_Data *pd, Proc_Info *proc)
|
||||||
evisum_size_format(proc->mem_virt));
|
evisum_size_format(proc->mem_virt));
|
||||||
elm_object_text_set(pd->general.entry_rss,
|
elm_object_text_set(pd->general.entry_rss,
|
||||||
evisum_size_format(proc->mem_rss));
|
evisum_size_format(proc->mem_rss));
|
||||||
#if !defined(__linux__)
|
|
||||||
elm_object_text_set(pd->general.entry_shared,
|
|
||||||
"N/A");
|
|
||||||
#else
|
|
||||||
elm_object_text_set(pd->general.entry_shared,
|
elm_object_text_set(pd->general.entry_shared,
|
||||||
evisum_size_format(proc->mem_shared));
|
evisum_size_format(proc->mem_shared));
|
||||||
#endif
|
|
||||||
elm_object_text_set(pd->general.entry_size,
|
elm_object_text_set(pd->general.entry_size,
|
||||||
evisum_size_format(proc->mem_size));
|
evisum_size_format(proc->mem_size));
|
||||||
char *t = _run_time_string(proc->run_time);
|
s = _run_time_string(proc->run_time);
|
||||||
if (t)
|
if (s)
|
||||||
{
|
{
|
||||||
elm_object_text_set(pd->general.entry_run_time, t);
|
elm_object_text_set(pd->general.entry_run_time, s);
|
||||||
free(t);
|
free(s);
|
||||||
}
|
}
|
||||||
t = _time_string(proc->start);
|
s = _time_string(proc->start);
|
||||||
if (t)
|
if (s)
|
||||||
{
|
{
|
||||||
elm_object_text_set(pd->general.entry_started, t);
|
elm_object_text_set(pd->general.entry_started, s);
|
||||||
free(t);
|
free(s);
|
||||||
}
|
}
|
||||||
elm_object_text_set(pd->general.entry_nice,
|
elm_object_text_set(pd->general.entry_nice,
|
||||||
eina_slstr_printf("%d", proc->nice));
|
eina_slstr_printf("%d", proc->nice));
|
||||||
|
@ -1015,7 +1013,7 @@ _proc_info_feedback_cb(void *data, Ecore_Thread *thread, void *msg)
|
||||||
|
|
||||||
_threads_cpu_usage(pd, proc);
|
_threads_cpu_usage(pd, proc);
|
||||||
|
|
||||||
if (pd->poll_count != 0 && (pd->poll_count % 10))
|
if ((pd->poll_count != 0) && (pd->poll_count % 10))
|
||||||
{
|
{
|
||||||
_graph_update(pd, proc);
|
_graph_update(pd, proc);
|
||||||
proc_info_free(proc);
|
proc_info_free(proc);
|
||||||
|
@ -1604,13 +1602,10 @@ static void
|
||||||
_tab_manual_clicked_cb(void *data, Evas_Object *obj EINA_UNUSED,
|
_tab_manual_clicked_cb(void *data, Evas_Object *obj EINA_UNUSED,
|
||||||
void *event_info EINA_UNUSED)
|
void *event_info EINA_UNUSED)
|
||||||
{
|
{
|
||||||
Ui_Data *pd;
|
Ui_Data *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;
|
|
||||||
|
|
||||||
_manual_init(pd);
|
_manual_init(pd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue