~indicator-multiload/indicator-multiload/trunk

« back to all changes in this revision

Viewing changes to src/function.vala

  • Committer: mh21 at mh21
  • Date: 2017-02-24 11:53:48 UTC
  • Revision ID: mh21@mh21.de-20170224115348-qnslmzm6f9x0wu0m
Add size2 function with IEC units (base 2).

Show diffs side-by-side

added added

removed removed

Lines of Context:
55
55
    }
56
56
}
57
57
 
 
58
public class Size2Function : Function {
 
59
    public Size2Function() {
 
60
        base("size2", {"value"});
 
61
    }
 
62
 
 
63
    public override string call(string[] parameters) throws Error {
 
64
        if (parameters.length != 1)
 
65
            throw error("one parameter expected");
 
66
        return GLib.format_size(uint64.parse(parameters[0]), FormatSizeFlags.IEC_UNITS);
 
67
    }
 
68
}
 
69
 
58
70
public class SpeedFunction : Function {
59
71
    public SpeedFunction() {
60
72
        base("speed", {"value"});