static VALUE rg_lookup_by_address_finish(VALUE self, VALUE result) { GError *error = NULL; gchar *hostname; hostname = g_resolver_lookup_by_address_finish(_SELF(self), RVAL2GASYNCRESULT(result), &error); if (hostname == NULL) rbgio_raise_error(error); return CSTR2RVAL_FREE(hostname); }
static VALUE rg_expand_references(VALUE self, VALUE rb_string) { const gchar *string = RVAL2CSTR(rb_string); gchar *expanded_string = NULL; GError *error = NULL; expanded_string = g_match_info_expand_references(_SELF(self), string, &error); if (error) RAISE_GERROR(error); return CSTR2RVAL_FREE(expanded_string); }
static VALUE rg_lookup_by_address(int argc, VALUE *argv, VALUE self) { VALUE address, cancellable; GError *error = NULL; gchar *hostname; rb_scan_args(argc, argv, "11", &address, &cancellable); hostname = g_resolver_lookup_by_address(_SELF(self), RVAL2GINETADDRESS(address), RVAL2GCANCELLABLE(cancellable), &error); if (hostname == NULL) rbgio_raise_error(error); return CSTR2RVAL_FREE(hostname); }
static VALUE rg_s_get_package_installation_directory_of_module(int argc, VALUE *argv, VALUE self) { VALUE rb_module; gchar *directory; gpointer hmodule; rb_scan_args(argc, argv, "01", &rb_module); if (NIL_P(rb_module)) hmodule = NULL; else hmodule = GINT_TO_POINTER(NUM2INT(rb_module)); directory = g_win32_get_package_installation_directory_of_module(hmodule); return CSTR2RVAL_FREE(directory); }
static VALUE rg_s_palette_to_string(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self) { VALUE rbcolors; long n; GdkColor *colors; gchar *palette; if (argc > 1) rb_scan_args(argc, argv, "*", &rbcolors); else rb_scan_args(argc, argv, "10", &rbcolors); colors = RVAL2GDKCOLORS(rbcolors, &n); palette = gtk_color_selection_palette_to_string(colors, n); g_free(colors); return CSTR2RVAL_FREE(palette); }
static VALUE rg_get_identifier(VALUE self, VALUE kind) { return CSTR2RVAL_FREE(g_volume_get_identifier(_SELF(self), RVAL2CSTR(kind))); }
static VALUE annot_get_modified(VALUE self) { return CSTR2RVAL_FREE(poppler_annot_get_modified(SELF(self))); }
static VALUE g_value_to_s(VALUE self) { return CSTR2RVAL_FREE(g_strdup_value_contents(RVAL2GOBJ(self))); }
static VALUE rg_active_text(VALUE self) { return CSTR2RVAL_FREE(gtk_combo_box_get_active_text(_SELF(self))); }
static VALUE rg_s_locale_filename_from_utf8(VALUE self, VALUE utf8_filename) { return CSTR2RVAL_FREE(g_win32_locale_filename_from_utf8(RVAL2CSTR(utf8_filename))); }
static VALUE rg_s_error_message(VALUE self, VALUE error) { return CSTR2RVAL_FREE(g_win32_error_message(NUM2INT(error))); }
static VALUE it_get_example_icon_name(VALUE self) { return CSTR2RVAL_FREE(gtk_icon_theme_get_example_icon_name(_SELF(self))); }
static VALUE rg_subject(VALUE self) { return CSTR2RVAL_FREE(poppler_annot_markup_get_subject(SELF(self))); }
static VALUE rg_label(VALUE self) { return CSTR2RVAL_FREE(poppler_annot_markup_get_label(SELF(self))); }
static VALUE unixmount_guess_name(VALUE self) { return CSTR2RVAL_FREE(g_unix_mount_guess_name(_SELF(self))); }
static VALUE rg_description(VALUE self) { return CSTR2RVAL_FREE(gdk_pixbuf_format_get_description(_SELF(self))); }
static VALUE rg_name(VALUE self) { return CSTR2RVAL_FREE(gdk_pixbuf_format_get_name(_SELF(self))); }
static VALUE rbglib_m_win32_get_package_installation_directory(VALUE self, VALUE package, VALUE dll_name) { return CSTR2RVAL_FREE(g_win32_get_package_installation_directory(RVAL2CSTR(package), RVAL2CSTR(dll_name))); }
static VALUE rg_replace(gint argc, VALUE *argv, VALUE self) { VALUE rb_string; VALUE rb_replacement; VALUE rb_options; VALUE rb_start_position; VALUE rb_match_options; VALUE rb_literal; GError *error = NULL; gchar *modified_string; const gchar *string; const gchar *replacement; gssize string_len = -1; gint start_position = 0; GRegexMatchFlags match_options = 0; if (rb_block_given_p()) { RGRegexEvalCallbackData data; rb_scan_args(argc, argv, "11", &rb_string, &rb_options); rbg_scan_options(rb_options, "start_position", &rb_start_position, "match_options", &rb_match_options, NULL); string = RVAL2CSTR(rb_string); string_len = RSTRING_LEN(rb_string); if (!NIL_P(rb_start_position)) start_position = NUM2INT(rb_start_position); if (!NIL_P(rb_match_options)) match_options = RVAL2GREGEXMATCHOPTIONSFLAGS(rb_match_options); data.callback = rb_block_proc(); data.status = 0; modified_string = g_regex_replace_eval(_SELF(self), string, string_len, start_position, match_options, rg_regex_eval_callback, &data, &error); if (!(data.status == 0 || data.status == RUBY_TAG_BREAK)) { if (error) g_error_free(error); g_free(modified_string); rb_jump_tag(data.status); } } else { rb_scan_args(argc, argv, "21", &rb_string, &rb_replacement, &rb_options); rbg_scan_options(rb_options, "start_position", &rb_start_position, "match_options", &rb_match_options, "literal", &rb_literal, NULL); string = RVAL2CSTR(rb_string); string_len = RSTRING_LEN(rb_string); replacement = RVAL2CSTR(rb_replacement); if (!NIL_P(rb_start_position)) start_position = NUM2INT(rb_start_position); if (!NIL_P(rb_match_options)) match_options = RVAL2GREGEXMATCHOPTIONSFLAGS(rb_match_options); if (RVAL2CBOOL(rb_literal)) { modified_string = g_regex_replace_literal(_SELF(self), string, string_len, start_position, replacement, match_options, &error); } else { modified_string = g_regex_replace(_SELF(self), string, string_len, start_position, replacement, match_options, &error); } } if (error) RAISE_GERROR(error); return CSTR2RVAL_FREE(modified_string); }
static VALUE rg_name(VALUE self) { return CSTR2RVAL_FREE(g_volume_get_name(_SELF(self))); }
static VALUE rg_uuid(VALUE self) { return CSTR2RVAL_FREE(g_volume_get_uuid(_SELF(self))); }
static VALUE rg_m_find_module_in_path(G_GNUC_UNUSED VALUE self, VALUE module_file) { return CSTR2RVAL_FREE(gtk_rc_find_module_in_path(RVAL2CSTR(module_file))); }
static VALUE rg_name(VALUE self) { return CSTR2RVAL_FREE(gdk_atom_name(_SELF(self))); }
static VALUE rg_s_get_description(G_GNUC_UNUSED VALUE type) { return CSTR2RVAL_FREE(g_content_type_get_description(RVAL2CSTR(type))); }
static VALUE rg_s_locale(VALUE self) { return CSTR2RVAL_FREE(g_win32_getlocale()); }
static VALUE rg_get_completion_suffix(VALUE self, VALUE initial_text) { return CSTR2RVAL_FREE(g_filename_completer_get_completion_suffix(_SELF(self), RVAL2CSTR(initial_text))); }
static VALUE rg_m_theme_dir(G_GNUC_UNUSED VALUE self) { return CSTR2RVAL_FREE(gtk_rc_get_theme_dir()); }
static VALUE shell_quote(VALUE self, VALUE unquoted_string) { return CSTR2RVAL_FREE(g_shell_quote(RVAL2CSTR(unquoted_string))); }
static VALUE rg_s_get_mime_type(G_GNUC_UNUSED VALUE type) { return CSTR2RVAL_FREE(g_content_type_get_mime_type(RVAL2CSTR(type))); }
static VALUE icon_to_string(VALUE self) { /* TODO: Should we raise if it returns NULL? */ return CSTR2RVAL_FREE(g_icon_to_string(_SELF(self))); }