Class: GObject::Object
Overview
Overrides for GObject, GObject’s generic base class.
Defined Under Namespace
Modules: Overrides
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from Overrides
#get_property, #set_property
Class Method Details
.make_finalizer(ptr) ⇒ Object
57
58
59
|
# File 'lib/ffi-gobject/object.rb', line 57
def self.make_finalizer(ptr)
proc { finalize ptr }
end
|
40
41
42
43
44
|
# File 'lib/ffi-gobject/object.rb', line 40
def self.new(...)
obj = allocate
obj.__send__(:initialize, ...)
obj
end
|
.new_with_properties ⇒ Object
14
15
16
17
18
|
# File 'lib/ffi-gobject/object.rb', line 14
def self.new_with_properties(...)
obj = allocate
obj.__send__(:initialize_with_properties, ...)
obj
end
|
Instance Method Details
#initialize_with_properties(properties = {}) ⇒ Object
Also known as:
initialize
Starting with GLib 2.54.0, use g_object_new_with_properties, which takes an array of names and an array of values.
22
23
24
25
26
27
28
29
30
31
32
33
34
|
# File 'lib/ffi-gobject/object.rb', line 22
def initialize_with_properties(properties = {})
names, gvalues = names_and_gvalues_for_properties(properties)
n_properties = names.length
names_arr = GirFFI::SizedArray.from(:utf8, -1, names)
gvalues_arr = GirFFI::SizedArray.from(GObject::Value, -1, gvalues)
ptr = GObject::Lib.g_object_new_with_properties(self.class.gtype,
n_properties,
names_arr,
gvalues_arr)
store_pointer ptr
end
|
52
53
54
55
|
# File 'lib/ffi-gobject/object.rb', line 52
def ref
Lib.g_object_ref self
self
end
|
#signal_connect(event, data = nil, &block) ⇒ Object
74
75
76
|
# File 'lib/ffi-gobject/object.rb', line 74
def signal_connect(event, data = nil, &block)
GObject.signal_connect(self, event, data, &block)
end
|
#signal_connect_after(event, data = nil, &block) ⇒ Object
78
79
80
|
# File 'lib/ffi-gobject/object.rb', line 78
def signal_connect_after(event, data = nil, &block)
GObject.signal_connect_after(self, event, data, &block)
end
|