static VALUE
rg_set_groups(VALUE self, VALUE groups)
{
    _SELF(self)->groups = RVAL2STRV_DUP(groups);

    return self;
}
示例#2
0
/* TODO: Is this unnecessarily complicated? */
static VALUE
rg_initialize(int argc, VALUE *argv, VALUE self)
{
        VALUE iconnames, with_default_fallbacks;
        GIcon *icon;

        rb_scan_args(argc, argv, "11", &iconnames, &with_default_fallbacks);

        if (TYPE(iconnames) != T_ARRAY) {
                const char *iconname = RVAL2CSTR(iconnames);

                icon = RVAL2CBOOL(with_default_fallbacks) ?
                        g_themed_icon_new_with_default_fallbacks(iconname) :
                        g_themed_icon_new(iconname);

                G_INITIALIZE(self, icon);

                return Qnil;
        }

        if (argc > 1)
                rb_raise(rb_eArgError,
                         "only one argument allowed when first argument is an Array");

        icon = g_themed_icon_new_from_names(RVAL2STRV_DUP(iconnames), -1);

        G_INITIALIZE(self, icon);

        return Qnil;
}