Module: GLib
- Extended by:
- Deprecatable
- Includes:
- Enumerable
- Defined in:
- lib/glib2/regex.rb,
lib/glib2.rb,
lib/glib2.rb,
lib/glib-mkenums.rb,
lib/glib2/variant.rb,
lib/glib2/version.rb,
lib/glib2/date-time.rb,
lib/glib2/time-zone.rb,
lib/glib2/deprecated.rb,
lib/glib2/deprecatable.rb,
ext/glib2/rbglib.c
Overview
Copyright © 2015-2017 Ruby-GNOME2 Project Team
This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Defined Under Namespace
Modules: Deprecatable, Idle, Log, MetaSignal, Module, OSInfoKey, Unicode, Version Classes: DateTime, DeprecatedError, Enum, EnumDefinition, Flags, Instantiatable, MkEnums, Object, Param, Regex, SpawnError, Thread, TimeZone, Type, UserDirectory, Variant
Constant Summary collapse
- SIGNAL_HANDLER_PREFIX =
"signal_do_"
- VIRTUAL_FUNCTION_IMPLEMENTATION_PREFIX =
"virtual_do_"
- LOG_DOMAIN =
"GLib"
- VERSION =
Version Information
rb_ary_new3(3, INT2FIX(glib_major_version), INT2FIX(glib_minor_version), INT2FIX(glib_micro_version))
- MAJOR_VERSION =
INT2FIX(glib_major_version)
- MINOR_VERSION =
INT2FIX(glib_minor_version)
- MICRO_VERSION =
INT2FIX(glib_micro_version)
- INTERFACE_AGE =
INT2FIX(glib_interface_age)
- BINARY_AGE =
INT2FIX(glib_binary_age)
- BINDING_VERSION =
rb_ary_new3(3, INT2FIX(RBGLIB_MAJOR_VERSION), INT2FIX(RBGLIB_MINOR_VERSION), INT2FIX(RBGLIB_MICRO_VERSION))
- BUILD_VERSION =
rb_ary_new3(3, INT2FIX(GLIB_MAJOR_VERSION), INT2FIX(GLIB_MINOR_VERSION), INT2FIX(GLIB_MICRO_VERSION))
- MININT =
Limits of Basic Types
INT2FIX(G_MININT)
- MAXINT =
INT2NUM(G_MAXINT)
- MAXUINT =
UINT2NUM(G_MAXUINT)
- MINSHORT =
INT2FIX(G_MINSHORT)
- MAXSHORT =
INT2FIX(G_MAXSHORT)
- MAXUSHORT =
UINT2NUM(G_MAXUSHORT)
- MINLONG =
LL2NUM(G_MINLONG)
- MAXLONG =
LL2NUM(G_MAXLONG)
- MAXULONG =
ULL2NUM(G_MAXULONG)
- MININT8 =
INT2FIX(G_MININT8)
- MAXINT8 =
INT2FIX(G_MAXINT8)
- MAXUINT8 =
UINT2NUM(G_MAXUINT8)
- MININT16 =
INT2FIX(G_MININT16)
- MAXINT16 =
INT2FIX(G_MAXINT16)
- MAXUINT16 =
UINT2NUM(G_MAXUINT16)
- MININT32 =
INT2FIX(G_MININT32)
- MAXINT32 =
INT2NUM(G_MAXINT32)
- MAXUINT32 =
UINT2NUM(G_MAXUINT32)
- MININT64 =
LL2NUM(G_MININT64)
- MAXINT64 =
LL2NUM(G_MAXINT64)
- MAXUINT64 =
ULL2NUM(G_MAXUINT64)
- MAXSIZE =
ULL2NUM(G_MAXSIZE)
- MINFLOAT =
DBL2NUM(G_MINFLOAT)
- MAXFLOAT =
DBL2NUM(G_MAXFLOAT)
- MINDOUBLE =
DBL2NUM(G_MINDOUBLE)
- MAXDOUBLE =
DBL2NUM(G_MAXDOUBLE)
- DIR_SEPARATOR =
CSTR2RVAL(G_DIR_SEPARATOR_S)
- SEARCHPATH_SEPARATOR =
CSTR2RVAL(G_SEARCHPATH_SEPARATOR_S)
- FILENAME_ENCODING =
rb_enc_from_encoding(rbg_filename_encoding)
- E =
Don’t implement them. #define G_IEEE754_FLOAT_BIAS #define G_IEEE754_DOUBLE_BIAS union GFloatIEEE754; union GDoubleIEEE754;
CSTR2RVAL(G_STRINGIFY(G_E))
- LN2 =
CSTR2RVAL(G_STRINGIFY(G_LN2))
- LN10 =
CSTR2RVAL(G_STRINGIFY(G_LN10))
- PI =
CSTR2RVAL(G_STRINGIFY(G_PI))
- PI_2 =
CSTR2RVAL(G_STRINGIFY(G_PI_2))
- PI_4 =
CSTR2RVAL(G_STRINGIFY(G_PI_4))
- SQRT2 =
CSTR2RVAL(G_STRINGIFY(G_SQRT2))
- LOG_2_BASE_10 =
CSTR2RVAL(G_STRINGIFY(G_LOG_2_BASE_10))
- PRIORITY_HIGH =
From “The Main Event Loop”
INT2FIX(G_PRIORITY_HIGH)
- PRIORITY_DEFAULT =
INT2FIX(G_PRIORITY_DEFAULT)
- PRIORITY_HIGH_IDLE =
INT2FIX(G_PRIORITY_HIGH_IDLE)
- PRIORITY_DEFAULT_IDLE =
INT2FIX(G_PRIORITY_DEFAULT_IDLE)
- PRIORITY_LOW =
INT2FIX(G_PRIORITY_LOW)
- FUNDAMENTAL_MAX =
INT2FIX(G_TYPE_FUNDAMENTAL_MAX)
- FUNDAMENTAL_TYPES =
better name
FIXME
- DEFAULT =
INT2NUM(G_SPAWN_DEFAULT)
- LEAVE_DESCRIPTORS_OPEN =
INT2NUM(G_SPAWN_LEAVE_DESCRIPTORS_OPEN)
- DO_NOT_REAP_CHILD =
INT2NUM(G_SPAWN_DO_NOT_REAP_CHILD)
- SEARCH_PATH =
INT2NUM(G_SPAWN_SEARCH_PATH)
- STDOUT_TO_DEV_NULL =
INT2NUM(G_SPAWN_STDOUT_TO_DEV_NULL)
- STDERR_TO_DEV_NULL =
INT2NUM(G_SPAWN_STDERR_TO_DEV_NULL)
- CHILD_INHERITS_STDIN =
INT2NUM(G_SPAWN_CHILD_INHERITS_STDIN)
- FILE_AND_ARGV_ZERO =
INT2NUM(G_SPAWN_FILE_AND_ARGV_ZERO)
- SEARCH_PATH_FROM_ENVP =
INT2NUM(G_SPAWN_SEARCH_PATH_FROM_ENVP)
- CLOEXEC_PIPES =
INT2NUM(G_SPAWN_CLOEXEC_PIPES)
- CHILD_INHERITS_STDOUT =
INT2NUM(G_SPAWN_CHILD_INHERITS_STDOUT)
- CHILD_INHERITS_STDERR =
INT2NUM(G_SPAWN_CHILD_INHERITS_STDERR)
- STDIN_FROM_DEV_NULL =
INT2NUM(G_SPAWN_STDIN_FROM_DEV_NULL)
- READABLE =
GParamFlags
INT2FIX(G_PARAM_READABLE)
- WRITABLE =
INT2FIX(G_PARAM_WRITABLE)
- READWRITE =
INT2FIX(G_PARAM_READWRITE)
- CONSTRUCT =
INT2FIX(G_PARAM_CONSTRUCT)
- CONSTRUCT_ONLY =
INT2FIX(G_PARAM_CONSTRUCT_ONLY)
- LAX_VALIDATION =
INT2FIX(G_PARAM_LAX_VALIDATION)
- STATIC_NAME =
INT2FIX(G_PARAM_STATIC_NAME)
- STATIC_NICK =
INT2FIX(G_PARAM_STATIC_NICK)
- STATIC_BLURB =
INT2FIX(G_PARAM_STATIC_BLURB)
- EXPLICIT_NOTIFY =
INT2FIX(G_PARAM_EXPLICIT_NOTIFY)
- DEPRECATED =
INT2FIX(G_PARAM_DEPRECATED)
- MASK =
INT2FIX(G_PARAM_MASK)
- USER_SHIFT =
INT2FIX(G_PARAM_USER_SHIFT)
- REMOVE =
CBOOL2RVAL(G_SOURCE_REMOVE)
- CONTINUE =
CBOOL2RVAL(G_SOURCE_CONTINUE)
- DESKTOP_GROUP =
Defines for handling freedesktop.org Desktop files
CSTR2RVAL(G_KEY_FILE_DESKTOP_GROUP)
- DESKTOP_KEY_TYPE =
CSTR2RVAL(G_KEY_FILE_DESKTOP_KEY_TYPE)
- DESKTOP_KEY_VERSION =
CSTR2RVAL(G_KEY_FILE_DESKTOP_KEY_VERSION)
- DESKTOP_KEY_NAME =
CSTR2RVAL(G_KEY_FILE_DESKTOP_KEY_NAME)
- DESKTOP_KEY_GENERIC_NAME =
CSTR2RVAL(G_KEY_FILE_DESKTOP_KEY_GENERIC_NAME)
- DESKTOP_KEY_NO_DISPLAY =
CSTR2RVAL(G_KEY_FILE_DESKTOP_KEY_NO_DISPLAY)
- DESKTOP_KEY_COMMENT =
CSTR2RVAL(G_KEY_FILE_DESKTOP_KEY_COMMENT)
- DESKTOP_KEY_ICON =
CSTR2RVAL(G_KEY_FILE_DESKTOP_KEY_ICON)
- DESKTOP_KEY_HIDDEN =
CSTR2RVAL(G_KEY_FILE_DESKTOP_KEY_HIDDEN)
- DESKTOP_KEY_ONLY_SHOW_IN =
CSTR2RVAL(G_KEY_FILE_DESKTOP_KEY_ONLY_SHOW_IN)
- DESKTOP_KEY_NOT_SHOW_IN =
CSTR2RVAL(G_KEY_FILE_DESKTOP_KEY_NOT_SHOW_IN)
- DESKTOP_KEY_TRY_EXEC =
CSTR2RVAL(G_KEY_FILE_DESKTOP_KEY_TRY_EXEC)
- DESKTOP_KEY_EXEC =
CSTR2RVAL(G_KEY_FILE_DESKTOP_KEY_EXEC)
- DESKTOP_KEY_PATH =
CSTR2RVAL(G_KEY_FILE_DESKTOP_KEY_PATH)
- DESKTOP_KEY_TERMINAL =
CSTR2RVAL(G_KEY_FILE_DESKTOP_KEY_TERMINAL)
- DESKTOP_KEY_MIME_TYPE =
CSTR2RVAL(G_KEY_FILE_DESKTOP_KEY_MIME_TYPE)
- DESKTOP_KEY_CATEGORIES =
CSTR2RVAL(G_KEY_FILE_DESKTOP_KEY_CATEGORIES)
- DESKTOP_KEY_STARTUP_NOTIFY =
CSTR2RVAL(G_KEY_FILE_DESKTOP_KEY_STARTUP_NOTIFY)
- DESKTOP_KEY_STARTUP_WM_CLASS =
CSTR2RVAL(G_KEY_FILE_DESKTOP_KEY_STARTUP_WM_CLASS)
- DESKTOP_KEY_URL =
CSTR2RVAL(G_KEY_FILE_DESKTOP_KEY_URL)
- DESKTOP_TYPE_APPLICATION =
CSTR2RVAL(G_KEY_FILE_DESKTOP_TYPE_APPLICATION)
- DESKTOP_TYPE_LINK =
CSTR2RVAL(G_KEY_FILE_DESKTOP_TYPE_LINK)
- DESKTOP_TYPE_DIRECTORY =
CSTR2RVAL(G_KEY_FILE_DESKTOP_TYPE_DIRECTORY)
- FATAL_MASK =
INT2NUM(G_LOG_FATAL_MASK)
- LEVEL_USER_SHIFT =
INT2NUM(G_LOG_LEVEL_USER_SHIFT)
- FLAG_RECURSION =
GLogLevelFlags
INT2NUM(G_LOG_FLAG_RECURSION)
- FLAG_FATAL =
INT2NUM(G_LOG_FLAG_FATAL)
- LEVEL_ERROR =
INT2NUM(G_LOG_LEVEL_ERROR)
- LEVEL_CRITICAL =
INT2NUM(G_LOG_LEVEL_CRITICAL)
- LEVEL_WARNING =
INT2NUM(G_LOG_LEVEL_WARNING)
- LEVEL_MESSAGE =
INT2NUM(G_LOG_LEVEL_MESSAGE)
- LEVEL_INFO =
INT2NUM(G_LOG_LEVEL_INFO)
- LEVEL_DEBUG =
INT2NUM(G_LOG_LEVEL_DEBUG)
- LEVEL_MASK =
INT2NUM(G_LOG_LEVEL_MASK)
- EXIST =
INT2NUM(G_FILE_ERROR_EXIST)
- ISDIR =
INT2NUM(G_IO_CHANNEL_ERROR_ISDIR)
- ACCES =
INT2NUM(G_FILE_ERROR_ACCES)
- NAMETOOLONG =
INT2NUM(G_FILE_ERROR_NAMETOOLONG)
- NOENT =
INT2NUM(G_FILE_ERROR_NOENT)
- NOTDIR =
INT2NUM(G_FILE_ERROR_NOTDIR)
- NXIO =
INT2NUM(G_IO_CHANNEL_ERROR_NXIO)
- NODEV =
INT2NUM(G_FILE_ERROR_NODEV)
- ROFS =
INT2NUM(G_FILE_ERROR_ROFS)
- TXTBSY =
INT2NUM(G_FILE_ERROR_TXTBSY)
- FAULT =
INT2NUM(G_FILE_ERROR_FAULT)
- LOOP =
INT2NUM(G_FILE_ERROR_LOOP)
- NOSPC =
INT2NUM(G_IO_CHANNEL_ERROR_NOSPC)
- NOMEM =
INT2NUM(G_FILE_ERROR_NOMEM)
- MFILE =
INT2NUM(G_FILE_ERROR_MFILE)
- NFILE =
INT2NUM(G_FILE_ERROR_NFILE)
- BADF =
INT2NUM(G_FILE_ERROR_BADF)
- INVAL =
INT2NUM(G_IO_CHANNEL_ERROR_INVAL)
- PIPE =
INT2NUM(G_IO_CHANNEL_ERROR_PIPE)
- AGAIN =
INT2NUM(G_FILE_ERROR_AGAIN)
- INTR =
INT2NUM(G_FILE_ERROR_INTR)
- IO =
INT2NUM(G_IO_CHANNEL_ERROR_IO)
- PERM =
INT2NUM(G_FILE_ERROR_PERM)
- FAILED =
INT2NUM(G_IO_CHANNEL_ERROR_FAILED)
- SEEK_CUR =
GSeekType
INT2NUM(G_SEEK_CUR)
- SEEK_SET =
INT2NUM(G_SEEK_SET)
- SEEK_END =
INT2NUM(G_SEEK_END)
- STATUS_ERROR =
GIOStatus
INT2NUM(G_IO_STATUS_ERROR)
- STATUS_NORMAL =
INT2NUM(G_IO_STATUS_NORMAL)
- STATUS_EOF =
INT2NUM(G_IO_STATUS_EOF)
- STATUS_AGAIN =
INT2NUM(G_IO_STATUS_AGAIN)
- FLAG_APPEND =
GIOFlags
INT2NUM(G_IO_FLAG_APPEND)
- FLAG_NONBLOCK =
INT2NUM(G_IO_FLAG_NONBLOCK)
- FLAG_READABLE =
INT2NUM(G_IO_FLAG_IS_READABLE)
- FLAG_WRITEABLE =
INT2NUM(G_IO_FLAG_IS_WRITEABLE)
- FLAG_IS_SEEKABLE =
INT2NUM(G_IO_FLAG_IS_SEEKABLE)
- FLAG_MASK =
INT2NUM(G_IO_FLAG_MASK)
- FLAG_GET_MASK =
INT2NUM(G_IO_FLAG_GET_MASK)
- FLAG_SET_MASK =
INT2NUM(G_IO_FLAG_SET_MASK)
- BAD_QUOTING =
INT2FIX(G_SHELL_ERROR_BAD_QUOTING)
- EMPTY_STRING =
INT2FIX(G_SHELL_ERROR_EMPTY_STRING)
- FORK =
INT2NUM(G_SPAWN_ERROR_FORK)
- READ =
INT2NUM(G_SPAWN_ERROR_READ)
- CHDIR =
INT2NUM(G_SPAWN_ERROR_CHDIR)
- EACCES =
INT2NUM(G_SPAWN_ERROR_ACCES)
- EPERM =
INT2NUM(G_SPAWN_ERROR_PERM)
- TOO_BIG =
INT2NUM(G_SPAWN_ERROR_TOO_BIG)
- ENOEXEC =
INT2NUM(G_SPAWN_ERROR_NOEXEC)
- ENAMETOOLONG =
INT2NUM(G_SPAWN_ERROR_NAMETOOLONG)
- ENOENT =
INT2NUM(G_SPAWN_ERROR_NOENT)
- ENOMEM =
INT2NUM(G_SPAWN_ERROR_NOMEM)
- ENOTDIR =
INT2NUM(G_SPAWN_ERROR_NOTDIR)
- ELOOP =
INT2NUM(G_SPAWN_ERROR_LOOP)
- ETXTBUSY =
INT2NUM(G_SPAWN_ERROR_TXTBUSY)
- EIO =
INT2NUM(G_SPAWN_ERROR_IO)
- ENFILE =
INT2NUM(G_SPAWN_ERROR_NFILE)
- EMFILE =
INT2NUM(G_SPAWN_ERROR_MFILE)
- EINVAL =
INT2NUM(G_SPAWN_ERROR_INVAL)
- EISDIR =
INT2NUM(G_SPAWN_ERROR_ISDIR)
- ELIBBAD =
INT2NUM(G_SPAWN_ERROR_LIBBAD)
- FBIG =
INT2NUM(G_IO_CHANNEL_ERROR_FBIG)
- OVERFLOW =
INT2NUM(G_IO_CHANNEL_ERROR_OVERFLOW)
- FLAGS_MASK =
INT2NUM(G_SIGNAL_FLAGS_MASK)
- MATCH_MASK =
INT2NUM(G_SIGNAL_MATCH_MASK)
- TYPE_STATIC_SCOPE =
INT2FIX(G_SIGNAL_TYPE_STATIC_SCOPE)
Class Method Summary collapse
- .__add_one_arg_setter(klass) ⇒ Object
- .check_binding_version?(major, minor, micro) ⇒ Boolean
- .exit_application(exception, status) ⇒ Object
- .prepend_dll_path(path) ⇒ Object
- .prepend_path_to_environment_variable(path, environment_name) ⇒ Object
Methods included from Deprecatable
define_deprecated_const, define_deprecated_enums, define_deprecated_method, define_deprecated_method_by_hash_args, define_deprecated_signal, define_deprecated_singleton_method, define_singleton_method, extended
Class Method Details
.__add_one_arg_setter(klass) ⇒ Object
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/glib2.rb', line 49 def __add_one_arg_setter(klass) # for Instance methods. method_names = klass.instance_methods(false) method_names.each do |method_name| next if /\Aset_/ !~ method_name property_name = $POSTMATCH next if klass.method_defined?("#{property_name}=") next if klass.instance_method(method_name).arity != 1 begin klass.module_eval("def #{property_name}=(val); set_#{property_name}(val); val; end\n") rescue SyntaxError if $DEBUG $stderr.puts "Couldn't create #{klass}\##{property_name}=(v)." end end end # for Class methods/Module functions. if klass.method(:methods).arity == -1 method_names = klass.methods(false) else method_names = klass.methods end singleton_klass = (class << klass; self; end) method_names.each do |method_name| next if /\Aset_/ !~ method_name property_name = $POSTMATCH next if singleton_klass.method_defined?("#{property_name}=") next if klass.method(method_name).arity != 1 begin klass.module_eval("def self.#{property_name}=(val); set_#{property_name}(val); val; end\n") rescue SyntaxError if $DEBUG $stderr.puts "Couldn't create #{klass}.#{property_name}=(v)." end end end end |
.check_binding_version?(major, minor, micro) ⇒ Boolean
24 25 26 27 28 29 30 31 |
# File 'lib/glib2.rb', line 24 def check_binding_version?(major, minor, micro) BINDING_VERSION[0] > major || (BINDING_VERSION[0] == major && BINDING_VERSION[1] > minor) || (BINDING_VERSION[0] == major && BINDING_VERSION[1] == minor && BINDING_VERSION[2] >= micro) end |
.exit_application(exception, status) ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/glib2.rb', line 33 def exit_application(exception, status) msg = exception. || exception.to_s msg = exception.class.to_s if msg == "" backtrace = exception.backtrace || [] first_line = backtrace.shift if first_line $stderr.puts("#{first_line}: #{msg}") else $stderr.puts(msg) end backtrace.each do |v| $stderr.puts("\t from #{v}") end exit(status) end |
.prepend_dll_path(path) ⇒ Object
103 104 105 106 107 108 109 110 111 112 113 114 |
# File 'lib/glib2.rb', line 103 def prepend_dll_path(path) path = Pathname(path) unless path.is_a?(Pathname) return unless path.exist? begin require "ruby_installer/runtime" rescue LoadError else RubyInstaller::Runtime.add_dll_directory(path.to_s) end prepend_path_to_environment_variable(path, "PATH") end |
.prepend_path_to_environment_variable(path, environment_name) ⇒ Object
88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
# File 'lib/glib2.rb', line 88 def prepend_path_to_environment_variable(path, environment_name) path = Pathname(path) unless path.is_a?(Pathname) return unless path.exist? dir = path.to_s dir = dir.gsub(/\//, ::File::ALT_SEPARATOR) if ::File::ALT_SEPARATOR separator = ::File::PATH_SEPARATOR paths = (ENV[environment_name] || '').split(separator) unless paths.include?(dir) paths = [dir] + paths ENV[environment_name] = paths.join(separator) end end |