本文整理汇总了C++中GOBJ2RVAL函数的典型用法代码示例。如果您正苦于以下问题:C++ GOBJ2RVAL函数的具体用法?C++ GOBJ2RVAL怎么用?C++ GOBJ2RVAL使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GOBJ2RVAL函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: rb_rsvg_pixbuf_from_file
/* Convenience API */
static VALUE
rb_rsvg_pixbuf_from_file(VALUE self, VALUE file_name)
{
VALUE rb_pixbuf;
GdkPixbuf *pixbuf;
GError *error = NULL;
pixbuf = rsvg_pixbuf_from_file(RVAL2CSTR(file_name), &error);
if (error) RAISE_GERROR(error);
rb_pixbuf = GOBJ2RVAL(pixbuf);
g_object_unref(pixbuf);
return rb_pixbuf;
}
开发者ID:benolee,项目名称:ruby-gnome2,代码行数:16,代码来源:rbrsvg.c
示例2: rc_property_parser
/*
* Gtk::Settings.install_property(...) do |spec, str|
* #parse str
* new_val = .... # parse value from string.
* new_val # return new_val or nil if you can't convert the value.
* end
*/
static gboolean
rc_property_parser(const GParamSpec *pspec, const GString *rc_string, GValue *property_value)
{
VALUE spec = GOBJ2RVAL((gpointer)pspec);
VALUE func = rb_hash_aref(prop_func_table, spec);
VALUE ret = rb_funcall(func, id_call, 2, spec, CSTR2RVAL(rc_string->str));
if (NIL_P(ret)) {
return FALSE;
} else if (RVAL2CBOOL(ret)){
rbgobj_rvalue_to_gvalue(ret, property_value);
return TRUE;
} else {
rb_raise(rb_eArgError, "Gtk::Settings#install_property() block should return new value or nil");
}
}
开发者ID:geoffyoungs,项目名称:ruby-gnome2,代码行数:22,代码来源:rbgtksettings.c
示例3: term_is_selected_cb
static gboolean
term_is_selected_cb(VteTerminal *terminal, glong column, glong row,
gpointer data)
{
gboolean result = TRUE;
VALUE callback = (VALUE)data;
if (!NIL_P(callback)) {
VALUE rb_result;
rb_result = rb_funcall(callback, id_call, 3, GOBJ2RVAL(terminal),
LONG2NUM(column), LONG2NUM(row));
result = RVAL2CBOOL(rb_result);
}
return result;
}
开发者ID:Vasfed,项目名称:ruby-gnome2,代码行数:16,代码来源:rbvteterminal.c
示例4: si_get_geometry
static VALUE
si_get_geometry(VALUE self)
{
GdkScreen* screen;
GdkRectangle area;
GtkOrientation orientation;
gboolean ret = gtk_status_icon_get_geometry(_SELF(self), &screen,
&area, &orientation);
if (ret) {
return rb_ary_new3(3, GOBJ2RVAL(screen),
BOXED2RVAL(&area, GDK_TYPE_RECTANGLE),
GENUM2RVAL(orientation, GTK_TYPE_ORIENTATION));
} else {
return rb_ary_new3(3, Qnil, Qnil, Qnil);
}
}
开发者ID:geoffyoungs,项目名称:ruby-gnome2,代码行数:16,代码来源:rbgtkstatusicon.c
示例5: menu_pos_func
static void
menu_pos_func(GtkMenu *menu, gint *px, gint *py, gboolean *push_in, gpointer data)
{
VALUE arr = rb_funcall((VALUE)data, id_call, 4, GOBJ2RVAL(menu),
INT2FIX(*px), INT2FIX(*py),
CBOOL2RVAL(*push_in));
if (TYPE(arr) == T_ARRAY && (RARRAY_LEN(arr) == 2 || RARRAY_LEN(arr) == 3)){
*px = NUM2INT(RARRAY_PTR(arr)[0]);
*py = NUM2INT(RARRAY_PTR(arr)[1]);
if (RARRAY_LEN(arr) == 3)
*push_in = RVAL2CBOOL(RARRAY_PTR(arr)[2]);
} else {
rb_raise(rb_eArgError, "block should return [x, y, push_in]");
}
}
开发者ID:msakai,项目名称:ruby-gnome2,代码行数:16,代码来源:rbgtkmenu.c
示例6: each_printer
static gboolean
each_printer(GtkPrinter *printer, gpointer data)
{
VALUE result;
VALUE argv[1];
struct callback_arg arg;
argv[0] = GOBJ2RVAL(printer);
arg.callback = (VALUE)data;
arg.argc = 1;
arg.argv = argv;
result = G_PROTECT_CALLBACK(invoke_callback, &arg);
return NIL_P(rb_errinfo()) ? TRUE : RVAL2CBOOL(result);
}
开发者ID:msakai,项目名称:ruby-gnome2,代码行数:16,代码来源:rbgtkprinter.c
示例7: rg_get_path_at_pos
static VALUE
rg_get_path_at_pos(VALUE self, VALUE x, VALUE y)
{
GtkTreePath* path;
GtkTreeViewColumn* column;
gint cell_x, cell_y;
gboolean ret;
ret = gtk_tree_view_get_path_at_pos(_SELF(self),
NUM2INT(x), NUM2INT(y),
&path, &column, &cell_x, &cell_y);
return ret ? rb_ary_new3(4,
path ? GTKTREEPATH2RVAL(path) : Qnil,
column ? GOBJ2RVAL(column) : Qnil,
INT2NUM(cell_x), INT2NUM(cell_y)) : Qnil;
}
开发者ID:Vasfed,项目名称:ruby-gnome2,代码行数:16,代码来源:rbgtktreeview.c
示例8: asyncinitable_initialize_finish
static VALUE
asyncinitable_initialize_finish(VALUE self, VALUE result)
{
GError *error = NULL;
GObject *object;
VALUE rbobject;
object = g_async_initable_new_finish(_SELF(self),
RVAL2GASYNCRESULT(result),
&error);
if (object == NULL)
rbgio_raise_error(error);
rbobject = GOBJ2RVAL(object);
g_object_unref(object);
return rbobject;
}
开发者ID:geoffyoungs,项目名称:ruby-gnome2,代码行数:18,代码来源:gasyncinitable.c
示例9: signal_rows_reordered_func
static VALUE
signal_rows_reordered_func(G_GNUC_UNUSED guint num, const GValue *values)
{
GtkTreeModel* model = g_value_get_object(&values[0]);
GtkTreePath* path = g_value_get_boxed(&values[1]);
GtkTreeIter* iter = g_value_get_boxed(&values[2]);
gint* new_orders = (gint*)g_value_get_pointer(&values[3]);
gint len = gtk_tree_model_iter_n_children(model, iter);
VALUE orders = Qnil;
int i;
iter->user_data3 = model;
orders = rb_ary_new2(len);
for (i = 0; i < len; i++, new_orders++) {
rb_ary_push(orders, INT2NUM(*new_orders));
}
return rb_ary_new3(4, GOBJ2RVAL(model), GTKTREEPATH2RVAL(path), GTKTREEITER2RVAL(iter), orders);
}
开发者ID:masaakiaoyagi,项目名称:ruby-gnome2,代码行数:19,代码来源:rbgtktreemodel.c
示例10: rg_s_pixbuf_from_file_at_zoom
static VALUE
rg_s_pixbuf_from_file_at_zoom(G_GNUC_UNUSED VALUE self, VALUE file_name,
VALUE x_zoom, VALUE y_zoom)
{
VALUE rb_pixbuf;
GdkPixbuf *pixbuf;
GError *error = NULL;
pixbuf = rsvg_pixbuf_from_file_at_zoom(RVAL2CSTR(file_name),
NUM2DBL(x_zoom),
NUM2DBL(y_zoom),
&error);
if (error) RAISE_GERROR(error);
rb_pixbuf = GOBJ2RVAL(pixbuf);
g_object_unref(pixbuf);
return rb_pixbuf;
}
开发者ID:Vasfed,项目名称:ruby-gnome2,代码行数:19,代码来源:rbrsvg.c
示例11: rg_s_pixbuf_from_file_at_size
static VALUE
rg_s_pixbuf_from_file_at_size(G_GNUC_UNUSED VALUE self, VALUE file_name,
VALUE width, VALUE height)
{
VALUE rb_pixbuf;
GdkPixbuf *pixbuf;
GError *error = NULL;
pixbuf = rsvg_pixbuf_from_file_at_size(RVAL2CSTR(file_name),
NUM2INT(width),
NUM2INT(height),
&error);
if (error) RAISE_GERROR(error);
rb_pixbuf = GOBJ2RVAL(pixbuf);
g_object_unref(pixbuf);
return rb_pixbuf;
}
开发者ID:Vasfed,项目名称:ruby-gnome2,代码行数:19,代码来源:rbrsvg.c
示例12: rg_each
static VALUE
rg_each(VALUE self)
{
PopplerDocument *document;
int i, n_pages;
document = RVAL2DOC(self);
n_pages = poppler_document_get_n_pages(document);
for (i = 0; i < n_pages; i++) {
PopplerPage *page;
VALUE rb_page;
page = poppler_document_get_page(document, i);
rb_page = GOBJ2RVAL(page);
if (page)
g_object_unref(page);
rb_yield(rb_page);
}
return self;
}
开发者ID:msakai,项目名称:ruby-gnome2,代码行数:20,代码来源:rbpoppler-document.c
示例13: rg_open_signal_func
static VALUE
rg_open_signal_func(G_GNUC_UNUSED guint num, const GValue *values)
{
VALUE rb_files;
GFile **files;
gint i, n_files;
files = g_value_get_pointer(&(values[1]));
n_files = g_value_get_int(&(values[2]));
rb_files = rb_ary_new2(n_files);
for (i = 0; i < n_files; i++) {
GFile *file = files[i];
rb_ary_push(rb_files, GOBJ2RVAL(file));
}
return rb_ary_new3(3,
GVAL2RVAL(&values[0]),
rb_files,
GVAL2RVAL(&values[3]));
}
开发者ID:adamhooper,项目名称:ruby-gnome2,代码行数:20,代码来源:rb-gio2-application.c
示例14: rb_rsvg_pixbuf_from_file_at_max_size_ex
static VALUE
rb_rsvg_pixbuf_from_file_at_max_size_ex(VALUE self, VALUE file_name,
VALUE max_width, VALUE max_height)
{
VALUE rb_pixbuf;
GdkPixbuf *pixbuf;
GError *error = NULL;
pixbuf = rsvg_pixbuf_from_file_at_max_size_ex(_SELF(self),
RVAL2CSTR(file_name),
NUM2INT(max_width),
NUM2INT(max_height),
&error);
if (error) RAISE_GERROR(error);
rb_pixbuf = GOBJ2RVAL(pixbuf);
g_object_unref(pixbuf);
return rb_pixbuf;
}
开发者ID:benolee,项目名称:ruby-gnome2,代码行数:20,代码来源:rbrsvg.c
示例15: rg_s_open
static VALUE
rg_s_open(G_GNUC_UNUSED VALUE self, VALUE display_name)
{
GdkDisplay* gdisplay = gdk_display_open(RVAL2CSTR(display_name));
if (! gdisplay) {
rb_raise(rb_eRuntimeError, "The display `%s' could not be opened.",
RVAL2CSTR(display_name));
} else {
VALUE display;
g_object_ref(gdisplay);
display = GOBJ2RVAL(gdisplay);
if (rb_block_given_p()) {
rb_ensure(rb_yield, display, rg_close, display);
return Qnil;
} else {
return display;
}
}
}
开发者ID:Mazwak,项目名称:ruby-gnome2,代码行数:20,代码来源:rbgdkdisplay.c
示例16: rg_families
static VALUE
rg_families(VALUE self)
{
int n_families;
PangoFontFamily** families;
int i;
VALUE result;
pango_font_map_list_families(_SELF(self),
&families,
&n_families);
result = rb_ary_new2(n_families);
for (i = 0; i < n_families; i++)
rb_ary_store(result, i, GOBJ2RVAL(families[i]));
g_free(families);
return result;
}
开发者ID:Vasfed,项目名称:ruby-gnome2,代码行数:20,代码来源:rbpangofontmap.c
示例17: rb_gst_elementfactory_make
/*
* Class method: make(factory_name, element_name)
* factory_name: a name of an existing factory.
* element_name: a name which will be attributed to the element.
*
* Creates a new Gst::Element of the type defined by the given element factory.
*
* If element name is ommited (or nil), then the element will receive a guaranteed
* unique name, consisting of the element factory name and a number.
* If name is given, it will be given the name supplied.
*
* # Creates a 'mad' GStreamer element, named 'foo':
* elem1 = Gst::ElementFactory.make("mad", "foo")
*
* # This line does exactly the same thing:
* elem2 = Gst::ElementFactory.find("mad").create("foo")
*
* Returns: a newly created object based on Gst::Element.
*/
static VALUE
rb_gst_elementfactory_make(int argc, VALUE *argv, VALUE self)
{
GstElement *element;
VALUE fname, ename;
VALUE ret;
rb_scan_args(argc, argv, "11", &fname, &ename);
element = gst_element_factory_make(RVAL2CSTR(fname),
RVAL2CSTR_ACCEPT_NIL(ename));
if (element == NULL)
return Qnil;
/* This add another ref to the element, but it was already ours so
* unref it again */
ret = GOBJ2RVAL(element);
GOBJ2RVAL_UNREF(element);
return ret;
}
开发者ID:benolee,项目名称:ruby-gnome2,代码行数:40,代码来源:rbgst-element-factory.c
示例18: set_prop_func
// FIXME: use rb_protect
static void
set_prop_func(GObject* object,
guint property_id,
const GValue* value,
GParamSpec* pspec)
{
ID ruby_setter = (ID)g_param_spec_get_qdata(pspec, q_ruby_setter);
if (!ruby_setter) {
gchar* name = g_strconcat(g_param_spec_get_name(pspec), "=", NULL);
gchar* p;
for (p = name; *p; p++) {
if (*p == '-')
*p = '_';
}
ruby_setter = rb_intern(name);
g_param_spec_set_qdata(pspec, q_ruby_setter, (gpointer)ruby_setter);
g_free(name);
}
rb_funcall(GOBJ2RVAL(object), ruby_setter, 1, GVAL2RVAL(value));
}
开发者ID:geoffyoungs,项目名称:ruby-gnome2,代码行数:22,代码来源:rbgobj_object.c
示例19: rg_m_new
static VALUE
rg_m_new(int argc, VALUE *argv, VALUE self)
{
const RGObjClassInfo* info;
VALUE cancellable, parameters;
GObject *object;
VALUE result;
rb_scan_args(argc, argv, "02", &cancellable, ¶meters);
info = CLASS2CINFO(self);
if (info->klass != self)
rb_raise(rb_eTypeError,
"%s: class not registered with GLib",
rb_class2name(self));
object = rbgio_ginitable_new(info->gtype, parameters, cancellable);
result = GOBJ2RVAL(object);
g_object_unref(object);
return result;
}
开发者ID:msakai,项目名称:ruby-gnome2,代码行数:22,代码来源:ginitable.c
示例20: rg_s_new_bang
static VALUE
rg_s_new_bang(int argc, VALUE *argv, VALUE self)
{
const RGObjClassInfo* cinfo = rbgobj_lookup_class(self);
VALUE params_hash;
GObject* gobj;
VALUE result;
rb_scan_args(argc, argv, "01", ¶ms_hash);
if (!NIL_P(params_hash))
Check_Type(params_hash, RUBY_T_HASH);
if (cinfo->klass != self)
rb_raise(rb_eTypeError, "%s isn't registered class",
rb_class2name(self));
gobj = rbgobj_gobject_new(cinfo->gtype, params_hash);
result = GOBJ2RVAL(gobj);
g_object_unref(gobj);
return result;
}
开发者ID:adamhooper,项目名称:ruby-gnome2,代码行数:23,代码来源:rbgobj_object.c
注:本文中的GOBJ2RVAL函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论