static VALUE rbg_rval2gtkradioactionentries_body(VALUE value) { long i; struct rbg_rval2gtkradioactionentries_args *args = (struct rbg_rval2gtkradioactionentries_args *)value; for (i = 0; i < args->n; i++) { VALUE entry; long n; RARRAY_PTR(args->ary)[i] = rb_ary_dup(rb_ary_to_ary(RARRAY_PTR(args->ary)[i])); entry = RARRAY_PTR(args->ary)[i]; n = RARRAY_LEN(entry); switch (n) { case 6: args->result[i].value = NUM2INT(RARRAY_PTR(entry)[5]); case 5: args->result[i].tooltip = RVAL2CSTR_ACCEPT_NIL(RARRAY_PTR(entry)[4]); case 4: args->result[i].accelerator = RVAL2CSTR_ACCEPT_NIL(RARRAY_PTR(entry)[3]); case 3: args->result[i].label = RVAL2CSTR_ACCEPT_NIL(RARRAY_PTR(entry)[2]); case 2: args->result[i].stock_id = RVAL2CSTR_ACCEPT_SYMBOL_ACCEPT_NIL(RARRAY_PTR(entry)[1]); case 1: args->result[i].name = RVAL2CSTR_ACCEPT_NIL(RARRAY_PTR(entry)[0]); default: rb_raise(rb_eArgError, "entry does not contain right number of entries %ld (1..6)", n); } } return Qnil; }
/* Method: prev(category=nil) * category: the category (string), or nil. * * Returns: the previous Gtk::SourceMark before the mark. */ static VALUE rg_prev(int argc, VALUE *argv, VALUE self) { VALUE category; rb_scan_args (argc, argv, "01", &category); return GOBJ2RVAL (gtk_source_mark_prev (_SELF (self), RVAL2CSTR_ACCEPT_SYMBOL_ACCEPT_NIL(category))); }
static VALUE rbg_rval2gtktoggleactionentries_body(VALUE value) { long i; struct rbg_rval2gtktoggleactionentries_args *args = (struct rbg_rval2gtktoggleactionentries_args *)value; for (i = 0; i < args->n; i++) { VALUE entry; long n; RARRAY_PTR(args->ary)[i] = rb_ary_dup(rb_ary_to_ary(RARRAY_PTR(args->ary)[i])); entry = RARRAY_PTR(args->ary)[i]; n = RARRAY_LEN(entry); args->result[i].callback = G_CALLBACK(activate_toggle_action); if (n < 1 || n > 7) rb_raise(rb_eArgError, "entry does not contain right number of entries %ld (1..7)", n); args->result[i].name = RVAL2CSTR_ACCEPT_NIL(RARRAY_PTR(entry)[0]); switch (n) { case 7: args->result[i].is_active = RVAL2CBOOL(RARRAY_PTR(entry)[6]); case 6: /* TODO: Call #to_proc on entry 5? */ rb_hash_aset(args->procs, RARRAY_PTR(entry)[0], RARRAY_PTR(entry)[5]); case 5: args->result[i].tooltip = RVAL2CSTR_ACCEPT_NIL(RARRAY_PTR(entry)[4]); case 4: args->result[i].accelerator = RVAL2CSTR_ACCEPT_NIL(RARRAY_PTR(entry)[3]); case 3: args->result[i].label = RVAL2CSTR_ACCEPT_NIL(RARRAY_PTR(entry)[2]); case 2: args->result[i].stock_id = RVAL2CSTR_ACCEPT_SYMBOL_ACCEPT_NIL(RARRAY_PTR(entry)[1]); break; default: break; } } return Qnil; }