summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Andreoli <dave@gurumeditation.it>2017-01-28 18:02:58 +0100
committerDave Andreoli <dave@gurumeditation.it>2017-01-28 18:02:58 +0100
commitd1cb369623417bda16a3fa7628e40b6b9605a5ca (patch)
tree8a2f20c52e526c7664c6ec0f39dfe95215bc0a2a
parent1c8ca780daa4e294fea8550c8fa51dfcd181326c (diff)
mem gadget: formatting, fit into 80 cols

no functional changes
-rw-r--r--src/modules/sysinfo/memusage/memusage.c70
1 files changed, 46 insertions, 24 deletions
diff --git a/src/modules/sysinfo/memusage/memusage.c b/src/modules/sysinfo/memusage/memusage.c
index 61ae18715..4eab289c3 100644
--- a/src/modules/sysinfo/memusage/memusage.c
+++ b/src/modules/sysinfo/memusage/memusage.c
@@ -34,8 +34,9 @@ _memusage_face_update(Instance *inst, int mem, int swap)
34 if (inst->cfg->memusage.popup) 34 if (inst->cfg->memusage.popup)
35 { 35 {
36 char text[4096]; 36 char text[4096];
37 snprintf(text, sizeof(text), "%s: %d%%<br>%s: %d%%", _("Total Memory Usage"), 37 snprintf(text, sizeof(text), "%s: %d%%<br>%s: %d%%",
38 inst->cfg->memusage.real, _("Total Swap Usage"), inst->cfg->memusage.swap); 38 _("Total Memory Usage"), inst->cfg->memusage.real,
39 _("Total Swap Usage"), inst->cfg->memusage.swap);
39 elm_object_text_set(inst->cfg->memusage.popup_label, text); 40 elm_object_text_set(inst->cfg->memusage.popup_label, text);
40 } 41 }
41} 42}
@@ -84,11 +85,14 @@ _memusage_mouse_down_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_U
84 } 85 }
85 popup = elm_ctxpopup_add(e_comp->elm); 86 popup = elm_ctxpopup_add(e_comp->elm);
86 elm_object_style_set(popup, "noblock"); 87 elm_object_style_set(popup, "noblock");
87 evas_object_smart_callback_add(popup, "dismissed", _memusage_popup_dismissed, inst); 88 evas_object_smart_callback_add(popup, "dismissed",
88 evas_object_event_callback_add(popup, EVAS_CALLBACK_DEL, _memusage_popup_deleted, inst); 89 _memusage_popup_dismissed, inst);
89 90 evas_object_event_callback_add(popup, EVAS_CALLBACK_DEL,
90 snprintf(text, sizeof(text), "%s: %d%%<br>%s: %d%%", _("Total Memory Usage"), 91 _memusage_popup_deleted, inst);
91 inst->cfg->memusage.real, _("Total Swap Usage"), inst->cfg->memusage.swap); 92
93 snprintf(text, sizeof(text), "%s: %d%%<br>%s: %d%%",
94 _("Total Memory Usage"), inst->cfg->memusage.real,
95 _("Total Swap Usage"), inst->cfg->memusage.swap);
92 label = elm_label_add(popup); 96 label = elm_label_add(popup);
93 elm_object_style_set(label, "marker"); 97 elm_object_style_set(label, "marker");
94 elm_object_text_set(label, text); 98 elm_object_text_set(label, text);
@@ -98,7 +102,8 @@ _memusage_mouse_down_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_U
98 102
99 e_comp_object_util_autoclose(popup, NULL, NULL, NULL); 103 e_comp_object_util_autoclose(popup, NULL, NULL, NULL);
100 evas_object_show(popup); 104 evas_object_show(popup);
101 e_gadget_util_ctxpopup_place(inst->o_main, popup, inst->cfg->memusage.o_gadget); 105 e_gadget_util_ctxpopup_place(inst->o_main, popup,
106 inst->cfg->memusage.o_gadget);
102 inst->cfg->memusage.popup = popup; 107 inst->cfg->memusage.popup = popup;
103 } 108 }
104 else 109 else
@@ -123,11 +128,14 @@ _memusage_resize_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSE
123 Evas_Coord w, h; 128 Evas_Coord w, h;
124 Instance *inst = data; 129 Instance *inst = data;
125 130
126 edje_object_parts_extends_calc(elm_layout_edje_get(inst->cfg->memusage.o_gadget), 0, 0, &w, &h); 131 edje_object_parts_extends_calc(elm_layout_edje_get(inst->cfg->memusage.o_gadget),
132 0, 0, &w, &h);
127 if (inst->cfg->esm == E_SYSINFO_MODULE_MEMUSAGE) 133 if (inst->cfg->esm == E_SYSINFO_MODULE_MEMUSAGE)
128 evas_object_size_hint_aspect_set(inst->o_main, EVAS_ASPECT_CONTROL_BOTH, w, h); 134 evas_object_size_hint_aspect_set(inst->o_main,
135 EVAS_ASPECT_CONTROL_BOTH, w, h);
129 else 136 else
130 evas_object_size_hint_aspect_set(inst->cfg->memusage.o_gadget, EVAS_ASPECT_CONTROL_BOTH, w, h); 137 evas_object_size_hint_aspect_set(inst->cfg->memusage.o_gadget,
138 EVAS_ASPECT_CONTROL_BOTH, w, h);
131} 139}
132 140
133static void 141static void
@@ -161,7 +169,8 @@ _memusage_cb_usage_check_notify(void *data,
161 Instance *inst = thc->inst; 169 Instance *inst = thc->inst;
162 170
163 if (!inst->cfg) return; 171 if (!inst->cfg) return;
164 if (inst->cfg->esm != E_SYSINFO_MODULE_MEMUSAGE && inst->cfg->esm != E_SYSINFO_MODULE_SYSINFO) return; 172 if (inst->cfg->esm != E_SYSINFO_MODULE_MEMUSAGE &&
173 inst->cfg->esm != E_SYSINFO_MODULE_SYSINFO) return;
165 174
166 inst->cfg->memusage.real = thc->memstatus; 175 inst->cfg->memusage.real = thc->memstatus;
167 inst->cfg->memusage.swap = thc->swapstatus; 176 inst->cfg->memusage.swap = thc->swapstatus;
@@ -209,7 +218,8 @@ _memusage_removed_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_data)
209 ecore_thread_cancel(inst->cfg->memusage.usage_check_thread); 218 ecore_thread_cancel(inst->cfg->memusage.usage_check_thread);
210 inst->cfg->memusage.usage_check_thread = NULL; 219 inst->cfg->memusage.usage_check_thread = NULL;
211 } 220 }
212 evas_object_event_callback_del_full(inst->o_main, EVAS_CALLBACK_DEL, sysinfo_memusage_remove, data); 221 evas_object_event_callback_del_full(inst->o_main, EVAS_CALLBACK_DEL,
222 sysinfo_memusage_remove, data);
213 223
214 sysinfo_config->items = eina_list_remove(sysinfo_config->items, inst->cfg); 224 sysinfo_config->items = eina_list_remove(sysinfo_config->items, inst->cfg);
215 E_FREE(inst->cfg); 225 E_FREE(inst->cfg);
@@ -252,10 +262,15 @@ _memusage_created_cb(void *data, Evas_Object *obj, void *event_data EINA_UNUSED)
252 E_EXPAND(inst->cfg->memusage.o_gadget); 262 E_EXPAND(inst->cfg->memusage.o_gadget);
253 E_FILL(inst->cfg->memusage.o_gadget); 263 E_FILL(inst->cfg->memusage.o_gadget);
254 elm_box_pack_end(inst->o_main, inst->cfg->memusage.o_gadget); 264 elm_box_pack_end(inst->o_main, inst->cfg->memusage.o_gadget);
255 evas_object_event_callback_add(inst->cfg->memusage.o_gadget, EVAS_CALLBACK_MOUSE_DOWN, _memusage_mouse_down_cb, inst); 265 evas_object_event_callback_add(inst->cfg->memusage.o_gadget,
256 evas_object_event_callback_add(inst->cfg->memusage.o_gadget, EVAS_CALLBACK_RESIZE, _memusage_resize_cb, inst); 266 EVAS_CALLBACK_MOUSE_DOWN,
267 _memusage_mouse_down_cb, inst);
268 evas_object_event_callback_add(inst->cfg->memusage.o_gadget,
269 EVAS_CALLBACK_RESIZE,
270 _memusage_resize_cb, inst);
257 evas_object_show(inst->cfg->memusage.o_gadget); 271 evas_object_show(inst->cfg->memusage.o_gadget);
258 evas_object_smart_callback_del_full(obj, "gadget_created", _memusage_created_cb, data); 272 evas_object_smart_callback_del_full(obj, "gadget_created",
273 _memusage_created_cb, data);
259 _memusage_config_updated(inst); 274 _memusage_config_updated(inst);
260} 275}
261 276
@@ -263,12 +278,17 @@ Evas_Object *
263sysinfo_memusage_create(Evas_Object *parent, Instance *inst) 278sysinfo_memusage_create(Evas_Object *parent, Instance *inst)
264{ 279{
265 inst->cfg->memusage.o_gadget = elm_layout_add(parent); 280 inst->cfg->memusage.o_gadget = elm_layout_add(parent);
266 e_theme_edje_object_set(inst->cfg->memusage.o_gadget, "base/theme/modules/memusage", 281 e_theme_edje_object_set(inst->cfg->memusage.o_gadget,
282 "base/theme/modules/memusage",
267 "e/modules/memusage/main"); 283 "e/modules/memusage/main");
268 E_EXPAND(inst->cfg->memusage.o_gadget); 284 E_EXPAND(inst->cfg->memusage.o_gadget);
269 E_FILL(inst->cfg->memusage.o_gadget); 285 E_FILL(inst->cfg->memusage.o_gadget);
270 evas_object_event_callback_add(inst->cfg->memusage.o_gadget, EVAS_CALLBACK_MOUSE_DOWN, _memusage_mouse_down_cb, inst); 286 evas_object_event_callback_add(inst->cfg->memusage.o_gadget,
271 evas_object_event_callback_add(inst->cfg->memusage.o_gadget, EVAS_CALLBACK_RESIZE, _memusage_resize_cb, inst); 287 EVAS_CALLBACK_MOUSE_DOWN,
288 _memusage_mouse_down_cb, inst);
289 evas_object_event_callback_add(inst->cfg->memusage.o_gadget,
290 EVAS_CALLBACK_RESIZE,
291 _memusage_resize_cb, inst);
272 evas_object_show(inst->cfg->memusage.o_gadget); 292 evas_object_show(inst->cfg->memusage.o_gadget);
273 _memusage_config_updated(inst); 293 _memusage_config_updated(inst);
274 294
@@ -321,15 +341,17 @@ memusage_create(Evas_Object *parent, int *id, E_Gadget_Site_Orient orient EINA_U
321 inst->o_main = elm_box_add(parent); 341 inst->o_main = elm_box_add(parent);
322 E_EXPAND(inst->o_main); 342 E_EXPAND(inst->o_main);
323 evas_object_data_set(inst->o_main, "Instance", inst); 343 evas_object_data_set(inst->o_main, "Instance", inst);
324 evas_object_smart_callback_add(parent, "gadget_created", _memusage_created_cb, inst); 344 evas_object_smart_callback_add(parent, "gadget_created",
325 evas_object_smart_callback_add(parent, "gadget_removed", _memusage_removed_cb, inst); 345 _memusage_created_cb, inst);
326 evas_object_event_callback_add(inst->o_main, EVAS_CALLBACK_DEL, sysinfo_memusage_remove, inst); 346 evas_object_smart_callback_add(parent, "gadget_removed",
347 _memusage_removed_cb, inst);
348 evas_object_event_callback_add(inst->o_main, EVAS_CALLBACK_DEL,
349 sysinfo_memusage_remove, inst);
327 evas_object_show(inst->o_main); 350 evas_object_show(inst->o_main);
328 351
329 if (inst->cfg->id < 0) return inst->o_main; 352 if (inst->cfg->id < 0) return inst->o_main;
330 353
331 sysinfo_instances = 354 sysinfo_instances = eina_list_append(sysinfo_instances, inst);
332 eina_list_append(sysinfo_instances, inst);
333 355
334 return inst->o_main; 356 return inst->o_main;
335} 357}