Sysinfo Gadgets: Provide only demo data and don't poll/thread when gadgets are in demo mode.

This fixes T5816
This commit is contained in:
Stephen 'Okra' Houston 2017-08-22 10:23:20 -05:00
parent 12b8f482ed
commit 993f8ad519
6 changed files with 68 additions and 1 deletions

View File

@ -390,6 +390,11 @@ _batman_config_updated(Instance *inst)
if (!inst->cfg) return;
if (inst->cfg->id == -1)
{
_batman_face_level_set(inst->cfg->batman.o_gadget, .60);
return;
}
if ((inst->cfg->batman.force_mode == UNKNOWN) ||
(inst->cfg->batman.force_mode == SUBSYSTEM))
{

View File

@ -364,6 +364,14 @@ _cpuclock_config_updated(Instance *inst)
int i;
unsigned int count;
if (inst->cfg->id == -1)
{
inst->cfg->cpuclock.status->cur_frequency = 3.0;
inst->cfg->cpuclock.status->can_set_frequency = 1;
inst->cfg->cpuclock.status->cur_min_frequency = 0.5;
inst->cfg->cpuclock.status->cur_max_frequency = 3.5;
return;
}
if (inst->cfg->cpuclock.status->frequencies)
{
count = eina_list_count(inst->cfg->cpuclock.status->frequencies);

View File

@ -262,7 +262,36 @@ _cpumonitor_config_updated(Instance *inst)
Thread_Config *thc;
CPU_Core *core;
int i = 0;
if (inst->cfg->id == -1)
{
int percent = 15;
thc = E_NEW(Thread_Config, 1);
if (thc)
{
thc->inst = inst;
thc->total = 0;
thc->idle = 0;
thc->percent = 60;
for (i = 0; i < 4; i++)
{
core = E_NEW(CPU_Core, 1);
core->layout = _cpumonitor_add_layout(inst);
if (i == 0)
evas_object_event_callback_add(core->layout, EVAS_CALLBACK_RESIZE, _cpumonitor_resize_cb, inst);
core->percent = percent;
core->total = 0;
core->idle = 0;
thc->cores = eina_list_append(thc->cores, core);
percent += 15;
}
_cpumonitor_face_update(thc);
EINA_LIST_FREE(thc->cores, core)
E_FREE(core);
E_FREE(thc);
}
return;
}
if (!ecore_thread_check(inst->cfg->cpumonitor.usage_check_thread))
{
_cpumonitor_del_layouts(inst);

View File

@ -358,6 +358,13 @@ _memusage_config_updated(Instance *inst)
{
Thread_Config *thc;
if (inst->cfg->id == -1)
{
inst->cfg->memusage.mem_percent = 75;
inst->cfg->memusage.swp_percent = 30;
_memusage_face_update(inst);
return;
}
if (inst->cfg->memusage.usage_check_thread)
{
ecore_thread_cancel(inst->cfg->memusage.usage_check_thread);

View File

@ -237,6 +237,19 @@ _netstatus_config_updated(Instance *inst)
{
Thread_Config *thc;
if (inst->cfg->id == -1)
{
thc = E_NEW(Thread_Config, 1);
if (thc)
{
thc->inst = inst;
thc->inpercent = 75;
thc->outpercent = 30;
_netstatus_face_update(thc);
E_FREE(thc);
}
return;
}
if (inst->cfg->netstatus.usage_check_thread)
{
ecore_thread_cancel(inst->cfg->netstatus.usage_check_thread);

View File

@ -259,6 +259,11 @@ _thermal_config_updated(Instance *inst)
{
Tempthread *tth;
if (inst->cfg->id == -1)
{
_thermal_face_level_set(inst, .60);
return;
}
if (inst->cfg->thermal.th) ecore_thread_cancel(inst->cfg->thermal.th);
tth = calloc(1, sizeof(Tempthread));