static VALUE initialize(VALUE self, VALUE name, VALUE left_gravity) { if (NIL_P(name)) G_INITIALIZE(self, gtk_text_mark_new(NULL, RVAL2CBOOL(left_gravity))); else G_INITIALIZE(self, gtk_text_mark_new(RVAL2CSTR(name), RVAL2CBOOL(left_gravity))); return Qnil; }
static VALUE rg_initialize(VALUE self, VALUE num) { guint atom = FIX2INT(num); if (atom == 0){ /* This is a trick for passing 0(NULL) */ G_INITIALIZE(self, GUINT_TO_POINTER(1)); _SELF(self) = GUINT_TO_POINTER(GDK_NONE); } else { G_INITIALIZE(self, GUINT_TO_POINTER(atom)); } return Qnil; }
static void initialize_receiver(VALUE receiver, GITypeInfo *info, GIArgument *value) { GIBaseInfo *interface_info; GIInfoType interface_type; if (g_type_info_get_tag(info) != GI_TYPE_TAG_INTERFACE) { rb_raise(rb_eRuntimeError, "TODO: returned value isn't interface"); } interface_info = g_type_info_get_interface(info); interface_type = g_base_info_get_type(interface_info); g_base_info_unref(interface_info); switch (interface_type) { case GI_INFO_TYPE_OBJECT: G_INITIALIZE(receiver, value->v_pointer); break; case GI_INFO_TYPE_STRUCT: G_INITIALIZE(receiver, value->v_pointer); break; case GI_INFO_TYPE_INVALID: case GI_INFO_TYPE_FUNCTION: case GI_INFO_TYPE_CALLBACK: case GI_INFO_TYPE_BOXED: case GI_INFO_TYPE_ENUM: case GI_INFO_TYPE_FLAGS: case GI_INFO_TYPE_INTERFACE: case GI_INFO_TYPE_CONSTANT: case GI_INFO_TYPE_INVALID_0: rb_raise(rb_eRuntimeError, "TODO: returned value isn't object, struct or union"); break; case GI_INFO_TYPE_UNION: G_INITIALIZE(receiver, value->v_pointer); break; case GI_INFO_TYPE_VALUE: case GI_INFO_TYPE_SIGNAL: case GI_INFO_TYPE_VFUNC: case GI_INFO_TYPE_PROPERTY: case GI_INFO_TYPE_FIELD: case GI_INFO_TYPE_ARG: case GI_INFO_TYPE_TYPE: case GI_INFO_TYPE_UNRESOLVED: default: rb_raise(rb_eRuntimeError, "TODO: returned value isn't object, struct or union"); break; } }
static VALUE async_start_initialize(VALUE self, VALUE src, VALUE new_base_time) { G_INITIALIZE(self, gst_message_new_async_start(RVAL2GST_OBJ(src), RVAL2CBOOL(new_base_time))); return Qnil; }
static VALUE application_initialize(VALUE self, VALUE src, VALUE structure) { G_INITIALIZE(self, gst_message_new_application(RVAL2GST_OBJ(src), RVAL2GST_STRUCT(structure))); return Qnil; }
static VALUE buffering_initialize(VALUE self, VALUE src, VALUE percent) { G_INITIALIZE(self, gst_message_new_buffering(RVAL2GST_OBJ(src), NUM2INT(percent))); return Qnil; }
static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE points_or_rectangle, rbfill_rule; GdkRegion *region; rb_scan_args(argc, argv, "02", &points_or_rectangle, &rbfill_rule); if (NIL_P(points_or_rectangle)) { region = gdk_region_new(); } else if (TYPE(points_or_rectangle) == T_ARRAY) { GdkFillRule fill_rule = RVAL2GENUM(rbfill_rule, GDK_TYPE_FILL_RULE); long n; GdkPoint *points = RVAL2GDKPOINTS(points_or_rectangle, &n); region = gdk_region_polygon(points, n, fill_rule); g_free(points); } else if (RVAL2GTYPE(points_or_rectangle) == GDK_TYPE_RECTANGLE) { region = gdk_region_rectangle((GdkRectangle*)RVAL2BOXED(points_or_rectangle, GDK_TYPE_RECTANGLE)); } else { rb_raise(rb_eArgError, "invalid argument %s (expect array of Gdk::Point or Gdk::Rectangle, nil)", rb_class2name(CLASS_OF(points_or_rectangle))); } G_INITIALIZE(self, region); return Qnil; }
static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { GtkPaperSize *size; if (argc <= 1) { VALUE name; rb_scan_args(argc, argv, "01", &name); size = gtk_paper_size_new(RVAL2CSTR_ACCEPT_NIL(name)); } else if (argc == 4) { size = gtk_paper_size_new_from_ppd(RVAL2CSTR(argv[0]), RVAL2CSTR(argv[1]), NUM2DBL(argv[2]), NUM2DBL(argv[3])); } else if (argc == 5) { size = gtk_paper_size_new_custom(RVAL2CSTR(argv[0]), RVAL2CSTR(argv[1]), NUM2DBL(argv[2]), NUM2DBL(argv[3]), RVAL2UNIT(argv[4])); } else { rb_raise(rb_eArgError, "wrong number of arguments (%d for 0, 1, 4 or 5)", argc); } G_INITIALIZE(self, size); return Qnil; }
static VALUE rb_rsvg_handle_initialize(int argc, VALUE *argv, VALUE self) { RsvgHandle *handle; VALUE gz; rb_scan_args(argc, argv, "01", &gz); #if LIBRSVG_CHECK_VERSION(2, 11, 0) handle = rsvg_handle_new(); #else if (RVAL2CBOOL(gz)) { # ifdef HAVE_LIBRSVG_RSVG_GZ_H handle = rsvg_handle_new_gz(); # else rb_warning("gz handling is not supported in your librsvg"); handle = rsvg_handle_new(); # endif } else { handle = rsvg_handle_new(); } #endif #ifdef RSVG_TYPE_HANDLE G_INITIALIZE(self, handle); #else DATA_PTR(self) = handle; #endif rb_ivar_set(self, id_closed, Qfalse); return Qnil; }
static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE path; GtkTreePath* widget; if (argc == 1) { path = argv[0]; if (TYPE(path) == T_STRING){ widget = gtk_tree_path_new_from_string(RVAL2CSTR(path)); } else { widget = gtk_tree_path_new(); gtk_tree_path_append_index(widget, NUM2INT(path)); } if (widget == NULL) rb_raise(rb_eArgError, "Invalid path %s was passed.", RVAL2CSTR(path)); } else { int i; widget = gtk_tree_path_new(); for (i = 0; i < argc; i++) gtk_tree_path_append_index(widget, NUM2INT(argv[i])); } G_INITIALIZE(self, widget); return Qnil; }
/* Image Data in Memory */ static VALUE initialize_loader(int argc, VALUE *argv, VALUE self) { GdkPixbufLoader* loader; GError* error = NULL; VALUE arg1, is_mime_type; rb_scan_args(argc, argv, "02", &arg1, &is_mime_type); if (NIL_P(arg1)) { loader = gdk_pixbuf_loader_new(); } else { if (is_mime_type == Qtrue) { #if RBGDK_PIXBUF_CHECK_VERSION(2,4,0) loader = gdk_pixbuf_loader_new_with_mime_type(RVAL2CSTR(arg1), &error); #else rb_warning("Not supported GTK+-2.0/2.2."); loader = gdk_pixbuf_loader_new(); #endif } else { /* Default behavior */ loader = gdk_pixbuf_loader_new_with_type(RVAL2CSTR(arg1), &error); } if(error) RAISE_GERROR(error); } G_INITIALIZE(self, loader); return Qnil; }
/* Class method: new(name, category) * name: mark name (string) * category: marker category (string) * * Returns: a newly created Gtk::SourceMark object. */ static VALUE rg_initialize(VALUE self, VALUE name, VALUE category) { G_INITIALIZE (self, gtk_source_mark_new (RVAL2CSTR(name), RVAL2CSTR_ACCEPT_SYMBOL(category))); return Qnil; }
static VALUE rg_initialize(VALUE self) { G_INITIALIZE(self, g_app_launch_context_new()); return Qnil; }
static VALUE geo_initialize(VALUE self) { GdkGeometry g; G_INITIALIZE(self, &g); return Qnil; }
static VALUE socketservice_initialize(VALUE self) { G_INITIALIZE(self, g_socket_service_new()); return Qnil; }
static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { VALUE arg1, arg2; GtkPrintSettings* settings = NULL; GError *error = NULL; rb_scan_args(argc, argv, "02", &arg1, &arg2); if (NIL_P(arg1)){ settings = gtk_print_settings_new(); } else if (NIL_P(arg2)){ settings = gtk_print_settings_new_from_file(RVAL2CSTR(arg1), &error); if (!settings) { RAISE_GERROR(error); } } else { settings = gtk_print_settings_new_from_key_file((GKeyFile*)RVAL2BOXED(arg1, G_TYPE_KEY_FILE), RVAL2CSTR(arg2), &error); if (!settings) { RAISE_GERROR(error); } } G_INITIALIZE(self, settings); return Qnil; }
static VALUE rg_initialize(VALUE self, VALUE desktop_id) { G_INITIALIZE(self, g_desktop_app_info_new(RVAL2CSTR(desktop_id))); return Qnil; }
static VALUE rg_initialize(gint argc, VALUE *argv, VALUE self) { GError *error = NULL; GRegex *regex = NULL; VALUE rb_pattern, rb_compile_options, rb_match_options; VALUE rb_options; const char *pattern; GRegexCompileFlags compile_options = 0; GRegexMatchFlags match_options = 0; rb_scan_args(argc, argv, "11", &rb_pattern, &rb_options); rbg_scan_options(rb_options, "compile_options", &rb_compile_options, "match_options", &rb_match_options, NULL); pattern = RVAL2CSTR(rb_pattern); if (!NIL_P(rb_compile_options)) compile_options = RVAL2GREGEXCOMPILEOPTIONSFLAGS(rb_compile_options); if (!NIL_P(rb_match_options)) match_options = RVAL2GREGEXMATCHOPTIONSFLAGS(rb_match_options); regex = g_regex_new(pattern, compile_options, match_options, &error); if (error) RAISE_GERROR(error); G_INITIALIZE(self, regex); return Qnil; }
static VALUE accel_key_initialize(VALUE self) { GtkAccelKey key; G_INITIALIZE(self, &key); return Qnil; }
static VALUE rg_initialize(VALUE self) { PangoAnalysis analysis = { NULL, NULL, NULL, 0, 0, 0, 0, NULL, NULL }; G_INITIALIZE(self, g_boxed_copy(PANGO_TYPE_ANALYSIS, &analysis)); return Qnil; }
static VALUE rg_initialize(VALUE self, VALUE filename) { G_INITIALIZE(self, g_io_module_new(RVAL2CSTR(filename))); return Qnil; }
static VALUE fileattributematcher_initialize(VALUE self, VALUE attributes) { G_INITIALIZE(self, g_file_attribute_matcher_new(RVAL2CSTR(attributes))); return Qnil; }
static VALUE tag_initialize(VALUE self, VALUE src, VALUE tag_list) { G_INITIALIZE(self, gst_message_new_tag(RVAL2GST_OBJ(src), RVAL2GST_TAG_LIST(tag_list))); /* FIXME */ return Qnil; }
static VALUE rg_initialize(int argc, VALUE *argv, VALUE self) { PopplerDocument *document = NULL; GError *error = NULL; VALUE uri_or_data, rb_password; const char *password; rb_scan_args(argc, argv, "11", &uri_or_data, &rb_password); password = NIL_P(rb_password) ? NULL : RVAL2CSTR(rb_password); if (RVAL2CBOOL(rb_funcall(self, id_pdf_data_p, 1, uri_or_data))) { document = poppler_document_new_from_data(RSTRING_PTR(uri_or_data), RSTRING_LEN(uri_or_data), password, &error); } if (!document && !error) { uri_or_data = rb_funcall(self, id_ensure_uri, 1, uri_or_data); document = poppler_document_new_from_file(RVAL2CSTR(uri_or_data), password, &error); } if (error) RAISE_GERROR(error); G_INITIALIZE(self, document); return Qnil; }
static VALUE new_clock_initialize(VALUE self, VALUE src, VALUE clock) { G_INITIALIZE(self, gst_message_new_new_clock(RVAL2GST_OBJ(src), RVAL2GST_CLOCK(clock))); return Qnil; }
static VALUE fileattributeinfolist_initialize(VALUE self) { G_INITIALIZE(self, g_file_attribute_info_list_new()); return Qnil; }
static VALUE element_initialize(VALUE self, VALUE src, VALUE structure) { G_INITIALIZE(self, gst_message_new_element(RVAL2GST_OBJ(src), RVAL2GST_STRUCT(structure))); return Qnil; }
static VALUE rg_initialize(VALUE self) { G_INITIALIZE(self, gtk_im_context_simple_new()); return Qnil; }
static VALUE rg_initialize(VALUE self) { G_INITIALIZE(self, g_mount_operation_new()); return Qnil; }
static VALUE rbcltgst_audio_initialize (VALUE self) { ClutterGstAudio *audio = clutter_gst_audio_new (); G_INITIALIZE (self, audio); return Qnil; }