summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Andreoli <dave@gurumeditation.it>2017-01-28 20:49:05 +0100
committerDave Andreoli <dave@gurumeditation.it>2017-01-28 20:49:05 +0100
commitadc5fa6c8bbf99e42d69ef7e099cbdb1c4309439 (patch)
treeb9e26cba0c4832e8f925c91523fc0aa56b8160a9
parent921af28813bf3a8887831a8977a4f26ab3c438d0 (diff)
mem gadget: pass the new fetched info to the theme
in case a themer want to show more info inside the gadget
-rw-r--r--src/modules/sysinfo/memusage/memusage.c35
-rw-r--r--src/modules/sysinfo/sysinfo.h6
2 files changed, 35 insertions, 6 deletions
diff --git a/src/modules/sysinfo/memusage/memusage.c b/src/modules/sysinfo/memusage/memusage.c
index 9250da190..1cc8b645d 100644
--- a/src/modules/sysinfo/memusage/memusage.c
+++ b/src/modules/sysinfo/memusage/memusage.c
@@ -8,7 +8,6 @@ struct _Thread_Config
8 Instance *inst; 8 Instance *inst;
9 int mem_percent; 9 int mem_percent;
10 int swp_percent; 10 int swp_percent;
11
12 unsigned long mem_total; 11 unsigned long mem_total;
13 unsigned long mem_active; 12 unsigned long mem_active;
14 unsigned long mem_cached; 13 unsigned long mem_cached;
@@ -18,15 +17,21 @@ struct _Thread_Config
18}; 17};
19 18
20static void 19static void
21_memusage_face_update(Instance *inst, int mem, int swap) 20_memusage_face_update(Instance *inst)
22{ 21{
23 Edje_Message_Int_Set *msg; 22 Edje_Message_Int_Set *msg;
24 23
25 msg = malloc(sizeof(Edje_Message_Int_Set) + 2 * sizeof(int)); 24 msg = malloc(sizeof(Edje_Message_Int_Set) + 8 * sizeof(int));
26 EINA_SAFETY_ON_NULL_RETURN(msg); 25 EINA_SAFETY_ON_NULL_RETURN(msg);
27 msg->count = 2; 26 msg->count = 2;
28 msg->val[0] = mem; 27 msg->val[0] = inst->cfg->memusage.mem_percent;
29 msg->val[1] = swap; 28 msg->val[1] = inst->cfg->memusage.swp_percent;
29 msg->val[2] = inst->cfg->memusage.mem_total;
30 msg->val[3] = inst->cfg->memusage.mem_active;
31 msg->val[4] = inst->cfg->memusage.mem_cached;
32 msg->val[5] = inst->cfg->memusage.mem_buffers;
33 msg->val[6] = inst->cfg->memusage.swp_total;
34 msg->val[7] = inst->cfg->memusage.swp_active;
30 edje_object_message_send(elm_layout_edje_get(inst->cfg->memusage.o_gadget), 35 edje_object_message_send(elm_layout_edje_get(inst->cfg->memusage.o_gadget),
31 EDJE_MESSAGE_INT_SET, 1, msg); 36 EDJE_MESSAGE_INT_SET, 1, msg);
32 free(msg); 37 free(msg);
@@ -174,7 +179,13 @@ _memusage_cb_usage_check_notify(void *data,
174 179
175 inst->cfg->memusage.mem_percent = thc->mem_percent; 180 inst->cfg->memusage.mem_percent = thc->mem_percent;
176 inst->cfg->memusage.swp_percent = thc->swp_percent; 181 inst->cfg->memusage.swp_percent = thc->swp_percent;
177 _memusage_face_update(inst, thc->mem_percent, thc->swp_percent); 182 inst->cfg->memusage.mem_total = thc->mem_total;
183 inst->cfg->memusage.mem_active = thc->mem_active;
184 inst->cfg->memusage.mem_cached = thc->mem_cached;
185 inst->cfg->memusage.mem_buffers = thc->mem_buffers;
186 inst->cfg->memusage.swp_total = thc->swp_total;
187 inst->cfg->memusage.swp_active = thc->swp_active;
188 _memusage_face_update(inst);
178} 189}
179 190
180void 191void
@@ -318,6 +329,12 @@ _conf_item_get(int *id)
318 ci->memusage.poll_interval = 32; 329 ci->memusage.poll_interval = 32;
319 ci->memusage.mem_percent = 0; 330 ci->memusage.mem_percent = 0;
320 ci->memusage.swp_percent = 0; 331 ci->memusage.swp_percent = 0;
332 ci->memusage.mem_total = 0;
333 ci->memusage.mem_active = 0;
334 ci->memusage.mem_cached = 0;
335 ci->memusage.mem_buffers = 0;
336 ci->memusage.swp_total = 0;
337 ci->memusage.swp_active = 0;
321 ci->memusage.popup = NULL; 338 ci->memusage.popup = NULL;
322 ci->memusage.configure = NULL; 339 ci->memusage.configure = NULL;
323 340
@@ -336,6 +353,12 @@ memusage_create(Evas_Object *parent, int *id, E_Gadget_Site_Orient orient EINA_U
336 *id = inst->cfg->id; 353 *id = inst->cfg->id;
337 inst->cfg->memusage.mem_percent = 0; 354 inst->cfg->memusage.mem_percent = 0;
338 inst->cfg->memusage.swp_percent = 0; 355 inst->cfg->memusage.swp_percent = 0;
356 inst->cfg->memusage.mem_total = 0;
357 inst->cfg->memusage.mem_active = 0;
358 inst->cfg->memusage.mem_cached = 0;
359 inst->cfg->memusage.mem_buffers = 0;
360 inst->cfg->memusage.swp_total = 0;
361 inst->cfg->memusage.swp_active = 0;
339 inst->cfg->memusage.popup = NULL; 362 inst->cfg->memusage.popup = NULL;
340 inst->cfg->memusage.configure = NULL; 363 inst->cfg->memusage.configure = NULL;
341 inst->o_main = elm_box_add(parent); 364 inst->o_main = elm_box_add(parent);
diff --git a/src/modules/sysinfo/sysinfo.h b/src/modules/sysinfo/sysinfo.h
index d9f78865a..41d672e98 100644
--- a/src/modules/sysinfo/sysinfo.h
+++ b/src/modules/sysinfo/sysinfo.h
@@ -208,6 +208,12 @@ struct _Config_Item
208 int poll_interval; 208 int poll_interval;
209 int mem_percent; 209 int mem_percent;
210 int swp_percent; 210 int swp_percent;
211 unsigned long mem_total;
212 unsigned long mem_active;
213 unsigned long mem_cached;
214 unsigned long mem_buffers;
215 unsigned long swp_total;
216 unsigned long swp_active;
211 Ecore_Thread *usage_check_thread; 217 Ecore_Thread *usage_check_thread;
212 } memusage; 218 } memusage;
213 struct 219 struct