module GLib

Extended Modules

Defined in:

lib/gi-crystal/src/auto/g_lib-2.0/allocator.cr
lib/gi-crystal/src/auto/g_lib-2.0/bytes.cr
lib/gi-crystal/src/auto/g_lib-2.0/cache.cr
lib/gi-crystal/src/auto/g_lib-2.0/completion.cr
lib/gi-crystal/src/auto/g_lib-2.0/g_lib.cr
lib/gi-crystal/src/auto/g_lib-2.0/main_context.cr
lib/gi-crystal/src/auto/g_lib-2.0/main_loop.cr
lib/gi-crystal/src/auto/g_lib-2.0/mapped_file.cr
lib/gi-crystal/src/auto/g_lib-2.0/markup_parse_context.cr
lib/gi-crystal/src/auto/g_lib-2.0/markup_parser.cr
lib/gi-crystal/src/auto/g_lib-2.0/mem_chunk.cr
lib/gi-crystal/src/auto/g_lib-2.0/path_buf.cr
lib/gi-crystal/src/auto/g_lib-2.0/relation.cr
lib/gi-crystal/src/auto/g_lib-2.0/source.cr
lib/gi-crystal/src/auto/g_lib-2.0/source_callback_funcs.cr
lib/gi-crystal/src/auto/g_lib-2.0/source_funcs.cr
lib/gi-crystal/src/auto/g_lib-2.0/tuples.cr
lib/gi-crystal/src/auto/g_lib-2.0/unix_pipe.cr
lib/gi-crystal/src/auto/g_lib-2.0/variant_builder.cr
lib/gi-crystal/src/auto/g_lib-2.0/variant_dict.cr
lib/gi-crystal/src/auto/g_lib-2.0/variant_type.cr
lib/gi-crystal/src/bindings/g_lib/bytes.cr
lib/gi-crystal/src/bindings/g_lib/error.cr
lib/gi-crystal/src/bindings/g_lib/list.cr
lib/gi-crystal/src/bindings/g_lib/slist.cr
lib/gi-crystal/src/bindings/g_lib/timeout.cr
lib/gi-crystal/src/bindings/g_lib/variant.cr
lib/gi-crystal/src/bindings/g_lib/variant_dict.cr

Constant Summary

ALLOC_AND_FREE = 2
ALLOC_ONLY = 1
ALLOCATOR_LIST = 1
ALLOCATOR_NODE = 3
ALLOCATOR_SLIST = 2
ATOMIC_REF_COUNT_INIT = 1

Evaluates to the initial reference count for gatomicrefcount.

This macro is useful for initializing gatomicrefcount fields inside structures, for instance:

|[ typedef struct { gatomicrefcount ref_count; char *name; char *address; } Person;

static const Person default_person = { .ref_count = G_ATOMIC_REF_COUNT_INIT, .name = "Default name", .address = "Default address", }; ]|

MAJOR_VERSION = 2

The major version number of the GLib library.

Like #glib_major_version, but from the headers used at application compile time, rather than from the library linked against at application run time.

MICRO_VERSION = 0

The micro version number of the GLib library.

Like #gtk_micro_version, but from the headers used at application compile time, rather than from the library linked against at application run time.

MINOR_VERSION = 84

The minor version number of the GLib library.

Like #gtk_minor_version, but from the headers used at application compile time, rather than from the library linked against at application run time.

PRIORITY_DEFAULT = 0

Use this for default priority event sources.

In GLib this priority is used when adding timeout functions with GLib::timeout_add. In GDK this priority is used for events from the X server.

PRIORITY_DEFAULT_IDLE = 200

Use this for default priority idle functions.

In GLib this priority is used when adding idle functions with GLib::idle_add.

PRIORITY_HIGH = -100

Use this for high priority event sources.

It is not used within GLib or GTK.

PRIORITY_HIGH_IDLE = 100

Use this for high priority idle functions.

GTK uses %G_PRIORITY_HIGH_IDLE + 10 for resizing operations, and %G_PRIORITY_HIGH_IDLE + 20 for redrawing operations. (This is done to ensure that any pending resizes are processed before any pending redraws, so that widgets are not redrawn twice unnecessarily.)

PRIORITY_LOW = 300

Use this for very low priority background tasks.

It is not used within GLib or GTK.

REF_COUNT_INIT = -1

Evaluates to the initial reference count for grefcount.

This macro is useful for initializing grefcount fields inside structures, for instance:

|[ typedef struct { grefcount ref_count; char *name; char *address; } Person;

static const Person default_person = { .ref_count = G_REF_COUNT_INIT, .name = "Default name", .address = "Default address", }; ]|

SOURCE_CONTINUE = true

Use this macro as the return value of a GLib::SourceFunc to leave the GLib::Source in the main loop.

SOURCE_REMOVE = false

Use this macro as the return value of a GLib::SourceFunc to remove the GLib::Source from the main loop.

TEST_OPTION_NO_PRGNAME = "no_g_set_prgname"

A value that can be passed as an option to GLib::test_init.

If this option is given, GLib::test_init will not call GLib#prgname=.

TEST_OPTION_NONFATAL_ASSERTIONS = "nonfatal-assertions"

A value that can be passed as an option to GLib::test_init.

If this option is given, assertions will not abort the process, but call GLib::test_fail. Equivalent to GLib::test_set_nonfatal_assertions.

Class Method Summary

Instance Method Summary

Class Method Detail

def self.aligned_free_sized(mem : Pointer(Void) | Nil, alignment : UInt64, size : UInt64) : Nil #

def self.application_name : String | Nil #

def self.application_name=(application_name : String) : Nil #

def self.assertion_message_cmpint(domain : String, file : String, line : Int32, func : String, expr : String, arg1 : UInt64, cmp : String, arg2 : UInt64, numtype : Int8) : Nil #

def self.async_queue_new : GLib::AsyncQueue #

def self.async_queue_new_full(item_free_func : GLib::DestroyNotify | Nil) : GLib::AsyncQueue #

def self.atomic_int_compare_and_exchange_full(atomic : Pointer(Int32), oldval : Int32, newval : Int32, preval : Int32) : Bool #

def self.atomic_int_exchange(atomic : Pointer(Int32), newval : Int32) : Int32 #

def self.atomic_pointer_compare_and_exchange_full(atomic : Pointer(Void), oldval : Pointer(Void) | Nil, newval : Pointer(Void) | Nil, preval : Pointer(Void)) : Bool #

def self.atomic_pointer_exchange(atomic : Pointer(Void) | Nil, newval : Pointer(Void) | Nil) : Pointer(Void) | Nil #

def self.bit_nth_lsf(mask : UInt64, nth_bit : Int32) : Int32 #

def self.bit_nth_msf(mask : UInt64, nth_bit : Int32) : Int32 #

def self.bit_storage(number : UInt64) : UInt32 #

def self.blow_chunks : Nil #

def self.byte_array_append(array : ::Bytes, data : Pointer(UInt8), len : UInt32) : ::Bytes #

def self.byte_array_prepend(array : ::Bytes, data : Pointer(UInt8), len : UInt32) : ::Bytes #

def self.byte_array_ref(array : ::Bytes) : ::Bytes #

def self.byte_array_ref(*array : UInt8) #

def self.byte_array_remove_index(array : ::Bytes, index_ : UInt32) : ::Bytes #

def self.byte_array_remove_index_fast(array : ::Bytes, index_ : UInt32) : ::Bytes #

def self.byte_array_remove_range(array : ::Bytes, index_ : UInt32, length : UInt32) : ::Bytes #

def self.byte_array_set_size(array : ::Bytes, length : UInt32) : ::Bytes #

def self.byte_array_sized_new(reserved_size : UInt32) : ::Bytes #

def self.byte_array_sort(array : ::Bytes, compare_func : GLib::CompareFunc) : Nil #

def self.byte_array_sort_with_data(array : ::Bytes, compare_func : GLib::CompareDataFunc, user_data : Pointer(Void) | Nil) : Nil #

def self.check_version(required_major : UInt32, required_minor : UInt32, required_micro : UInt32) : String | Nil #

def self.chmod(filename : String, mode : Int32) : Int32 #

def self.closefrom(lowfd : Int32) : Int32 #

def self.creat(filename : String, mode : Int32) : Int32 #

def self.datalist_id_remove_multiple(datalist : GLib::Data, keys : Enumerable(UInt32)) : Nil #

def self.error_domain_register(error_type_name : String, error_type_private_size : UInt64, error_type_init : GLib::ErrorInitFunc, error_type_copy : GLib::ErrorCopyFunc, error_type_clear : GLib::ErrorClearFunc) : UInt32 #

def self.error_domain_register_static(error_type_name : String, error_type_private_size : UInt64, error_type_init : GLib::ErrorInitFunc, error_type_copy : GLib::ErrorCopyFunc, error_type_clear : GLib::ErrorClearFunc) : UInt32 #

def self.fdwalk_set_cloexec(lowfd : Int32) : Int32 #

def self.fopen(filename : String, mode : String) : Pointer(Void) | Nil #

def self.format_size_for_display(size : Int64) : String #

DEPRECATED


def self.free_sized(mem : Pointer(Void) | Nil, size : UInt64) : Nil #

def self.freopen(filename : String, mode : String, stream : Pointer(Void) | Nil) : Pointer(Void) | Nil #

def self.fsync(fd : Int32) : Int32 #

def self.hash_table_find(hash_table : Pointer(Void), predicate : GLib::HRFunc, user_data : Pointer(Void) | Nil) : Pointer(Void) | Nil #

def self.hash_table_foreach(hash_table : Pointer(Void), func : GLib::HFunc, user_data : Pointer(Void) | Nil) : Nil #

def self.hash_table_foreach_remove(hash_table : Pointer(Void), func : GLib::HRFunc, user_data : Pointer(Void) | Nil) : UInt32 #

def self.hash_table_foreach_steal(hash_table : Pointer(Void), func : GLib::HRFunc, user_data : Pointer(Void) | Nil) : UInt32 #

def self.hash_table_ref(hash_table : Pointer(Void)) : Pointer(Void) #

def self.hook_insert_sorted(hook_list : GLib::HookList, hook : GLib::Hook, func : GLib::HookCompareFunc) : Nil #

def self.idle_add(priority : Priority = Priority::Default, &block : -> Bool) #

def self.idle_remove_by_data(data : Pointer(Void) | Nil) : Bool #

def self.idle_source_new : GLib::Source #

def self.list_pop_allocator : Nil #

def self.list_push_allocator(allocator : GLib::Allocator) : Nil #

def self.log_writer_default_set_debug_domains(domains : String | Nil) : Nil #

def self.log_writer_syslog(log_level : GLib::LogLevelFlags, fields : Enumerable(GLib::LogField), user_data : Pointer(Void) | Nil) : GLib::LogWriterOutput #

def self.lstat(filename : String, buf : GLib::StatBuf) : Int32 #

def self.main_context_default : GLib::MainContext #

def self.main_context_get_thread_default : GLib::MainContext | Nil #

def self.main_context_ref_thread_default : GLib::MainContext #

def self.main_current_source : GLib::Source | Nil #

def self.main_depth : Int32 #

def self.markup_escape_text(text : String, length : Int64) : String #

def self.mem_chunk_info : Nil #

def self.mkdir(filename : String, mode : Int32) : Int32 #

def self.node_pop_allocator : Nil #

def self.node_push_allocator(allocator : GLib::Allocator) : Nil #

def self.on_error_query(prg_name : String) : Nil #

def self.on_error_stack_trace(prg_name : String | Nil) : Nil #

def self.once_init_enter_impl(location : Pointer(UInt64)) : Bool #

def self.open(filename : String, flags : Int32, mode : Int32) : Int32 #

def self.os_info(key_name : String) : String | Nil #

def self.path_buf_equal(v1 : Pointer(Void), v2 : Pointer(Void)) : Bool #

def self.pointer_bit_lock_and_get(address : Pointer(Void), lock_bit : UInt32) : Nil #

def self.pointer_bit_lock_mask_ptr(ptr : Pointer(Void) | Nil, lock_bit : UInt32, set : Bool, preserve_mask : UInt64, preserve_ptr : Pointer(Void) | Nil) : Pointer(Void) | Nil #

def self.pointer_bit_unlock_and_set(address : Pointer(Void), lock_bit : UInt32, ptr : Pointer(Void) | Nil, preserve_mask : UInt64) : Nil #

def self.prgname : String | Nil #

def self.prgname=(prgname : String) : Nil #

def self.prgname_once=(prgname : String) : Bool #

def self.qsort_with_data(pbase : Pointer(Void), total_elems : Int32, size : UInt64, compare_func : GLib::CompareDataFunc, user_data : Pointer(Void) | Nil) : Nil #

DEPRECATED


def self.quark_from_string(string : String | Nil) : UInt32 #

def self.quark_to_string(quark : UInt32) : String #

def self.quark_try_string(string : String | Nil) : UInt32 #

def self.ref_string_equal(str1 : String, str2 : String) : Bool #

def self.reload_user_special_dirs_cache : Nil #

def self.remove(filename : String) : Int32 #

def self.rename(oldfilename : String, newfilename : String) : Int32 #

def self.sequence_foreach_range(begin _begin : GLib::SequenceIter, end _end : GLib::SequenceIter, func : GLib::Func, user_data : Pointer(Void) | Nil) : Nil #

def self.sequence_sort_changed(iter : GLib::SequenceIter, cmp_func : GLib::CompareDataFunc, cmp_data : Pointer(Void) | Nil) : Nil #

def self.sequence_sort_changed_iter(iter : GLib::SequenceIter, iter_cmp : GLib::SequenceIterCompareFunc, cmp_data : Pointer(Void) | Nil) : Nil #

def self.slist_pop_allocator : Nil #

def self.slist_push_allocator(allocator : GLib::Allocator) : Nil #

def self.source_remove(tag : UInt32) : Bool #

def self.source_set_name_by_id(tag : UInt32, name : String) : Nil #

def self.spaced_primes_closest(num : UInt32) : UInt32 #

def self.stat(filename : String, buf : GLib::StatBuf) : Int32 #

def self.strdupv(str_array : Enumerable(String) | Nil) : Enumerable(String) | Nil #

def self.strdupv(*str_array : String) #

def self.strsplit(string : String, delimiter : String, max_tokens : Int32) : Enumerable(String) #

def self.strsplit_set(string : String, delimiters : String, max_tokens : Int32) : Enumerable(String) #

def self.system_config_dirs : Enumerable(String) #

def self.system_data_dirs : Enumerable(String) #

def self.test_disable_crash_reporting : Nil #

def self.test_trap_subprocess_with_envp(test_path : String | Nil, envp : Enumerable(String) | Nil, usec_timeout : UInt64, test_flags : GLib::TestSubprocessFlags) : Nil #

def self.timeout(interval : Time::Span, priority : Priority = Priority::Default, &block : -> Bool) #

def self.timeout_milliseconds(interval : UInt32, priority : Priority = Priority::Default, &block : -> Bool) #

def self.timeout_seconds(interval : UInt32, priority : Priority = Priority::Default, &block : -> Bool) #

def self.timeout_source_new(interval : UInt32) : GLib::Source #

def self.timeout_source_new_seconds(interval : UInt32) : GLib::Source #

def self.user_cache_dir : Path #

def self.user_config_dir : Path #

def self.user_data_dir : Path #

def self.user_runtime_dir : Path #

def self.user_special_dir(directory : GLib::UserDirectory) : Path | Nil #

def self.user_state_dir : Path #

def self.utf8_truncate_middle(string : String, truncate_length : UInt64) : String #

def self.utime(filename : String, utb : Pointer(Void) | Nil) : Int32 #

def self.variant_get_gtype : UInt64 #

def self.variant_is_object_path(string : String) : Bool #

def self.variant_is_signature(string : String) : Bool #

def self.variant_parse_error_print_context(error : GLib::Error, source_str : String) : String #

def self.variant_parse_error_quark : UInt32 #

def self.variant_parser_get_error_quark : UInt32 #

DEPRECATED


def self.variant_type_checked_(type_string : String) : GLib::VariantType #

def self.variant_type_string_get_depth_(type_string : String) : UInt64 #

def self.variant_type_string_is_valid(type_string : String) : Bool #

def self.variant_type_string_scan(string : String, limit : String | Nil) : Bool #

Instance Method Detail

def variant_parse(type : GLib::VariantType | Nil, text : String, limit : String | Nil, endptr : String | Nil) : GLib::Variant #