summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlastair Poole <alastair.poole@int6.co.uk>2019-12-14 19:34:58 +0000
committerAlastair Poole <alastair.poole@int6.co.uk>2019-12-14 19:35:26 +0000
commit539f078812dc07034ce7b90cbc8ec57cad770a82 (patch)
treecd41a696d3fffb8c2747b342e2b585b8d5b51ccc
parentf8225a6d6b74bee5e6750b7c643280b90b1549c4 (diff)
UI: Show percentage sign where applicable.
-rw-r--r--src/bin/ui.c48
1 files changed, 25 insertions, 23 deletions
diff --git a/src/bin/ui.c b/src/bin/ui.c
index b3af63a..24bfa7d 100644
--- a/src/bin/ui.c
+++ b/src/bin/ui.c
@@ -247,17 +247,17 @@ _ui_disk_add(Ui *ui, const char *path, const char *mount, unsigned long total, u
247 evas_object_size_hint_weight_set(progress, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 247 evas_object_size_hint_weight_set(progress, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
248 elm_progressbar_span_size_set(progress, 1.0); 248 elm_progressbar_span_size_set(progress, 1.0);
249 249
250 ratio = total / 100.0;
251 value = used / ratio;
252
250 elm_progressbar_unit_format_set(progress, 253 elm_progressbar_unit_format_set(progress,
251 eina_slstr_printf( 254 eina_slstr_printf(
252 "%lu%c of %lu%c", 255 "%lu%c of %lu%c (%1.0f &#37;)",
253 _disk_adjust(ui->data_unit, used), ui->data_unit, 256 _disk_adjust(ui->data_unit, used), ui->data_unit,
254 _disk_adjust(ui->data_unit, total), ui->data_unit)); 257 _disk_adjust(ui->data_unit, total), ui->data_unit, value));
255 258
256 elm_object_content_set(frame, progress); 259 elm_object_content_set(frame, progress);
257 260
258 ratio = total / 100.0;
259 value = used / ratio;
260
261 if (used == 0 && total == 0) 261 if (used == 0 && total == 0)
262 elm_progressbar_value_set(progress, 1.0); 262 elm_progressbar_value_set(progress, 1.0);
263 else 263 else
@@ -309,52 +309,54 @@ _tab_memory_update(Ui *ui, results_t *results)
309 return; 309 return;
310 310
311 progress = ui->progress_mem_used; 311 progress = ui->progress_mem_used;
312 ratio = results->memory.total / 100.0;
313 value = results->memory.used / ratio;
312 elm_progressbar_unit_format_set(progress, 314 elm_progressbar_unit_format_set(progress,
313 eina_slstr_printf( 315 eina_slstr_printf(
314 "%lu %c / %lu %c", 316 "%lu %c / %lu %c (%1.0f &#37;)",
315 _mem_adjust(ui->data_unit, results->memory.used), ui->data_unit, 317 _mem_adjust(ui->data_unit, results->memory.used), ui->data_unit,
316 _mem_adjust(ui->data_unit, results->memory.total), ui->data_unit)); 318 _mem_adjust(ui->data_unit, results->memory.total), ui->data_unit, value));
317 ratio = results->memory.total / 100.0;
318 value = results->memory.used / ratio;
319 elm_progressbar_value_set(progress, value / 100); 319 elm_progressbar_value_set(progress, value / 100);
320 320
321 progress = ui->progress_mem_cached; 321 progress = ui->progress_mem_cached;
322 elm_progressbar_unit_format_set(progress, eina_slstr_printf(
323 "%lu %c / %lu %c",
324 _mem_adjust(ui->data_unit, results->memory.cached), ui->data_unit,
325 _mem_adjust(ui->data_unit, results->memory.total), ui->data_unit));
326 ratio = results->memory.total / 100.0; 322 ratio = results->memory.total / 100.0;
327 value = results->memory.cached / ratio; 323 value = results->memory.cached / ratio;
324 elm_progressbar_unit_format_set(progress, eina_slstr_printf(
325 "%lu %c / %lu %c (%1.0f &#37;)",
326 _mem_adjust(ui->data_unit, results->memory.cached), ui->data_unit,
327 _mem_adjust(ui->data_unit, results->memory.total), ui->data_unit, value));
328 elm_progressbar_value_set(progress, value / 100); 328 elm_progressbar_value_set(progress, value / 100);
329 329
330 progress = ui->progress_mem_buffered; 330 progress = ui->progress_mem_buffered;
331 ratio = results->memory.total / 100.0;
332 value = results->memory.buffered / ratio;
331 elm_progressbar_unit_format_set(progress, 333 elm_progressbar_unit_format_set(progress,
332 eina_slstr_printf( 334 eina_slstr_printf(
333 "%lu %c / %lu %c", 335 "%lu %c / %lu %c (%1.0f &#37;)",
334 _mem_adjust(ui->data_unit, results->memory.buffered), ui->data_unit, 336 _mem_adjust(ui->data_unit, results->memory.buffered), ui->data_unit,
335 _mem_adjust(ui->data_unit, results->memory.total), ui->data_unit)); 337 _mem_adjust(ui->data_unit, results->memory.total), ui->data_unit, value));
336 ratio = results->memory.total / 100.0;
337 value = results->memory.buffered / ratio;
338 elm_progressbar_value_set(progress, value / 100); 338 elm_progressbar_value_set(progress, value / 100);
339 339
340 progress = ui->progress_mem_shared; 340 progress = ui->progress_mem_shared;
341 ratio = results->memory.total / 100.0;
342 value = results->memory.shared / ratio;
341 elm_progressbar_unit_format_set(progress, 343 elm_progressbar_unit_format_set(progress,
342 eina_slstr_printf( 344 eina_slstr_printf(
343 "%lu %c / %lu %c", 345 "%lu %c / %lu %c (%1.0f &#37;)",
344 _mem_adjust(ui->data_unit, results->memory.shared), ui->data_unit, 346 _mem_adjust(ui->data_unit, results->memory.shared), ui->data_unit,
345 _mem_adjust(ui->data_unit, results->memory.total), ui->data_unit)); 347 _mem_adjust(ui->data_unit, results->memory.total), ui->data_unit, value));
346 ratio = results->memory.total / 100.0; 348 ratio = results->memory.total / 100.0;
347 value = results->memory.shared / ratio; 349 value = results->memory.shared / ratio;
348 elm_progressbar_value_set(progress, value / 100); 350 elm_progressbar_value_set(progress, value / 100);
349 351
350 progress = ui->progress_mem_swap; 352 progress = ui->progress_mem_swap;
353 ratio = results->memory.swap_total / 100.0;
354 value = results->memory.swap_used / ratio;
351 elm_progressbar_unit_format_set(progress, 355 elm_progressbar_unit_format_set(progress,
352 eina_slstr_printf( 356 eina_slstr_printf(
353 "%lu %c / %lu %c", 357 "%lu %c / %lu %c (%1.0f &#37;)",
354 _mem_adjust(ui->data_unit, results->memory.swap_used), ui->data_unit, 358 _mem_adjust(ui->data_unit, results->memory.swap_used), ui->data_unit,
355 _mem_adjust(ui->data_unit, results->memory.swap_total), ui->data_unit)); 359 _mem_adjust(ui->data_unit, results->memory.swap_total), ui->data_unit, value));
356 ratio = results->memory.swap_total / 100.0;
357 value = results->memory.swap_used / ratio;
358 elm_progressbar_value_set(progress, value / 100); 360 elm_progressbar_value_set(progress, value / 100);
359} 361}
360 362