Exemplo n.º 1
0
static VALUE
rg_fetch_all(VALUE self)
{
    gchar **strings;
    strings = g_match_info_fetch_all(_SELF(self));
    return STRV2RVAL_FREE(strings);
}
Exemplo n.º 2
0
static VALUE
shell_parse(VALUE self, VALUE command_line)
{
    gint argc;
    gchar **argv;
    GError *error = NULL;

    if (!g_shell_parse_argv(RVAL2CSTR(command_line), &argc, &argv, &error))
        RAISE_GERROR(error);

    return STRV2RVAL_FREE(argv);
}
Exemplo n.º 3
0
static VALUE
rg_guess_content_type_finish(VALUE self, VALUE result)
{
        GError *error = NULL;
        gchar **content_types;

        content_types = g_mount_guess_content_type_finish(_SELF(self),
                                                          RVAL2GASYNCRESULT(result),
                                                          &error);
        if (content_types == NULL)
                rbgio_raise_error(error);

        return STRV2RVAL_FREE(content_types);
}
Exemplo n.º 4
0
static VALUE
rg_guess_content_type_sync(int argc, VALUE *argv, VALUE self)
{
        VALUE force_rescan, cancellable;
        GError *error = NULL;
        gchar **content_types;

        rb_scan_args(argc, argv, "02", &force_rescan, &cancellable);
        content_types = g_mount_guess_content_type_sync(_SELF(self),
                                                        RVAL2CBOOL(force_rescan),
                                                        RVAL2GCANCELLABLE(cancellable),
                                                        &error);
        if (content_types == NULL)
                rbgio_raise_error(error);

        return STRV2RVAL_FREE(content_types);
}
Exemplo n.º 5
0
static VALUE
rg_split(gint argc, VALUE *argv, VALUE self)
{
    VALUE rb_string, rb_start_position, rb_match_options, rb_max_tokens, rb_options;
    GError *error = NULL;
    gchar **strings;
    const gchar *string;
    gssize string_len = -1;
    gint start_position = 0;
    GRegexMatchFlags match_options = 0;
    gint max_tokens = 0;

    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,
                     "max_tokens", &rb_max_tokens,
                     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);
    if (!NIL_P(rb_max_tokens))
        max_tokens = NUM2INT(rb_max_tokens);

    strings = g_regex_split_full(_SELF(self),
                                 string,
                                 string_len,
                                 start_position,
                                 match_options,
                                 max_tokens,
                                 &error);

    if (error)
        RAISE_GERROR(error);

    return STRV2RVAL_FREE(strings);
}
Exemplo n.º 6
0
static VALUE
rg_s_guess_for_tree(G_GNUC_UNUSED VALUE self, VALUE root)
{
        return STRV2RVAL_FREE(g_content_type_guess_for_tree(RVAL2GFILE(root)));
}
Exemplo n.º 7
0
static VALUE
rg_enumerate_identifiers(VALUE self)
{
        return STRV2RVAL_FREE(g_volume_enumerate_identifiers(_SELF(self)));
}
Exemplo n.º 8
0
static VALUE
rg_get_completions(VALUE self, VALUE initial_text)
{
        return STRV2RVAL_FREE(g_filename_completer_get_completions(_SELF(self),
                                                                   RVAL2CSTR(initial_text)));
}