glib2 3.4.4 → 3.4.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/glib2/glib2.def +1 -0
- data/ext/glib2/rbglib.h +9 -2
- data/ext/glib2/rbglib_error.c +3 -1
- data/ext/glib2/rbgobj_signal.c +24 -45
- data/ext/glib2/rbgobj_typeinterface.c +38 -2
- data/lib/glib2.rb +32 -3
- data/lib/mkmf-gnome.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fc9021ce7fcfcf108ddb84e10f240e64b4295fbd3ed9c9da17a2fcd1598d139e
|
4
|
+
data.tar.gz: fa8d854ce07dd819e679e5738440ba76ea0611076cfcccb6e43a4b14ce35f4ab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b94a4faf33a5ed7eef416b4fbab7e3b1fc2af86613b6fdaac5df4ca3cfb2ab32a3023b385dece2e0e390f3671b1ae61efad58fb79884c8c886a3cc93cbf1a0cc
|
7
|
+
data.tar.gz: 45ccc2a9af969adf3224b1527fd645afdbe933e0c8da47939316d9cb1da988eb622fc0407358590eb1f4f9debcfea521f51c0ba64a0047916074e0de35fb8201
|
data/ext/glib2/glib2.def
CHANGED
data/ext/glib2/rbglib.h
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
2
|
/*
|
3
|
-
* Copyright (C) 2002-
|
3
|
+
* Copyright (C) 2002-2021 Ruby-GNOME Project Team
|
4
4
|
* Copyright (C) 2002,2003 Masahiro Sakai
|
5
5
|
*
|
6
6
|
* This library is free software; you can redistribute it and/or
|
@@ -33,7 +33,7 @@ G_BEGIN_DECLS
|
|
33
33
|
|
34
34
|
#define RBGLIB_MAJOR_VERSION 3
|
35
35
|
#define RBGLIB_MINOR_VERSION 4
|
36
|
-
#define RBGLIB_MICRO_VERSION
|
36
|
+
#define RBGLIB_MICRO_VERSION 5
|
37
37
|
|
38
38
|
#ifndef RB_ZALLOC
|
39
39
|
# ifdef ZALLOC
|
@@ -222,6 +222,13 @@ extern VALUE rbg_check_hash_type(VALUE object);
|
|
222
222
|
extern void rbg_scan_options(VALUE options, ...);
|
223
223
|
|
224
224
|
/* rbgerror.h */
|
225
|
+
typedef enum {
|
226
|
+
RBG_RUBY_ERROR_UNKNOWN,
|
227
|
+
} RBGRubyError;
|
228
|
+
|
229
|
+
#define RBG_RUBY_ERROR rbgerr_ruby_error_quark()
|
230
|
+
extern GQuark rbgerr_ruby_error_quark(void);
|
231
|
+
|
225
232
|
extern VALUE rbgerr_gerror2exception(GError *error);
|
226
233
|
extern VALUE rbgerr_define_gerror(GQuark domain, const gchar* name, VALUE module, VALUE parent, GType gtype);
|
227
234
|
|
data/ext/glib2/rbglib_error.c
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
2
|
/*
|
3
|
-
* Copyright (C) 2011-
|
3
|
+
* Copyright (C) 2011-2021 Ruby-GNOME Project Team
|
4
4
|
* Copyright (C) 2004 Masao Mutoh
|
5
5
|
*
|
6
6
|
* This library is free software; you can redistribute it and/or
|
@@ -29,6 +29,8 @@ static VALUE gerror_table;
|
|
29
29
|
static VALUE generic_error;
|
30
30
|
static VALUE error_info;
|
31
31
|
|
32
|
+
G_DEFINE_QUARK(ruby-error-quark, rbgerr_ruby_error)
|
33
|
+
|
32
34
|
VALUE
|
33
35
|
rbgerr_gerror2exception(GError *error)
|
34
36
|
{
|
data/ext/glib2/rbgobj_signal.c
CHANGED
@@ -26,8 +26,6 @@
|
|
26
26
|
static VALUE RG_TARGET_NAMESPACE;
|
27
27
|
VALUE rbgobj_signal_wrap(guint sig_id);
|
28
28
|
|
29
|
-
#define default_handler_method_prefix "signal_do_"
|
30
|
-
|
31
29
|
/**********************************************************************/
|
32
30
|
|
33
31
|
static const rb_data_type_t rg_glib_signal_type = {
|
@@ -235,20 +233,13 @@ gobj_s_define_signal(int argc, VALUE* argv, VALUE self)
|
|
235
233
|
signal_flags = RVAL2GFLAGS(rbsignal_flags, G_TYPE_SIGNAL_FLAGS);
|
236
234
|
|
237
235
|
{
|
238
|
-
VALUE
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
rb_str_concat(rb_str_new_cstr(default_handler_method_prefix),
|
244
|
-
rbsignal_name);
|
245
|
-
method_id = rb_to_id(rb_method_name);
|
246
|
-
|
247
|
-
proc = rb_funcall(mMetaInterface, rb_intern("signal_callback"), 2,
|
248
|
-
self, ID2SYM(method_id));
|
249
|
-
|
236
|
+
VALUE proc = rb_funcall(mMetaInterface,
|
237
|
+
rb_intern("signal_callback"),
|
238
|
+
2,
|
239
|
+
self,
|
240
|
+
rbsignal_name);
|
250
241
|
class_closure = g_rclosure_new(proc, Qnil, NULL);
|
251
|
-
g_rclosure_set_tag(class_closure, RVAL2CSTR(
|
242
|
+
g_rclosure_set_tag(class_closure, RVAL2CSTR(rbsignal_name));
|
252
243
|
}
|
253
244
|
|
254
245
|
return_type = rbgobj_gtype_from_ruby(rbreturn_type);
|
@@ -722,39 +713,25 @@ gobj_sig_chain_from_overridden(int argc, VALUE *argv, VALUE self)
|
|
722
713
|
}
|
723
714
|
|
724
715
|
static VALUE
|
725
|
-
|
716
|
+
gobj_s_signal_handler_attach(VALUE klass,
|
717
|
+
VALUE rb_signal,
|
718
|
+
VALUE rb_handler_name)
|
726
719
|
{
|
727
|
-
const RGObjClassInfo*
|
728
|
-
|
729
|
-
|
730
|
-
|
731
|
-
|
732
|
-
|
733
|
-
|
734
|
-
|
735
|
-
|
736
|
-
|
737
|
-
|
738
|
-
{
|
739
|
-
GSignalQuery query;
|
740
|
-
g_signal_query(signal_id, &query);
|
741
|
-
if (query.itype == cinfo->gtype)
|
742
|
-
return Qnil;
|
743
|
-
}
|
744
|
-
|
745
|
-
{
|
746
|
-
VALUE proc = rb_funcall(mMetaInterface, rb_intern("signal_callback"), 2,
|
747
|
-
klass, id);
|
748
|
-
GClosure* rclosure = g_rclosure_new(proc, Qnil,
|
749
|
-
rbgobj_get_signal_func(signal_id));
|
750
|
-
g_rclosure_attach((GClosure *)rclosure, klass);
|
751
|
-
g_signal_override_class_closure(signal_id, cinfo->gtype, rclosure);
|
752
|
-
}
|
720
|
+
const RGObjClassInfo *cinfo = rbgobj_lookup_class(klass);
|
721
|
+
guint signal_id = rbgobj_signal_get_raw(rb_signal)->signal_id;
|
722
|
+
VALUE handler_name = RVAL2CSTR(rb_handler_name);
|
723
|
+
VALUE proc = rb_block_proc();
|
724
|
+
GClosure* rclosure = g_rclosure_new(proc,
|
725
|
+
Qnil,
|
726
|
+
rbgobj_get_signal_func(signal_id));
|
727
|
+
g_rclosure_set_tag(rclosure, handler_name);
|
728
|
+
g_rclosure_attach((GClosure *)rclosure, klass);
|
729
|
+
g_signal_override_class_closure(signal_id, cinfo->gtype, rclosure);
|
753
730
|
|
754
731
|
{
|
755
732
|
VALUE mod = rb_define_module_under(klass, RubyGObjectHookModule);
|
756
733
|
rb_include_module(klass, mod);
|
757
|
-
rbg_define_method(mod,
|
734
|
+
rbg_define_method(mod, handler_name, gobj_sig_chain_from_overridden, -1);
|
758
735
|
}
|
759
736
|
|
760
737
|
return Qnil;
|
@@ -1059,6 +1036,8 @@ Init_gobject_gsignal(void)
|
|
1059
1036
|
rbg_define_method(cInstantiatable, "signal_handler_is_connected?",
|
1060
1037
|
gobj_sig_handler_is_connected, 1);
|
1061
1038
|
|
1062
|
-
rbg_define_singleton_method(cInstantiatable,
|
1063
|
-
|
1039
|
+
rbg_define_singleton_method(cInstantiatable,
|
1040
|
+
"signal_handler_attach",
|
1041
|
+
gobj_s_signal_handler_attach,
|
1042
|
+
2);
|
1064
1043
|
}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
2
|
/*
|
3
|
-
* Copyright (C) 2011,
|
4
|
-
* Copyright (C) 2002-2006 Ruby-
|
3
|
+
* Copyright (C) 2011,2021 Ruby-GNOME Project Team
|
4
|
+
* Copyright (C) 2002-2006 Ruby-GNOME Project Team
|
5
5
|
* Copyright (C) 2002,2003 Masahiro Sakai
|
6
6
|
*
|
7
7
|
* This library is free software; you can redistribute it and/or
|
@@ -35,6 +35,41 @@ rg_append_features(G_GNUC_UNUSED VALUE self, VALUE klass)
|
|
35
35
|
return rb_call_super(1, &klass);
|
36
36
|
}
|
37
37
|
|
38
|
+
static void
|
39
|
+
interface_init(G_GNUC_UNUSED gpointer g_iface,
|
40
|
+
G_GNUC_UNUSED gpointer iface_data)
|
41
|
+
{
|
42
|
+
}
|
43
|
+
|
44
|
+
static VALUE
|
45
|
+
rg_included(VALUE self, VALUE class_or_module)
|
46
|
+
{
|
47
|
+
const GInterfaceInfo interface_info = {
|
48
|
+
interface_init, NULL, NULL
|
49
|
+
};
|
50
|
+
const RGObjClassInfo *interface_cinfo;
|
51
|
+
const RGObjClassInfo *class_cinfo;
|
52
|
+
if (RVAL2CBOOL(rb_obj_is_instance_of(class_or_module, rb_cModule))) {
|
53
|
+
rb_raise(rb_eTypeError,
|
54
|
+
"GLib::Interface based module (%" PRIsVALUE ") "
|
55
|
+
"must be included into a class directly: %" PRIsVALUE,
|
56
|
+
self,
|
57
|
+
class_or_module);
|
58
|
+
}
|
59
|
+
interface_cinfo = rbgobj_lookup_class(self);
|
60
|
+
class_cinfo = rbgobj_lookup_class(class_or_module);
|
61
|
+
if (class_cinfo->klass != class_or_module) {
|
62
|
+
return Qnil;
|
63
|
+
}
|
64
|
+
if (g_type_is_a(class_cinfo->gtype, interface_cinfo->gtype)) {
|
65
|
+
return Qnil;
|
66
|
+
}
|
67
|
+
g_type_add_interface_static(class_cinfo->gtype,
|
68
|
+
interface_cinfo->gtype,
|
69
|
+
&interface_info);
|
70
|
+
return Qnil;
|
71
|
+
}
|
72
|
+
|
38
73
|
static VALUE
|
39
74
|
rg_install_property(VALUE self, VALUE pspec_obj)
|
40
75
|
{
|
@@ -141,6 +176,7 @@ Init_gobject_typeinterface(void)
|
|
141
176
|
RG_TARGET_NAMESPACE = rb_define_module_under(mGLib, "MetaInterface");
|
142
177
|
rbg_define_method(RG_TARGET_NAMESPACE, "gtype", generic_s_gtype, 0);
|
143
178
|
RG_DEF_METHOD(append_features, 1);
|
179
|
+
RG_DEF_METHOD(included, 1);
|
144
180
|
RG_DEF_METHOD(install_property, 1);
|
145
181
|
RG_DEF_METHOD(property, 1);
|
146
182
|
RG_DEF_METHOD(properties, -1);
|
data/lib/glib2.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2005-
|
1
|
+
# Copyright (C) 2005-2021 Ruby-GNOME Project Team
|
2
2
|
#
|
3
3
|
# This library is free software; you can redistribute it and/or
|
4
4
|
# modify it under the terms of the GNU Lesser General Public
|
@@ -117,17 +117,46 @@ end
|
|
117
117
|
require "glib2.so"
|
118
118
|
|
119
119
|
module GLib
|
120
|
+
SIGNAL_HANDLER_PREFIX = "signal_do_"
|
121
|
+
VIRTUAL_FUNCTION_IMPLEMENTATION_PREFIX = "virtual_do_"
|
122
|
+
|
120
123
|
module MetaInterface
|
121
124
|
class << self
|
122
|
-
def signal_callback(klass,
|
125
|
+
def signal_callback(klass, name)
|
123
126
|
lambda do |instance, *args|
|
124
|
-
|
127
|
+
method_name = "#{SIGNAL_HANDLER_PREFIX}#{name}"
|
128
|
+
klass.instance_method(method_name).bind(instance).call(*args)
|
125
129
|
end
|
126
130
|
end
|
127
131
|
end
|
128
132
|
end
|
129
133
|
|
130
134
|
class Instantiatable
|
135
|
+
class << self
|
136
|
+
def method_added(name)
|
137
|
+
super
|
138
|
+
|
139
|
+
case name.to_s
|
140
|
+
when /\A#{Regexp.escape(SIGNAL_HANDLER_PREFIX)}/o
|
141
|
+
signal_name = $POSTMATCH
|
142
|
+
begin
|
143
|
+
signal_ = signal(signal_name)
|
144
|
+
rescue NoSignalError
|
145
|
+
return
|
146
|
+
end
|
147
|
+
return unless signal_.class != self
|
148
|
+
signal_handler_attach(signal_, name.to_s) do |instance, *args|
|
149
|
+
instance.__send__(name, *args)
|
150
|
+
end
|
151
|
+
when /\A#{Regexp.escape(VIRTUAL_FUNCTION_IMPLEMENTATION_PREFIX)}/o
|
152
|
+
ancestors.each do |klass|
|
153
|
+
next unless klass.respond_to?(:implement_virtual_function)
|
154
|
+
return if klass.implement_virtual_function(self, name)
|
155
|
+
end
|
156
|
+
end
|
157
|
+
end
|
158
|
+
end
|
159
|
+
|
131
160
|
private
|
132
161
|
def create_signal_handler(signal_name, callback)
|
133
162
|
callback
|
data/lib/mkmf-gnome.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: glib2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.4.
|
4
|
+
version: 3.4.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- The Ruby-GNOME Project Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-07-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pkg-config
|