class Xmms::Result

Public Instance Methods

error() click to toggle source
static VALUE
c_get_error (VALUE self)
{
        RbResult *res;
        xmmsv_t *val;
        const char *error;
        int ret;

        Data_Get_Struct (self, RbResult, res);

        val = xmmsc_result_get_value (res->real);

        ret = xmmsv_get_error (val, &error);

        return rb_str_new2 (ret ? error : "");
}
error?() click to toggle source
static VALUE
c_is_error (VALUE self)
{
        RbResult *res;

        Data_Get_Struct (self, RbResult, res);

        return xmmsc_result_iserror (res->real) ? Qtrue : Qfalse;
}
notifier { |res| } click to toggle source

Sets the block that’s executed when res is handled. Used by asyncronous results only.

static VALUE
c_notifier_set (VALUE self)
{
        VALUE callback;
        RbResult *res = NULL;
        RbXmmsClient *xmms = NULL;

        Data_Get_Struct (self, RbResult, res);

        if (!rb_block_given_p ())
                return Qnil;

        callback = rb_block_proc ();

        Data_Get_Struct (res->xmms, RbXmmsClient, xmms);
        rb_ary_push (xmms->result_callbacks, callback);

        xmmsc_result_notifier_set (res->real, on_signal, (void *) callback);

        return Qnil;
}
value() click to toggle source
static VALUE
c_value_get (VALUE self)
{
        RbResult *res = NULL;
        xmmsv_t *val;

        Data_Get_Struct (self, RbResult, res);

        val = xmmsc_result_get_value (res->real);

        return extract_value (self, val);
}
wait → self click to toggle source

Waits for res to be handled.

static VALUE
c_wait (VALUE self)
{
        RbResult *res = NULL;

        Data_Get_Struct (self, RbResult, res);

        xmmsc_result_wait (res->real);

        return self;
}